balancePressHomeBD.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <a-spin tip="Loading..." :spinning="loading">
  3. <div class="monitor-container">
  4. <div class="lr left-box">
  5. <ventBox1>
  6. <template #title>
  7. <div>均压与低氧参数监测与设置</div>
  8. </template>
  9. <template #container>
  10. <div class="vent-flex-row-between auto-control mt-10px mb-10px">
  11. <div class="title">自动调节:</div>
  12. <a-radio-group v-model:value="isAutoControl" name="radioGroup" @change="changeType(isAutoControl)">
  13. <a-radio value="1">关闭</a-radio>
  14. <a-radio value="2">开启</a-radio>
  15. </a-radio-group>
  16. </div>
  17. <div class="input-box">
  18. <div class="divider-line">开始条件</div>
  19. <div v-for="(item, index) in settingParam1" class="input-item" :key="index">
  20. <div class="title">{{ item.title }}:</div>
  21. <a-input-number class="input-value" v-model:value="formData[item.code]" placeholder="" />
  22. <div class="unit">{{ item.unit }}</div>
  23. </div>
  24. <div class="divider-line">调节参数</div>
  25. <div v-for="(item, index) in settingParam2" class="input-item" :key="index">
  26. <div class="title">{{ item.title }}:</div>
  27. <a-input-number class="input-value" v-model:value="formData[item.code]" placeholder="" />
  28. <div class="unit">{{ item.unit }}</div>
  29. </div>
  30. <div class="divider-line">结束时间</div>
  31. <div v-for="(item, index) in settingParam3" class="input-item" :key="index">
  32. <div class="title">{{ item.title }}:</div>
  33. <a-input-number class="input-value" v-model:value="formData[item.code]" placeholder="" />
  34. <div class="unit">{{ item.unit }}</div>
  35. </div>
  36. </div>
  37. <div class="btn-box" style="text-align: center">
  38. <div class="btn btn1" @click="onSubmit">提交</div>
  39. </div>
  40. </template>
  41. </ventBox1>
  42. </div>
  43. <div class="lr">
  44. <ventBox1>
  45. <template #title>
  46. <div>均压工作面风机与风门联动</div>
  47. </template>
  48. <template #container>
  49. <div class="vent-flex-row-between auto-control mt-10px mb-10px">
  50. <div class="title">自动调节:</div>
  51. <a-radio-group v-model:value="isAutoControl" name="radioGroup" @change="changeType(isAutoControl)">
  52. <a-radio value="1">关闭</a-radio>
  53. <a-radio value="2">开启</a-radio>
  54. </a-radio-group>
  55. </div>
  56. <div class="btn-box" style="text-align: center">
  57. <div class="btn btn1" @click="onSubmit">提交</div>
  58. </div>
  59. </template>
  60. </ventBox1>
  61. </div>
  62. <ModuleCommon
  63. v-for="cfg in configs"
  64. :key="cfg.deviceType"
  65. :show-style="cfg.showStyle"
  66. :module-data="cfg.moduleData"
  67. :module-name="cfg.moduleName"
  68. :device-type="cfg.deviceType"
  69. :data="selectData"
  70. :visible="true"
  71. />
  72. </div>
  73. </a-spin>
  74. </template>
  75. <script setup lang="ts">
  76. import { ref, onMounted, onUnmounted, defineProps } from 'vue';
  77. import { mountedThree, destroy, setModelType, updateText, play } from '../balancePress.threejs';
  78. import { list } from '../balancePress.api';
  79. import ModuleCommon from '../../../home/configurable/components/ModuleCommon.vue';
  80. import { useInitConfigs } from '../../../home/configurable/hooks/useInit';
  81. import { useGlobSetting } from '/@/hooks/setting';
  82. import { settingParam1, settingParam2, settingParam3 } from '../balancePress.data';
  83. import { message } from 'ant-design-vue';
  84. import ventBox1 from '/@/components/vent/ventBox1.vue';
  85. // import { Config } from '../../../deviceManager/configurationTable/types';
  86. const props = defineProps({
  87. deviceId: {
  88. type: String,
  89. require: true,
  90. },
  91. });
  92. const { sysOrgCode } = useGlobSetting();
  93. const loading = ref(false);
  94. // 监测数据
  95. const selectData = ref();
  96. // https获取监测数据
  97. let timer: any = null;
  98. function getMonitor(flag?) {
  99. if (Object.prototype.toString.call(timer) === '[object Null]') {
  100. timer = setTimeout(
  101. async () => {
  102. if (props.deviceId) {
  103. const data = await getDataSource(props.deviceId);
  104. // Object.assign(selectData, data);
  105. updateText(selectData);
  106. selectData.value = data;
  107. }
  108. if (timer) {
  109. timer = null;
  110. }
  111. await getMonitor();
  112. loading.value = false;
  113. },
  114. flag ? 0 : 1000
  115. );
  116. }
  117. }
  118. async function getDataSource(systemID) {
  119. const res = await list({ devicetype: 'sys', systemID });
  120. const result = Array.from(res.msgTxt).reduce(
  121. (obj: any, e: any) => {
  122. obj[e.type] = e;
  123. // if (true) {
  124. if (sysOrgCode === 'sdmtjtswmk') {
  125. if (e.type.startsWith('fanlocal')) {
  126. obj.fanlocal.datalist.push(...e.datalist);
  127. }
  128. if (e.type.startsWith('safetymonitor')) {
  129. e.datalist.forEach((ele) => {
  130. if (ele.strinstallpos.includes('风门')) {
  131. obj.gate.datalist.push(ele);
  132. } else if (ele.strinstallpos.includes('风窗')) {
  133. obj.window.datalist.push(ele);
  134. } else if (ele.strinstallpos.includes('工作面')) {
  135. obj.work_surface.datalist.push(ele);
  136. } else {
  137. obj.others.datalist.push(ele);
  138. }
  139. });
  140. }
  141. }
  142. return obj;
  143. },
  144. {
  145. /** 用于归类fanlocal */
  146. fanlocal: { datalist: [] },
  147. /** 用于归类gate */
  148. gate: { datalist: [] },
  149. /** 用于归类window */
  150. window: { datalist: [] },
  151. /** 用于归类work_surface */
  152. work_surface: { datalist: [] },
  153. others: { datalist: [] },
  154. }
  155. );
  156. return result;
  157. }
  158. // const configs = ref<Config[]>([
  159. // {
  160. // deviceType: '',
  161. // moduleName: '局扇',
  162. // pageType: 'balancePressHome',
  163. // moduleData: {
  164. // header: {
  165. // show: false,
  166. // readFrom: '',
  167. // selector: {
  168. // show: false,
  169. // value: '',
  170. // },
  171. // slot: {
  172. // show: false,
  173. // value: '',
  174. // },
  175. // },
  176. // background: {
  177. // show: false,
  178. // type: 'image',
  179. // link: '',
  180. // },
  181. // layout: {
  182. // direction: 'row',
  183. // items: [
  184. // {
  185. // name: 'complex_list',
  186. // basis: '50%',
  187. // },
  188. // {
  189. // name: 'complex_list',
  190. // basis: '50%',
  191. // },
  192. // ],
  193. // },
  194. // complex_list: [
  195. // {
  196. // type: 'G',
  197. // readFrom: 'fanlocal_steml_zj',
  198. // mapFromData: false,
  199. // items: [
  200. // {
  201. // title: '主机',
  202. // contents: [
  203. // {
  204. // label: '运行状态',
  205. // value: '${datalist[0].readData.Fan1StartStatus_str}',
  206. // color: 'blue',
  207. // },
  208. // {
  209. // label: '运行频率',
  210. // value: '${datalist[0].readData.Fan1fHz}',
  211. // color: 'blue',
  212. // },
  213. // {
  214. // label: '输出电压',
  215. // value: '${datalist[0].readData.Fan1fHz}',
  216. // color: 'blue',
  217. // },
  218. // ],
  219. // },
  220. // ],
  221. // },
  222. // {
  223. // type: 'G',
  224. // readFrom: 'fanlocal_steml_zj',
  225. // mapFromData: false,
  226. // items: [
  227. // {
  228. // title: '备机',
  229. // contents: [
  230. // {
  231. // label: '运行状态',
  232. // value: '${datalist[0].readData.Fan2StartStatus_str}',
  233. // color: 'blue',
  234. // },
  235. // {
  236. // label: '运行频率',
  237. // value: '${datalist[0].readData.Fan2fHz}',
  238. // color: 'blue',
  239. // },
  240. // {
  241. // label: '输出电压',
  242. // value: '${datalist[0].readData.Fan2fHz}',
  243. // color: 'blue',
  244. // },
  245. // ],
  246. // },
  247. // ],
  248. // },
  249. // ],
  250. // to: '',
  251. // },
  252. // showStyle: {
  253. // size: 'width:380px;height:200px;',
  254. // version: '原版',
  255. // position: 'top:150px;right:0;',
  256. // },
  257. // },
  258. // {
  259. // deviceType: '',
  260. // moduleName: '其他模块A',
  261. // pageType: 'balancePressHome',
  262. // moduleData: {
  263. // header: {
  264. // show: false,
  265. // readFrom: '',
  266. // selector: {
  267. // show: false,
  268. // value: '',
  269. // },
  270. // slot: {
  271. // show: false,
  272. // value: '',
  273. // },
  274. // },
  275. // background: {
  276. // show: false,
  277. // type: 'image',
  278. // link: '',
  279. // },
  280. // layout: {
  281. // direction: 'column',
  282. // items: [
  283. // {
  284. // name: 'list',
  285. // basis: '100%',
  286. // },
  287. // ],
  288. // },
  289. // list: [
  290. // {
  291. // type: 'K',
  292. // readFrom: 'windrect_ds_four.datalist[0]',
  293. // items: [
  294. // {
  295. // label: '网络状态',
  296. // value: '${readData.netStatus_str}',
  297. // color: 'blue',
  298. // },
  299. // ],
  300. // },
  301. // ],
  302. // to: '',
  303. // },
  304. // showStyle: {
  305. // size: 'width:380px;height:230px;',
  306. // version: '原版',
  307. // position: 'top:360px;right:0;',
  308. // },
  309. // },
  310. // ]);
  311. // const { configs, fetchConfigs } = useInitConfigs();
  312. const formData = ref({});
  313. // 默认初始是第一行
  314. const isAutoControl = ref('1');
  315. const changeType = (isAutoControl) => {
  316. isAutoControl;
  317. //
  318. };
  319. function onSubmit() {
  320. message.success('提交成功');
  321. }
  322. const { configs, fetchConfigs } = useInitConfigs();
  323. onMounted(() => {
  324. // getMonitor()
  325. fetchConfigs('balancePressHome');
  326. loading.value = true;
  327. mountedThree().then(async () => {
  328. await setModelType('balancePressBase'); //balancePressBase
  329. loading.value = false;
  330. timer = null;
  331. await getMonitor(true);
  332. play('startSmoke', 'top', 30, 'open', 0);
  333. });
  334. // loading.value = false;
  335. // timer = null;
  336. // getMonitor(true);
  337. });
  338. onUnmounted(() => {
  339. destroy();
  340. if (timer) {
  341. clearTimeout(timer);
  342. }
  343. });
  344. </script>
  345. <style lang="less" scoped>
  346. @import '/@/design/vent/modal.less';
  347. @import '../../comment/less/workFace.less';
  348. @ventSpace: zxm;
  349. .monitor-container {
  350. margin-top: 60px;
  351. }
  352. </style>