balancePressHome.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  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. </div>
  44. </div>
  45. <div class="lr right-box ml-auto">
  46. <div class="item-box sensor-container">
  47. <ventBox1 class="">
  48. <template #title>
  49. <div>设备监测详情</div>
  50. </template>
  51. <template #container>
  52. <div class="overflow-y-auto max-h-500px">
  53. <template v-for="monitor in windrectMonitorData" :key="monitor.deviceId">
  54. <div class="parameter-title group-parameter-title"
  55. ><SvgIcon class="icon" size="14" name="fiber-title" />
  56. <span>测风装置:{{ monitor.strinstallpos }}</span>
  57. </div>
  58. <div class="input-box">
  59. <div v-for="(item, index) in windrectParam" class="input-item" :key="index">
  60. <div class="title">{{ item.title }}</div>
  61. <div class="value">{{ get(monitor, item.code, '-') }}</div>
  62. <div class="unit">{{ item.unit }}</div>
  63. </div>
  64. </div>
  65. </template>
  66. </div>
  67. </template>
  68. </ventBox1>
  69. </div>
  70. </div>
  71. <div class="lr right-box ml-5px">
  72. <div class="item-box sensor-container">
  73. <ventBox1>
  74. <template #title>
  75. <!-- <div>CO与O2监测</div> -->
  76. <div>传感器/安全监控监测</div>
  77. </template>
  78. <template #container>
  79. <div class="overflow-y-auto max-h-300px">
  80. <template v-for="monitor in safetyMonitorData" :key="monitor.deviceId">
  81. <div class="parameter-title group-parameter-title"
  82. ><SvgIcon class="icon" size="14" name="fiber-title" />
  83. <span>{{ monitor.strinstallpos }}</span>
  84. </div>
  85. <div class="input-box">
  86. <div v-for="(item, index) in monitorParam" class="input-item" :key="index">
  87. <div class="title">{{ item.title }}</div>
  88. <div class="value" style="width: 50%">{{ get(monitor, item.code, '-') }}</div>
  89. </div>
  90. </div>
  91. </template>
  92. </div>
  93. </template>
  94. </ventBox1>
  95. <ventBox1 class="vent-margin-t-10">
  96. <template #title>
  97. <div>设备监测详情</div>
  98. </template>
  99. <template #container>
  100. <div class="overflow-y-auto max-h-400px">
  101. <template v-for="monitor in windowMonitorData" :key="monitor.deviceId">
  102. <div class="parameter-title group-parameter-title"
  103. ><SvgIcon class="icon" size="14" name="fiber-title" />
  104. <span>风窗:{{ monitor.strinstallpos }}</span>
  105. </div>
  106. <div class="input-box">
  107. <div v-for="(item, index) in windowParam" class="input-item" :key="index">
  108. <div class="title">{{ item.title }}</div>
  109. <div class="value">{{ get(monitor, item.code, '-') }}</div>
  110. <div class="unit">{{ item.unit }}</div>
  111. </div>
  112. </div>
  113. </template>
  114. <template v-for="monitor in fanlocalMonitorData" :key="monitor.deviceId">
  115. <div class="parameter-title group-parameter-title"
  116. ><SvgIcon class="icon" size="14" name="fiber-title" />
  117. <span>局扇:{{ monitor.strinstallpos }}</span>
  118. </div>
  119. <div class="input-box">
  120. <div v-for="(item, index) in localFanParam" class="input-item" :key="index">
  121. <div class="title">{{ item.title }}</div>
  122. <div class="value">{{ get(monitor, item.code, '-') }}</div>
  123. <div class="unit">{{ item.unit }}</div>
  124. </div>
  125. </div>
  126. </template>
  127. </div>
  128. </template>
  129. </ventBox1>
  130. </div>
  131. </div>
  132. </div>
  133. </a-spin>
  134. </template>
  135. <script setup lang="ts" name="balancePressHome">
  136. import { onBeforeMount, ref, onMounted, onUnmounted, reactive, defineProps, watch } from 'vue';
  137. import ventBox1 from '/@/components/vent/ventBox1.vue';
  138. import { SvgIcon } from '/@/components/Icon';
  139. import { mountedThree, destroy, setModelType, updateText, play } from '../balancePress.threejs';
  140. import { settingParam1, settingParam2, settingParam3, windowParam, localFanParam, windrectParam } from '../balancePress.data';
  141. import { list, submit, subList } from '../balancePress.api';
  142. import { message } from 'ant-design-vue';
  143. import { get } from 'lodash-es';
  144. const props = defineProps({
  145. deviceId: {
  146. type: String,
  147. require: true,
  148. },
  149. });
  150. const loading = ref(false);
  151. // 默认初始是第一行
  152. const isAutoControl = ref('1');
  153. // 监测数据
  154. const selectData = reactive({
  155. frontRearDP: '-',
  156. sourcePressure: '-',
  157. fault: '-',
  158. });
  159. const monitorParam = [
  160. {
  161. title: '监测值',
  162. code: 'readData.ss_analog_value',
  163. unit: '',
  164. },
  165. ];
  166. const changeType = (isAutoControl) => {
  167. isAutoControl;
  168. //
  169. };
  170. // https获取监测数据
  171. let timer: any = null;
  172. function getMonitor(flag?) {
  173. if (Object.prototype.toString.call(timer) === '[object Null]') {
  174. timer = setTimeout(
  175. async () => {
  176. if (props.deviceId) {
  177. const data = await getDataSource(props.deviceId);
  178. Object.assign(selectData, data);
  179. updateText(selectData);
  180. }
  181. if (timer) {
  182. timer = null;
  183. }
  184. await getMonitor();
  185. loading.value = false;
  186. },
  187. flag ? 0 : 1000
  188. );
  189. }
  190. }
  191. const safetyMonitorData = ref<any[]>([]);
  192. const fanlocalMonitorData = ref<any[]>([]);
  193. const windowMonitorData = ref<any[]>([]);
  194. const windrectMonitorData = ref<any[]>([]);
  195. async function getDataSource(systemID) {
  196. const res = await list({ devicetype: 'sys', systemID });
  197. const result = res.msgTxt;
  198. safetyMonitorData.value = [];
  199. fanlocalMonitorData.value = [];
  200. windowMonitorData.value = [];
  201. windrectMonitorData.value = [];
  202. result.forEach((item) => {
  203. if (item.type.startsWith('safetymonitor')) {
  204. safetyMonitorData.value.push(...item.datalist);
  205. }
  206. if (item.type.startsWith('fanlocal')) {
  207. item.datalist.forEach((e) => {
  208. const f1Run = e.readData.Fan1StartStatus == '1';
  209. e.FanfHz = f1Run ? e.readData.Fan1_Frequency : e.readData.Fan2_Frequency;
  210. e.FanRun = f1Run ? '1#风机' : '2#风机';
  211. });
  212. fanlocalMonitorData.value.push(...item.datalist);
  213. }
  214. if (item.type.startsWith('window')) {
  215. windowMonitorData.value.push(...item.datalist);
  216. }
  217. if (item.type.startsWith('windrect')) {
  218. windrectMonitorData.value.push(...item.datalist);
  219. }
  220. });
  221. }
  222. // 喷粉操作
  223. async function onSubmit() {
  224. let res = await submit(formData.value);
  225. if (res.code == 500) {
  226. message.success(res.message);
  227. } else {
  228. initParamList();
  229. message.success('提交成功');
  230. }
  231. }
  232. //获取低氧参数监测返显列表
  233. async function initParamList() {
  234. let res = await subList();
  235. if (res && res.records && res.records.length != 0) {
  236. formData.value = res.records[0];
  237. }
  238. }
  239. watch(
  240. () => props.deviceId,
  241. (newVal, oldVal) => {
  242. if (newVal && oldVal != undefined) {
  243. setModelType('balancePressBase');
  244. }
  245. loading.value = true;
  246. }
  247. );
  248. const formData = ref({
  249. coMaxStart: 0,
  250. o2MinStart: 0,
  251. coRiseStart: 0,
  252. o2DownStart: 0,
  253. windowAreaSetGrad: 0,
  254. windowSetTime: 0,
  255. windowMinArea: 0,
  256. windowAreaDef: 0,
  257. setMinTime: 0,
  258. coEnd: 0,
  259. coTimeEnd: 0,
  260. o2End: 0,
  261. o2TimeEnd: 0,
  262. });
  263. onBeforeMount(() => {});
  264. onMounted(() => {
  265. loading.value = true;
  266. mountedThree().then(async () => {
  267. await setModelType('balancePressBase'); //balancePressBase
  268. loading.value = false;
  269. timer = null;
  270. await initParamList();
  271. await getMonitor(true);
  272. play('startSmoke', 'top', 30, 'open', 0);
  273. });
  274. });
  275. onUnmounted(() => {
  276. destroy();
  277. if (timer) {
  278. clearTimeout(timer);
  279. }
  280. });
  281. </script>
  282. <style lang="less" scoped>
  283. @import '/@/design/vent/modal.less';
  284. @import '../../comment/less/workFace.less';
  285. @ventSpace: zxm;
  286. .monitor-container {
  287. margin-top: 60px;
  288. }
  289. .lr {
  290. width: 340px !important;
  291. }
  292. .auto-control {
  293. padding: 10px 8px;
  294. margin: 0 4px 4px 4px;
  295. border-radius: 4px;
  296. border: 1px solid #ffffff05;
  297. background-image: linear-gradient(to left, #39deff15, #3977e500, #39deff15);
  298. }
  299. .divider-line {
  300. position: relative;
  301. color: aqua;
  302. padding-left: 20px;
  303. font-size: 14px;
  304. &::before {
  305. position: absolute;
  306. content: '';
  307. display: block;
  308. top: 10px;
  309. left: 0;
  310. height: 1px;
  311. width: 15px;
  312. background-color: #ffffff33;
  313. }
  314. &::after {
  315. position: absolute;
  316. content: '';
  317. display: block;
  318. top: 10px;
  319. right: 0;
  320. height: 1px;
  321. width: calc(100% - 85px);
  322. background-color: #ffffff33;
  323. }
  324. }
  325. .input-value {
  326. width: 120px !important;
  327. }
  328. .unit {
  329. text-align: right;
  330. }
  331. .btn-box {
  332. margin: 10px 4px;
  333. .btn1 {
  334. padding: 4px 0;
  335. }
  336. }
  337. :deep(.@{ventSpace}-tabs-tabpane-active) {
  338. overflow: auto;
  339. }
  340. :deep(.@{ventSpace}-input-number) {
  341. border-color: #ffffff88 !important;
  342. }
  343. </style>