nitrogenHome_dltj.vue 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216
  1. <template>
  2. <div id="nitrogen3D" style="width: 100%; height: 100%; position: absolute; overflow: hidden"></div>
  3. <div
  4. id="nitrogenCss3D"
  5. class="threejs-Object-CSS"
  6. style="width: 100%; height: 100%; position: absolute; pointer-events: none; overflow: hidden; z-index: 2; top: 0px; left: 0px"
  7. >
  8. <a-spin :spinning="loading" />
  9. <div v-for="groupNum in monitorDataGroupNum" :key="groupNum" class="modal-monitor">
  10. <fourBorderBg :class="`kyj${groupNum}`" :id="`nitrogenMonitor${groupNum}`">
  11. <!-- <div class="title">空压机{{ groupNum }} </div> -->
  12. <div class="title">
  13. {{ monitorData ? monitorData['strname' + groupNum] : '注氮机' + groupNum }}
  14. <span :style="{ color: monitorData && monitorData['Status' + groupNum] == '1' ? '#67fc00' : '#e9170b' }">
  15. {{ monitorData && monitorData['Status' + groupNum] == '1' ? '运行' : '停止' }}
  16. </span>
  17. </div>
  18. <template v-for="(preMonitor, preMonitorIndex) in preMonitorListData" :key="preMonitorIndex">
  19. <div v-if="preMonitor.code !== 'signal'" class="monitor-item">
  20. <span class="monitor-title">{{ preMonitor.title }}:</span>
  21. <span class="monitor-val"
  22. ><span class="val">{{ monitorData[preMonitor.code + groupNum] ? formatNum(monitorData[preMonitor.code + groupNum]) : '-' }}</span
  23. ><span class="unit">{{ preMonitor.unit }}</span></span
  24. >
  25. </div>
  26. <div v-else class="signal-item">
  27. <div class="signal" v-for="(signal, childIndex) in preMonitor.child" :key="childIndex">
  28. <span class="monitor-title">{{ signal.title }}</span>
  29. <span style="display: inline-block; width: 30px; text-align: center" v-if="signal.isFault == -2">{{
  30. monitorData[signal.code + groupNum] == '0' ? '就地' : monitorData[signal.code + groupNum] == '1' ? '远程' : '-'
  31. }}</span>
  32. <span style="display: inline-block; width: 30px; text-align: center" v-else-if="signal.isFault == -1">{{
  33. monitorData[signal.code + groupNum] == '1' ? '加载' : monitorData[signal.code + groupNum] == '0' ? '卸载' : '-'
  34. }}</span>
  35. <span
  36. v-else
  37. :class="{
  38. 'signal-round': true,
  39. 'signal-round-run': !signal.isFault && monitorData[signal.code + groupNum] == '1',
  40. 'signal-round-warning': signal.isFault && monitorData[signal.code + groupNum] == '1',
  41. 'signal-round-gry': monitorData[signal.code + groupNum] != '1',
  42. }"
  43. ></span>
  44. </div>
  45. </div>
  46. </template>
  47. </fourBorderBg>
  48. </div>
  49. </div>
  50. <div class="nitrogen-home">
  51. <div class="nitrogen-container">
  52. <div class="top-box">
  53. <!-- 中间区域控制按钮 -->
  54. <div class="center-item-box">
  55. <div class="top-left" v-if="airCompressorState.length > 0">
  56. <div class="button-box" @click="handlerDevice(airCompressorState[0], '主机启动')">上位机启动</div>
  57. <div class="button-box" @click="handlerDevice(airCompressorState[0], '主机停止')">上位机停止</div>
  58. <div class="button-box" @click="handlerDevice(airCompressorState[0], '备机启动')">上位复位</div>
  59. </div>
  60. <div class="top-center">
  61. <div class="top-c-label">通信状态:</div>
  62. <div class="top-c-val">{{ monitorData['netStatus'] == 1 ? '连接' : monitorData['netStatus'] == 0 ? '断开' : '未知' }}</div>
  63. </div>
  64. <div class="top-right">
  65. <div class="control-type" v-if="monitorData['RemSelect'] !== undefined">
  66. <div class="control-title">空压机远近控切换:</div>
  67. <a-radio-group v-model:value="monitorData['RemSelect']">
  68. <a-radio :value="`1`">远程</a-radio>
  69. <a-radio :value="`0`">就地</a-radio>
  70. </a-radio-group>
  71. </div>
  72. <div class="control-type" v-if="monitorData['LocSelect'] !== undefined">
  73. <div class="control-title">制氮机远近控切换:</div>
  74. <a-radio-group v-model:value="monitorData['LocSelect']">
  75. <a-radio :value="`1`">远程</a-radio>
  76. <a-radio :value="`0`">就地</a-radio>
  77. </a-radio-group>
  78. </div>
  79. </div>
  80. </div>
  81. <!-- 左边监测数据 -->
  82. <div class="lr-box left-box">
  83. <ventBox1 v-if="deviceType != 'nitrogen_52507'">
  84. <template #title>
  85. <div>注氮机监测</div>
  86. </template>
  87. <template #container>
  88. <div class="input-item" v-for="(preFan, index) in nitrogenMonitor" :key="index">
  89. <div class="title">{{ preFan.title }}</div>
  90. <div v-if="preFan.unit !== 'signal' && preFan.unit !== 'warning'" class="value">{{
  91. monitorData[preFan.code] >= 0 ? formatNum(Number(monitorData[preFan.code])) : '-'
  92. }}</div>
  93. <div
  94. v-else
  95. :class="{
  96. 'signal-round': true,
  97. 'signal-round-warning': monitorData[preFan.code] == '1' && preFan.unit == 'warning',
  98. 'signal-round-run': monitorData[preFan.code] == '1' && preFan.unit == 'signal',
  99. 'signal-round-gry': monitorData[preFan.code] != '1',
  100. }"
  101. ></div>
  102. <div class="unit">{{ preFan.unit !== 'signal' && preFan.unit !== 'warning' ? `(${preFan.unit})` : '' }}</div>
  103. </div>
  104. </template>
  105. </ventBox1>
  106. <div class="item item-l" v-for="groupNum in monitorDataGroupNum" :key="groupNum">
  107. <ventBox1>
  108. <template #title>
  109. <div>{{ monitorData ? monitorData['strname' + groupNum] : '注氮机' + groupNum }}</div>
  110. </template>
  111. <template #container>
  112. <div class="monitor-box">
  113. <div class="monitor-item">
  114. <div class="state-item" v-for="(preFan, index) in preFanMonitor" :key="index">
  115. <div class="state-title">{{
  116. preFan.title + (preFan.unit !== 'signal' && preFan.unit !== 'warning' ? `(${preFan.unit})` : '')
  117. }}</div>
  118. <div v-if="preFan.unit !== 'signal' && preFan.unit !== 'warning'" class="value">{{
  119. monitorData[preFan.code + groupNum] >= 0 ? formatNum(Number(monitorData[preFan.code + groupNum])) : '-'
  120. }}</div>
  121. <div
  122. v-else
  123. :class="{
  124. 'signal-round': true,
  125. 'signal-round-warning': monitorData[preFan.code + groupNum] == '1' && preFan.unit == 'warning',
  126. 'signal-round-run': monitorData[preFan.code + groupNum] == '1' && preFan.unit == 'signal',
  127. 'signal-round-gry': monitorData[preFan.code + groupNum] != '1',
  128. }"
  129. ></div>
  130. </div>
  131. </div>
  132. </div>
  133. </template>
  134. </ventBox1>
  135. </div>
  136. </div>
  137. <!-- 右边控制状态 -->
  138. <div class="lr-box right-box">
  139. <!-- <ventBox1 v-if="deviceType == 'nitrogen_52507'">
  140. <template #title>
  141. <div>注氮机监测</div>
  142. </template>
  143. <template #container>
  144. <div class="input-item" v-for="(preFan, index) in nitrogenMonitor" :key="index">
  145. <div class="title">{{ preFan.title }}</div>
  146. <div v-if="preFan.unit !== 'signal' && preFan.unit !== 'warning'" class="value">{{
  147. monitorData[preFan.code] >= 0 ? formatNum(Number(monitorData[preFan.code])) : '-'
  148. }}</div>
  149. <div
  150. v-else
  151. :class="{
  152. 'signal-round': true,
  153. 'signal-round-warning': monitorData[preFan.code] == '1' && preFan.unit == 'warning',
  154. 'signal-round-run': monitorData[preFan.code] == '1' && preFan.unit == 'signal',
  155. 'signal-round-gry': monitorData[preFan.code] != '1',
  156. }"
  157. ></div>
  158. <div class="unit">{{ preFan.unit !== 'signal' && preFan.unit !== 'warning' ? `(${preFan.unit})` : '' }}</div>
  159. </div>
  160. </template>
  161. </ventBox1> -->
  162. <ventBox1 class="vent-margin-t-10">
  163. <template #title>
  164. <div>设备实时监测曲线</div>
  165. </template>
  166. <template #container>
  167. <BarAndLine
  168. v-if="chartsColumns.length > 0"
  169. xAxisPropType="readTime"
  170. :dataSource="echartData"
  171. height="320px"
  172. :chartsColumns="chartsColumns"
  173. :option="echatsOption"
  174. />
  175. </template>
  176. </ventBox1>
  177. </div>
  178. </div>
  179. <div ref="playerRef" class="player-box" style=""> </div>
  180. </div>
  181. <div class="modal-monitor">
  182. <fourBorderBg id="downWindMonitor">
  183. <div class="title">下风测监测 </div>
  184. <div class="monitor-item" v-for="(data, index) in downWindData" :key="index">
  185. <span class="monitor-title">{{ data.title }} :</span>
  186. <span class="monitor-val" v-if="!refresh"
  187. ><span class="val">
  188. {{ monitorData && monitorData[data.code] ? (data.raw ? monitorData[data.code] : parseFloat(monitorData[data.code]).toFixed(2)) : '-' }}
  189. </span>
  190. <span class="unit">{{ data.unit }}</span></span
  191. >
  192. </div>
  193. </fourBorderBg>
  194. </div>
  195. </div>
  196. </template>
  197. <script lang="ts" setup name="nitrogenHome">
  198. import { onMounted, onUnmounted, ref, watch, reactive, defineProps, nextTick, inject, unref } from 'vue';
  199. import ventBox1 from '/@/components/vent/ventBox1.vue';
  200. import fourBorderBg from '../../../comment/components/fourBorderBg.vue';
  201. import { mountedThree, destroy, setModelType } from '../nitrogen.threejs';
  202. import { getDevice } from '../nitrogen.api';
  203. import BarAndLine from '/@/components/chart/BarAndLine.vue';
  204. import { deviceControlApi } from '/@/api/vent/index';
  205. // import { preMonitorListData, preFanMonitor, nitrogenMonitor } from '../nitrogen.data.dltj';
  206. import { downWindData } from '../nitrogen.data';
  207. import { formatNum } from '/@/utils/ventutil';
  208. import { useCamera } from '/@/hooks/system/useCamera';
  209. import { message } from 'ant-design-vue';
  210. import lodash from 'lodash';
  211. import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
  212. const globalConfig = inject('globalConfig');
  213. const props = defineProps({
  214. deviceId: {
  215. type: String,
  216. require: true,
  217. },
  218. modalType: {
  219. type: String,
  220. require: true,
  221. },
  222. });
  223. const playerRef = ref();
  224. const refresh = ref(false);
  225. const modalTitle = ref(''); // 模态框标题显示内容,根据设备操作类型决定
  226. const modalType = ref(''); // 模态框内容显示类型,设备操作类型
  227. const modalIsShow = ref<boolean>(false); // 是否显示模态框
  228. const loading = ref(true);
  229. let kzParam = reactive<any>({
  230. data: {},
  231. isFw: null,
  232. });
  233. // const kyjs = ['1号空压机', '1号空压机', '1号空压机', '1号空压机'];
  234. const flvURL1 = () => {
  235. // return `https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv`;
  236. return '';
  237. };
  238. const colors = ['#FDB146', '#EE6666', '#9BCB75', '#03C2EC', '#DA3914', '#9C83D9'];
  239. const echatsOption = {
  240. grid: {
  241. top: '35%',
  242. left: '15%',
  243. right: '20px',
  244. bottom: '8%',
  245. // containLabel: true
  246. },
  247. toolbox: {
  248. feature: {},
  249. },
  250. };
  251. const preMonitorListData = ref<any[]>([]);
  252. const preFanMonitor = ref<any[]>([]);
  253. const nitrogenMonitor = ref<any[]>([]);
  254. const deviceType = ref('');
  255. const monitorNetStatus = ref(0);
  256. const monitorDataGroupNum = ref(2);
  257. let airCompressorState = reactive<any[]>([]);
  258. // const chartsColumns = ref([
  259. // {
  260. // legend: '瞬时流量',
  261. // seriesName: '(m³/h)',
  262. // ymax: 2000,
  263. // yname: 'm³/h',
  264. // linetype: 'line',
  265. // yaxispos: 'left',
  266. // color: '#FDB146',
  267. // sort: 1,
  268. // xRotate: 0,
  269. // dataIndex: 'InputFlux',
  270. // },
  271. // ]);
  272. const chartsColumns = ref(getTableHeaderColumns('sys_nitrogen_chart'));
  273. const { getCamera, removeCamera } = useCamera();
  274. const monitorData = ref({});
  275. //图表数据
  276. let echartData = ref<any>([]);
  277. // https获取监测数据
  278. let timer: null | NodeJS.Timeout = null;
  279. async function getMonitor(flag?) {
  280. if (Object.prototype.toString.call(timer) === '[object Null]') {
  281. return new Promise(async (resolve) => {
  282. timer = await setTimeout(
  283. async () => {
  284. if (props.deviceId) {
  285. await getDataSource(props.deviceId);
  286. }
  287. if (timer) {
  288. timer = null;
  289. }
  290. resolve(null);
  291. await getMonitor();
  292. },
  293. flag ? 0 : 3000
  294. );
  295. });
  296. }
  297. }
  298. async function getDataSource(systemID) {
  299. const res = await getDevice({ devicetype: 'sys', systemID, type: 'all' });
  300. if (res) {
  301. const result = res;
  302. // const result = {
  303. // cmd: 'monitordata',
  304. // msgTxt: [
  305. // {
  306. // datalist: [
  307. // {
  308. // msgType: null,
  309. // deviceID: '1818548876779245569',
  310. // strname: '52507注氮机-2',
  311. // strinstallpos: '52507注氮机-2',
  312. // fsectarea: 'null',
  313. // stationname: '52507注氮机-2',
  314. // stationtype: 'redis',
  315. // deviceType: 'nitrogen_525072',
  316. // typeName: '52507注氮机2',
  317. // netStatus: 1,
  318. // warnFlag: 0,
  319. // warnLevel: 0,
  320. // warnLevel_str: '正常',
  321. // syswarnLevel: null,
  322. // syswarnLevel_str: null,
  323. // syswarnLevel_des: null,
  324. // warnTime: null,
  325. // readTime: '2024-08-04 17:59:25',
  326. // warnDes: '',
  327. // frontGateOpenCtrl: null,
  328. // rearGateOpenCtrl: null,
  329. // readData: {
  330. // FluxTotal12: '0.0',
  331. // RunTime42: '131072000',
  332. // NitrogenPurity2: '26',
  333. // ExhaustTemp2: '25.0',
  334. // Status2: '0',
  335. // RunTime2: '0',
  336. // sign: '0',
  337. // OilGasBarrel_SeparatorFault2: '0',
  338. // TotalFailureSignal2: '0',
  339. // InputFlux2: '5',
  340. // PhaseFailureFault12: '0',
  341. // RunTime22: '3080192',
  342. // LowVoltageFault2: '0',
  343. // SysVoltage2: '1158',
  344. // Fan_Current2: '0',
  345. // CtrlMode2: '1',
  346. // ExhaustPreHighFault2: '0',
  347. // ShortCutFaul2: '0',
  348. // OilGasBarrel_OverTempAlarm2: '0',
  349. // CloseFail2: '0',
  350. // OilGasBarrel_FilterBlockageFault2: '0',
  351. // HMIStartStop2: '0',
  352. // OilGasBarrel_OverTempAlarm12: '0',
  353. // OverVoltageFault2: '0',
  354. // OilGasBarrel_HighPressureFault2: '0',
  355. // Fan_OverloadFault2: '0',
  356. // OilPressureLowFault2: '0',
  357. // PhaseSequenceFault2: '0',
  358. // PhaseFailureFault2: '0',
  359. // RunTime32: '35323904',
  360. // MainMotor_OverTempFault2: '0',
  361. // FluxTotal22: '0.0',
  362. // PowerFault2: '0',
  363. // LoadorUnload2: '0',
  364. // PreMembraneTemperature2: '-19',
  365. // PhaseSequenceFault12: '0',
  366. // RunTime12: '393216',
  367. // ExhaustTemp12: '0',
  368. // TotalFailureSignal12: '0',
  369. // UnbalanceFault2: '0',
  370. // ExhaustPre2: '0',
  371. // MainMotor_OverloadFault2: '0',
  372. // NoWaterFault2: '0',
  373. // LoadTime2: '539',
  374. // MainMotor_Current2: '0',
  375. // isRun: '-2',
  376. // LeakageLock2: '0',
  377. // OpenFail2: '0',
  378. // },
  379. // readDataDes: null,
  380. // summaryHour: [],
  381. // summaryDay: [],
  382. // history: [],
  383. // dayhistory: [],
  384. // totalInfo: null,
  385. // sign: null,
  386. // cameras: [],
  387. // links: [],
  388. // other1: null,
  389. // other2: null,
  390. // other3: null,
  391. // remarkInfo: null,
  392. // linkInfo: null,
  393. // addrIndex: null,
  394. // warnLogNotOkCount: 0,
  395. // },
  396. // ],
  397. // avginfo: {
  398. // warnFlag: {
  399. // value: 0,
  400. // },
  401. // },
  402. // typeName: '52507注氮机2',
  403. // type: 'nitrogen_525072',
  404. // },
  405. // {
  406. // datalist: [
  407. // {
  408. // msgType: null,
  409. // deviceID: '1818546650996330498',
  410. // strname: '52507注氮机-1',
  411. // strinstallpos: '52507注氮机-1',
  412. // fsectarea: 'null',
  413. // stationname: '52507注氮机-1',
  414. // stationtype: 'redis',
  415. // deviceType: 'nitrogen_525071',
  416. // typeName: '52507注氮机1',
  417. // netStatus: 1,
  418. // warnFlag: 0,
  419. // warnLevel: 0,
  420. // warnLevel_str: '正常',
  421. // syswarnLevel: null,
  422. // syswarnLevel_str: null,
  423. // syswarnLevel_des: null,
  424. // warnTime: null,
  425. // readTime: '2024-08-04 17:59:25',
  426. // warnDes: '',
  427. // frontGateOpenCtrl: null,
  428. // rearGateOpenCtrl: null,
  429. // readData: {
  430. // RunTime41: '131072000',
  431. // NitrogenPurity1: '12',
  432. // ExhaustTemp1: '82.0',
  433. // RunTime21: '786432',
  434. // RunTime1: '1',
  435. // sign: '0',
  436. // OilGasBarrel_SeparatorFault1: '0',
  437. // InputFlux1: '13',
  438. // PhaseFailureFault11: '0',
  439. // LowVoltageFault1: '0',
  440. // SysVoltage1: '1149',
  441. // TotalFailureSignal1: '0',
  442. // Fan_Current1: '0',
  443. // ExhaustPreHighFault1: '0',
  444. // ShortCutFaul1: '0',
  445. // OilGasBarrel_OverTempAlarm1: '0',
  446. // CloseFail1: '0',
  447. // OilGasBarrel_FilterBlockageFault1: '0',
  448. // OilGasBarrel_OverTempAlarm11: '0',
  449. // HMIStartStop1: '0',
  450. // CtrlMode1: '1',
  451. // Fan_OverloadFault1: '0',
  452. // OilPressureLowFault1: '0',
  453. // OverVoltageFault1: '0',
  454. // OilGasBarrel_HighPressureFault1: '0',
  455. // PhaseFailureFault1: '0',
  456. // RunTime31: '70516736',
  457. // FluxTotal21: '0.0',
  458. // FluxTotal1: '0.01',
  459. // MainMotor_OverTempFault1: '0',
  460. // PhaseSequenceFault1: '0',
  461. // PowerFault1: '0',
  462. // LoadorUnload1: '0',
  463. // RunTime11: '3342336',
  464. // PhaseSequenceFault11: '0',
  465. // PreMembraneTemperature1: '25',
  466. // TotalFailureSignal11: '0',
  467. // UnbalanceFault1: '0',
  468. // ExhaustTemp11: '0',
  469. // ExhaustPre1: '89',
  470. // MainMotor_OverloadFault1: '0',
  471. // NoWaterFault1: '0',
  472. // Status1: '0',
  473. // LoadTime1: '1086',
  474. // isRun: '-2',
  475. // LeakageLock1: '0',
  476. // MainMotor_Current1: '95',
  477. // OpenFail1: '0',
  478. // o2Val: '20.23',
  479. // temperature: '19.5',
  480. // fumes_str: '0.2',
  481. // },
  482. // readDataDes: null,
  483. // summaryHour: [],
  484. // summaryDay: [],
  485. // history: [],
  486. // dayhistory: [],
  487. // totalInfo: null,
  488. // sign: null,
  489. // cameras: [],
  490. // links: [],
  491. // other1: null,
  492. // other2: null,
  493. // other3: null,
  494. // remarkInfo: null,
  495. // linkInfo: null,
  496. // addrIndex: null,
  497. // warnLogNotOkCount: 0,
  498. // },
  499. // ],
  500. // avginfo: {
  501. // warnFlag: {
  502. // value: 0,
  503. // },
  504. // },
  505. // typeName: '52507注氮机1',
  506. // type: 'nitrogen_525071',
  507. // },
  508. // {
  509. // subtype: 'sys_nitrogen',
  510. // datalist: [
  511. // {
  512. // msgType: '2',
  513. // deviceID: '1818821502634352642',
  514. // strname: '52507注氮系统',
  515. // strinstallpos: '52507注氮系统',
  516. // fsectarea: 'null',
  517. // stationname: null,
  518. // stationtype: null,
  519. // deviceType: 'sys_nitrogen',
  520. // typeName: '注氮系统',
  521. // netStatus: null,
  522. // warnFlag: 0,
  523. // warnLevel: null,
  524. // warnLevel_str: null,
  525. // syswarnLevel: 0,
  526. // syswarnLevel_str: null,
  527. // syswarnLevel_des: null,
  528. // warnTime: null,
  529. // readTime: '2024-08-01 09:56:28',
  530. // warnDes: '',
  531. // frontGateOpenCtrl: null,
  532. // rearGateOpenCtrl: null,
  533. // readData: {
  534. // sign: '0',
  535. // isRun: '-2',
  536. // },
  537. // readDataDes: null,
  538. // summaryHour: [],
  539. // summaryDay: [],
  540. // history: null,
  541. // dayhistory: [],
  542. // totalInfo: null,
  543. // sign: null,
  544. // cameras: [],
  545. // links: [],
  546. // other1: null,
  547. // other2: null,
  548. // other3: null,
  549. // remarkInfo: null,
  550. // linkInfo: null,
  551. // addrIndex: null,
  552. // warnLogNotOkCount: 0,
  553. // },
  554. // ],
  555. // typeName: '综合监测系统',
  556. // type: 'sys',
  557. // },
  558. // ],
  559. // };
  560. if (!result || result.msgTxt.length < 1) return;
  561. let dataSoreDatas = {};
  562. let netStatus = 0;
  563. result.msgTxt.forEach((item, index) => {
  564. if (item.type && item.type.startsWith('nitrogen')) {
  565. airCompressorState.length = 0;
  566. if (item.type.startsWith('nitrogen_52507')) {
  567. if (deviceType.value !== 'nitrogen_52507') deviceType.value = 'nitrogen_52507';
  568. dataSoreDatas = Object.assign(dataSoreDatas, item['datalist'][0], item['datalist'][0]['readData']);
  569. dataSoreDatas['strname' + (index + 1)] = item['datalist'][0]['strname'];
  570. if (item['datalist'][0]['netStatus']) {
  571. netStatus = 1;
  572. }
  573. } else {
  574. deviceType.value = '';
  575. monitorData.value = Object.assign(item['datalist'][0], item['datalist'][0]['readData']);
  576. if (monitorData.value['netStatus'] == 1) {
  577. netStatus = 1;
  578. }
  579. airCompressorState.push({
  580. id: monitorData.value['deviceID'],
  581. deviceType: monitorData.value['deviceType'],
  582. HMIStart: monitorData.value['HMIStart'],
  583. HMIStop: monitorData.value['HMIStop'],
  584. });
  585. }
  586. }
  587. });
  588. if (JSON.stringify(dataSoreDatas) !== '{}') {
  589. monitorData.value = dataSoreDatas;
  590. }
  591. monitorNetStatus.value = netStatus;
  592. const dataArr = lodash.cloneDeep(echartData.value);
  593. const airCompressor = { readTime: monitorData.value['readTime'].substring(11) };
  594. if (JSON.stringify(dataSoreDatas) === '{}') {
  595. airCompressor[`FluxTotal`] = monitorData.value['FluxTotal'] || 0;
  596. }
  597. // airCompressor[`InputFlux`] = Number(monitorData.value['InputFlux1']) + Number(monitorData.value['InputFlux2']) || null;
  598. // if (!airCompressor[`InputFlux`]) {
  599. // airCompressor[`InputFlux`] = monitorData.value['InputFlux'];
  600. // }
  601. airCompressor[`InputFlux`] =
  602. monitorData.value['InputFlux'] || Number(monitorData.value['InputFlux1']) + Number(monitorData.value['InputFlux2']);
  603. monitorData.value['FluxTotal'] = airCompressor[`InputFlux`];
  604. //图表数据
  605. if (dataArr.length <= 5) {
  606. dataArr.push(airCompressor);
  607. } else {
  608. dataArr.shift();
  609. dataArr.push(airCompressor);
  610. }
  611. echartData.value = dataArr;
  612. refresh.value = true;
  613. nextTick(() => {
  614. refresh.value = false;
  615. });
  616. }
  617. }
  618. function handlerDevice(data, bol) {
  619. kzParam.data = data;
  620. kzParam.isFw = bol;
  621. if (bol) {
  622. modalTitle.value = '一键复位';
  623. modalType.value = '1';
  624. modalIsShow.value = true;
  625. kzParam.data.HMIReset = !data.HMIReset;
  626. } else {
  627. modalTitle.value = '一键启停';
  628. modalType.value = '2';
  629. modalIsShow.value = true;
  630. kzParam.data.HMIStartStop = !data.HMIStartStop;
  631. }
  632. }
  633. function handleOK(passWord, handlerState) {
  634. console.log(kzParam, 'kz----------');
  635. // if (passWord !== '123456') {
  636. // message.warning('密码不正确,请重新输入');
  637. // return;
  638. // }
  639. let data = {};
  640. if (kzParam.isFw) {
  641. data = {
  642. deviceid: kzParam.data.id,
  643. devicetype: kzParam.data.deviceType,
  644. password: passWord,
  645. HMIReset: kzParam.data.HMIReset,
  646. };
  647. } else {
  648. data = {
  649. deviceid: kzParam.data.id,
  650. password: passWord,
  651. devicetype: kzParam.data.deviceType,
  652. HMIStartStop: kzParam.data.HMIStartStop,
  653. };
  654. }
  655. deviceControlApi(data).then((res) => {
  656. // 模拟时开启
  657. if (res.success) {
  658. modalIsShow.value = false;
  659. getDataSource(props.deviceId);
  660. if (globalConfig.History_Type == 'remote') {
  661. message.success('指令已下发至生产管控平台成功!');
  662. } else {
  663. message.success('指令已下发成功!');
  664. }
  665. }
  666. });
  667. }
  668. function handleCancel() {
  669. modalIsShow.value = false;
  670. modalTitle.value = '';
  671. modalType.value = '';
  672. }
  673. watch([monitorDataGroupNum, loading], ([newMonitorDataGroupNum, newLoading]) => {
  674. nextTick(() => {
  675. if (newMonitorDataGroupNum && !newLoading) {
  676. setModelType(props.modalType, newMonitorDataGroupNum);
  677. }
  678. });
  679. });
  680. // 多套系统,不同点表
  681. watch(
  682. () => unref(deviceType),
  683. async (type: string) => {
  684. if (type == 'nitrogen_52507') {
  685. const { preMonitorList, preFanMonitorData, nitrogenMonitorData } = await import('../nitrogen.data.dlt1');
  686. preMonitorListData.value = preMonitorList;
  687. preFanMonitor.value = preFanMonitorData;
  688. nitrogenMonitor.value = nitrogenMonitorData;
  689. } else {
  690. const { preMonitorList, preFanMonitorData, nitrogenMonitorData } = await import('../nitrogen.data.dltj');
  691. preMonitorListData.value = preMonitorList;
  692. preFanMonitor.value = preFanMonitorData;
  693. nitrogenMonitor.value = nitrogenMonitorData;
  694. }
  695. },
  696. { immediate: true }
  697. );
  698. onMounted(async () => {
  699. await getMonitor(true);
  700. await mountedThree().then(() => {
  701. loading.value = false;
  702. });
  703. await getCamera(props.deviceId, playerRef.value);
  704. });
  705. onUnmounted(() => {
  706. destroy();
  707. if (timer) {
  708. clearTimeout(timer);
  709. timer = undefined;
  710. }
  711. removeCamera();
  712. });
  713. </script>
  714. <style lang="less" scoped>
  715. @import '/@/design/theme.less';
  716. @ventSpace: zxm;
  717. .nitrogen-box {
  718. width: 100%;
  719. height: 100%;
  720. display: flex;
  721. justify-content: center;
  722. }
  723. #nitrogenCss3D {
  724. .modal-monitor {
  725. width: 200px;
  726. position: absolute;
  727. left: 0px;
  728. top: 0px;
  729. }
  730. &:deep(.win) {
  731. margin: 0 !important;
  732. background: #00000044;
  733. }
  734. }
  735. .nitrogen-home {
  736. width: 100%;
  737. height: 100%;
  738. position: fixed;
  739. z-index: 9999;
  740. display: flex;
  741. flex-direction: column;
  742. justify-content: center;
  743. align-items: center;
  744. pointer-events: none;
  745. top: 20px;
  746. .nitrogen-container {
  747. width: 100%;
  748. height: calc(100% - 100px);
  749. display: flex;
  750. justify-content: space-between;
  751. margin-bottom: 100px;
  752. position: relative;
  753. .device-state {
  754. width: 100%;
  755. position: absolute;
  756. top: 20px;
  757. color: #e90000;
  758. display: flex;
  759. justify-content: center;
  760. font-size: 20px;
  761. }
  762. .top-box {
  763. width: 100%;
  764. padding: 10px;
  765. overflow: hidden;
  766. display: flex;
  767. justify-content: space-between;
  768. // margin-top: 40px;
  769. .center-item-box {
  770. position: absolute;
  771. left: 50%;
  772. top: 50px;
  773. transform: translate(-48%, 0);
  774. width: calc(100% - 720px);
  775. height: 50px;
  776. display: flex;
  777. align-items: center;
  778. pointer-events: auto;
  779. .top-left {
  780. display: flex;
  781. flex: 1.5;
  782. color: #fff;
  783. .button-box {
  784. position: relative;
  785. width: auto;
  786. height: 32px;
  787. display: flex;
  788. align-items: center;
  789. justify-content: center;
  790. border-radius: 5px;
  791. color: #fff;
  792. padding: 10px 15px;
  793. margin: 0px 10px;
  794. box-sizing: border-box;
  795. cursor: pointer;
  796. background: linear-gradient(#1fa6cb, #127cb5);
  797. &:hover {
  798. background: linear-gradient(#1fa6cbcc, #127cb5cc);
  799. }
  800. }
  801. }
  802. .top-center {
  803. display: flex;
  804. flex: 1;
  805. justify-content: center;
  806. align-items: center;
  807. font-size: 20px;
  808. color: #fff;
  809. .top-c-label {
  810. color: yellow;
  811. }
  812. }
  813. .top-right {
  814. display: flex;
  815. flex: 2;
  816. justify-content: right;
  817. align-items: center;
  818. color: #fff;
  819. .control-type {
  820. display: flex;
  821. color: #fff;
  822. .control-title {
  823. color: #73e8fe;
  824. }
  825. }
  826. }
  827. }
  828. .lr-box {
  829. height: 100%;
  830. display: flex;
  831. flex-direction: column;
  832. position: relative;
  833. // overflow: hidden;
  834. z-index: 9999;
  835. pointer-events: auto;
  836. overflow-y: auto;
  837. overflow-x: hidden;
  838. .input-item {
  839. display: flex;
  840. justify-content: space-between;
  841. align-items: center;
  842. padding: 4px 8px;
  843. margin: 6px 0;
  844. background-image: linear-gradient(to right, #39deff15, #3977e500);
  845. .title {
  846. width: 200px;
  847. }
  848. .title-auto {
  849. width: auto;
  850. }
  851. .input-value {
  852. width: 80px;
  853. height: 28px;
  854. line-height: 28px !important;
  855. background: transparent !important;
  856. border-color: #228da2 !important;
  857. color: #fff !important;
  858. }
  859. .value {
  860. width: 100px;
  861. color: #00d8ff;
  862. padding-right: 20px;
  863. }
  864. .unit {
  865. width: 80px;
  866. text-align: right;
  867. }
  868. }
  869. }
  870. .item {
  871. width: 305px;
  872. height: auto;
  873. position: relative;
  874. border-radius: 5px;
  875. margin-top: 10px;
  876. margin-bottom: 0px;
  877. pointer-events: auto;
  878. color: #fff;
  879. // overflow: hidden;
  880. &:first-child {
  881. margin-top: 0px;
  882. }
  883. .base-title {
  884. color: #fff;
  885. margin-bottom: 8px;
  886. padding-left: 10px;
  887. position: relative;
  888. font-size: 16px;
  889. &::after {
  890. content: '';
  891. position: absolute;
  892. display: block;
  893. width: 4px;
  894. height: 12px;
  895. top: 7px;
  896. left: 0px;
  897. background: #45d3fd;
  898. border-radius: 4px;
  899. }
  900. }
  901. .monitor-item {
  902. width: 100%;
  903. display: flex;
  904. flex-direction: row;
  905. flex-wrap: wrap;
  906. .state-item {
  907. width: 50%;
  908. padding: 5px;
  909. display: flex;
  910. align-items: center;
  911. justify-content: space-between;
  912. .state-title {
  913. width: 100px;
  914. color: #ffffffdd;
  915. flex: 9;
  916. font-size: 14px;
  917. .unit {
  918. // color: #ffffffbb;
  919. }
  920. .value {
  921. color: #00d8ff;
  922. }
  923. }
  924. .state-val {
  925. flex: 1;
  926. color: #e4a300;
  927. margin-right: 5px;
  928. text-align: right;
  929. font-size: 14px;
  930. }
  931. }
  932. }
  933. .signal-box {
  934. margin: 5px 0;
  935. display: flex;
  936. align-items: center;
  937. .signal-title {
  938. color: #7af5ff;
  939. margin: 0 5px;
  940. }
  941. &:last-child {
  942. margin-right: 0px;
  943. }
  944. }
  945. .list-item {
  946. padding: 0 10px;
  947. display: flex;
  948. justify-content: space-between;
  949. align-items: center;
  950. .item-data-key {
  951. color: #ffffff99;
  952. }
  953. }
  954. .item-data-box {
  955. color: #fff;
  956. .state-icon {
  957. display: inline-block;
  958. width: 12px;
  959. height: 12px;
  960. border-radius: 12px;
  961. }
  962. .open {
  963. border: 5px solid #133a56;
  964. background: #4ecb73;
  965. }
  966. .close {
  967. border: 5px solid #192961;
  968. background: #6d7898;
  969. }
  970. }
  971. }
  972. .item-l {
  973. width: 100%;
  974. .monitor-box {
  975. width: 100%;
  976. .parameter-title {
  977. position: relative;
  978. width: 100%;
  979. height: 14px;
  980. margin-top: 10px;
  981. .icon,
  982. span {
  983. position: absolute;
  984. top: -10px;
  985. }
  986. }
  987. .group-parameter-title {
  988. background-image: linear-gradient(to right, #39a3ff50, #39a3ff00);
  989. .icon {
  990. left: -12px;
  991. top: -17px;
  992. }
  993. span {
  994. left: 18px;
  995. }
  996. .item-col {
  997. background-image: linear-gradient(to right, #39a3ff00, #39a3ff10);
  998. }
  999. }
  1000. .device-parameter-title {
  1001. background-image: linear-gradient(to right, #3df6ff40, #3df6ff00);
  1002. .icon {
  1003. left: -10px;
  1004. top: -14px;
  1005. }
  1006. span {
  1007. left: 18px;
  1008. }
  1009. .item-col {
  1010. background-image: linear-gradient(to right, #3df6ff10, #3df6ff00);
  1011. }
  1012. }
  1013. .monitor-item {
  1014. .value {
  1015. color: #00d8ff;
  1016. }
  1017. }
  1018. }
  1019. }
  1020. .right-box {
  1021. width: 300px;
  1022. margin-top: 50px;
  1023. }
  1024. .left-box {
  1025. width: 335px;
  1026. margin-top: 80px;
  1027. }
  1028. }
  1029. &:deep(.win) {
  1030. width: 100%;
  1031. margin: 0 !important;
  1032. }
  1033. }
  1034. .player-box {
  1035. position: absolute;
  1036. height: auto;
  1037. // width: 100%;
  1038. right: 0px;
  1039. bottom: 110px;
  1040. z-index: 99999;
  1041. display: flex;
  1042. #LivePlayerBox {
  1043. width: auto !important;
  1044. }
  1045. }
  1046. }
  1047. &:deep(.main) {
  1048. .title {
  1049. height: 34px;
  1050. text-align: center;
  1051. font-weight: 600;
  1052. color: #7af5ff;
  1053. // background-image: url('../../../assets/img/yfj/light.png');
  1054. background-repeat: no-repeat;
  1055. background-position-x: center;
  1056. background-position-y: 100%;
  1057. background-size: 80%;
  1058. font-size: 16px;
  1059. }
  1060. .monitor-item {
  1061. width: 200px;
  1062. display: flex;
  1063. flex-direction: row;
  1064. width: auto;
  1065. margin-bottom: 3px;
  1066. .monitor-val {
  1067. color: #ffb700;
  1068. display: flex;
  1069. width: auto;
  1070. .val {
  1071. width: 80px;
  1072. font-size: 14px;
  1073. }
  1074. .unit {
  1075. color: #ffffffbb;
  1076. font-size: 14px;
  1077. }
  1078. }
  1079. }
  1080. .monitor-title {
  1081. width: 100px;
  1082. color: #7af5ff;
  1083. font-weight: 400;
  1084. font-size: 14px;
  1085. }
  1086. .signal-item {
  1087. display: flex;
  1088. justify-content: space-between;
  1089. // margin-bottom: 5px;
  1090. .signal-round {
  1091. display: inline-block;
  1092. width: 8px;
  1093. height: 8px;
  1094. border-radius: 50%;
  1095. margin: 0 10px;
  1096. position: relative;
  1097. &::after {
  1098. display: block;
  1099. content: '';
  1100. position: absolute;
  1101. width: 12px;
  1102. height: 12px;
  1103. top: -2px;
  1104. left: -2px;
  1105. border-radius: 50%;
  1106. }
  1107. }
  1108. .signal-round-gry {
  1109. background-color: #858585;
  1110. &::after {
  1111. background-color: #85858544;
  1112. box-shadow: 0 0 1px 1px #85858599;
  1113. }
  1114. }
  1115. .signal-round-run {
  1116. background-color: #67fc00;
  1117. &::after {
  1118. background-color: #67fc0044;
  1119. box-shadow: 0 0 1px 1px #c6ff77;
  1120. }
  1121. }
  1122. .signal-round-warning {
  1123. background-color: #e9170b;
  1124. &::after {
  1125. background-color: #e9170b44;
  1126. box-shadow: 0 0 1px 1px #e9170b;
  1127. }
  1128. }
  1129. }
  1130. }
  1131. :deep(.zxm-radio-wrapper) {
  1132. color: #fff !important;
  1133. }
  1134. </style>