nitrogenHome2.vue 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103
  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 2" :key="groupNum" class="modal-monitor">
  9. <fourBorderBg :class="`kyj${groupNum}`" :id="`nitrogenMonitor${groupNum}`">
  10. <div class="title">{{ monitorData[groupNum - 1]['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[groupNum - 1]['bv_1_open'] ? monitorData[groupNum -
  15. 1]['bv_1_open'] : '-'
  16. }}</span>
  17. </span>
  18. </div>
  19. <div class="monitor-item">
  20. <span class="monitor-title">检修:</span>
  21. <!-- <span class="monitor-val" v-if="!refresh"><span class="val">{{ monitorData[groupNum -
  22. 1]['FluxTotal1'] ? parseFloat(monitorData[groupNum - 1]['FluxTotal1']).toFixed(2) : '-'
  23. }}</span><span class="unit">m³/h</span></span> -->
  24. <div class="monitor-val">
  25. <span v-if="false"
  26. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: red;"></span>
  27. <span v-if="true"
  28. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: greenyellow;"></span>
  29. <span v-if="false"
  30. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: #ccc;"></span>
  31. </div>
  32. </div>
  33. <div class="monitor-item">
  34. <span class="monitor-title">运行:</span>
  35. <!-- <span class="monitor-val" v-if="!refresh"><span class="val">{{ monitorData[groupNum -
  36. 1]['NitrogenPurity'] ? parseFloat(monitorData[groupNum - 1]['NitrogenPurity']).toFixed(2) :
  37. '-' }}</span>
  38. <span class="unit">%</span></span> -->
  39. <div class="monitor-val">
  40. <span
  41. v-if="false"
  42. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: red;"></span>
  43. <span
  44. v-if="true"
  45. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: greenyellow;"></span>
  46. <span
  47. v-if="false"
  48. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: #ccc;"></span>
  49. </div>
  50. </div>
  51. <div class="monitor-item">
  52. <span class="monitor-title">进气蝶阀远控:</span>
  53. <!-- <span class="monitor-val" v-if="!refresh"><span class="val">{{
  54. monitorData[groupNum - 1]['AirCompressor_RunTime'] ? monitorData[groupNum -
  55. 1]['AirCompressor_RunTime'] :
  56. '-'
  57. }}</span><span class="unit">h</span></span> -->
  58. <div class="monitor-val">
  59. <span
  60. v-if="false"
  61. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: red;"></span>
  62. <span
  63. v-if="true"
  64. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: greenyellow;"></span>
  65. <span
  66. v-if="false"
  67. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: #ccc;"></span>
  68. </div>
  69. </div>
  70. <div class="monitor-item">
  71. <span class="monitor-title">进气蝶阀开到位:</span>
  72. <!-- <span class="monitor-val" v-if="!refresh"><span class="val">{{
  73. monitorData[groupNum - 1]['AirCompressor_LoadTime'] ? monitorData[groupNum -
  74. 1]['AirCompressor_LoadTime']
  75. : '-'
  76. }}</span><span class="unit">h</span></span> -->
  77. <div class="monitor-val">
  78. <span
  79. v-if="false"
  80. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: red;"></span>
  81. <span
  82. v-if="true"
  83. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: greenyellow;"></span>
  84. <span
  85. v-if="false"
  86. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: #ccc;"></span>
  87. </div>
  88. </div>
  89. <div class="monitor-item">
  90. <span class="monitor-title">进气蝶阀关到位:</span>
  91. <!-- <span class="monitor-val" v-if="!refresh"><span class="val">{{
  92. monitorData[groupNum - 1]['AirCompressor_LoadTime'] ? monitorData[groupNum -
  93. 1]['AirCompressor_LoadTime']
  94. : '-'
  95. }}</span><span class="unit">h</span></span> -->
  96. <div class="monitor-val">
  97. <span
  98. v-if="false"
  99. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: red;"></span>
  100. <span
  101. v-if="true"
  102. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: greenyellow;"></span>
  103. <span
  104. v-if="false"
  105. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: #ccc;"></span>
  106. </div>
  107. </div>
  108. <div class="monitor-item">
  109. <span class="monitor-title">出气蝶阀远控:</span>
  110. <!-- <span class="monitor-val" v-if="!refresh"><span class="val">{{
  111. monitorData[groupNum - 1]['AirCompressor_LoadTime'] ? monitorData[groupNum -
  112. 1]['AirCompressor_LoadTime']
  113. : '-'
  114. }}</span><span class="unit">h</span></span> -->
  115. <div class="monitor-val">
  116. <span
  117. v-if="false"
  118. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: red;"></span>
  119. <span
  120. v-if="true"
  121. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: greenyellow;"></span>
  122. <span
  123. v-if="false"
  124. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: #ccc;"></span>
  125. </div>
  126. </div>
  127. <div class="monitor-item">
  128. <span class="monitor-title">出气蝶阀开到位:</span>
  129. <!-- <span class="monitor-val" v-if="!refresh"><span class="val">{{
  130. monitorData[groupNum - 1]['AirCompressor_LoadTime'] ? monitorData[groupNum -
  131. 1]['AirCompressor_LoadTime']
  132. : '-'
  133. }}</span><span class="unit">h</span></span> -->
  134. <div class="monitor-val">
  135. <span
  136. v-if="false"
  137. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: red;"></span>
  138. <span
  139. v-if="true"
  140. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: greenyellow;"></span>
  141. <span
  142. v-if="false"
  143. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: #ccc;"></span>
  144. </div>
  145. </div>
  146. <div class="monitor-item">
  147. <span class="monitor-title">出气蝶阀关到位:</span>
  148. <!-- <span class="monitor-val" v-if="!refresh"><span class="val">{{
  149. monitorData[groupNum - 1]['AirCompressor_LoadTime'] ? monitorData[groupNum -
  150. 1]['AirCompressor_LoadTime']
  151. : '-'
  152. }}</span><span class="unit">h</span></span> -->
  153. <div class="monitor-val">
  154. <span
  155. v-if="false"
  156. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: red;"></span>
  157. <span
  158. v-if="true"
  159. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: greenyellow;"></span>
  160. <span
  161. v-if="false"
  162. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: #ccc;"></span>
  163. </div>
  164. </div>
  165. </fourBorderBg>
  166. </div>
  167. </template>
  168. </div>
  169. <div class="nitrogen-home">
  170. <div class="nitrogen-container">
  171. <div v-if="monitorNetStatus == 0" class="device-state">网络断开</div>
  172. <div class="top-box">
  173. <!-- 左边监测数据 -->
  174. <div class="lr-box left-box">
  175. <div class="item item-l" v-for="groupNum in monitorDataGroupNum" :key="groupNum">
  176. <ventBox1>
  177. <template #title>
  178. <div>{{ monitorData[groupNum - 1]['strname'] }}</div>
  179. </template>
  180. <template #container>
  181. <div class="monitor-box">
  182. <div class="parameter-title group-parameter-title">
  183. <SvgIcon class="icon" size="38" name="device-group-paramer" /><span>蝶阀参数</span>
  184. </div>
  185. <div class="state-item" v-for="(data, index) in groupParameterData" :key="index">
  186. <div class="item-col">
  187. <span class="state-title">{{ Object.values(data)[0] }} :</span>
  188. <span class="state-val">{{
  189. (monitorData.length > 0 && monitorData[groupNum - 1][Object.keys(data)[0]])
  190. >= 0
  191. ? monitorData[groupNum - 1][Object.keys(data)[0]] ?
  192. parseFloat(monitorData[groupNum -
  193. 1][Object.keys(data)[0]]).toFixed(2) : '-'
  194. : '-'
  195. }}</span>
  196. </div>
  197. <div class="item-col" v-if="Object.keys(data)[1]">
  198. <span class="state-title">{{ Object.values(data)[1] }} :</span>
  199. <span class="state-val">{{
  200. (monitorData.length > 0 && monitorData[groupNum - 1][Object.keys(data)[1]])
  201. >= 0
  202. ? monitorData[groupNum - 1][Object.keys(data)[1]] ?
  203. parseFloat(monitorData[groupNum -
  204. 1][Object.keys(data)[1]]).toFixed(2) : '-'
  205. : '-'
  206. }}</span>
  207. </div>
  208. </div>
  209. </div>
  210. <div class="monitor-box monitor-box1 ">
  211. <div class="parameter-title device-parameter-title">
  212. <SvgIcon class="icon" size="32" name="device-paramer" /><span>蝶阀故障数据</span>
  213. </div>
  214. <div class="state-box">
  215. <div class="state-item" v-for="(data, index) in deviceParameterData" :key="index">
  216. <div class="item-col">
  217. <span class="state-title1">{{ Object.values(data)[0] }} :</span>
  218. <span class="state-val1">
  219. <!-- {{
  220. (monitorData.length > 0 && monitorData[groupNum - 1][Object.keys(data)[0]]) >= 0
  221. ? monitorData[groupNum - 1][Object.keys(data)[0]]
  222. : '-'
  223. }} -->
  224. <span v-if="monitorData[groupNum - 1][Object.keys(data)[0]] === true"
  225. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: red;"></span>
  226. <span
  227. v-else-if="monitorData[groupNum - 1][Object.keys(data)[0]] === false"
  228. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: greenyellow;"></span>
  229. <span v-else
  230. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: #ccc;"></span>
  231. </span>
  232. </div>
  233. <div class="item-col" v-if="Object.keys(data)[1]">
  234. <span class="state-title1">{{ Object.values(data)[1] }} :</span>
  235. <span class="state-val1">
  236. <!-- {{
  237. (monitorData.length > 0 && monitorData[groupNum - 1][Object.keys(data)[1]]) >= 0
  238. ? monitorData[groupNum - 1][Object.keys(data)[1]]
  239. : '-'
  240. }} -->
  241. <span v-if="monitorData[groupNum - 1][Object.keys(data)[1]] === true"
  242. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: red;"></span>
  243. <span
  244. v-else-if="monitorData[groupNum - 1][Object.keys(data)[1]] === false"
  245. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: greenyellow;"></span>
  246. <span v-else
  247. style="display: inline-block; width: 10px;height: 10px;border-radius: 50%;background-color: #ccc;"></span>
  248. </span>
  249. </div>
  250. </div>
  251. </div>
  252. </div>
  253. </template>
  254. </ventBox1>
  255. </div>
  256. <!-- <div class="item item-l">
  257. <ventBox1 class="vent-margin-t-10">
  258. <template #title>
  259. <div>下风测详情</div>
  260. </template>
  261. <template #container>
  262. <div class="monitor-box">
  263. <div class="state-item" v-for="(data, index) in downWindData" :key="index">
  264. <div class="item-col">
  265. <span class="state-title">{{ Object.values(data)[0] }} :</span>
  266. <span class="state-val">{{
  267. (monitorData.length > 0 && monitorData[0][Object.keys(data)[0]]) >= 0
  268. ? monitorData[0][Object.keys(data)[0]] ?
  269. parseFloat(monitorData[0][Object.keys(data)[0]]).toFixed(2) : '-'
  270. : '-'
  271. }}</span>
  272. </div>
  273. <div class="item-col" v-if="Object.keys(data)[1]">
  274. <span class="state-title">{{ Object.values(data)[1] }} :</span>
  275. <span class="state-val">{{
  276. (monitorData.length > 0 && monitorData[0][Object.keys(data)[1]]) >= 0
  277. ? monitorData[0][Object.keys(data)[1]] ?
  278. parseFloat(monitorData[0][Object.keys(data)[1]]).toFixed(2) : '-'
  279. : '-'
  280. }}</span>
  281. </div>
  282. </div>
  283. </div>
  284. </template>
  285. </ventBox1>
  286. </div> -->
  287. </div>
  288. <!-- 右边控制状态 -->
  289. <div class="lr-box right-box">
  290. <ventBox1>
  291. <template #title>
  292. <div>远程控制</div>
  293. </template>
  294. <template #container>
  295. <div class="control-group">
  296. <div class="control-item" v-for="(groupNum, index) in monitorDataGroupNum" :key="groupNum">
  297. <div class="control-item-title">{{ monitorData[groupNum - 1]['strname'] }}</div>
  298. <div class="control-item-state">
  299. <a-button v-if="index == 0" size="small" type="text" style="color: #fff;"
  300. @click="handlerDevice(airCompressorState[groupNum - 1], false)">主机启动</a-button>
  301. <a-button v-else size="small" type="text" style="color: #fff;"
  302. @click="handlerDevice(airCompressorState[groupNum - 1], false)">一键启停11</a-button>
  303. </div>
  304. </div>
  305. <div class="control-item" v-for="(groupNum, index) in monitorDataGroupNum" :key="groupNum">
  306. <div class="control-item-title">{{ monitorData[groupNum - 1]['strname'] }}</div>
  307. <div class="control-item-state">
  308. <a-button v-if="index == 0" size="small" type="text" style="color: #fff;"
  309. @click="handlerDevice(airCompressorState[groupNum - 1], true)">主机停止</a-button>
  310. <a-button v-else size="small" type="text" style="color: #fff;"
  311. @click="handlerDevice(airCompressorState[groupNum - 1], true)">一键复位</a-button>
  312. </div>
  313. </div>
  314. <div class="control-item" v-for="(groupNum, index) in monitorDataGroupNum" :key="groupNum">
  315. <div class="control-item-title">{{ monitorData[groupNum - 1]['strname'] }}</div>
  316. <div class="control-item-state">
  317. <a-button v-if="index == 0" size="small" type="text" style="color: #fff;"
  318. @click="handlerDevice(airCompressorState[groupNum - 1], true)">主机进气蝶阀开</a-button>
  319. <a-button v-else size="small" type="text" style="color: #fff;"
  320. @click="handlerDevice(airCompressorState[groupNum - 1], true)">一键复位</a-button>
  321. </div>
  322. </div>
  323. </div>
  324. </template>
  325. </ventBox1>
  326. <ventBox1 class="vent-margin-t-10">
  327. <template #title>
  328. <div>设备实时监测曲线</div>
  329. </template>
  330. <template #container>
  331. <BarAndLine v-if="chartsColumns.length > 0" xAxisPropType="readTime" :dataSource="echartData"
  332. height="340px" :chartsColumns="chartsColumns" chartsType="listMonitor"
  333. :option="echatsOption" />
  334. <!-- :option="zhudanOption" -->
  335. </template>
  336. </ventBox1>
  337. </div>
  338. </div>
  339. </div>
  340. </div>
  341. <HandleModal :modal-is-show="modalIsShow" :modal-title="modalTitle" :modal-type="modalType" @handle-ok="handleOK"
  342. @handle-cancel="handleCancel" />
  343. </template>
  344. <script lang="ts" setup name="nitrogenHome">
  345. import { onMounted, onUnmounted, ref, watch, reactive, defineProps, nextTick, inject, computed } from 'vue';
  346. import ventBox1 from '/@/components/vent/ventBox1.vue';
  347. import fourBorderBg from '../../../comment/components/fourBorderBg.vue';
  348. import { mountedThree, destroy, setModelType, addText } from '../nitrogen.threejs';
  349. import { getDevice } from '../nitrogen.api';
  350. import { SvgIcon } from '/@/components/Icon';
  351. import BarAndLine from '/@/components/chart/BarAndLine.vue';
  352. import HandleModal from './modal.vue';
  353. import { deviceControlApi } from '/@/api/vent/index';
  354. import { message } from 'ant-design-vue';
  355. import lodash from 'lodash';
  356. const globalConfig = inject('globalConfig');
  357. const props = defineProps({
  358. deviceId: {
  359. type: String,
  360. require: true,
  361. },
  362. modalType: {
  363. type: String,
  364. require: true,
  365. },
  366. });
  367. const refresh = ref(false)
  368. const modalTitle = ref(''); // 模态框标题显示内容,根据设备操作类型决定
  369. const modalType = ref(''); // 模态框内容显示类型,设备操作类型
  370. const modalIsShow = ref<boolean>(false); // 是否显示模态框
  371. const loading = ref(true);
  372. let kzParam = reactive<any>({
  373. data: {},
  374. isFw: null,
  375. });
  376. // const kyjs = ['1号空压机', '1号空压机', '1号空压机', '1号空压机'];
  377. const flvURL1 = () => {
  378. // return `https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv`;
  379. return '';
  380. };
  381. const colors = ['#FDB146', '#EE6666', '#9BCB75', '#03C2EC', '#DA3914', '#9C83D9']
  382. const echatsOption = {
  383. grid: {
  384. top: '35%',
  385. left: '-25px',
  386. right: '10px',
  387. bottom: '3%',
  388. containLabel: true
  389. },
  390. toolbox: {
  391. feature: {}
  392. }
  393. }
  394. const monitorDataGroupNum = ref(0);
  395. const monitorNetStatus = ref(0)
  396. let airCompressorState = reactive<any[]>([]);
  397. const groupParameterData = [
  398. {
  399. flow: '流量(m³/h)',
  400. total_flow: '总流量(m³)',
  401. },
  402. {
  403. single_flow: '单次流量(m³/h)',
  404. oxygen_concentration: '氧浓度(%)',
  405. },
  406. ];
  407. const deviceParameterData = [
  408. {
  409. bv_1_load_short: '负载短路故障',
  410. bv_1_motor_leakage: '电机漏电故障',
  411. },
  412. {
  413. bv_1_low_voltage: '电压过低故障',
  414. bv_1_high_voltage: '电压过高故障',
  415. },
  416. {
  417. bv_1_supply_phase: '电源缺相故障',
  418. bv_1_valve_position: '阀位故障',
  419. },
  420. {
  421. bv_1_closing_overtorque: '关向过力矩故障',
  422. bv_1_opening_overtorque: '开向过力矩故障',
  423. },
  424. {
  425. bv_1_closing_overcurrent: '关向过电流故障',
  426. bv_1_opening_overcurrent: '开向过电流故障',
  427. },
  428. {
  429. bv_1_closing_timeout: '关向超时故障',
  430. bv_1_opening_timeout: '开向超时故障',
  431. },
  432. {
  433. bv_1_thermal_overload: '热过载故障',
  434. },
  435. ];
  436. const downWindData = [
  437. {
  438. o2Val: '下风侧氧气(%)',
  439. temperature: '下风测温度(℃)',
  440. },
  441. {
  442. fumes: '下风测烟雾(­%)',
  443. },
  444. ];
  445. const propTypeArr = ref([])
  446. const chartsColumns = ref([])
  447. watch(monitorDataGroupNum, () => {
  448. const arr = <any[]>[]
  449. const item = {
  450. legend: '瞬时流量',
  451. seriesName: '(m³/h)',
  452. ymax: 5,
  453. yname: 'm³/h',
  454. linetype: 'line',
  455. yaxispos: 'left',
  456. color: '#FDB146',
  457. sort: 1,
  458. xRotate: 0,
  459. dataIndex: 'InputFlux',
  460. }
  461. const propTypeList = []
  462. for (let i = 1; i <= monitorDataGroupNum.value; i++) {
  463. const lineType = lodash.cloneDeep(item)
  464. lineType.legend = `制氮机${i}瞬时流量`;
  465. lineType.dataIndex = `InputFlux${i}`
  466. lineType.color = colors[i - 1]
  467. arr.push(lineType)
  468. }
  469. chartsColumns.value = arr
  470. })
  471. const monitorData = ref(
  472. new Array(3).fill({
  473. // strName: '空压机',
  474. // cumulativeFlow: '-',
  475. // centerTemperature: '-',
  476. // outletTemperature: '-',
  477. // Ia: '-',
  478. // Ib: '-',
  479. // Ic: '-',
  480. // Vab: '-',
  481. // Vac: '-',
  482. // Vbc: '-',
  483. // compressGroupName: '',
  484. // compressExhaustPressF1: '-',
  485. // compressSeparatePressF1: '-',
  486. // compressHostTempF1: '-',
  487. // compressCrewTempF1: '-',
  488. // compressRunTimeF1: '-',
  489. // controlModel: 'LOC'
  490. })
  491. );
  492. //图表数据
  493. let echartData = ref<any>([]);
  494. // https获取监测数据
  495. let timer: null | NodeJS.Timeout = null;
  496. async function getMonitor(flag?) {
  497. if (Object.prototype.toString.call(timer) === '[object Null]') {
  498. timer = await setTimeout(
  499. async () => {
  500. if (props.deviceId) {
  501. await getDataSource(props.deviceId);
  502. }
  503. if (timer) {
  504. timer = null;
  505. }
  506. await getMonitor();
  507. },
  508. flag ? 0 : 3000
  509. );
  510. }
  511. }
  512. async function getDataSource(systemID) {
  513. const res = await getDevice({ devicetype: 'sys', systemID, type: 'all' });
  514. console.log(res, 'res---------------');
  515. if (res) {
  516. const result = res;
  517. if (!result || result.msgTxt.length < 1) return;
  518. result.msgTxt.forEach((item) => {
  519. if (item.type && item.type.startsWith('nitrogen')) {
  520. airCompressorState.length = 0;
  521. let netStatus = 0
  522. monitorData.value = item['datalist'].filter((data) => {
  523. const readData = data.readData;
  524. if (data['netStatus'] == 1) {
  525. netStatus = 1
  526. }
  527. airCompressorState.push({
  528. id: data.deviceID,
  529. deviceType: data.deviceType,
  530. HMIReset: readData.HMIReset,
  531. HMIStartStop: readData.HMIStartStop
  532. });
  533. return Object.assign(data, readData);
  534. });
  535. monitorNetStatus.value = netStatus
  536. console.log(monitorData, 'monitorData.value---===')
  537. const airCompressor = { readTime: monitorData.value[0]['readTime'].substring(11) }
  538. const dataArr = lodash.cloneDeep(echartData.value)
  539. //图表数据
  540. if (dataArr.length <= 5) {
  541. monitorData.value.forEach((el, index) => {
  542. airCompressor[`InputFlux${index + 1}`] = el['InputFlux'] || 0
  543. });
  544. dataArr.push(airCompressor)
  545. } else {
  546. dataArr.shift()
  547. dataArr.push(airCompressor)
  548. }
  549. echartData.value = dataArr
  550. }
  551. });
  552. monitorDataGroupNum.value = monitorData.value.length;
  553. refresh.value = true
  554. nextTick(() => {
  555. refresh.value = false
  556. })
  557. }
  558. }
  559. function handlerDevice(data, bol) {
  560. console.log(bol, 'bol-------')
  561. kzParam.data = data;
  562. kzParam.isFw = bol;
  563. console.log(kzParam, 'kz--------')
  564. if (bol) {
  565. modalTitle.value = '一键复位';
  566. modalType.value = '1';
  567. modalIsShow.value = true;
  568. kzParam.data.HMIReset = !data.HMIReset
  569. } else {
  570. modalTitle.value = '一键启停';
  571. modalType.value = '2';
  572. modalIsShow.value = true;
  573. kzParam.data.HMIStartStop = !data.HMIStartStop;
  574. }
  575. }
  576. function handleOK(passWord, handlerState) {
  577. console.log(kzParam, 'kz----------');
  578. // if (passWord !== '123456') {
  579. // message.warning('密码不正确,请重新输入');
  580. // return;
  581. // }
  582. let data = {};
  583. if (kzParam.isFw) {
  584. data = {
  585. deviceid: kzParam.data.id,
  586. devicetype: kzParam.data.deviceType,
  587. password: passWord,
  588. HMIReset: kzParam.data.HMIReset,
  589. };
  590. } else {
  591. data = {
  592. deviceid: kzParam.data.id,
  593. password: passWord,
  594. devicetype: kzParam.data.deviceType,
  595. HMIStartStop: kzParam.data.HMIStartStop,
  596. };
  597. }
  598. deviceControlApi(data).then((res) => {
  599. // 模拟时开启
  600. if (res.success) {
  601. modalIsShow.value = false;
  602. getDataSource(props.deviceId);
  603. if (globalConfig.History_Type == 'remote') {
  604. message.success('指令已下发至生产管控平台成功!')
  605. } else {
  606. message.success('指令已下发成功!')
  607. }
  608. }
  609. });
  610. }
  611. function handleCancel() {
  612. modalIsShow.value = false;
  613. modalTitle.value = '';
  614. modalType.value = '';
  615. }
  616. watch([monitorDataGroupNum, loading], ([newMonitorDataGroupNum, newLoading]) => {
  617. nextTick(() => {
  618. if (newMonitorDataGroupNum && !newLoading) {
  619. setModelType(props.modalType, newMonitorDataGroupNum);
  620. }
  621. });
  622. });
  623. onMounted(async () => {
  624. await getMonitor(true);
  625. await mountedThree().then(() => {
  626. loading.value = false;
  627. });
  628. });
  629. onUnmounted(() => {
  630. destroy();
  631. if (timer) {
  632. clearTimeout(timer);
  633. timer = undefined;
  634. }
  635. });
  636. </script>
  637. <style lang="less" scoped>
  638. @ventSpace: zxm;
  639. .nitrogen-box {
  640. width: 100%;
  641. height: 100%;
  642. display: flex;
  643. justify-content: center;
  644. }
  645. #nitrogenCss3D {
  646. .modal-monitor {
  647. width: 200px;
  648. position: absolute;
  649. left: 0px;
  650. top: 0px;
  651. }
  652. &:deep(.win) {
  653. margin: 0 !important;
  654. background: #00000044;
  655. }
  656. }
  657. .nitrogen-home {
  658. width: 100%;
  659. height: 100%;
  660. position: fixed;
  661. z-index: 9999;
  662. display: flex;
  663. flex-direction: column;
  664. justify-content: center;
  665. align-items: center;
  666. pointer-events: none;
  667. top: 20px;
  668. .nitrogen-container {
  669. width: 100%;
  670. height: calc(100%);
  671. display: flex;
  672. justify-content: space-between;
  673. margin-bottom: 100px;
  674. .top-box {
  675. margin-top: 40px; //lxh
  676. width: 100%;
  677. padding: 10px;
  678. overflow: hidden;
  679. display: flex;
  680. justify-content: space-between;
  681. .lr-box {
  682. height: fit-content;
  683. display: flex;
  684. flex-direction: column;
  685. position: relative;
  686. overflow: hidden;
  687. z-index: 9999;
  688. pointer-events: auto;
  689. }
  690. .item {
  691. width: 335px;
  692. height: auto;
  693. position: relative;
  694. border-radius: 5px;
  695. margin-top: 10px;
  696. margin-bottom: 0px;
  697. pointer-events: auto;
  698. color: #fff;
  699. overflow: hidden;
  700. &:first-child {
  701. margin-top: 0px;
  702. }
  703. .base-title {
  704. color: #fff;
  705. margin-bottom: 8px;
  706. padding-left: 10px;
  707. position: relative;
  708. font-size: 16px;
  709. &::after {
  710. content: '';
  711. position: absolute;
  712. display: block;
  713. width: 4px;
  714. height: 12px;
  715. top: 7px;
  716. left: 0px;
  717. background: #45d3fd;
  718. border-radius: 4px;
  719. }
  720. }
  721. .state-item {
  722. display: flex;
  723. flex-direction: row;
  724. padding: 5px;
  725. .item-col {
  726. width: calc(50% - 5px);
  727. display: flex;
  728. justify-content: center;
  729. align-items: center;
  730. padding-right: 4px;
  731. background-image: linear-gradient(to right, #39a3ff00, #39a3ff10);
  732. &:first-child {
  733. margin-right: 10px;
  734. }
  735. .state-title {
  736. color: #ffffffcc;
  737. flex: 9;
  738. font-size: 14px;
  739. }
  740. .state-val {
  741. flex: 1;
  742. color: #00eefffe;
  743. margin-right: 5px;
  744. text-align: right;
  745. font-size: 14px;
  746. }
  747. .state-title1 {
  748. color: #ffffffcc;
  749. flex: 2.5;
  750. font-size: 14px;
  751. }
  752. .state-val1 {
  753. display: flex;
  754. flex: 1;
  755. justify-content: center;
  756. align-items: center;
  757. }
  758. }
  759. }
  760. .signal-box {
  761. margin: 5px 0;
  762. display: flex;
  763. align-items: center;
  764. .signal-title {
  765. color: #7af5ff;
  766. margin: 0 5px;
  767. }
  768. &:last-child {
  769. margin-right: 0px;
  770. }
  771. }
  772. .list-item {
  773. padding: 0 10px;
  774. display: flex;
  775. justify-content: space-between;
  776. align-items: center;
  777. .item-data-key {
  778. color: #ffffff99;
  779. }
  780. }
  781. .item-data-box {
  782. color: #fff;
  783. .state-icon {
  784. display: inline-block;
  785. width: 12px;
  786. height: 12px;
  787. border-radius: 12px;
  788. }
  789. .open {
  790. border: 5px solid #133a56;
  791. background: #4ecb73;
  792. }
  793. .close {
  794. border: 5px solid #192961;
  795. background: #6d7898;
  796. }
  797. }
  798. }
  799. .item-l {
  800. width: 100%;
  801. .monitor-box {
  802. width: 100%;
  803. .parameter-title {
  804. position: relative;
  805. width: 100%;
  806. height: 14px;
  807. margin-top: 10px;
  808. .icon,
  809. span {
  810. position: absolute;
  811. top: -10px;
  812. }
  813. }
  814. .group-parameter-title {
  815. background-image: linear-gradient(to right, #39a3ff50, #39a3ff00);
  816. .icon {
  817. left: -12px;
  818. top: -17px;
  819. }
  820. span {
  821. left: 18px;
  822. }
  823. .item-col {
  824. background-image: linear-gradient(to right, #39a3ff00, #39a3ff10);
  825. }
  826. }
  827. .device-parameter-title {
  828. background-image: linear-gradient(to right, #3df6ff40, #3df6ff00);
  829. .icon {
  830. left: -10px;
  831. top: -14px;
  832. }
  833. span {
  834. left: 18px;
  835. }
  836. .item-col {
  837. background-image: linear-gradient(to right, #3df6ff10, #3df6ff00);
  838. }
  839. }
  840. }
  841. .monitor-box1 {
  842. height: 140px;
  843. }
  844. .state-box {
  845. height: calc(100% - 24px);
  846. overflow-y: auto;
  847. }
  848. }
  849. .right-box {
  850. width: 330px;
  851. margin-top: 50px;
  852. .control-group {
  853. display: flex;
  854. // justify-content: space-around;
  855. flex-wrap: wrap;
  856. .control-item {
  857. width: 50%; //lxh
  858. display: flex;
  859. flex-direction: column;
  860. justify-content: center;
  861. align-items: center;
  862. padding: 0 4px;
  863. .control-item-title {
  864. color: #a6dce9;
  865. position: relative;
  866. top: 5px;
  867. }
  868. .control-item-state {
  869. width: 94px;
  870. height: 47px;
  871. background: url('/@/assets/images/vent/control-switch-bg.png');
  872. display: flex;
  873. justify-content: center;
  874. align-items: center;
  875. color: #fff;
  876. }
  877. .button-box {
  878. position: relative;
  879. padding: 5px;
  880. border: 1px transparent solid;
  881. background-clip: border-box;
  882. border-radius: 5px;
  883. margin-left: 8px;
  884. }
  885. .a-button {
  886. pointer-events: auto;
  887. }
  888. &::v-deep .a-button--mini {
  889. padding: 6px 10px;
  890. }
  891. &::v-deep .a-button--mini.is-round {
  892. padding: 6px 10px;
  893. }
  894. }
  895. }
  896. }
  897. .left-box {
  898. width: 365px;
  899. margin-top: 80px;
  900. }
  901. }
  902. &:deep(.win) {
  903. width: 100%;
  904. margin: 0 !important;
  905. }
  906. }
  907. }
  908. &:deep(.main) {
  909. .title {
  910. height: 34px;
  911. text-align: center;
  912. font-weight: 600;
  913. color: #7af5ff;
  914. // background-image: url('../../../assets/img/yfj/light.png');
  915. background-repeat: no-repeat;
  916. background-position-x: center;
  917. background-position-y: 100%;
  918. background-size: 80%;
  919. font-size: 16px;
  920. }
  921. .monitor-item {
  922. width: 200px;
  923. // width: auto;
  924. display: flex;
  925. flex-direction: row;
  926. justify-content: space-between;
  927. margin-bottom: 3px;
  928. .monitor-title {
  929. display: flex;
  930. flex: 2;
  931. justify-content: center;
  932. align-items: center;
  933. color: #7af5ff;
  934. font-weight: 400;
  935. font-size: 14px;
  936. }
  937. .monitor-val {
  938. color: #ffb700;
  939. display: flex;
  940. // width: auto;
  941. flex: 1;
  942. justify-content: center;
  943. align-items: center;
  944. .val {
  945. width: 100%;
  946. text-align: center;
  947. font-size: 14px;
  948. }
  949. // .unit {
  950. // color: #ffffffbb;
  951. // font-size: 14px;
  952. // }
  953. }
  954. }
  955. .signal-item {
  956. display: flex;
  957. justify-content: space-between;
  958. // margin-bottom: 5px;
  959. .signal-round {
  960. display: inline-block;
  961. width: 8px;
  962. height: 8px;
  963. border-radius: 50%;
  964. margin: 0 10px;
  965. position: relative;
  966. &::after {
  967. display: block;
  968. content: '';
  969. position: absolute;
  970. width: 12px;
  971. height: 12px;
  972. top: -2px;
  973. left: -2px;
  974. border-radius: 50%;
  975. }
  976. }
  977. .signal-round-gry {
  978. background-color: #858585;
  979. &::after {
  980. background-color: #85858544;
  981. box-shadow: 0 0 1px 1px #85858599;
  982. }
  983. }
  984. .signal-round-run {
  985. background-color: #67fc00;
  986. &::after {
  987. background-color: #67fc0044;
  988. box-shadow: 0 0 1px 1px #c6ff77;
  989. }
  990. }
  991. .signal-round-warning {
  992. background-color: #e9170b;
  993. &::after {
  994. background-color: #e9170b44;
  995. box-shadow: 0 0 1px 1px #e9170b;
  996. }
  997. }
  998. }
  999. }
  1000. :deep(.zxm-radio-wrapper) {
  1001. color: #fff !important;
  1002. }
  1003. </style>