balancePressHome1.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. <template>
  2. <a-spin tip="Loading..." :spinning="loading">
  3. <div class="monitor-container">
  4. <div class="lr left-box">
  5. <div class="monitor-info item-box">
  6. <!-- <ventBox1>
  7. <template #title>
  8. <div>均压与低氧参数监测与设置</div>
  9. </template>
  10. <template #container>
  11. <div class="vent-flex-row-between auto-control">
  12. <div class="title">自动调节:</div>
  13. <a-radio-group v-model:value="isAutoControl" name="radioGroup" @change="changeType(isAutoControl)">
  14. <a-radio value="1">关闭</a-radio>
  15. <a-radio value="2">开启</a-radio>
  16. </a-radio-group>
  17. </div>
  18. <div class="input-box">
  19. <div class="divider-line">开始条件</div>
  20. <div v-for="(item, index) in settingParam1" class="input-item" :key="index">
  21. <div class="title">{{ item.title }}:</div>
  22. <a-input-number class="input-value" v-model:value="formData[item.code]" placeholder="" />
  23. <div class="unit">{{ item.unit }}</div>
  24. </div>
  25. <div class="divider-line">调节参数</div>
  26. <div v-for="(item, index) in settingParam2" class="input-item" :key="index">
  27. <div class="title">{{ item.title }}:</div>
  28. <a-input-number class="input-value" v-model:value="formData[item.code]" placeholder="" />
  29. <div class="unit">{{ item.unit }}</div>
  30. </div>
  31. <div class="divider-line">结束时间</div>
  32. <div v-for="(item, index) in settingParam3" class="input-item" :key="index">
  33. <div class="title">{{ item.title }}:</div>
  34. <a-input-number class="input-value" v-model:value="formData[item.code]" placeholder="" />
  35. <div class="unit">{{ item.unit }}</div>
  36. </div>
  37. </div>
  38. <div class="btn-box" style="text-align: center">
  39. <div class="btn btn1" @click="onSubmit">提交</div>
  40. </div>
  41. </template>
  42. </ventBox1> -->
  43. <ventBox1 class="vent-margin-t-10">
  44. <template #title>
  45. <div>设备监测详情</div>
  46. </template>
  47. <template #container>
  48. <div class="overflow-y-auto max-h-700px">
  49. <template v-for="monitor in windrectMonitorData" :key="monitor.deviceId">
  50. <div class="parameter-title group-parameter-title"
  51. ><SvgIcon class="icon" size="14" name="fiber-title" />
  52. <span>测风装置:{{ monitor.strinstallpos }}</span>
  53. </div>
  54. <div class="input-box">
  55. <div v-for="(item, index) in windrectParam" class="input-item" :key="index">
  56. <div class="title">{{ item.title }}</div>
  57. <div class="value">{{ get(monitor, item.code, '-') }}</div>
  58. <div class="unit">{{ item.unit }}</div>
  59. </div>
  60. </div>
  61. </template>
  62. <template v-for="monitor in windowMonitorData" :key="monitor.deviceId">
  63. <div class="parameter-title group-parameter-title"
  64. ><SvgIcon class="icon" size="14" name="fiber-title" />
  65. <span>风窗:{{ monitor.strinstallpos }}</span>
  66. </div>
  67. <div class="input-box">
  68. <div v-for="(item, index) in windowParam" class="input-item" :key="index">
  69. <div class="title">{{ item.title }}</div>
  70. <div class="value">{{ get(monitor, item.code, '-') }}</div>
  71. <div class="unit">{{ item.unit }}</div>
  72. </div>
  73. </div>
  74. </template>
  75. <template v-for="monitor in fanlocalMonitorData" :key="monitor.deviceId">
  76. <div class="parameter-title group-parameter-title"
  77. ><SvgIcon class="icon" size="14" name="fiber-title" />
  78. <span>局扇:{{ monitor.strinstallpos }}</span>
  79. </div>
  80. <div class="vent-flex-row">
  81. <div
  82. class="fan-btn"
  83. :class="{ 'fan-btn-active': get(fanBtnData, monitor.deviceId) == 'Fan1' }"
  84. @click="changeFanBtn(monitor.deviceId, 'Fan1')"
  85. >主机</div
  86. >
  87. <div
  88. class="fan-btn"
  89. :class="{ 'fan-btn-active': get(fanBtnData, monitor.deviceId) == 'Fan2' }"
  90. @click="changeFanBtn(monitor.deviceId, 'Fan2')"
  91. >备机</div
  92. >
  93. </div>
  94. <div class="input-box">
  95. <div class="input-item">
  96. <div class="title">运行风机</div>
  97. <div class="value">{{ monitor.FanRun }}</div>
  98. </div>
  99. <div v-for="(item, index) in fanlocalColumn" class="input-item" :key="index">
  100. <div class="title">{{ item.title }}</div>
  101. <div class="value">{{
  102. item.dataIndex.startsWith('Fan')
  103. ? get(monitor, item.dataIndex.replace('Fan', fanBtnData[monitor.deviceId]))
  104. : get(monitor, item.dataIndex)
  105. }}</div>
  106. </div>
  107. </div>
  108. </template>
  109. </div>
  110. </template>
  111. </ventBox1>
  112. </div>
  113. </div>
  114. <div class="lr right-box ml-5px">
  115. <div class="item-box sensor-container">
  116. <ventBox1>
  117. <template #title>
  118. <!-- <div>CO与O2监测</div> -->
  119. <div>传感器/安全监控监测</div>
  120. </template>
  121. <template #container>
  122. <div class="overflow-y-auto max-h-700px">
  123. <template v-for="monitor in safetyMonitorData" :key="monitor.deviceId">
  124. <div class="parameter-title group-parameter-title"
  125. ><SvgIcon class="icon" size="14" name="fiber-title" />
  126. <span>{{ monitor.strinstallpos }}</span>
  127. </div>
  128. <div class="input-box">
  129. <div v-for="(item, index) in monitorParam" class="input-item" :key="index">
  130. <div class="title">{{ item.title }}</div>
  131. <div class="value" style="width: 50%">{{ get(monitor, item.code, '-') }}</div>
  132. </div>
  133. </div>
  134. </template>
  135. </div>
  136. </template>
  137. </ventBox1>
  138. </div>
  139. </div>
  140. </div>
  141. </a-spin>
  142. </template>
  143. <script setup lang="ts" name="balancePressHome1">
  144. import { onBeforeMount, ref, onMounted, onUnmounted, reactive, defineProps, watch } from 'vue';
  145. import ventBox1 from '/@/components/vent/ventBox1.vue';
  146. import { SvgIcon } from '/@/components/Icon';
  147. import { mountedThree, destroy, setModelType, updateText, play } from '../balancePress.threejs';
  148. import { settingParam1, settingParam2, settingParam3, windowParam, localFanParam, monitorParam, windrectParam } from '../balancePress.data';
  149. import { list } from '../balancePress.api';
  150. import { message } from 'ant-design-vue';
  151. import { get } from 'lodash-es';
  152. import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
  153. const props = defineProps({
  154. deviceId: {
  155. type: String,
  156. require: true,
  157. },
  158. });
  159. const loading = ref(false);
  160. // 默认初始是第一行
  161. const isAutoControl = ref('1');
  162. // 监测数据
  163. const selectData = reactive({
  164. frontRearDP: '-',
  165. sourcePressure: '-',
  166. fault: '-',
  167. });
  168. const changeType = (isAutoControl) => {
  169. isAutoControl;
  170. //
  171. };
  172. // https获取监测数据
  173. let timer: any = null;
  174. function getMonitor(flag?) {
  175. if (Object.prototype.toString.call(timer) === '[object Null]') {
  176. timer = setTimeout(
  177. async () => {
  178. if (props.deviceId) {
  179. const data = await getDataSource(props.deviceId);
  180. Object.assign(selectData, data);
  181. updateText(selectData);
  182. }
  183. if (timer) {
  184. timer = null;
  185. }
  186. await getMonitor();
  187. loading.value = false;
  188. },
  189. flag ? 0 : 1000
  190. );
  191. }
  192. }
  193. const safetyMonitorData = ref<any[]>([]);
  194. const fanlocalMonitorData = ref<any[]>([]);
  195. const fanBtnData = reactive({});
  196. const windowMonitorData = ref<any[]>([]);
  197. const windrectMonitorData = ref<any[]>([]);
  198. const fanlocalColumn = ref<any[]>([]);
  199. const windowColumn = ref<any[]>([]);
  200. async function getDataSource(systemID) {
  201. const res = await list({ devicetype: 'sys', systemID });
  202. const result = res.msgTxt;
  203. safetyMonitorData.value = [];
  204. fanlocalMonitorData.value = [];
  205. windowMonitorData.value = [];
  206. windrectMonitorData.value = [];
  207. result.forEach((item) => {
  208. if (item.type.startsWith('safetymonitor') || item.type.startsWith('avgpressure_lowoxygen')) {
  209. safetyMonitorData.value.push(...item.datalist);
  210. }
  211. if (item.type.startsWith('fanlocal')) {
  212. item.datalist.forEach((e) => {
  213. fanlocalColumn.value = getTableHeaderColumns('sys_surface_junya_fanlocal') || localFanParam;
  214. Object.assign(e, e.readData);
  215. const f1Run = e.readData.Fan1StartStatus == '1';
  216. e.FanfHz = f1Run ? e.readData.Fan1_Frequency : e.readData.Fan2_Frequency;
  217. e.FanRun = f1Run ? '1#风机' : '2#风机';
  218. if (!fanBtnData[e.deviceId]) fanBtnData[e.deviceId] = 'Fan1';
  219. });
  220. fanlocalMonitorData.value.push(...item.datalist);
  221. }
  222. if (item.type.startsWith('window')) {
  223. windowMonitorData.value.push(...item.datalist);
  224. }
  225. if (item.type.startsWith('windrect')) {
  226. windrectMonitorData.value.push(...item.datalist);
  227. }
  228. });
  229. }
  230. function changeFanBtn(deviceId, fan) {
  231. fanBtnData[deviceId] = fan;
  232. }
  233. // 喷粉操作
  234. function onSubmit() {
  235. sessionStorage.setItem('lalance-press-formdata', JSON.stringify(formData.value));
  236. message.success('提交成功');
  237. }
  238. // watch(
  239. // () => props.deviceId,
  240. // (newVal, oldVal) => {
  241. // if (newVal && oldVal != undefined) {
  242. // setModelType('balancePressBase');
  243. // }
  244. // loading.value = true;
  245. // }
  246. // );
  247. const formData = ref({
  248. a: 0,
  249. b: 0,
  250. c: 0,
  251. d: 0,
  252. e: 0,
  253. f: 0,
  254. g: 0,
  255. h: 0,
  256. i: 0,
  257. j: 0,
  258. k: 0,
  259. l: 0,
  260. m: 0,
  261. });
  262. onBeforeMount(() => {});
  263. onMounted(() => {
  264. // getMonitor()
  265. loading.value = true;
  266. const storage = sessionStorage.getItem('lalance-press-formdata');
  267. if (storage) formData.value = JSON.parse(storage);
  268. mountedThree().then(async () => {
  269. await setModelType('balancePressTun'); //balancePressBase
  270. loading.value = false;
  271. timer = null;
  272. await getMonitor(true);
  273. play('startSmoke', 'top', 30, 'open', 0);
  274. });
  275. });
  276. onUnmounted(() => {
  277. destroy();
  278. if (timer) {
  279. clearTimeout(timer);
  280. }
  281. });
  282. </script>
  283. <style lang="less" scoped>
  284. @import '/@/design/vent/modal.less';
  285. @import '../../comment/less/workFace.less';
  286. @ventSpace: zxm;
  287. .monitor-container {
  288. margin-top: 60px;
  289. }
  290. .lr {
  291. width: 340px !important;
  292. }
  293. .auto-control {
  294. padding: 10px 8px;
  295. margin: 0 4px 4px 4px;
  296. border-radius: 4px;
  297. border: 1px solid #ffffff05;
  298. background-image: linear-gradient(to left, #39deff15, #3977e500, #39deff15);
  299. }
  300. .divider-line {
  301. position: relative;
  302. color: aqua;
  303. padding-left: 20px;
  304. font-size: 14px;
  305. &::before {
  306. position: absolute;
  307. content: '';
  308. display: block;
  309. top: 10px;
  310. left: 0;
  311. height: 1px;
  312. width: 15px;
  313. background-color: #ffffff33;
  314. }
  315. &::after {
  316. position: absolute;
  317. content: '';
  318. display: block;
  319. top: 10px;
  320. right: 0;
  321. height: 1px;
  322. width: calc(100% - 85px);
  323. background-color: #ffffff33;
  324. }
  325. }
  326. .input-value {
  327. width: 120px !important;
  328. }
  329. .unit {
  330. text-align: right;
  331. }
  332. .btn-box {
  333. margin: 10px 4px;
  334. .btn1 {
  335. padding: 4px 0;
  336. }
  337. }
  338. .fan-btn {
  339. flex: 1;
  340. text-align: center;
  341. background: var(--vent-balancePress-fan-bg-default);
  342. cursor: pointer;
  343. &:hover {
  344. color: var(--vent-font-action-link);
  345. background: var(--vent-balancePress-fan-bg-select);
  346. }
  347. &:first-child {
  348. border-left: 1px solid;
  349. border-radius: 4px;
  350. border-color: var(--vent-configurable-home-light-border);
  351. }
  352. &:last-child {
  353. border-right: 1px solid;
  354. border-radius: 4px;
  355. border-color: var(--vent-configurable-home-light-border);
  356. }
  357. }
  358. .fan-btn-active {
  359. color: var(--vent-font-action-link);
  360. background: var(--vent-balancePress-fan-bg-select);
  361. }
  362. :deep(.@{ventSpace}-tabs-tabpane-active) {
  363. overflow: auto;
  364. }
  365. :deep(.@{ventSpace}-input-number) {
  366. border-color: #ffffff88 !important;
  367. }
  368. </style>