balancePressHome.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  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, submitEdit } 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. let listData = ref<any[]>([]);
  171. // https获取监测数据
  172. let timer: any = null;
  173. function getMonitor(flag?) {
  174. if (Object.prototype.toString.call(timer) === '[object Null]') {
  175. timer = setTimeout(
  176. async () => {
  177. if (props.deviceId) {
  178. const data = await getDataSource(props.deviceId);
  179. Object.assign(selectData, data);
  180. updateText(selectData);
  181. }
  182. if (timer) {
  183. timer = null;
  184. }
  185. await getMonitor();
  186. loading.value = false;
  187. },
  188. flag ? 0 : 1000
  189. );
  190. }
  191. }
  192. const safetyMonitorData = ref<any[]>([]);
  193. const fanlocalMonitorData = ref<any[]>([]);
  194. const windowMonitorData = ref<any[]>([]);
  195. const windrectMonitorData = ref<any[]>([]);
  196. async function getDataSource(systemID) {
  197. const res = await list({ devicetype: 'sys', systemID });
  198. const result = res.msgTxt;
  199. safetyMonitorData.value = [];
  200. fanlocalMonitorData.value = [];
  201. windowMonitorData.value = [];
  202. windrectMonitorData.value = [];
  203. result.forEach((item) => {
  204. if (item.type.startsWith('safetymonitor')) {
  205. safetyMonitorData.value.push(...item.datalist);
  206. }
  207. if (item.type.startsWith('fanlocal')) {
  208. item.datalist.forEach((e) => {
  209. const f1Run = e.readData.Fan1StartStatus == '1';
  210. e.FanfHz = f1Run ? e.readData.Fan1_Frequency : e.readData.Fan2_Frequency;
  211. e.FanRun = f1Run ? '1#风机' : '2#风机';
  212. });
  213. fanlocalMonitorData.value.push(...item.datalist);
  214. }
  215. if (item.type.startsWith('window')) {
  216. windowMonitorData.value.push(...item.datalist);
  217. }
  218. if (item.type.startsWith('windrect')) {
  219. windrectMonitorData.value.push(...item.datalist);
  220. }
  221. });
  222. }
  223. // 喷粉操作
  224. async function onSubmit() {
  225. if (listData.value.length != 0) {
  226. //编辑
  227. let res = await submitEdit(listData.value[0]);
  228. if (res) {
  229. initParamList();
  230. }
  231. } else {
  232. //新增
  233. let res = await submit(formData.value);
  234. if (res) {
  235. initParamList();
  236. message.success('提交成功');
  237. }
  238. }
  239. }
  240. //获取低氧参数监测返显列表
  241. async function initParamList() {
  242. let res = await subList();
  243. if (res && res.records && res.records.length != 0) {
  244. listData.value = res.records;
  245. formData.value = res.records[0];
  246. }
  247. }
  248. watch(
  249. () => props.deviceId,
  250. (newVal, oldVal) => {
  251. if (newVal && oldVal != undefined) {
  252. setModelType('balancePressBase');
  253. }
  254. loading.value = true;
  255. }
  256. );
  257. const formData = ref({
  258. id: '',
  259. coMaxStart: 0,
  260. o2MinStart: 0,
  261. coRiseStart: 0,
  262. o2DownStart: 0,
  263. windowAreaSetGrad: 0,
  264. windowSetTime: 0,
  265. windowMinArea: 0,
  266. windowAreaDef: 0,
  267. setMinTime: 0,
  268. coEnd: 0,
  269. coTimeEnd: 0,
  270. o2End: 0,
  271. o2TimeEnd: 0,
  272. });
  273. onBeforeMount(() => {});
  274. onMounted(() => {
  275. loading.value = true;
  276. mountedThree().then(async () => {
  277. await setModelType('balancePressBase'); //balancePressBase
  278. loading.value = false;
  279. timer = null;
  280. await initParamList();
  281. await getMonitor(true);
  282. play('startSmoke', 'top', 30, 'open', 0);
  283. });
  284. });
  285. onUnmounted(() => {
  286. destroy();
  287. if (timer) {
  288. clearTimeout(timer);
  289. }
  290. });
  291. </script>
  292. <style lang="less" scoped>
  293. @import '/@/design/vent/modal.less';
  294. @import '../../comment/less/workFace.less';
  295. @ventSpace: zxm;
  296. .monitor-container {
  297. margin-top: 60px;
  298. }
  299. .lr {
  300. width: 340px !important;
  301. }
  302. .auto-control {
  303. padding: 10px 8px;
  304. margin: 0 4px 4px 4px;
  305. border-radius: 4px;
  306. border: 1px solid #ffffff05;
  307. background-image: linear-gradient(to left, #39deff15, #3977e500, #39deff15);
  308. }
  309. .divider-line {
  310. position: relative;
  311. color: aqua;
  312. padding-left: 20px;
  313. font-size: 14px;
  314. &::before {
  315. position: absolute;
  316. content: '';
  317. display: block;
  318. top: 10px;
  319. left: 0;
  320. height: 1px;
  321. width: 15px;
  322. background-color: #ffffff33;
  323. }
  324. &::after {
  325. position: absolute;
  326. content: '';
  327. display: block;
  328. top: 10px;
  329. right: 0;
  330. height: 1px;
  331. width: calc(100% - 85px);
  332. background-color: #ffffff33;
  333. }
  334. }
  335. .input-value {
  336. width: 120px !important;
  337. }
  338. .unit {
  339. text-align: right;
  340. }
  341. .btn-box {
  342. margin: 10px 4px;
  343. .btn1 {
  344. padding: 4px 0;
  345. }
  346. }
  347. :deep(.@{ventSpace}-tabs-tabpane-active) {
  348. overflow: auto;
  349. }
  350. :deep(.@{ventSpace}-input-number) {
  351. border-color: #ffffff88 !important;
  352. }
  353. </style>