nitrogenHome_bd.vue 52 KB

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