nitrogenHome_hlg.vue 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195
  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] ? 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 preMonitorList" :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 nitrogenMonitorData" :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] ? 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 preFanMonitorData" :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 { preFanMonitorData, preMonitorList, nitrogenMonitorData } from '../nitrogen.data.hlg';
  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 deviceType = ref('');
  252. const monitorNetStatus = ref(0);
  253. const monitorDataGroupNum = ref(1);
  254. let airCompressorState = reactive<any[]>([]);
  255. // const chartsColumns = ref([
  256. // {
  257. // legend: '瞬时流量',
  258. // seriesName: '(m³/h)',
  259. // ymax: 2000,
  260. // yname: 'm³/h',
  261. // linetype: 'line',
  262. // yaxispos: 'left',
  263. // color: '#FDB146',
  264. // sort: 1,
  265. // xRotate: 0,
  266. // dataIndex: 'InputFlux',
  267. // },
  268. // ]);
  269. const chartsColumns = ref(getTableHeaderColumns('sys_nitrogen_chart'));
  270. const { getCamera, removeCamera } = useCamera();
  271. const monitorData = ref({});
  272. //图表数据
  273. let echartData = ref<any>([]);
  274. // https获取监测数据
  275. let timer: null | NodeJS.Timeout = null;
  276. async function getMonitor(flag?) {
  277. if (Object.prototype.toString.call(timer) === '[object Null]') {
  278. return new Promise(async (resolve) => {
  279. timer = await setTimeout(
  280. async () => {
  281. if (props.deviceId) {
  282. await getDataSource(props.deviceId);
  283. }
  284. if (timer) {
  285. timer = null;
  286. }
  287. resolve(null);
  288. await getMonitor();
  289. },
  290. flag ? 0 : 3000
  291. );
  292. });
  293. }
  294. }
  295. async function getDataSource(systemID) {
  296. const res = await getDevice({ devicetype: 'sys', systemID, type: 'all' });
  297. if (res) {
  298. const result = res;
  299. // const result = {
  300. // cmd: 'monitordata',
  301. // msgTxt: [
  302. // {
  303. // datalist: [
  304. // {
  305. // msgType: null,
  306. // deviceID: '1818548876779245569',
  307. // strname: '52507注氮机-2',
  308. // strinstallpos: '52507注氮机-2',
  309. // fsectarea: 'null',
  310. // stationname: '52507注氮机-2',
  311. // stationtype: 'redis',
  312. // deviceType: 'nitrogen_525072',
  313. // typeName: '52507注氮机2',
  314. // netStatus: 1,
  315. // warnFlag: 0,
  316. // warnLevel: 0,
  317. // warnLevel_str: '正常',
  318. // syswarnLevel: null,
  319. // syswarnLevel_str: null,
  320. // syswarnLevel_des: null,
  321. // warnTime: null,
  322. // readTime: '2024-08-04 17:59:25',
  323. // warnDes: '',
  324. // frontGateOpenCtrl: null,
  325. // rearGateOpenCtrl: null,
  326. // readData: {
  327. // FluxTotal12: '0.0',
  328. // RunTime42: '131072000',
  329. // NitrogenPurity2: '26',
  330. // ExhaustTemp2: '25.0',
  331. // Status2: '0',
  332. // RunTime2: '0',
  333. // sign: '0',
  334. // OilGasBarrel_SeparatorFault2: '0',
  335. // TotalFailureSignal2: '0',
  336. // InputFlux2: '5',
  337. // PhaseFailureFault12: '0',
  338. // RunTime22: '3080192',
  339. // LowVoltageFault2: '0',
  340. // SysVoltage2: '1158',
  341. // Fan_Current2: '0',
  342. // CtrlMode2: '1',
  343. // ExhaustPreHighFault2: '0',
  344. // ShortCutFaul2: '0',
  345. // OilGasBarrel_OverTempAlarm2: '0',
  346. // CloseFail2: '0',
  347. // OilGasBarrel_FilterBlockageFault2: '0',
  348. // HMIStartStop2: '0',
  349. // OilGasBarrel_OverTempAlarm12: '0',
  350. // OverVoltageFault2: '0',
  351. // OilGasBarrel_HighPressureFault2: '0',
  352. // Fan_OverloadFault2: '0',
  353. // OilPressureLowFault2: '0',
  354. // PhaseSequenceFault2: '0',
  355. // PhaseFailureFault2: '0',
  356. // RunTime32: '35323904',
  357. // MainMotor_OverTempFault2: '0',
  358. // FluxTotal22: '0.0',
  359. // PowerFault2: '0',
  360. // LoadorUnload2: '0',
  361. // PreMembraneTemperature2: '-19',
  362. // PhaseSequenceFault12: '0',
  363. // RunTime12: '393216',
  364. // ExhaustTemp12: '0',
  365. // TotalFailureSignal12: '0',
  366. // UnbalanceFault2: '0',
  367. // ExhaustPre2: '0',
  368. // MainMotor_OverloadFault2: '0',
  369. // NoWaterFault2: '0',
  370. // LoadTime2: '539',
  371. // MainMotor_Current2: '0',
  372. // isRun: '-2',
  373. // LeakageLock2: '0',
  374. // OpenFail2: '0',
  375. // },
  376. // readDataDes: null,
  377. // summaryHour: [],
  378. // summaryDay: [],
  379. // history: [],
  380. // dayhistory: [],
  381. // totalInfo: null,
  382. // sign: null,
  383. // cameras: [],
  384. // links: [],
  385. // other1: null,
  386. // other2: null,
  387. // other3: null,
  388. // remarkInfo: null,
  389. // linkInfo: null,
  390. // addrIndex: null,
  391. // warnLogNotOkCount: 0,
  392. // },
  393. // ],
  394. // avginfo: {
  395. // warnFlag: {
  396. // value: 0,
  397. // },
  398. // },
  399. // typeName: '52507注氮机2',
  400. // type: 'nitrogen_525072',
  401. // },
  402. // {
  403. // datalist: [
  404. // {
  405. // msgType: null,
  406. // deviceID: '1818546650996330498',
  407. // strname: '52507注氮机-1',
  408. // strinstallpos: '52507注氮机-1',
  409. // fsectarea: 'null',
  410. // stationname: '52507注氮机-1',
  411. // stationtype: 'redis',
  412. // deviceType: 'nitrogen_525071',
  413. // typeName: '52507注氮机1',
  414. // netStatus: 1,
  415. // warnFlag: 0,
  416. // warnLevel: 0,
  417. // warnLevel_str: '正常',
  418. // syswarnLevel: null,
  419. // syswarnLevel_str: null,
  420. // syswarnLevel_des: null,
  421. // warnTime: null,
  422. // readTime: '2024-08-04 17:59:25',
  423. // warnDes: '',
  424. // frontGateOpenCtrl: null,
  425. // rearGateOpenCtrl: null,
  426. // readData: {
  427. // RunTime41: '131072000',
  428. // NitrogenPurity1: '12',
  429. // ExhaustTemp1: '82.0',
  430. // RunTime21: '786432',
  431. // RunTime1: '1',
  432. // sign: '0',
  433. // OilGasBarrel_SeparatorFault1: '0',
  434. // InputFlux1: '13',
  435. // PhaseFailureFault11: '0',
  436. // LowVoltageFault1: '0',
  437. // SysVoltage1: '1149',
  438. // TotalFailureSignal1: '0',
  439. // Fan_Current1: '0',
  440. // ExhaustPreHighFault1: '0',
  441. // ShortCutFaul1: '0',
  442. // OilGasBarrel_OverTempAlarm1: '0',
  443. // CloseFail1: '0',
  444. // OilGasBarrel_FilterBlockageFault1: '0',
  445. // OilGasBarrel_OverTempAlarm11: '0',
  446. // HMIStartStop1: '0',
  447. // CtrlMode1: '1',
  448. // Fan_OverloadFault1: '0',
  449. // OilPressureLowFault1: '0',
  450. // OverVoltageFault1: '0',
  451. // OilGasBarrel_HighPressureFault1: '0',
  452. // PhaseFailureFault1: '0',
  453. // RunTime31: '70516736',
  454. // FluxTotal21: '0.0',
  455. // FluxTotal1: '0.01',
  456. // MainMotor_OverTempFault1: '0',
  457. // PhaseSequenceFault1: '0',
  458. // PowerFault1: '0',
  459. // LoadorUnload1: '0',
  460. // RunTime11: '3342336',
  461. // PhaseSequenceFault11: '0',
  462. // PreMembraneTemperature1: '25',
  463. // TotalFailureSignal11: '0',
  464. // UnbalanceFault1: '0',
  465. // ExhaustTemp11: '0',
  466. // ExhaustPre1: '89',
  467. // MainMotor_OverloadFault1: '0',
  468. // NoWaterFault1: '0',
  469. // Status1: '0',
  470. // LoadTime1: '1086',
  471. // isRun: '-2',
  472. // LeakageLock1: '0',
  473. // MainMotor_Current1: '95',
  474. // OpenFail1: '0',
  475. // o2Val: '20.23',
  476. // temperature: '19.5',
  477. // fumes_str: '0.2',
  478. // },
  479. // readDataDes: null,
  480. // summaryHour: [],
  481. // summaryDay: [],
  482. // history: [],
  483. // dayhistory: [],
  484. // totalInfo: null,
  485. // sign: null,
  486. // cameras: [],
  487. // links: [],
  488. // other1: null,
  489. // other2: null,
  490. // other3: null,
  491. // remarkInfo: null,
  492. // linkInfo: null,
  493. // addrIndex: null,
  494. // warnLogNotOkCount: 0,
  495. // },
  496. // ],
  497. // avginfo: {
  498. // warnFlag: {
  499. // value: 0,
  500. // },
  501. // },
  502. // typeName: '52507注氮机1',
  503. // type: 'nitrogen_525071',
  504. // },
  505. // {
  506. // subtype: 'sys_nitrogen',
  507. // datalist: [
  508. // {
  509. // msgType: '2',
  510. // deviceID: '1818821502634352642',
  511. // strname: '52507注氮系统',
  512. // strinstallpos: '52507注氮系统',
  513. // fsectarea: 'null',
  514. // stationname: null,
  515. // stationtype: null,
  516. // deviceType: 'sys_nitrogen',
  517. // typeName: '注氮系统',
  518. // netStatus: null,
  519. // warnFlag: 0,
  520. // warnLevel: null,
  521. // warnLevel_str: null,
  522. // syswarnLevel: 0,
  523. // syswarnLevel_str: null,
  524. // syswarnLevel_des: null,
  525. // warnTime: null,
  526. // readTime: '2024-08-01 09:56:28',
  527. // warnDes: '',
  528. // frontGateOpenCtrl: null,
  529. // rearGateOpenCtrl: null,
  530. // readData: {
  531. // sign: '0',
  532. // isRun: '-2',
  533. // },
  534. // readDataDes: null,
  535. // summaryHour: [],
  536. // summaryDay: [],
  537. // history: null,
  538. // dayhistory: [],
  539. // totalInfo: null,
  540. // sign: null,
  541. // cameras: [],
  542. // links: [],
  543. // other1: null,
  544. // other2: null,
  545. // other3: null,
  546. // remarkInfo: null,
  547. // linkInfo: null,
  548. // addrIndex: null,
  549. // warnLogNotOkCount: 0,
  550. // },
  551. // ],
  552. // typeName: '综合监测系统',
  553. // type: 'sys',
  554. // },
  555. // ],
  556. // };
  557. if (!result || result.msgTxt.length < 1) return;
  558. let dataSoreDatas = {};
  559. let netStatus = 0;
  560. result.msgTxt.forEach((item, index) => {
  561. if (item.type && item.type.startsWith('nitrogen')) {
  562. airCompressorState.length = 0;
  563. if (item.type.startsWith('nitrogen_52507')) {
  564. if (deviceType.value !== 'nitrogen_52507') deviceType.value = 'nitrogen_52507';
  565. dataSoreDatas = Object.assign(dataSoreDatas, item['datalist'][0], item['datalist'][0]['readData']);
  566. dataSoreDatas['strname' + (index + 1)] = item['datalist'][0]['strname'];
  567. if (item['datalist'][0]['netStatus']) {
  568. netStatus = 1;
  569. }
  570. } else {
  571. deviceType.value = '';
  572. monitorData.value = Object.assign(item['datalist'][0], item['datalist'][0]['readData']);
  573. if (monitorData.value['netStatus'] == 1) {
  574. netStatus = 1;
  575. }
  576. airCompressorState.push({
  577. id: monitorData.value['deviceID'],
  578. deviceType: monitorData.value['deviceType'],
  579. HMIStart: monitorData.value['HMIStart'],
  580. HMIStop: monitorData.value['HMIStop'],
  581. });
  582. }
  583. }
  584. });
  585. if (JSON.stringify(dataSoreDatas) !== '{}') {
  586. monitorData.value = dataSoreDatas;
  587. }
  588. monitorNetStatus.value = netStatus;
  589. const dataArr = lodash.cloneDeep(echartData.value);
  590. const airCompressor = { readTime: monitorData.value['readTime'].substring(11) };
  591. if (JSON.stringify(dataSoreDatas) === '{}') {
  592. airCompressor[`FluxTotal`] = monitorData.value['FluxTotal'] || 0;
  593. }
  594. // airCompressor[`InputFlux`] = Number(monitorData.value['InputFlux1']) + Number(monitorData.value['InputFlux2']) || null;
  595. // if (!airCompressor[`InputFlux`]) {
  596. // airCompressor[`InputFlux`] = monitorData.value['InputFlux'];
  597. // }
  598. airCompressor[`InputFlux`] =
  599. monitorData.value['InputFlux'] || Number(monitorData.value['InputFlux1']) + Number(monitorData.value['InputFlux2']);
  600. monitorData.value['FluxTotal'] = airCompressor[`InputFlux`];
  601. //图表数据
  602. if (dataArr.length <= 5) {
  603. dataArr.push(airCompressor);
  604. } else {
  605. dataArr.shift();
  606. dataArr.push(airCompressor);
  607. }
  608. echartData.value = dataArr;
  609. refresh.value = true;
  610. nextTick(() => {
  611. refresh.value = false;
  612. });
  613. }
  614. }
  615. function handlerDevice(data, bol) {
  616. kzParam.data = data;
  617. kzParam.isFw = bol;
  618. if (bol) {
  619. modalTitle.value = '一键复位';
  620. modalType.value = '1';
  621. modalIsShow.value = true;
  622. kzParam.data.HMIReset = !data.HMIReset;
  623. } else {
  624. modalTitle.value = '一键启停';
  625. modalType.value = '2';
  626. modalIsShow.value = true;
  627. kzParam.data.HMIStartStop = !data.HMIStartStop;
  628. }
  629. }
  630. function handleOK(passWord, handlerState) {
  631. console.log(kzParam, 'kz----------');
  632. // if (passWord !== '123456') {
  633. // message.warning('密码不正确,请重新输入');
  634. // return;
  635. // }
  636. let data = {};
  637. if (kzParam.isFw) {
  638. data = {
  639. deviceid: kzParam.data.id,
  640. devicetype: kzParam.data.deviceType,
  641. password: passWord,
  642. HMIReset: kzParam.data.HMIReset,
  643. };
  644. } else {
  645. data = {
  646. deviceid: kzParam.data.id,
  647. password: passWord,
  648. devicetype: kzParam.data.deviceType,
  649. HMIStartStop: kzParam.data.HMIStartStop,
  650. };
  651. }
  652. deviceControlApi(data).then((res) => {
  653. // 模拟时开启
  654. if (res.success) {
  655. modalIsShow.value = false;
  656. getDataSource(props.deviceId);
  657. if (globalConfig.History_Type == 'remote') {
  658. message.success('指令已下发至生产管控平台成功!');
  659. } else {
  660. message.success('指令已下发成功!');
  661. }
  662. }
  663. });
  664. }
  665. function handleCancel() {
  666. modalIsShow.value = false;
  667. modalTitle.value = '';
  668. modalType.value = '';
  669. }
  670. watch([monitorDataGroupNum, loading], ([newMonitorDataGroupNum, newLoading]) => {
  671. nextTick(() => {
  672. if (newMonitorDataGroupNum && !newLoading) {
  673. setModelType(props.modalType, newMonitorDataGroupNum);
  674. }
  675. });
  676. });
  677. onMounted(async () => {
  678. await getMonitor(true);
  679. await mountedThree().then(() => {
  680. loading.value = false;
  681. });
  682. await getCamera(props.deviceId, playerRef.value);
  683. });
  684. onUnmounted(() => {
  685. destroy();
  686. if (timer) {
  687. clearTimeout(timer);
  688. timer = undefined;
  689. }
  690. removeCamera();
  691. });
  692. </script>
  693. <style lang="less" scoped>
  694. @import '/@/design/theme.less';
  695. @ventSpace: zxm;
  696. .nitrogen-box {
  697. width: 100%;
  698. height: 100%;
  699. display: flex;
  700. justify-content: center;
  701. }
  702. #nitrogenCss3D {
  703. .modal-monitor {
  704. width: 200px;
  705. position: absolute;
  706. left: 0px;
  707. top: 0px;
  708. }
  709. &:deep(.win) {
  710. margin: 0 !important;
  711. background: #00000044;
  712. }
  713. }
  714. .nitrogen-home {
  715. width: 100%;
  716. height: 100%;
  717. position: fixed;
  718. z-index: 9999;
  719. display: flex;
  720. flex-direction: column;
  721. justify-content: center;
  722. align-items: center;
  723. pointer-events: none;
  724. top: 20px;
  725. .nitrogen-container {
  726. width: 100%;
  727. height: calc(100% - 100px);
  728. display: flex;
  729. justify-content: space-between;
  730. margin-bottom: 100px;
  731. position: relative;
  732. .device-state {
  733. width: 100%;
  734. position: absolute;
  735. top: 20px;
  736. color: #e90000;
  737. display: flex;
  738. justify-content: center;
  739. font-size: 20px;
  740. }
  741. .top-box {
  742. width: 100%;
  743. padding: 10px;
  744. overflow: hidden;
  745. display: flex;
  746. justify-content: space-between;
  747. // margin-top: 40px;
  748. .center-item-box {
  749. position: absolute;
  750. left: 50%;
  751. top: 50px;
  752. transform: translate(-48%, 0);
  753. width: calc(100% - 720px);
  754. height: 50px;
  755. display: flex;
  756. align-items: center;
  757. pointer-events: auto;
  758. .top-left {
  759. display: flex;
  760. flex: 1.5;
  761. color: #fff;
  762. .button-box {
  763. position: relative;
  764. width: auto;
  765. height: 32px;
  766. display: flex;
  767. align-items: center;
  768. justify-content: center;
  769. border-radius: 5px;
  770. color: #fff;
  771. padding: 10px 15px;
  772. margin: 0px 10px;
  773. box-sizing: border-box;
  774. cursor: pointer;
  775. background: linear-gradient(#1fa6cb, #127cb5);
  776. &:hover {
  777. background: linear-gradient(#1fa6cbcc, #127cb5cc);
  778. }
  779. }
  780. }
  781. .top-center {
  782. display: flex;
  783. flex: 1;
  784. justify-content: center;
  785. align-items: center;
  786. font-size: 20px;
  787. color: #fff;
  788. .top-c-label {
  789. color: yellow;
  790. }
  791. }
  792. .top-right {
  793. display: flex;
  794. flex: 2;
  795. justify-content: right;
  796. align-items: center;
  797. color: #fff;
  798. .control-type {
  799. display: flex;
  800. color: #fff;
  801. .control-title {
  802. color: #73e8fe;
  803. }
  804. }
  805. }
  806. }
  807. .lr-box {
  808. height: 100%;
  809. display: flex;
  810. flex-direction: column;
  811. position: relative;
  812. // overflow: hidden;
  813. z-index: 9999;
  814. pointer-events: auto;
  815. overflow-y: auto;
  816. overflow-x: hidden;
  817. .input-item {
  818. display: flex;
  819. justify-content: space-between;
  820. align-items: center;
  821. padding: 4px 8px;
  822. margin: 6px 0;
  823. background-image: linear-gradient(to right, #39deff15, #3977e500);
  824. .title {
  825. width: 200px;
  826. }
  827. .title-auto {
  828. width: auto;
  829. }
  830. .input-value {
  831. width: 80px;
  832. height: 28px;
  833. line-height: 28px !important;
  834. background: transparent !important;
  835. border-color: #228da2 !important;
  836. color: #fff !important;
  837. }
  838. .value {
  839. width: 100px;
  840. color: #00d8ff;
  841. padding-right: 20px;
  842. }
  843. .unit {
  844. width: 80px;
  845. text-align: right;
  846. }
  847. }
  848. }
  849. .item {
  850. width: 305px;
  851. height: auto;
  852. position: relative;
  853. border-radius: 5px;
  854. margin-top: 10px;
  855. margin-bottom: 0px;
  856. pointer-events: auto;
  857. color: #fff;
  858. // overflow: hidden;
  859. &:first-child {
  860. margin-top: 0px;
  861. }
  862. .base-title {
  863. color: #fff;
  864. margin-bottom: 8px;
  865. padding-left: 10px;
  866. position: relative;
  867. font-size: 16px;
  868. &::after {
  869. content: '';
  870. position: absolute;
  871. display: block;
  872. width: 4px;
  873. height: 12px;
  874. top: 7px;
  875. left: 0px;
  876. background: #45d3fd;
  877. border-radius: 4px;
  878. }
  879. }
  880. .monitor-item {
  881. width: 100%;
  882. display: flex;
  883. flex-direction: row;
  884. flex-wrap: wrap;
  885. .state-item {
  886. width: 50%;
  887. padding: 5px;
  888. display: flex;
  889. align-items: center;
  890. justify-content: space-between;
  891. .state-title {
  892. width: 100px;
  893. color: #ffffffdd;
  894. flex: 9;
  895. font-size: 14px;
  896. .unit {
  897. // color: #ffffffbb;
  898. }
  899. .value {
  900. color: #00d8ff;
  901. }
  902. }
  903. .state-val {
  904. flex: 1;
  905. color: #e4a300;
  906. margin-right: 5px;
  907. text-align: right;
  908. font-size: 14px;
  909. }
  910. }
  911. }
  912. .signal-box {
  913. margin: 5px 0;
  914. display: flex;
  915. align-items: center;
  916. .signal-title {
  917. color: #7af5ff;
  918. margin: 0 5px;
  919. }
  920. &:last-child {
  921. margin-right: 0px;
  922. }
  923. }
  924. .list-item {
  925. padding: 0 10px;
  926. display: flex;
  927. justify-content: space-between;
  928. align-items: center;
  929. .item-data-key {
  930. color: #ffffff99;
  931. }
  932. }
  933. .item-data-box {
  934. color: #fff;
  935. .state-icon {
  936. display: inline-block;
  937. width: 12px;
  938. height: 12px;
  939. border-radius: 12px;
  940. }
  941. .open {
  942. border: 5px solid #133a56;
  943. background: #4ecb73;
  944. }
  945. .close {
  946. border: 5px solid #192961;
  947. background: #6d7898;
  948. }
  949. }
  950. }
  951. .item-l {
  952. width: 100%;
  953. .monitor-box {
  954. width: 100%;
  955. .parameter-title {
  956. position: relative;
  957. width: 100%;
  958. height: 14px;
  959. margin-top: 10px;
  960. .icon,
  961. span {
  962. position: absolute;
  963. top: -10px;
  964. }
  965. }
  966. .group-parameter-title {
  967. background-image: linear-gradient(to right, #39a3ff50, #39a3ff00);
  968. .icon {
  969. left: -12px;
  970. top: -17px;
  971. }
  972. span {
  973. left: 18px;
  974. }
  975. .item-col {
  976. background-image: linear-gradient(to right, #39a3ff00, #39a3ff10);
  977. }
  978. }
  979. .device-parameter-title {
  980. background-image: linear-gradient(to right, #3df6ff40, #3df6ff00);
  981. .icon {
  982. left: -10px;
  983. top: -14px;
  984. }
  985. span {
  986. left: 18px;
  987. }
  988. .item-col {
  989. background-image: linear-gradient(to right, #3df6ff10, #3df6ff00);
  990. }
  991. }
  992. .monitor-item {
  993. .value {
  994. color: #00d8ff;
  995. }
  996. }
  997. }
  998. }
  999. .right-box {
  1000. width: 300px;
  1001. margin-top: 50px;
  1002. }
  1003. .left-box {
  1004. width: 335px;
  1005. margin-top: 80px;
  1006. }
  1007. }
  1008. &:deep(.win) {
  1009. width: 100%;
  1010. margin: 0 !important;
  1011. }
  1012. }
  1013. .player-box {
  1014. position: absolute;
  1015. height: auto;
  1016. // width: 100%;
  1017. right: 0px;
  1018. bottom: 110px;
  1019. z-index: 99999;
  1020. display: flex;
  1021. #LivePlayerBox {
  1022. width: auto !important;
  1023. }
  1024. }
  1025. }
  1026. &:deep(.main) {
  1027. .title {
  1028. height: 34px;
  1029. text-align: center;
  1030. font-weight: 600;
  1031. color: #7af5ff;
  1032. // background-image: url('../../../assets/img/yfj/light.png');
  1033. background-repeat: no-repeat;
  1034. background-position-x: center;
  1035. background-position-y: 100%;
  1036. background-size: 80%;
  1037. font-size: 16px;
  1038. }
  1039. .monitor-item {
  1040. width: 200px;
  1041. display: flex;
  1042. flex-direction: row;
  1043. width: auto;
  1044. margin-bottom: 3px;
  1045. .monitor-val {
  1046. color: #ffb700;
  1047. display: flex;
  1048. width: auto;
  1049. .val {
  1050. width: 80px;
  1051. font-size: 14px;
  1052. }
  1053. .unit {
  1054. color: #ffffffbb;
  1055. font-size: 14px;
  1056. }
  1057. }
  1058. }
  1059. .monitor-title {
  1060. width: 100px;
  1061. color: #7af5ff;
  1062. font-weight: 400;
  1063. font-size: 14px;
  1064. }
  1065. .signal-item {
  1066. display: flex;
  1067. justify-content: space-between;
  1068. // margin-bottom: 5px;
  1069. .signal-round {
  1070. display: inline-block;
  1071. width: 8px;
  1072. height: 8px;
  1073. border-radius: 50%;
  1074. margin: 0 10px;
  1075. position: relative;
  1076. &::after {
  1077. display: block;
  1078. content: '';
  1079. position: absolute;
  1080. width: 12px;
  1081. height: 12px;
  1082. top: -2px;
  1083. left: -2px;
  1084. border-radius: 50%;
  1085. }
  1086. }
  1087. .signal-round-gry {
  1088. background-color: #858585;
  1089. &::after {
  1090. background-color: #85858544;
  1091. box-shadow: 0 0 1px 1px #85858599;
  1092. }
  1093. }
  1094. .signal-round-run {
  1095. background-color: #67fc00;
  1096. &::after {
  1097. background-color: #67fc0044;
  1098. box-shadow: 0 0 1px 1px #c6ff77;
  1099. }
  1100. }
  1101. .signal-round-warning {
  1102. background-color: #e9170b;
  1103. &::after {
  1104. background-color: #e9170b44;
  1105. box-shadow: 0 0 1px 1px #e9170b;
  1106. }
  1107. }
  1108. }
  1109. }
  1110. :deep(.zxm-radio-wrapper) {
  1111. color: #fff !important;
  1112. }
  1113. </style>