balancePressHome.vue 12 KB

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