nitrogenHome_dltj.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191
  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. <template v-for="(preMonitor, preMonitorIndex) in preMonitorListData" :key="preMonitorIndex">
  13. <div v-if="preMonitor.code !== 'signal'" class="monitor-item">
  14. <span class="monitor-title">{{ preMonitor.title }}:</span>
  15. <span class="monitor-val"
  16. ><span class="val">{{ monitorData[preMonitor.code + groupNum] ? formatNum(monitorData[preMonitor.code + groupNum]) : '-' }}</span
  17. ><span class="unit">{{ preMonitor.unit }}</span></span
  18. >
  19. </div>
  20. <div v-else class="signal-item">
  21. <div class="signal" v-for="(signal, childIndex) in preMonitor.child" :key="childIndex">
  22. <span class="monitor-title">{{ signal.title }}</span>
  23. <span style="display: inline-block; width: 30px; text-align: center" v-if="signal.isFault == -2">{{
  24. monitorData[signal.code + groupNum] == '0' ? '就地' : monitorData[signal.code + groupNum] == '1' ? '远程' : '-'
  25. }}</span>
  26. <span style="display: inline-block; width: 30px; text-align: center" v-else-if="signal.isFault == -1">{{
  27. monitorData[signal.code + groupNum] == '1' ? '加载' : monitorData[signal.code + groupNum] == '0' ? '卸载' : '-'
  28. }}</span>
  29. <span
  30. v-else
  31. :class="{
  32. 'signal-round': true,
  33. 'signal-round-run': !signal.isFault && monitorData[signal.code + groupNum] == '1',
  34. 'signal-round-warning': signal.isFault && monitorData[signal.code + groupNum] == '1',
  35. 'signal-round-gry': monitorData[signal.code + groupNum] != '1',
  36. }"
  37. ></span>
  38. </div>
  39. </div>
  40. </template>
  41. </fourBorderBg>
  42. </div>
  43. </div>
  44. <div class="nitrogen-home">
  45. <div class="nitrogen-container">
  46. <div class="top-box">
  47. <!-- 中间区域控制按钮 -->
  48. <div class="center-item-box">
  49. <div class="top-left" v-if="airCompressorState.length > 0">
  50. <div class="button-box" @click="handlerDevice(airCompressorState[0], '主机启动')">上位机启动</div>
  51. <div class="button-box" @click="handlerDevice(airCompressorState[0], '主机停止')">上位机停止</div>
  52. <div class="button-box" @click="handlerDevice(airCompressorState[0], '备机启动')">上位复位</div>
  53. </div>
  54. <div class="top-center">
  55. <div class="top-c-label">通信状态:</div>
  56. <div class="top-c-val">{{ monitorData['netStatus'] == 1 ? '连接' : monitorData['netStatus'] == 0 ? '断开' : '未知' }}</div>
  57. </div>
  58. <div class="top-right">
  59. <div class="control-type" v-if="monitorData['RemSelect'] !== undefined">
  60. <div class="control-title">空压机远近控切换:</div>
  61. <a-radio-group v-model:value="monitorData['RemSelect']">
  62. <a-radio :value="`1`">远程</a-radio>
  63. <a-radio :value="`0`">就地</a-radio>
  64. </a-radio-group>
  65. </div>
  66. <div class="control-type" v-if="monitorData['LocSelect'] !== undefined">
  67. <div class="control-title">制氮机远近控切换:</div>
  68. <a-radio-group v-model:value="monitorData['LocSelect']">
  69. <a-radio :value="`1`">远程</a-radio>
  70. <a-radio :value="`0`">就地</a-radio>
  71. </a-radio-group>
  72. </div>
  73. </div>
  74. </div>
  75. <!-- 左边监测数据 -->
  76. <div class="lr-box left-box">
  77. <ventBox1 v-if="deviceType != 'nitrogen_52507'">
  78. <template #title>
  79. <div>注氮机监测</div>
  80. </template>
  81. <template #container>
  82. <div class="input-item" v-for="(preFan, index) in nitrogenMonitor" :key="index">
  83. <div class="title">{{ preFan.title }}</div>
  84. <div v-if="preFan.unit !== 'signal' && preFan.unit !== 'warning'" class="value">{{
  85. monitorData[preFan.code] >= 0 ? formatNum(Number(monitorData[preFan.code])) : '-'
  86. }}</div>
  87. <div
  88. v-else
  89. :class="{
  90. 'signal-round': true,
  91. 'signal-round-warning': monitorData[preFan.code] == '1' && preFan.unit == 'warning',
  92. 'signal-round-run': monitorData[preFan.code] == '1' && preFan.unit == 'signal',
  93. 'signal-round-gry': monitorData[preFan.code] != '1',
  94. }"
  95. ></div>
  96. <div class="unit">{{ preFan.unit !== 'signal' && preFan.unit !== 'warning' ? `(${preFan.unit})` : '' }}</div>
  97. </div>
  98. </template>
  99. </ventBox1>
  100. <div class="item item-l" v-for="groupNum in monitorDataGroupNum" :key="groupNum">
  101. <ventBox1>
  102. <template #title>
  103. <div>空压机{{ groupNum }}</div>
  104. </template>
  105. <template #container>
  106. <div class="monitor-box">
  107. <div class="monitor-item">
  108. <div class="state-item" v-for="(preFan, index) in preFanMonitor" :key="index">
  109. <div class="state-title">{{
  110. preFan.title + (preFan.unit !== 'signal' && preFan.unit !== 'warning' ? `(${preFan.unit})` : '')
  111. }}</div>
  112. <div v-if="preFan.unit !== 'signal' && preFan.unit !== 'warning'" class="value">{{
  113. monitorData[preFan.code + groupNum] >= 0 ? formatNum(Number(monitorData[preFan.code + groupNum])) : '-'
  114. }}</div>
  115. <div
  116. v-else
  117. :class="{
  118. 'signal-round': true,
  119. 'signal-round-warning': monitorData[preFan.code + groupNum] == '1' && preFan.unit == 'warning',
  120. 'signal-round-run': monitorData[preFan.code + groupNum] == '1' && preFan.unit == 'signal',
  121. 'signal-round-gry': monitorData[preFan.code + groupNum] != '1',
  122. }"
  123. ></div>
  124. </div>
  125. </div>
  126. </div>
  127. </template>
  128. </ventBox1>
  129. </div>
  130. </div>
  131. <!-- 右边控制状态 -->
  132. <div class="lr-box right-box">
  133. <!-- <ventBox1 v-if="deviceType == 'nitrogen_52507'">
  134. <template #title>
  135. <div>注氮机监测</div>
  136. </template>
  137. <template #container>
  138. <div class="input-item" v-for="(preFan, index) in nitrogenMonitor" :key="index">
  139. <div class="title">{{ preFan.title }}</div>
  140. <div v-if="preFan.unit !== 'signal' && preFan.unit !== 'warning'" class="value">{{
  141. monitorData[preFan.code] >= 0 ? formatNum(Number(monitorData[preFan.code])) : '-'
  142. }}</div>
  143. <div
  144. v-else
  145. :class="{
  146. 'signal-round': true,
  147. 'signal-round-warning': monitorData[preFan.code] == '1' && preFan.unit == 'warning',
  148. 'signal-round-run': monitorData[preFan.code] == '1' && preFan.unit == 'signal',
  149. 'signal-round-gry': monitorData[preFan.code] != '1',
  150. }"
  151. ></div>
  152. <div class="unit">{{ preFan.unit !== 'signal' && preFan.unit !== 'warning' ? `(${preFan.unit})` : '' }}</div>
  153. </div>
  154. </template>
  155. </ventBox1> -->
  156. <ventBox1 class="vent-margin-t-10">
  157. <template #title>
  158. <div>设备实时监测曲线</div>
  159. </template>
  160. <template #container>
  161. <BarAndLine
  162. v-if="chartsColumns.length > 0"
  163. xAxisPropType="readTime"
  164. :dataSource="echartData"
  165. height="320px"
  166. :chartsColumns="chartsColumns"
  167. :option="echatsOption"
  168. />
  169. </template>
  170. </ventBox1>
  171. </div>
  172. </div>
  173. <div ref="playerRef" class="player-box" style=""> </div>
  174. </div>
  175. </div>
  176. </template>
  177. <script lang="ts" setup name="nitrogenHome">
  178. import { onMounted, onUnmounted, ref, watch, reactive, defineProps, nextTick, inject, unref } from 'vue';
  179. import ventBox1 from '/@/components/vent/ventBox1.vue';
  180. import fourBorderBg from '../../../comment/components/fourBorderBg.vue';
  181. import { mountedThree, destroy, setModelType } from '../nitrogen.threejs';
  182. import { getDevice } from '../nitrogen.api';
  183. import BarAndLine from '/@/components/chart/BarAndLine.vue';
  184. import { deviceControlApi } from '/@/api/vent/index';
  185. // import { preMonitorListData, preFanMonitor, nitrogenMonitor } from '../nitrogen.data.dltj';
  186. import { formatNum } from '/@/utils/ventutil';
  187. import { useCamera } from '/@/hooks/system/useCamera';
  188. import { message } from 'ant-design-vue';
  189. import lodash from 'lodash';
  190. import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
  191. const globalConfig = inject('globalConfig');
  192. const props = defineProps({
  193. deviceId: {
  194. type: String,
  195. require: true,
  196. },
  197. modalType: {
  198. type: String,
  199. require: true,
  200. },
  201. });
  202. const playerRef = ref();
  203. const refresh = ref(false);
  204. const modalTitle = ref(''); // 模态框标题显示内容,根据设备操作类型决定
  205. const modalType = ref(''); // 模态框内容显示类型,设备操作类型
  206. const modalIsShow = ref<boolean>(false); // 是否显示模态框
  207. const loading = ref(true);
  208. let kzParam = reactive<any>({
  209. data: {},
  210. isFw: null,
  211. });
  212. // const kyjs = ['1号空压机', '1号空压机', '1号空压机', '1号空压机'];
  213. const flvURL1 = () => {
  214. // return `https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv`;
  215. return '';
  216. };
  217. const colors = ['#FDB146', '#EE6666', '#9BCB75', '#03C2EC', '#DA3914', '#9C83D9'];
  218. const echatsOption = {
  219. grid: {
  220. top: '35%',
  221. left: '15%',
  222. right: '20px',
  223. bottom: '8%',
  224. // containLabel: true
  225. },
  226. toolbox: {
  227. feature: {},
  228. },
  229. };
  230. const preMonitorListData = ref<any[]>([]);
  231. const preFanMonitor = ref<any[]>([]);
  232. const nitrogenMonitor = ref<any[]>([]);
  233. const deviceType = ref('');
  234. const monitorNetStatus = ref(0);
  235. const monitorDataGroupNum = ref(2);
  236. let airCompressorState = reactive<any[]>([]);
  237. // const chartsColumns = ref([
  238. // {
  239. // legend: '瞬时流量',
  240. // seriesName: '(m³/h)',
  241. // ymax: 2000,
  242. // yname: 'm³/h',
  243. // linetype: 'line',
  244. // yaxispos: 'left',
  245. // color: '#FDB146',
  246. // sort: 1,
  247. // xRotate: 0,
  248. // dataIndex: 'InputFlux',
  249. // },
  250. // ]);
  251. const chartsColumns = ref(getTableHeaderColumns('sys_nitrogen_chart'));
  252. const { getCamera, removeCamera } = useCamera();
  253. const monitorData = ref({});
  254. //图表数据
  255. let echartData = ref<any>([]);
  256. // https获取监测数据
  257. let timer: null | NodeJS.Timeout = null;
  258. async function getMonitor(flag?) {
  259. if (Object.prototype.toString.call(timer) === '[object Null]') {
  260. return new Promise(async (resolve) => {
  261. timer = await setTimeout(
  262. async () => {
  263. if (props.deviceId) {
  264. await getDataSource(props.deviceId);
  265. }
  266. if (timer) {
  267. timer = null;
  268. }
  269. resolve(null);
  270. await getMonitor();
  271. },
  272. flag ? 0 : 3000
  273. );
  274. });
  275. }
  276. }
  277. async function getDataSource(systemID) {
  278. const res = await getDevice({ devicetype: 'sys', systemID, type: 'all' });
  279. if (res) {
  280. const result = res;
  281. debugger;
  282. // const result = {
  283. // cmd: 'monitordata',
  284. // msgTxt: [
  285. // {
  286. // datalist: [
  287. // {
  288. // msgType: null,
  289. // deviceID: '1818548876779245569',
  290. // strname: '52507注氮机-2',
  291. // strinstallpos: '52507注氮机-2',
  292. // fsectarea: 'null',
  293. // stationname: '52507注氮机-2',
  294. // stationtype: 'redis',
  295. // deviceType: 'nitrogen_525072',
  296. // typeName: '52507注氮机2',
  297. // netStatus: 1,
  298. // warnFlag: 0,
  299. // warnLevel: 0,
  300. // warnLevel_str: '正常',
  301. // syswarnLevel: null,
  302. // syswarnLevel_str: null,
  303. // syswarnLevel_des: null,
  304. // warnTime: null,
  305. // readTime: '2024-08-04 17:59:25',
  306. // warnDes: '',
  307. // frontGateOpenCtrl: null,
  308. // rearGateOpenCtrl: null,
  309. // readData: {
  310. // FluxTotal12: '0.0',
  311. // RunTime42: '131072000',
  312. // NitrogenPurity2: '26',
  313. // ExhaustTemp2: '25.0',
  314. // Status2: '0',
  315. // RunTime2: '0',
  316. // sign: '0',
  317. // OilGasBarrel_SeparatorFault2: '0',
  318. // TotalFailureSignal2: '0',
  319. // InputFlux2: '5',
  320. // PhaseFailureFault12: '0',
  321. // RunTime22: '3080192',
  322. // LowVoltageFault2: '0',
  323. // SysVoltage2: '1158',
  324. // Fan_Current2: '0',
  325. // CtrlMode2: '1',
  326. // ExhaustPreHighFault2: '0',
  327. // ShortCutFaul2: '0',
  328. // OilGasBarrel_OverTempAlarm2: '0',
  329. // CloseFail2: '0',
  330. // OilGasBarrel_FilterBlockageFault2: '0',
  331. // HMIStartStop2: '0',
  332. // OilGasBarrel_OverTempAlarm12: '0',
  333. // OverVoltageFault2: '0',
  334. // OilGasBarrel_HighPressureFault2: '0',
  335. // Fan_OverloadFault2: '0',
  336. // OilPressureLowFault2: '0',
  337. // PhaseSequenceFault2: '0',
  338. // PhaseFailureFault2: '0',
  339. // RunTime32: '35323904',
  340. // MainMotor_OverTempFault2: '0',
  341. // FluxTotal22: '0.0',
  342. // PowerFault2: '0',
  343. // LoadorUnload2: '0',
  344. // PreMembraneTemperature2: '-19',
  345. // PhaseSequenceFault12: '0',
  346. // RunTime12: '393216',
  347. // ExhaustTemp12: '0',
  348. // TotalFailureSignal12: '0',
  349. // UnbalanceFault2: '0',
  350. // ExhaustPre2: '0',
  351. // MainMotor_OverloadFault2: '0',
  352. // NoWaterFault2: '0',
  353. // LoadTime2: '539',
  354. // MainMotor_Current2: '0',
  355. // isRun: '-2',
  356. // LeakageLock2: '0',
  357. // OpenFail2: '0',
  358. // },
  359. // readDataDes: null,
  360. // summaryHour: [],
  361. // summaryDay: [],
  362. // history: [],
  363. // dayhistory: [],
  364. // totalInfo: null,
  365. // sign: null,
  366. // cameras: [],
  367. // links: [],
  368. // other1: null,
  369. // other2: null,
  370. // other3: null,
  371. // remarkInfo: null,
  372. // linkInfo: null,
  373. // addrIndex: null,
  374. // warnLogNotOkCount: 0,
  375. // },
  376. // ],
  377. // avginfo: {
  378. // warnFlag: {
  379. // value: 0,
  380. // },
  381. // },
  382. // typeName: '52507注氮机2',
  383. // type: 'nitrogen_525072',
  384. // },
  385. // {
  386. // datalist: [
  387. // {
  388. // msgType: null,
  389. // deviceID: '1818546650996330498',
  390. // strname: '52507注氮机-1',
  391. // strinstallpos: '52507注氮机-1',
  392. // fsectarea: 'null',
  393. // stationname: '52507注氮机-1',
  394. // stationtype: 'redis',
  395. // deviceType: 'nitrogen_525071',
  396. // typeName: '52507注氮机1',
  397. // netStatus: 1,
  398. // warnFlag: 0,
  399. // warnLevel: 0,
  400. // warnLevel_str: '正常',
  401. // syswarnLevel: null,
  402. // syswarnLevel_str: null,
  403. // syswarnLevel_des: null,
  404. // warnTime: null,
  405. // readTime: '2024-08-04 17:59:25',
  406. // warnDes: '',
  407. // frontGateOpenCtrl: null,
  408. // rearGateOpenCtrl: null,
  409. // readData: {
  410. // RunTime41: '131072000',
  411. // NitrogenPurity1: '12',
  412. // ExhaustTemp1: '82.0',
  413. // RunTime21: '786432',
  414. // RunTime1: '1',
  415. // sign: '0',
  416. // OilGasBarrel_SeparatorFault1: '0',
  417. // InputFlux1: '13',
  418. // PhaseFailureFault11: '0',
  419. // LowVoltageFault1: '0',
  420. // SysVoltage1: '1149',
  421. // TotalFailureSignal1: '0',
  422. // Fan_Current1: '0',
  423. // ExhaustPreHighFault1: '0',
  424. // ShortCutFaul1: '0',
  425. // OilGasBarrel_OverTempAlarm1: '0',
  426. // CloseFail1: '0',
  427. // OilGasBarrel_FilterBlockageFault1: '0',
  428. // OilGasBarrel_OverTempAlarm11: '0',
  429. // HMIStartStop1: '0',
  430. // CtrlMode1: '1',
  431. // Fan_OverloadFault1: '0',
  432. // OilPressureLowFault1: '0',
  433. // OverVoltageFault1: '0',
  434. // OilGasBarrel_HighPressureFault1: '0',
  435. // PhaseFailureFault1: '0',
  436. // RunTime31: '70516736',
  437. // FluxTotal21: '0.0',
  438. // FluxTotal1: '0.01',
  439. // MainMotor_OverTempFault1: '0',
  440. // PhaseSequenceFault1: '0',
  441. // PowerFault1: '0',
  442. // LoadorUnload1: '0',
  443. // RunTime11: '3342336',
  444. // PhaseSequenceFault11: '0',
  445. // PreMembraneTemperature1: '25',
  446. // TotalFailureSignal11: '0',
  447. // UnbalanceFault1: '0',
  448. // ExhaustTemp11: '0',
  449. // ExhaustPre1: '89',
  450. // MainMotor_OverloadFault1: '0',
  451. // NoWaterFault1: '0',
  452. // Status1: '0',
  453. // LoadTime1: '1086',
  454. // isRun: '-2',
  455. // LeakageLock1: '0',
  456. // MainMotor_Current1: '95',
  457. // OpenFail1: '0',
  458. // },
  459. // readDataDes: null,
  460. // summaryHour: [],
  461. // summaryDay: [],
  462. // history: [],
  463. // dayhistory: [],
  464. // totalInfo: null,
  465. // sign: null,
  466. // cameras: [],
  467. // links: [],
  468. // other1: null,
  469. // other2: null,
  470. // other3: null,
  471. // remarkInfo: null,
  472. // linkInfo: null,
  473. // addrIndex: null,
  474. // warnLogNotOkCount: 0,
  475. // },
  476. // ],
  477. // avginfo: {
  478. // warnFlag: {
  479. // value: 0,
  480. // },
  481. // },
  482. // typeName: '52507注氮机1',
  483. // type: 'nitrogen_525071',
  484. // },
  485. // {
  486. // subtype: 'sys_nitrogen',
  487. // datalist: [
  488. // {
  489. // msgType: '2',
  490. // deviceID: '1818821502634352642',
  491. // strname: '52507注氮系统',
  492. // strinstallpos: '52507注氮系统',
  493. // fsectarea: 'null',
  494. // stationname: null,
  495. // stationtype: null,
  496. // deviceType: 'sys_nitrogen',
  497. // typeName: '注氮系统',
  498. // netStatus: null,
  499. // warnFlag: 0,
  500. // warnLevel: null,
  501. // warnLevel_str: null,
  502. // syswarnLevel: 0,
  503. // syswarnLevel_str: null,
  504. // syswarnLevel_des: null,
  505. // warnTime: null,
  506. // readTime: '2024-08-01 09:56:28',
  507. // warnDes: '',
  508. // frontGateOpenCtrl: null,
  509. // rearGateOpenCtrl: null,
  510. // readData: {
  511. // sign: '0',
  512. // isRun: '-2',
  513. // },
  514. // readDataDes: null,
  515. // summaryHour: [],
  516. // summaryDay: [],
  517. // history: null,
  518. // dayhistory: [],
  519. // totalInfo: null,
  520. // sign: null,
  521. // cameras: [],
  522. // links: [],
  523. // other1: null,
  524. // other2: null,
  525. // other3: null,
  526. // remarkInfo: null,
  527. // linkInfo: null,
  528. // addrIndex: null,
  529. // warnLogNotOkCount: 0,
  530. // },
  531. // ],
  532. // typeName: '综合监测系统',
  533. // type: 'sys',
  534. // },
  535. // ],
  536. // };
  537. if (!result || result.msgTxt.length < 1) return;
  538. let dataSoreDatas = {};
  539. let netStatus = 0;
  540. result.msgTxt.forEach((item) => {
  541. if (item.type && item.type.startsWith('nitrogen')) {
  542. airCompressorState.length = 0;
  543. if (item.type.startsWith('nitrogen_52507')) {
  544. if (deviceType.value !== 'nitrogen_52507') deviceType.value = 'nitrogen_52507';
  545. dataSoreDatas = Object.assign(dataSoreDatas, item['datalist'][0], item['datalist'][0]['readData']);
  546. if (item['datalist'][0]['netStatus']) {
  547. netStatus = 1;
  548. }
  549. } else {
  550. deviceType.value = '';
  551. monitorData.value = Object.assign(item['datalist'][0], item['datalist'][0]['readData']);
  552. if (monitorData.value['netStatus'] == 1) {
  553. netStatus = 1;
  554. }
  555. airCompressorState.push({
  556. id: monitorData.value['deviceID'],
  557. deviceType: monitorData.value['deviceType'],
  558. HMIStart: monitorData.value['HMIStart'],
  559. HMIStop: monitorData.value['HMIStop'],
  560. });
  561. }
  562. }
  563. });
  564. if (JSON.stringify(dataSoreDatas) !== '{}') {
  565. monitorData.value = dataSoreDatas;
  566. }
  567. monitorNetStatus.value = netStatus;
  568. const dataArr = lodash.cloneDeep(echartData.value);
  569. const airCompressor = { readTime: monitorData.value['readTime'].substring(11) };
  570. if (JSON.stringify(dataSoreDatas) === '{}') {
  571. airCompressor[`FluxTotal`] = monitorData.value['FluxTotal'] || 0;
  572. }
  573. // airCompressor[`InputFlux`] = Number(monitorData.value['InputFlux1']) + Number(monitorData.value['InputFlux2']) || null;
  574. // if (!airCompressor[`InputFlux`]) {
  575. // airCompressor[`InputFlux`] = monitorData.value['InputFlux'];
  576. // }
  577. airCompressor[`InputFlux`] =
  578. monitorData.value['InputFlux'] || Number(monitorData.value['InputFlux1']) + Number(monitorData.value['InputFlux2']);
  579. monitorData.value['RunTime31'] = (Number(monitorData.value['RunTime31']) / 24).toFixed(0);
  580. monitorData.value['RunTime41'] = (Number(monitorData.value['RunTime41']) / 24).toFixed(0);
  581. monitorData.value['RunTime32'] = (Number(monitorData.value['RunTime32']) / 24).toFixed(0);
  582. monitorData.value['RunTime42'] = (Number(monitorData.value['RunTime42']) / 24).toFixed(0);
  583. monitorData.value['FluxTotal'] = airCompressor[`InputFlux`];
  584. //图表数据
  585. if (dataArr.length <= 5) {
  586. dataArr.push(airCompressor);
  587. } else {
  588. dataArr.shift();
  589. dataArr.push(airCompressor);
  590. }
  591. echartData.value = dataArr;
  592. refresh.value = true;
  593. nextTick(() => {
  594. refresh.value = false;
  595. });
  596. }
  597. }
  598. function handlerDevice(data, bol) {
  599. kzParam.data = data;
  600. kzParam.isFw = bol;
  601. if (bol) {
  602. modalTitle.value = '一键复位';
  603. modalType.value = '1';
  604. modalIsShow.value = true;
  605. kzParam.data.HMIReset = !data.HMIReset;
  606. } else {
  607. modalTitle.value = '一键启停';
  608. modalType.value = '2';
  609. modalIsShow.value = true;
  610. kzParam.data.HMIStartStop = !data.HMIStartStop;
  611. }
  612. }
  613. function handleOK(passWord, handlerState) {
  614. console.log(kzParam, 'kz----------');
  615. // if (passWord !== '123456') {
  616. // message.warning('密码不正确,请重新输入');
  617. // return;
  618. // }
  619. let data = {};
  620. if (kzParam.isFw) {
  621. data = {
  622. deviceid: kzParam.data.id,
  623. devicetype: kzParam.data.deviceType,
  624. password: passWord,
  625. HMIReset: kzParam.data.HMIReset,
  626. };
  627. } else {
  628. data = {
  629. deviceid: kzParam.data.id,
  630. password: passWord,
  631. devicetype: kzParam.data.deviceType,
  632. HMIStartStop: kzParam.data.HMIStartStop,
  633. };
  634. }
  635. deviceControlApi(data).then((res) => {
  636. // 模拟时开启
  637. if (res.success) {
  638. modalIsShow.value = false;
  639. getDataSource(props.deviceId);
  640. if (globalConfig.History_Type == 'remote') {
  641. message.success('指令已下发至生产管控平台成功!');
  642. } else {
  643. message.success('指令已下发成功!');
  644. }
  645. }
  646. });
  647. }
  648. function handleCancel() {
  649. modalIsShow.value = false;
  650. modalTitle.value = '';
  651. modalType.value = '';
  652. }
  653. watch([monitorDataGroupNum, loading], ([newMonitorDataGroupNum, newLoading]) => {
  654. nextTick(() => {
  655. if (newMonitorDataGroupNum && !newLoading) {
  656. setModelType(props.modalType, newMonitorDataGroupNum);
  657. }
  658. });
  659. });
  660. // 多套系统,不同点表
  661. watch(
  662. () => unref(deviceType),
  663. async (type: string) => {
  664. if (type == 'nitrogen_52507') {
  665. const { preMonitorList, preFanMonitorData, nitrogenMonitorData } = await import('../nitrogen.data.dlt1');
  666. preMonitorListData.value = preMonitorList;
  667. preFanMonitor.value = preFanMonitorData;
  668. nitrogenMonitor.value = nitrogenMonitorData;
  669. } else {
  670. const { preMonitorList, preFanMonitorData, nitrogenMonitorData } = await import('../nitrogen.data.dltj');
  671. preMonitorListData.value = preMonitorList;
  672. preFanMonitor.value = preFanMonitorData;
  673. nitrogenMonitor.value = nitrogenMonitorData;
  674. }
  675. },
  676. { immediate: true }
  677. );
  678. onMounted(async () => {
  679. await getMonitor(true);
  680. await mountedThree().then(() => {
  681. loading.value = false;
  682. });
  683. await getCamera(props.deviceId, playerRef.value);
  684. });
  685. onUnmounted(() => {
  686. destroy();
  687. if (timer) {
  688. clearTimeout(timer);
  689. timer = undefined;
  690. }
  691. removeCamera();
  692. });
  693. </script>
  694. <style lang="less" scoped>
  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>