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 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 loading = ref(true);
  330. let kzParam = reactive<any>({
  331. data: {},
  332. isFw: '',
  333. });
  334. const playerRef = ref();
  335. const colors = ['#FDB146', '#EE6666', '#9BCB75', '#03C2EC', '#DA3914', '#9C83D9'];
  336. const echatsOption = {
  337. grid: {
  338. top: '20%',
  339. left: '0px',
  340. right: '10px',
  341. bottom: '3%',
  342. containLabel: true,
  343. },
  344. toolbox: {
  345. feature: {},
  346. },
  347. };
  348. const monitorDataGroupNum = ref(0);
  349. let airCompressorState = reactive<any[]>([]);
  350. //主机进气
  351. const groupParameterData = [
  352. {
  353. m_in_open: '开度',
  354. m_bv_in_remote: '远控',
  355. },
  356. {
  357. m_bv_in_open: '开到位',
  358. m_bv_in_close: '关到位',
  359. },
  360. ];
  361. //备机进气
  362. const groupParameterData1 = [
  363. {
  364. b_in_open: '开度',
  365. b_bv_in_remote: '远控',
  366. },
  367. {
  368. b_bv_in_open: '开到位',
  369. b_bv_in_close: '关到位',
  370. },
  371. ];
  372. //主机出气
  373. const deviceParameterData = [
  374. {
  375. m_out_open: '开度',
  376. m_bv_out_remote: '远控',
  377. },
  378. {
  379. m_bv_out_open: '开到位',
  380. m_bv_out_close: '关到位',
  381. },
  382. ];
  383. //备机出气
  384. const deviceParameterData1 = [
  385. {
  386. b_out_open: '开度',
  387. b_bv_out_remote: '远控',
  388. },
  389. {
  390. b_bv_out_open: '开到位',
  391. b_bv_out_close: '关到位',
  392. },
  393. ];
  394. const deviceMonitorList = reactive([
  395. {
  396. title: '负载短路故障',
  397. dataList: [
  398. {
  399. title: '主机-进',
  400. code: 'm_in_load_short',
  401. },
  402. {
  403. title: '主机-出',
  404. code: 'm_out_load_short',
  405. },
  406. {
  407. title: '备机-进',
  408. code: 'b_in_load_short',
  409. },
  410. {
  411. title: '备机-出',
  412. code: 'b_out_load_short',
  413. },
  414. ],
  415. },
  416. {
  417. title: '电压过低故障',
  418. dataList: [
  419. {
  420. title: '主机-进',
  421. code: 'm_in_low_voltage',
  422. },
  423. {
  424. title: '主机-出',
  425. code: 'm_out_low_voltage',
  426. },
  427. {
  428. title: '备机-进',
  429. code: 'b_in_low_voltage',
  430. },
  431. {
  432. title: '备机-出',
  433. code: 'b_out_low_voltage',
  434. },
  435. ],
  436. },
  437. {
  438. title: '电压过高故障',
  439. dataList: [
  440. {
  441. title: '主机-进',
  442. code: 'm_in_high_voltage',
  443. },
  444. {
  445. title: '主机-出',
  446. code: 'm_out_high_voltage',
  447. },
  448. {
  449. title: '备机-进',
  450. code: 'b_in_high_voltage',
  451. },
  452. {
  453. title: '备机-出',
  454. code: 'b_out_high_voltage',
  455. },
  456. ],
  457. },
  458. {
  459. title: '电机漏电故障',
  460. dataList: [
  461. {
  462. title: '主机-进',
  463. code: 'm_in_motor_leakage',
  464. },
  465. {
  466. title: '主机-出',
  467. code: 'm_out_motor_leakage',
  468. },
  469. {
  470. title: '备机-进',
  471. code: 'b_in_motor_leakage',
  472. },
  473. {
  474. title: '备机-出',
  475. code: 'b_out_motor_leakage',
  476. },
  477. ],
  478. },
  479. {
  480. title: '电源缺相故障',
  481. dataList: [
  482. {
  483. title: '主机-进',
  484. code: 'm_in_supply_phase',
  485. },
  486. {
  487. title: '主机-出',
  488. code: 'm_out_supply_phase',
  489. },
  490. {
  491. title: '备机-进',
  492. code: 'b_in_supply_phase',
  493. },
  494. {
  495. title: '备机-出',
  496. code: 'b_out_supply_phase',
  497. },
  498. ],
  499. },
  500. {
  501. title: '关向过力矩故障',
  502. dataList: [
  503. {
  504. title: '主机-进',
  505. code: 'm_in_closing_overtorque',
  506. },
  507. {
  508. title: '主机-出',
  509. code: 'm_out_closing_overtorque',
  510. },
  511. {
  512. title: '备机-进',
  513. code: 'b_in_closing_overtorque',
  514. },
  515. {
  516. title: '备机-出',
  517. code: 'b_out_closing_overtorque',
  518. },
  519. ],
  520. },
  521. {
  522. title: '开向过力矩故障',
  523. dataList: [
  524. {
  525. title: '主机-进',
  526. code: 'm_in_opening_overtorque',
  527. },
  528. {
  529. title: '主机-出',
  530. code: 'm_out_opening_overtorque',
  531. },
  532. {
  533. title: '备机-进',
  534. code: 'b_in_opening_overtorque',
  535. },
  536. {
  537. title: '备机-出',
  538. code: 'b_out_opening_overtorque',
  539. },
  540. ],
  541. },
  542. {
  543. title: '关向过电流故障',
  544. dataList: [
  545. {
  546. title: '主机-进',
  547. code: 'm_in_closing_overcurrent',
  548. },
  549. {
  550. title: '主机-出',
  551. code: 'm_out_closing_overcurrent',
  552. },
  553. {
  554. title: '备机-进',
  555. code: 'b_in_closing_overcurrent',
  556. },
  557. {
  558. title: '备机出',
  559. code: 'b_out_closing_overcurrent',
  560. },
  561. ],
  562. },
  563. {
  564. title: '开向过电流故障',
  565. dataList: [
  566. {
  567. title: '主机-进',
  568. code: 'm_in_opening_overcurrent',
  569. },
  570. {
  571. title: '主机-出',
  572. code: 'm_out_opening_overcurrent',
  573. },
  574. {
  575. title: '备机-进',
  576. code: 'b_in_opening_overcurrent',
  577. },
  578. {
  579. title: '备机-出',
  580. code: 'b_out_opening_overcurrent',
  581. },
  582. ],
  583. },
  584. {
  585. title: '关向超时故障',
  586. dataList: [
  587. {
  588. title: '主机-进',
  589. code: 'm_in_closing_timeout',
  590. },
  591. {
  592. title: '主机-出',
  593. code: 'm_out_closing_timeout',
  594. },
  595. {
  596. title: '备机-进',
  597. code: 'b_in_closing_timeout',
  598. },
  599. {
  600. title: '备机-出',
  601. code: 'b_out_closing_timeout',
  602. },
  603. ],
  604. },
  605. {
  606. title: '开向超时故障',
  607. dataList: [
  608. {
  609. title: '主机-进',
  610. code: 'm_in_opening_timeout',
  611. },
  612. {
  613. title: '主机-出',
  614. code: 'm_out_opening_timeout',
  615. },
  616. {
  617. title: '备机-进',
  618. code: 'b_in_opening_timeout',
  619. },
  620. {
  621. title: '备机-出',
  622. code: 'b_out_opening_timeout',
  623. },
  624. ],
  625. },
  626. {
  627. title: '阀位故障',
  628. dataList: [
  629. {
  630. title: '主机-进',
  631. code: 'm_in_valve_position',
  632. },
  633. {
  634. title: '主机-出',
  635. code: 'm_out_valve_position',
  636. },
  637. {
  638. title: '备机-进',
  639. code: 'b_in_valve_position',
  640. },
  641. {
  642. title: '备机-出',
  643. code: 'b_out_valve_position',
  644. },
  645. ],
  646. },
  647. {
  648. title: '热过载故障',
  649. dataList: [
  650. {
  651. title: '主机-进',
  652. code: 'm_in_thermal_overload',
  653. },
  654. {
  655. title: '主机-出',
  656. code: 'm_out_thermal_overload',
  657. },
  658. {
  659. title: '备机-进',
  660. code: 'b_in_thermal_overload',
  661. },
  662. {
  663. title: '备机-出',
  664. code: 'b_out_thermal_overload',
  665. },
  666. ],
  667. },
  668. ]);
  669. // const chartsColumns = ref([])
  670. const chartsColumns = ref(getTableHeaderColumns('sys_nitrogen_chart'));
  671. // const propTypeArr = ref([])
  672. // watch(monitorDataGroupNum, () => {
  673. // const arr = <any[]>[]
  674. // const item = getTableHeaderColumns('sys_nitrogen_chart')
  675. // const propTypeList = []
  676. // for (let i = 1; i <= monitorDataGroupNum.value; i++) {
  677. // const lineType = lodash.cloneDeep(item[0])
  678. // lineType.legend = `制氮机${i}瞬时流量`;
  679. // lineType.dataIndex = `${item[0].dataIndex}${i}`
  680. // lineType.color = colors[i - 1]
  681. // arr.push(lineType)
  682. // }
  683. // chartsColumns.value = arr
  684. // })
  685. const monitorData = ref(
  686. new Array(3).fill({
  687. // strName: '空压机',
  688. // cumulativeFlow: '-',
  689. // centerTemperature: '-',
  690. // outletTemperature: '-',
  691. // Ia: '-',
  692. // Ib: '-',
  693. // Ic: '-',
  694. // Vab: '-',
  695. // Vac: '-',
  696. // Vbc: '-',
  697. // compressGroupName: '',
  698. // compressExhaustPressF1: '-',
  699. // compressSeparatePressF1: '-',
  700. // compressHostTempF1: '-',
  701. // compressCrewTempF1: '-',
  702. // compressRunTimeF1: '-',
  703. // controlModel: 'LOC'
  704. })
  705. );
  706. //图表数据
  707. let echartData = ref<any>([]);
  708. // https获取监测数据
  709. let timer: null | NodeJS.Timeout = null;
  710. async function getMonitor(flag?) {
  711. if (Object.prototype.toString.call(timer) === '[object Null]') {
  712. timer = await setTimeout(
  713. async () => {
  714. if (props.deviceId) {
  715. await getDataSource(props.deviceId);
  716. }
  717. if (timer) {
  718. timer = null;
  719. }
  720. await getMonitor();
  721. },
  722. flag ? 0 : 3000
  723. );
  724. }
  725. }
  726. async function getDataSource(systemID) {
  727. const res = await getDevice({ devicetype: 'sys', systemID, type: 'all' });
  728. if (res) {
  729. const result = res;
  730. if (!result || result.msgTxt.length < 1) return;
  731. result.msgTxt.forEach((item) => {
  732. if (item.type && item.type.startsWith('nitrogen')) {
  733. airCompressorState.length = 0;
  734. monitorData.value = item['datalist'].filter((data) => {
  735. const readData = data.readData;
  736. airCompressorState.push({
  737. id: data.deviceID,
  738. deviceType: data.deviceType,
  739. m_start: readData.m_start,
  740. m_stop: readData.m_stop,
  741. b_start: readData.b_start,
  742. b_stop: readData.b_stop,
  743. });
  744. return Object.assign(data, readData);
  745. });
  746. console.log(monitorData, 'monitorData.value---===');
  747. console.log(airCompressorState, 'airCompressorState--------');
  748. if (monitorData.value.length > 0 && monitorData.value[0]['readTime']) {
  749. const airCompressor = { readTime: monitorData.value[0]['readTime'].substring(11) };
  750. const dataArr = lodash.cloneDeep(echartData.value);
  751. //图表数据
  752. if (dataArr.length < 4) {
  753. monitorData.value.forEach((el, index) => {
  754. airCompressor['flow'] = el['flow'] || 0;
  755. });
  756. dataArr.push(airCompressor);
  757. } else {
  758. dataArr.shift();
  759. // dataArr.push(airCompressor)
  760. monitorData.value.forEach((el, index) => {
  761. airCompressor['flow'] = el['flow'] || 0;
  762. });
  763. dataArr.push(airCompressor);
  764. // console.log(dataArr,'dataArr---------')
  765. }
  766. echartData.value = dataArr;
  767. }
  768. }
  769. });
  770. // monitorDataGroupNum.value = monitorData.value.length;
  771. monitorDataGroupNum.value = 2;
  772. refresh.value = true;
  773. nextTick(() => {
  774. refresh.value = false;
  775. });
  776. }
  777. }
  778. function handlerDevice(data, titles) {
  779. kzParam.data = data;
  780. kzParam.isFw = titles;
  781. switch (titles) {
  782. case '主机启动':
  783. modalTitle.value = titles;
  784. modalType.value = '1';
  785. modalIsShow.value = true;
  786. kzParam.data.m_start = data.m_start;
  787. break;
  788. case '备机启动':
  789. modalTitle.value = titles;
  790. modalType.value = '2';
  791. modalIsShow.value = true;
  792. kzParam.data.b_start = data.b_start;
  793. break;
  794. case '主机停止':
  795. modalTitle.value = titles;
  796. modalType.value = '1';
  797. modalIsShow.value = true;
  798. kzParam.data.m_stop = data.m_stop;
  799. break;
  800. case '备机停止':
  801. modalTitle.value = titles;
  802. modalType.value = '2';
  803. modalIsShow.value = true;
  804. kzParam.data.b_stop = data.b_stop;
  805. break;
  806. }
  807. }
  808. function handleOK(passWord, handlerState) {
  809. console.log(kzParam, 'kz----------');
  810. let data = {};
  811. switch (kzParam.isFw) {
  812. case '主机启动':
  813. data = {
  814. deviceid: kzParam.data.id,
  815. devicetype: kzParam.data.deviceType,
  816. password: passWord,
  817. // m_start: '1',
  818. paramcode: 'm_start',
  819. value: '1',
  820. };
  821. break;
  822. case '备机启动':
  823. data = {
  824. deviceid: kzParam.data.id,
  825. devicetype: kzParam.data.deviceType,
  826. password: passWord,
  827. paramcode: 'b_start',
  828. value: '1',
  829. };
  830. break;
  831. case '主机停止':
  832. data = {
  833. deviceid: kzParam.data.id,
  834. devicetype: kzParam.data.deviceType,
  835. password: passWord,
  836. paramcode: 'm_stop',
  837. value: '1',
  838. };
  839. break;
  840. case '备机停止':
  841. data = {
  842. deviceid: kzParam.data.id,
  843. devicetype: kzParam.data.deviceType,
  844. password: passWord,
  845. paramcode: 'b_stop',
  846. value: '1',
  847. };
  848. break;
  849. }
  850. deviceControlApi(data).then((res) => {
  851. // 模拟时开启
  852. if (res.success) {
  853. modalIsShow.value = false;
  854. getDataSource(props.deviceId);
  855. if (globalConfig.History_Type == 'remote') {
  856. message.success('指令已下发至生产管控平台成功!');
  857. } else {
  858. message.success('指令已下发成功!');
  859. }
  860. }
  861. });
  862. }
  863. function handleCancel() {
  864. modalIsShow.value = false;
  865. modalTitle.value = '';
  866. modalType.value = '';
  867. }
  868. watch([monitorDataGroupNum, loading], ([newMonitorDataGroupNum, newLoading]) => {
  869. nextTick(() => {
  870. if (newMonitorDataGroupNum && !newLoading) {
  871. setModelType(props.modalType, newMonitorDataGroupNum);
  872. }
  873. });
  874. });
  875. watch(
  876. () => props.deviceId,
  877. async (deviceId) => {
  878. if (deviceId) {
  879. await getCamera(deviceId, playerRef.value);
  880. }
  881. }
  882. );
  883. onBeforeUnmount(() => {
  884. removeCamera();
  885. });
  886. onMounted(async () => {
  887. await getMonitor(true);
  888. await mountedThree().then(() => {
  889. loading.value = false;
  890. });
  891. await getCamera(props.deviceId, playerRef.value);
  892. });
  893. onUnmounted(() => {
  894. destroy();
  895. removeCamera();
  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>