nitrogenHome_bd.vue 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471
  1. <template>
  2. <div>{{ Math.random() }}</div>
  3. <div id="nitrogen3D" style="width: 100%; height: 100%; position: absolute; overflow: hidden"></div>
  4. <div
  5. id="nitrogenCss3D"
  6. class="threejs-Object-CSS"
  7. style="width: 100%; height: 100%; position: absolute; pointer-events: none; overflow: hidden; z-index: 2; top: 0px; left: 0px"
  8. >
  9. <a-spin :spinning="loading" />
  10. <template>
  11. <div v-for="groupNum in 1" :key="groupNum" class="modal-monitor">
  12. <fourBorderBg :class="`kyj${groupNum}`" :id="`nitrogenMonitor${groupNum}`">
  13. <div class="title">{{ monitorData[0]['strname'] }} </div>
  14. <div class="monitor-item">
  15. <span class="monitor-title">实时流量:</span>
  16. <span class="monitor-val" v-if="!refresh"
  17. ><span class="val">{{ monitorData[0]['flow'] ? monitorData[0]['flow'] : '-' }}</span> <span class="unit">m³/min</span></span
  18. >
  19. </div>
  20. <div class="monitor-item">
  21. <span class="monitor-title">总流量:</span>
  22. <span class="monitor-val" v-if="!refresh"
  23. ><span class="val">{{ monitorData[0]['total_flow'] ? monitorData[0]['total_flow'] : '-' }}</span> <span class="unit">m³</span></span
  24. >
  25. </div>
  26. <div class="monitor-item">
  27. <span class="monitor-title">氧浓度:</span>
  28. <span class="monitor-val" v-if="!refresh"
  29. ><span class="val">{{ monitorData[0]['oxygen_concentration'] ? monitorData[0]['oxygen_concentration'] : '-' }}</span>
  30. <span class="unit">%</span></span
  31. >
  32. </div>
  33. </fourBorderBg>
  34. </div>
  35. </template>
  36. </div>
  37. <div class="nitrogen-home">
  38. <div class="nitrogen-container">
  39. <div class="top-box">
  40. <!-- 中间区域控制按钮 -->
  41. <div class="center-item-box">
  42. <div class="top-left">
  43. <div class="button-box" @click="handlerDevice(airCompressorState[0], '主机启动')">主机启动</div>
  44. <div class="button-box" @click="handlerDevice(airCompressorState[0], '主机停止')">主机停止</div>
  45. <div class="button-box" @click="handlerDevice(airCompressorState[0], '备机启动')">备机启动</div>
  46. <div class="button-box" @click="handlerDevice(airCompressorState[0], '备机停止')">备机停止</div>
  47. </div>
  48. <div class="top-center">
  49. <div class="top-c-label">通信状态:</div>
  50. <div class="top-c-val">{{ monitorData[0]['netStatus'] == 1 ? '连接' : monitorData[0]['netStatus'] == 0 ? '断开' : '未知' }}</div>
  51. </div>
  52. <div class="top-right">
  53. <div class="control-type">
  54. <div class="control-title">运行状态:</div>
  55. <a-radio-group v-model:value="monitorData[0]['overhaul_run']">
  56. <a-radio :value="`1`" disabled>检修</a-radio>
  57. <a-radio :value="`0`" disabled>运行</a-radio>
  58. </a-radio-group>
  59. </div>
  60. <div class="control-type">
  61. <div class="control-title">控制模式:</div>
  62. <a-radio-group v-model:value="monitorData[0]['remote_local']">
  63. <a-radio :value="`1`" disabled>就地</a-radio>
  64. <a-radio :value="`0`" disabled>远程</a-radio>
  65. </a-radio-group>
  66. </div>
  67. </div>
  68. </div>
  69. <!-- 底部区域故障数据 -->
  70. <div class="footer-item-box">
  71. <div class="device-detail">
  72. <div class="device-title">&nbsp</div>
  73. <div class="device-val">主机进气蝶阀</div>
  74. <div class="device-val">主机出气蝶阀</div>
  75. <div class="device-val">备机进气蝶阀</div>
  76. <div class="device-val">备机出气蝶阀</div>
  77. <!-- <div class="device-val">故障</div> -->
  78. </div>
  79. <div v-for="(device, key) in deviceMonitorList" class="device-detail" :key="key">
  80. <div class="device-title">{{ device.title }}</div>
  81. <div v-for="(detailItem, index) in device.dataList" :key="detailItem.code" class="device-val">
  82. <span :style="{ color: monitorData[0][detailItem.code] != '1' ? '#BFBFBF' : '#10BC79' }">{{
  83. monitorData[0][detailItem.code] == '0' ? '正常' : monitorData[0][detailItem.code] == '1' ? '故障' : '-'
  84. }}</span>
  85. <!-- <span v-if="index == 1"
  86. :style="{ color: monitorData[0][detailItem.code] != '1' ? '#BFBFBF' : '#10BC79' }">{{
  87. monitorData[0][detailItem.code] == '0' ? '正常' : monitorData[0][detailItem.code] == '1' ? '故障' :
  88. '-'
  89. }}</span> -->
  90. </div>
  91. </div>
  92. </div>
  93. <!-- 左边监测数据 -->
  94. <div class="lr-box left-box">
  95. <div class="item item-l" v-for="(groupNum, ind) in monitorDataGroupNum" :key="groupNum">
  96. <ventBox1>
  97. <template #title>
  98. <!-- <div>{{ monitorData[groupNum - 1]['strname'] }}</div> -->
  99. <div v-if="ind == 0">{{ `${monitorData[0]['strname']}-主` }}</div>
  100. <div v-else>{{ `${monitorData[0]['strname']}-备` }}</div>
  101. </template>
  102. <template #container>
  103. <div class="monitor-box">
  104. <div class="parameter-title group-parameter-title">
  105. <SvgIcon class="icon" size="38" name="device-group-paramer" /><span>进气蝶阀参数</span>
  106. </div>
  107. <div v-if="ind == 0">
  108. <div class="state-item" v-for="(data, index) in groupParameterData" :key="index">
  109. <div class="item-col">
  110. <span class="state-title1">{{ Object.values(data)[0] }} :</span>
  111. <span class="state-val1" v-if="index == 0">{{
  112. (monitorData.length > 0 && monitorData[0][Object.keys(data)[0]]) >= 0
  113. ? monitorData[0][Object.keys(data)[0]]
  114. ? parseFloat(monitorData[0][Object.keys(data)[0]]).toFixed(2)
  115. : '-'
  116. : '-'
  117. }}</span>
  118. <span class="state-val" v-else>
  119. <span
  120. v-if="monitorData[0][Object.keys(data)[0]] == '0'"
  121. style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: blue"
  122. ></span>
  123. <span
  124. v-else-if="monitorData[0][Object.keys(data)[0]] == '1'"
  125. style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: greenyellow"
  126. ></span>
  127. <span v-else style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: #ccc"></span>
  128. </span>
  129. </div>
  130. <div class="item-col" v-if="Object.keys(data)[1]">
  131. <span class="state-title1">{{ Object.values(data)[1] }} :</span>
  132. <span class="state-val1">
  133. <span
  134. v-if="monitorData[0][Object.keys(data)[1]] == '0'"
  135. style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: blue"
  136. ></span>
  137. <span
  138. v-else-if="monitorData[0][Object.keys(data)[1]] == '1'"
  139. style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: greenyellow"
  140. ></span>
  141. <span v-else style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: #ccc"></span>
  142. </span>
  143. </div>
  144. </div>
  145. </div>
  146. <div v-else>
  147. <div class="state-item" v-for="(data, index) in groupParameterData1" :key="index">
  148. <div class="item-col">
  149. <span class="state-title1">{{ Object.values(data)[0] }} :</span>
  150. <span class="state-val1" v-if="index == 0">{{
  151. (monitorData.length > 0 && monitorData[0][Object.keys(data)[0]]) >= 0
  152. ? monitorData[0][Object.keys(data)[0]]
  153. ? parseFloat(monitorData[0][Object.keys(data)[0]]).toFixed(2)
  154. : '-'
  155. : '-'
  156. }}</span>
  157. <span class="state-val" v-else>
  158. <span
  159. v-if="monitorData[0][Object.keys(data)[0]] == '0'"
  160. style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: blue"
  161. ></span>
  162. <span
  163. v-else-if="monitorData[0][Object.keys(data)[0]] == '1'"
  164. style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: greenyellow"
  165. ></span>
  166. <span v-else style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: #ccc"></span>
  167. </span>
  168. </div>
  169. <div class="item-col" v-if="Object.keys(data)[1]">
  170. <span class="state-title1">{{ Object.values(data)[1] }} :</span>
  171. <span class="state-val1">
  172. <span
  173. v-if="monitorData[0][Object.keys(data)[1]] == '0'"
  174. style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: blue"
  175. ></span>
  176. <span
  177. v-else-if="monitorData[0][Object.keys(data)[1]] == '1'"
  178. style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: greenyellow"
  179. ></span>
  180. <span v-else style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: #ccc"></span>
  181. </span>
  182. </div>
  183. </div>
  184. </div>
  185. </div>
  186. <div class="monitor-box monitor-box1">
  187. <div class="parameter-title device-parameter-title">
  188. <SvgIcon class="icon" size="32" name="device-paramer" /><span>出气蝶阀参数</span>
  189. </div>
  190. <div class="state-box">
  191. <div v-if="ind == 0">
  192. <div class="state-item" v-for="(data, index) in deviceParameterData" :key="index">
  193. <div class="item-col">
  194. <span class="state-title1">{{ Object.values(data)[0] }} :</span>
  195. <span class="state-val1" v-if="index == 0">{{
  196. (monitorData.length > 0 && monitorData[0][Object.keys(data)[0]]) >= 0
  197. ? monitorData[0][Object.keys(data)[0]]
  198. ? parseFloat(monitorData[0][Object.keys(data)[0]]).toFixed(2)
  199. : '-'
  200. : '-'
  201. }}</span>
  202. <span class="state-val" v-else>
  203. <span
  204. v-if="monitorData[0][Object.keys(data)[0]] == '0'"
  205. style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: blue"
  206. ></span>
  207. <span
  208. v-else-if="monitorData[0][Object.keys(data)[0]] == '1'"
  209. style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: greenyellow"
  210. ></span>
  211. <span v-else style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: #ccc"></span>
  212. </span>
  213. </div>
  214. <div class="item-col" v-if="Object.keys(data)[1]">
  215. <span class="state-title1">{{ Object.values(data)[1] }} :</span>
  216. <span class="state-val1">
  217. <span
  218. v-if="monitorData[0][Object.keys(data)[1]] == '0'"
  219. style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: blue"
  220. ></span>
  221. <span
  222. v-else-if="monitorData[0][Object.keys(data)[1]] == '1'"
  223. style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: greenyellow"
  224. ></span>
  225. <span v-else style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: #ccc"></span>
  226. </span>
  227. </div>
  228. </div>
  229. </div>
  230. <div v-else>
  231. <div class="state-item" v-for="(data, index) in deviceParameterData1" :key="index">
  232. <div class="item-col">
  233. <span class="state-title1">{{ Object.values(data)[0] }} :</span>
  234. <span class="state-val1" v-if="index == 0">{{
  235. (monitorData.length > 0 && monitorData[0][Object.keys(data)[0]]) >= 0
  236. ? monitorData[0][Object.keys(data)[0]]
  237. ? parseFloat(monitorData[0][Object.keys(data)[0]]).toFixed(2)
  238. : '-'
  239. : '-'
  240. }}</span>
  241. <span class="state-val" v-else>
  242. <span
  243. v-if="monitorData[0][Object.keys(data)[0]] == '0'"
  244. style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: blue"
  245. ></span>
  246. <span
  247. v-else-if="monitorData[0][Object.keys(data)[0]] == '1'"
  248. style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: greenyellow"
  249. ></span>
  250. <span v-else style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: #ccc"></span>
  251. </span>
  252. </div>
  253. <div class="item-col" v-if="Object.keys(data)[1]">
  254. <span class="state-title1">{{ Object.values(data)[1] }} :</span>
  255. <span class="state-val1">
  256. <span
  257. v-if="monitorData[0][Object.keys(data)[1]] == '0'"
  258. style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: blue"
  259. ></span>
  260. <span
  261. v-else-if="monitorData[0][Object.keys(data)[1]] == '1'"
  262. style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: greenyellow"
  263. ></span>
  264. <span v-else style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: #ccc"></span>
  265. </span>
  266. </div>
  267. </div>
  268. </div>
  269. </div>
  270. </div>
  271. </template>
  272. </ventBox1>
  273. </div>
  274. </div>
  275. <!-- 右边控制状态 -->
  276. <div class="lr-box right-box">
  277. <ventBox1 class="vent-margin-t-10">
  278. <template #title>
  279. <div>设备实时监测曲线</div>
  280. </template>
  281. <template #container>
  282. <BarAndLine
  283. v-if="chartsColumns.length > 0"
  284. xAxisPropType="readTime"
  285. :dataSource="echartData"
  286. height="240px"
  287. :chartsColumns="chartsColumns"
  288. :option="echatsOption"
  289. />
  290. </template>
  291. </ventBox1>
  292. <div v-if="renderPlayer" ref="playerRef" class="player-box vent-margin-t-10"></div>
  293. </div>
  294. </div>
  295. </div>
  296. </div>
  297. <HandleModal :modal-is-show="modalIsShow" :modal-title="modalTitle" :modal-type="modalType" @handle-ok="handleOK" @handle-cancel="handleCancel" />
  298. </template>
  299. <script lang="ts" setup name="nitrogenHome">
  300. import { onMounted, onUnmounted, ref, watch, reactive, defineProps, nextTick, inject, onBeforeUnmount } from 'vue';
  301. import ventBox1 from '/@/components/vent/ventBox1.vue';
  302. import fourBorderBg from '../../../comment/components/fourBorderBg.vue';
  303. import { mountedThree, destroy, setModelType } from '../nitrogen.threejs';
  304. import { getDevice } from '../nitrogen.api';
  305. import { SvgIcon } from '/@/components/Icon';
  306. import BarAndLine from '/@/components/chart/BarAndLine.vue';
  307. import HandleModal from './modal.vue';
  308. import { deviceControlApi } from '/@/api/vent/index';
  309. import { message } from 'ant-design-vue';
  310. import { useCamera } from '/@/hooks/system/useCamera';
  311. import lodash from 'lodash';
  312. import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
  313. const globalConfig = inject('globalConfig');
  314. const props = defineProps({
  315. deviceId: {
  316. type: String,
  317. require: true,
  318. },
  319. modalType: {
  320. type: String,
  321. require: true,
  322. },
  323. });
  324. const { getCamera, removeCamera } = useCamera();
  325. const refresh = ref(false);
  326. const modalTitle = ref(''); // 模态框标题显示内容,根据设备操作类型决定
  327. const modalType = ref(''); // 模态框内容显示类型,设备操作类型
  328. const modalIsShow = ref<boolean>(false); // 是否显示模态框
  329. const renderPlayer = ref(true);
  330. const loading = ref(true);
  331. let kzParam = reactive<any>({
  332. data: {},
  333. isFw: '',
  334. });
  335. const playerRef = ref();
  336. const colors = ['#FDB146', '#EE6666', '#9BCB75', '#03C2EC', '#DA3914', '#9C83D9'];
  337. const echatsOption = {
  338. grid: {
  339. top: '20%',
  340. left: '0px',
  341. right: '10px',
  342. bottom: '3%',
  343. containLabel: true,
  344. },
  345. toolbox: {
  346. feature: {},
  347. },
  348. };
  349. const monitorDataGroupNum = ref(0);
  350. let airCompressorState = reactive<any[]>([]);
  351. //主机进气
  352. const groupParameterData = [
  353. {
  354. m_in_open: '开度',
  355. m_bv_in_remote: '远控',
  356. },
  357. {
  358. m_bv_in_open: '开到位',
  359. m_bv_in_close: '关到位',
  360. },
  361. ];
  362. //备机进气
  363. const groupParameterData1 = [
  364. {
  365. b_in_open: '开度',
  366. b_bv_in_remote: '远控',
  367. },
  368. {
  369. b_bv_in_open: '开到位',
  370. b_bv_in_close: '关到位',
  371. },
  372. ];
  373. //主机出气
  374. const deviceParameterData = [
  375. {
  376. m_out_open: '开度',
  377. m_bv_out_remote: '远控',
  378. },
  379. {
  380. m_bv_out_open: '开到位',
  381. m_bv_out_close: '关到位',
  382. },
  383. ];
  384. //备机出气
  385. const deviceParameterData1 = [
  386. {
  387. b_out_open: '开度',
  388. b_bv_out_remote: '远控',
  389. },
  390. {
  391. b_bv_out_open: '开到位',
  392. b_bv_out_close: '关到位',
  393. },
  394. ];
  395. const deviceMonitorList = reactive([
  396. {
  397. title: '负载短路故障',
  398. dataList: [
  399. {
  400. title: '主机-进',
  401. code: 'm_in_load_short',
  402. },
  403. {
  404. title: '主机-出',
  405. code: 'm_out_load_short',
  406. },
  407. {
  408. title: '备机-进',
  409. code: 'b_in_load_short',
  410. },
  411. {
  412. title: '备机-出',
  413. code: 'b_out_load_short',
  414. },
  415. ],
  416. },
  417. {
  418. title: '电压过低故障',
  419. dataList: [
  420. {
  421. title: '主机-进',
  422. code: 'm_in_low_voltage',
  423. },
  424. {
  425. title: '主机-出',
  426. code: 'm_out_low_voltage',
  427. },
  428. {
  429. title: '备机-进',
  430. code: 'b_in_low_voltage',
  431. },
  432. {
  433. title: '备机-出',
  434. code: 'b_out_low_voltage',
  435. },
  436. ],
  437. },
  438. {
  439. title: '电压过高故障',
  440. dataList: [
  441. {
  442. title: '主机-进',
  443. code: 'm_in_high_voltage',
  444. },
  445. {
  446. title: '主机-出',
  447. code: 'm_out_high_voltage',
  448. },
  449. {
  450. title: '备机-进',
  451. code: 'b_in_high_voltage',
  452. },
  453. {
  454. title: '备机-出',
  455. code: 'b_out_high_voltage',
  456. },
  457. ],
  458. },
  459. {
  460. title: '电机漏电故障',
  461. dataList: [
  462. {
  463. title: '主机-进',
  464. code: 'm_in_motor_leakage',
  465. },
  466. {
  467. title: '主机-出',
  468. code: 'm_out_motor_leakage',
  469. },
  470. {
  471. title: '备机-进',
  472. code: 'b_in_motor_leakage',
  473. },
  474. {
  475. title: '备机-出',
  476. code: 'b_out_motor_leakage',
  477. },
  478. ],
  479. },
  480. {
  481. title: '电源缺相故障',
  482. dataList: [
  483. {
  484. title: '主机-进',
  485. code: 'm_in_supply_phase',
  486. },
  487. {
  488. title: '主机-出',
  489. code: 'm_out_supply_phase',
  490. },
  491. {
  492. title: '备机-进',
  493. code: 'b_in_supply_phase',
  494. },
  495. {
  496. title: '备机-出',
  497. code: 'b_out_supply_phase',
  498. },
  499. ],
  500. },
  501. {
  502. title: '关向过力矩故障',
  503. dataList: [
  504. {
  505. title: '主机-进',
  506. code: 'm_in_closing_overtorque',
  507. },
  508. {
  509. title: '主机-出',
  510. code: 'm_out_closing_overtorque',
  511. },
  512. {
  513. title: '备机-进',
  514. code: 'b_in_closing_overtorque',
  515. },
  516. {
  517. title: '备机-出',
  518. code: 'b_out_closing_overtorque',
  519. },
  520. ],
  521. },
  522. {
  523. title: '开向过力矩故障',
  524. dataList: [
  525. {
  526. title: '主机-进',
  527. code: 'm_in_opening_overtorque',
  528. },
  529. {
  530. title: '主机-出',
  531. code: 'm_out_opening_overtorque',
  532. },
  533. {
  534. title: '备机-进',
  535. code: 'b_in_opening_overtorque',
  536. },
  537. {
  538. title: '备机-出',
  539. code: 'b_out_opening_overtorque',
  540. },
  541. ],
  542. },
  543. {
  544. title: '关向过电流故障',
  545. dataList: [
  546. {
  547. title: '主机-进',
  548. code: 'm_in_closing_overcurrent',
  549. },
  550. {
  551. title: '主机-出',
  552. code: 'm_out_closing_overcurrent',
  553. },
  554. {
  555. title: '备机-进',
  556. code: 'b_in_closing_overcurrent',
  557. },
  558. {
  559. title: '备机出',
  560. code: 'b_out_closing_overcurrent',
  561. },
  562. ],
  563. },
  564. {
  565. title: '开向过电流故障',
  566. dataList: [
  567. {
  568. title: '主机-进',
  569. code: 'm_in_opening_overcurrent',
  570. },
  571. {
  572. title: '主机-出',
  573. code: 'm_out_opening_overcurrent',
  574. },
  575. {
  576. title: '备机-进',
  577. code: 'b_in_opening_overcurrent',
  578. },
  579. {
  580. title: '备机-出',
  581. code: 'b_out_opening_overcurrent',
  582. },
  583. ],
  584. },
  585. {
  586. title: '关向超时故障',
  587. dataList: [
  588. {
  589. title: '主机-进',
  590. code: 'm_in_closing_timeout',
  591. },
  592. {
  593. title: '主机-出',
  594. code: 'm_out_closing_timeout',
  595. },
  596. {
  597. title: '备机-进',
  598. code: 'b_in_closing_timeout',
  599. },
  600. {
  601. title: '备机-出',
  602. code: 'b_out_closing_timeout',
  603. },
  604. ],
  605. },
  606. {
  607. title: '开向超时故障',
  608. dataList: [
  609. {
  610. title: '主机-进',
  611. code: 'm_in_opening_timeout',
  612. },
  613. {
  614. title: '主机-出',
  615. code: 'm_out_opening_timeout',
  616. },
  617. {
  618. title: '备机-进',
  619. code: 'b_in_opening_timeout',
  620. },
  621. {
  622. title: '备机-出',
  623. code: 'b_out_opening_timeout',
  624. },
  625. ],
  626. },
  627. {
  628. title: '阀位故障',
  629. dataList: [
  630. {
  631. title: '主机-进',
  632. code: 'm_in_valve_position',
  633. },
  634. {
  635. title: '主机-出',
  636. code: 'm_out_valve_position',
  637. },
  638. {
  639. title: '备机-进',
  640. code: 'b_in_valve_position',
  641. },
  642. {
  643. title: '备机-出',
  644. code: 'b_out_valve_position',
  645. },
  646. ],
  647. },
  648. {
  649. title: '热过载故障',
  650. dataList: [
  651. {
  652. title: '主机-进',
  653. code: 'm_in_thermal_overload',
  654. },
  655. {
  656. title: '主机-出',
  657. code: 'm_out_thermal_overload',
  658. },
  659. {
  660. title: '备机-进',
  661. code: 'b_in_thermal_overload',
  662. },
  663. {
  664. title: '备机-出',
  665. code: 'b_out_thermal_overload',
  666. },
  667. ],
  668. },
  669. ]);
  670. // const chartsColumns = ref([])
  671. const chartsColumns = ref(getTableHeaderColumns('sys_nitrogen_chart'));
  672. // const propTypeArr = ref([])
  673. // watch(monitorDataGroupNum, () => {
  674. // const arr = <any[]>[]
  675. // const item = getTableHeaderColumns('sys_nitrogen_chart')
  676. // const propTypeList = []
  677. // for (let i = 1; i <= monitorDataGroupNum.value; i++) {
  678. // const lineType = lodash.cloneDeep(item[0])
  679. // lineType.legend = `制氮机${i}瞬时流量`;
  680. // lineType.dataIndex = `${item[0].dataIndex}${i}`
  681. // lineType.color = colors[i - 1]
  682. // arr.push(lineType)
  683. // }
  684. // chartsColumns.value = arr
  685. // })
  686. const monitorData = ref(
  687. new Array(3).fill({
  688. // strName: '空压机',
  689. // cumulativeFlow: '-',
  690. // centerTemperature: '-',
  691. // outletTemperature: '-',
  692. // Ia: '-',
  693. // Ib: '-',
  694. // Ic: '-',
  695. // Vab: '-',
  696. // Vac: '-',
  697. // Vbc: '-',
  698. // compressGroupName: '',
  699. // compressExhaustPressF1: '-',
  700. // compressSeparatePressF1: '-',
  701. // compressHostTempF1: '-',
  702. // compressCrewTempF1: '-',
  703. // compressRunTimeF1: '-',
  704. // controlModel: 'LOC'
  705. })
  706. );
  707. //图表数据
  708. let echartData = ref<any>([]);
  709. // https获取监测数据
  710. let timer: null | NodeJS.Timeout = null;
  711. async function getMonitor(flag?) {
  712. if (Object.prototype.toString.call(timer) === '[object Null]') {
  713. timer = await setTimeout(
  714. async () => {
  715. if (props.deviceId) {
  716. await getDataSource(props.deviceId);
  717. }
  718. if (timer) {
  719. timer = null;
  720. }
  721. await getMonitor();
  722. },
  723. flag ? 0 : 3000
  724. );
  725. }
  726. }
  727. async function getDataSource(systemID) {
  728. const res = await getDevice({ devicetype: 'sys', systemID, type: 'all' });
  729. if (res) {
  730. const result = res;
  731. if (!result || result.msgTxt.length < 1) return;
  732. result.msgTxt.forEach((item) => {
  733. if (item.type && item.type.startsWith('nitrogen')) {
  734. airCompressorState.length = 0;
  735. monitorData.value = item['datalist'].filter((data) => {
  736. const readData = data.readData;
  737. airCompressorState.push({
  738. id: data.deviceID,
  739. deviceType: data.deviceType,
  740. m_start: readData.m_start,
  741. m_stop: readData.m_stop,
  742. b_start: readData.b_start,
  743. b_stop: readData.b_stop,
  744. });
  745. return Object.assign(data, readData);
  746. });
  747. console.log(monitorData, 'monitorData.value---===');
  748. console.log(airCompressorState, 'airCompressorState--------');
  749. if (monitorData.value.length > 0 && monitorData.value[0]['readTime']) {
  750. const airCompressor = { readTime: monitorData.value[0]['readTime'].substring(11) };
  751. const dataArr = lodash.cloneDeep(echartData.value);
  752. //图表数据
  753. if (dataArr.length < 4) {
  754. monitorData.value.forEach((el, index) => {
  755. airCompressor['flow'] = el['flow'] || 0;
  756. });
  757. dataArr.push(airCompressor);
  758. } else {
  759. dataArr.shift();
  760. // dataArr.push(airCompressor)
  761. monitorData.value.forEach((el, index) => {
  762. airCompressor['flow'] = el['flow'] || 0;
  763. });
  764. dataArr.push(airCompressor);
  765. // console.log(dataArr,'dataArr---------')
  766. }
  767. echartData.value = dataArr;
  768. }
  769. }
  770. });
  771. // monitorDataGroupNum.value = monitorData.value.length;
  772. monitorDataGroupNum.value = 2;
  773. refresh.value = true;
  774. nextTick(() => {
  775. refresh.value = false;
  776. });
  777. }
  778. }
  779. function handlerDevice(data, titles) {
  780. kzParam.data = data;
  781. kzParam.isFw = titles;
  782. switch (titles) {
  783. case '主机启动':
  784. modalTitle.value = titles;
  785. modalType.value = '1';
  786. modalIsShow.value = true;
  787. kzParam.data.m_start = data.m_start;
  788. break;
  789. case '备机启动':
  790. modalTitle.value = titles;
  791. modalType.value = '2';
  792. modalIsShow.value = true;
  793. kzParam.data.b_start = data.b_start;
  794. break;
  795. case '主机停止':
  796. modalTitle.value = titles;
  797. modalType.value = '1';
  798. modalIsShow.value = true;
  799. kzParam.data.m_stop = data.m_stop;
  800. break;
  801. case '备机停止':
  802. modalTitle.value = titles;
  803. modalType.value = '2';
  804. modalIsShow.value = true;
  805. kzParam.data.b_stop = data.b_stop;
  806. break;
  807. }
  808. }
  809. function handleOK(passWord, handlerState) {
  810. console.log(kzParam, 'kz----------');
  811. let data = {};
  812. switch (kzParam.isFw) {
  813. case '主机启动':
  814. data = {
  815. deviceid: kzParam.data.id,
  816. devicetype: kzParam.data.deviceType,
  817. password: passWord,
  818. // m_start: '1',
  819. paramcode: 'm_start',
  820. value: '1',
  821. };
  822. break;
  823. case '备机启动':
  824. data = {
  825. deviceid: kzParam.data.id,
  826. devicetype: kzParam.data.deviceType,
  827. password: passWord,
  828. paramcode: 'b_start',
  829. value: '1',
  830. };
  831. break;
  832. case '主机停止':
  833. data = {
  834. deviceid: kzParam.data.id,
  835. devicetype: kzParam.data.deviceType,
  836. password: passWord,
  837. paramcode: 'm_stop',
  838. value: '1',
  839. };
  840. break;
  841. case '备机停止':
  842. data = {
  843. deviceid: kzParam.data.id,
  844. devicetype: kzParam.data.deviceType,
  845. password: passWord,
  846. paramcode: 'b_stop',
  847. value: '1',
  848. };
  849. break;
  850. }
  851. deviceControlApi(data).then((res) => {
  852. // 模拟时开启
  853. if (res.success) {
  854. modalIsShow.value = false;
  855. getDataSource(props.deviceId);
  856. if (globalConfig.History_Type == 'remote') {
  857. message.success('指令已下发至生产管控平台成功!');
  858. } else {
  859. message.success('指令已下发成功!');
  860. }
  861. }
  862. });
  863. }
  864. function handleCancel() {
  865. modalIsShow.value = false;
  866. modalTitle.value = '';
  867. modalType.value = '';
  868. }
  869. watch([monitorDataGroupNum, loading], ([newMonitorDataGroupNum, newLoading]) => {
  870. nextTick(() => {
  871. if (newMonitorDataGroupNum && !newLoading) {
  872. setModelType(props.modalType, newMonitorDataGroupNum);
  873. }
  874. });
  875. });
  876. watch(
  877. () => props.deviceId,
  878. async (deviceId) => {
  879. if (deviceId) {
  880. await getCamera(deviceId, playerRef, renderPlayer);
  881. }
  882. }
  883. );
  884. onBeforeUnmount(() => {
  885. removeCamera(playerRef);
  886. });
  887. onMounted(async () => {
  888. await getMonitor(true);
  889. await mountedThree().then(() => {
  890. loading.value = false;
  891. });
  892. await getCamera(props.deviceId, playerRef, renderPlayer);
  893. });
  894. onUnmounted(() => {
  895. destroy();
  896. if (timer) {
  897. clearTimeout(timer);
  898. timer = undefined;
  899. }
  900. });
  901. </script>
  902. <style lang="less" scoped>
  903. @import '/@/design/theme.less';
  904. @ventSpace: zxm;
  905. @{theme-deepblue} {
  906. .nitrogen-home {
  907. --button-box-bg: linear-gradient(#0963c1, #1774d7);
  908. --control-title-color: #0a80fa;
  909. --border-color: #0a80fad4;
  910. --footer-item-bg: rgba(0, 32, 66, 0.6);
  911. }
  912. }
  913. .nitrogen-box {
  914. width: 100%;
  915. height: 100%;
  916. display: flex;
  917. justify-content: center;
  918. }
  919. #nitrogenCss3D {
  920. .modal-monitor {
  921. width: 200px;
  922. position: absolute;
  923. left: 0px;
  924. top: 0px;
  925. }
  926. &:deep(.win) {
  927. margin: 0 !important;
  928. background: #00000044;
  929. }
  930. }
  931. .nitrogen-home {
  932. --button-box-bg: linear-gradient(#1fa6cb, #127cb5);
  933. --control-title-color: #73e8fe;
  934. --border-color: #00baffd4;
  935. --footer-item-bg: #0e223b90;
  936. width: 100%;
  937. height: 100%;
  938. position: fixed;
  939. z-index: 9999;
  940. display: flex;
  941. flex-direction: column;
  942. justify-content: center;
  943. align-items: center;
  944. pointer-events: none;
  945. top: 20px;
  946. .nitrogen-container {
  947. width: 100%;
  948. height: calc(100% - 100px);
  949. display: flex;
  950. justify-content: space-between;
  951. margin-bottom: 100px;
  952. .top-box {
  953. // margin-top: 40px; //lxh
  954. position: relative;
  955. width: 100%;
  956. padding: 10px;
  957. overflow: hidden;
  958. display: flex;
  959. justify-content: space-between;
  960. .center-item-box {
  961. position: absolute;
  962. left: 50%;
  963. top: 50px;
  964. transform: translate(-48%, 0);
  965. width: calc(100% - 760px);
  966. height: 50px;
  967. display: flex;
  968. align-items: center;
  969. pointer-events: auto;
  970. .top-left {
  971. display: flex;
  972. flex: 2;
  973. color: var(--vent-font-color);
  974. .button-box {
  975. position: relative;
  976. width: auto;
  977. height: 32px;
  978. display: flex;
  979. align-items: center;
  980. justify-content: center;
  981. border-radius: 5px;
  982. color: var(--vent-font-color);
  983. padding: 10px 15px;
  984. margin: 0px 10px;
  985. box-sizing: border-box;
  986. cursor: pointer;
  987. background: var(--button-box-bg);
  988. }
  989. }
  990. .top-center {
  991. display: flex;
  992. flex: 1;
  993. justify-content: center;
  994. align-items: center;
  995. font-size: 20px;
  996. color: var(--vent-font-color);
  997. .top-c-label {
  998. color: yellow;
  999. }
  1000. }
  1001. .top-right {
  1002. display: flex;
  1003. flex: 2;
  1004. justify-content: right;
  1005. align-items: center;
  1006. color: var(--vent-font-color);
  1007. .control-type {
  1008. display: flex;
  1009. color: var(--vent-font-color);
  1010. .control-title {
  1011. color: var(--control-title-color);
  1012. }
  1013. }
  1014. }
  1015. }
  1016. .footer-item-box {
  1017. width: calc(100% - 20px);
  1018. height: auto;
  1019. position: absolute;
  1020. left: 50%;
  1021. bottom: 30px;
  1022. transform: translate(-50%);
  1023. display: flex;
  1024. justify-content: center;
  1025. color: var(--vent-font-color);
  1026. // box-shadow: 0 0 30px rgb(0, 153, 184) inset;
  1027. pointer-events: auto;
  1028. .device-detail {
  1029. text-align: center;
  1030. &:first-child {
  1031. background-color: var(--footer-item-bg);
  1032. }
  1033. &:last-child {
  1034. .device-val,
  1035. .device-title {
  1036. border-right: 1px solid var(--border-color);
  1037. }
  1038. }
  1039. .device-val {
  1040. line-height: 36px;
  1041. border-top: 1px solid var(--border-color);
  1042. border-left: 1px solid var(--border-color);
  1043. &:last-child {
  1044. border-bottom: 1px solid var(--border-color);
  1045. }
  1046. }
  1047. }
  1048. .device-title {
  1049. width: 110px;
  1050. text-align: center;
  1051. border-top: 1px solid var(--border-color);
  1052. border-left: 1px solid var(--border-color);
  1053. line-height: 46px;
  1054. color: #e7fdff;
  1055. background-color: var(--footer-item-bg);
  1056. }
  1057. }
  1058. .lr-box {
  1059. height: fit-content;
  1060. display: flex;
  1061. flex-direction: column;
  1062. position: relative;
  1063. overflow: hidden;
  1064. z-index: 9999;
  1065. pointer-events: auto;
  1066. }
  1067. .item {
  1068. width: 335px;
  1069. height: auto;
  1070. position: relative;
  1071. border-radius: 5px;
  1072. margin-top: 10px;
  1073. margin-bottom: 0px;
  1074. pointer-events: auto;
  1075. color: var(--vent-font-color);
  1076. overflow: hidden;
  1077. &:first-child {
  1078. margin-top: 0px;
  1079. }
  1080. .base-title {
  1081. color: var(--vent-font-color);
  1082. margin-bottom: 8px;
  1083. padding-left: 10px;
  1084. position: relative;
  1085. font-size: 16px;
  1086. &::after {
  1087. content: '';
  1088. position: absolute;
  1089. display: block;
  1090. width: 4px;
  1091. height: 12px;
  1092. top: 7px;
  1093. left: 0px;
  1094. background: #45d3fd;
  1095. border-radius: 4px;
  1096. }
  1097. }
  1098. .state-item {
  1099. display: flex;
  1100. flex-direction: row;
  1101. padding: 5px;
  1102. .item-col {
  1103. width: calc(50% - 5px);
  1104. display: flex;
  1105. justify-content: center;
  1106. align-items: center;
  1107. padding-right: 4px;
  1108. background-image: linear-gradient(to right, #39a3ff00, #39a3ff10);
  1109. &:first-child {
  1110. margin-right: 10px;
  1111. }
  1112. .state-title {
  1113. color: #ffffffcc;
  1114. flex: 9;
  1115. font-size: 14px;
  1116. }
  1117. .state-val {
  1118. flex: 1;
  1119. color: #00eefffe;
  1120. margin-right: 5px;
  1121. text-align: right;
  1122. font-size: 14px;
  1123. }
  1124. .state-title1 {
  1125. color: #ffffffcc;
  1126. flex: 5;
  1127. font-size: 14px;
  1128. }
  1129. .state-val1 {
  1130. display: flex;
  1131. flex: 1;
  1132. justify-content: center;
  1133. align-items: center;
  1134. }
  1135. }
  1136. }
  1137. .signal-box {
  1138. margin: 5px 0;
  1139. display: flex;
  1140. align-items: center;
  1141. .signal-title {
  1142. color: var(--vent-font-action-link);
  1143. margin: 0 5px;
  1144. }
  1145. &:last-child {
  1146. margin-right: 0px;
  1147. }
  1148. }
  1149. .list-item {
  1150. padding: 0 10px;
  1151. display: flex;
  1152. justify-content: space-between;
  1153. align-items: center;
  1154. .item-data-key {
  1155. color: #ffffff99;
  1156. }
  1157. }
  1158. .item-data-box {
  1159. color: var(--vent-font-color);
  1160. .state-icon {
  1161. display: inline-block;
  1162. width: 12px;
  1163. height: 12px;
  1164. border-radius: 12px;
  1165. }
  1166. .open {
  1167. border: 5px solid #133a56;
  1168. background: #4ecb73;
  1169. }
  1170. .close {
  1171. border: 5px solid #192961;
  1172. background: #6d7898;
  1173. }
  1174. }
  1175. }
  1176. .item-l {
  1177. width: 100%;
  1178. .monitor-box {
  1179. width: 100%;
  1180. .parameter-title {
  1181. position: relative;
  1182. width: 100%;
  1183. height: 14px;
  1184. margin-top: 10px;
  1185. .icon,
  1186. span {
  1187. position: absolute;
  1188. top: -10px;
  1189. }
  1190. }
  1191. .group-parameter-title {
  1192. background-image: linear-gradient(to right, #39a3ff50, #39a3ff00);
  1193. .icon {
  1194. left: -12px;
  1195. top: -17px;
  1196. }
  1197. span {
  1198. left: 18px;
  1199. }
  1200. .item-col {
  1201. background-image: linear-gradient(to right, #39a3ff00, #39a3ff10);
  1202. }
  1203. }
  1204. .device-parameter-title {
  1205. background-image: linear-gradient(to right, #3df6ff40, #3df6ff00);
  1206. .icon {
  1207. left: -10px;
  1208. top: -14px;
  1209. }
  1210. span {
  1211. left: 18px;
  1212. }
  1213. .item-col {
  1214. background-image: linear-gradient(to right, #3df6ff10, #3df6ff00);
  1215. }
  1216. }
  1217. }
  1218. // .monitor-box1 {
  1219. // height: 126px;
  1220. // }
  1221. .state-box {
  1222. height: calc(100% - 24px);
  1223. overflow-y: auto;
  1224. }
  1225. }
  1226. .right-box {
  1227. width: 330px;
  1228. margin-top: 50px;
  1229. }
  1230. .left-box {
  1231. width: 365px;
  1232. margin-top: 80px;
  1233. }
  1234. }
  1235. &:deep(.win) {
  1236. width: 100%;
  1237. margin: 0 !important;
  1238. }
  1239. }
  1240. }
  1241. &:deep(.main) {
  1242. .title {
  1243. height: 34px;
  1244. text-align: center;
  1245. font-weight: 600;
  1246. color: var(--vent-font-action-link);
  1247. // background-image: url('../../../assets/img/yfj/light.png');
  1248. background-repeat: no-repeat;
  1249. background-position-x: center;
  1250. background-position-y: 100%;
  1251. background-size: 80%;
  1252. font-size: 16px;
  1253. }
  1254. .monitor-item {
  1255. width: 200px;
  1256. display: flex;
  1257. flex-direction: row;
  1258. width: auto;
  1259. margin-bottom: 3px;
  1260. .monitor-val {
  1261. color: #ffb700;
  1262. display: flex;
  1263. width: auto;
  1264. .val {
  1265. width: 80px;
  1266. // font-size: 14px;
  1267. font-size: 16px;
  1268. }
  1269. .unit {
  1270. color: #ffffffbb;
  1271. // font-size: 14px;
  1272. font-size: 16px;
  1273. }
  1274. }
  1275. }
  1276. .monitor-title {
  1277. width: 100px;
  1278. color: var(--vent-font-action-link);
  1279. font-weight: 400;
  1280. // font-size: 14px;
  1281. font-size: 16px;
  1282. }
  1283. .signal-item {
  1284. display: flex;
  1285. justify-content: space-between;
  1286. // margin-bottom: 5px;
  1287. .signal-round {
  1288. display: inline-block;
  1289. width: 8px;
  1290. height: 8px;
  1291. border-radius: 50%;
  1292. margin: 0 10px;
  1293. position: relative;
  1294. &::after {
  1295. display: block;
  1296. content: '';
  1297. position: absolute;
  1298. width: 12px;
  1299. height: 12px;
  1300. top: -2px;
  1301. left: -2px;
  1302. border-radius: 50%;
  1303. }
  1304. }
  1305. .signal-round-gry {
  1306. background-color: #858585;
  1307. &::after {
  1308. background-color: #85858544;
  1309. box-shadow: 0 0 1px 1px #85858599;
  1310. }
  1311. }
  1312. .signal-round-run {
  1313. background-color: #67fc00;
  1314. &::after {
  1315. background-color: #67fc0044;
  1316. box-shadow: 0 0 1px 1px #c6ff77;
  1317. }
  1318. }
  1319. .signal-round-warning {
  1320. background-color: #e9170b;
  1321. &::after {
  1322. background-color: #e9170b44;
  1323. box-shadow: 0 0 1px 1px #e9170b;
  1324. }
  1325. }
  1326. }
  1327. }
  1328. :deep(.zxm-radio-wrapper) {
  1329. color: var(--vent-font-color) !important;
  1330. }
  1331. :deep(.zxm-radio-group) {
  1332. color: var(--vent-font-color) !important;
  1333. }
  1334. :deep(.zxm-radio-group .zxm-radio-wrapper) {
  1335. color: var(--vent-font-color) !important;
  1336. }
  1337. :deep(.zxm-radio-disabled + span) {
  1338. color: var(--vent-font-color);
  1339. }
  1340. :deep(.zxm-radio-disabled .zxm-radio-inner::after) {
  1341. background-color: #0490a8;
  1342. }
  1343. </style>