nitrogenHome_bd.vue 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478
  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[1], '备机启动')">备机启动</div>
  51. <div class="button-box" @click="handlerDevice(airCompressorState[1], '备机停止')">备机停止</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. };
  808. break;
  809. case '备机启动':
  810. data = {
  811. deviceid: kzParam.data.id,
  812. devicetype: kzParam.data.deviceType,
  813. password: passWord,
  814. b_start: '1',
  815. };
  816. break;
  817. case '主机停止':
  818. data = {
  819. deviceid: kzParam.data.id,
  820. devicetype: kzParam.data.deviceType,
  821. password: passWord,
  822. m_stop: '0',
  823. };
  824. break;
  825. case '备机停止':
  826. data = {
  827. deviceid: kzParam.data.id,
  828. devicetype: kzParam.data.deviceType,
  829. password: passWord,
  830. b_stop: '0',
  831. };
  832. break;
  833. }
  834. deviceControlApi(data).then((res) => {
  835. // 模拟时开启
  836. if (res.success) {
  837. modalIsShow.value = false;
  838. getDataSource(props.deviceId);
  839. if (globalConfig.History_Type == 'remote') {
  840. message.success('指令已下发至生产管控平台成功!')
  841. } else {
  842. message.success('指令已下发成功!')
  843. }
  844. }
  845. });
  846. }
  847. function handleCancel() {
  848. modalIsShow.value = false;
  849. modalTitle.value = '';
  850. modalType.value = '';
  851. }
  852. watch([monitorDataGroupNum, loading], ([newMonitorDataGroupNum, newLoading]) => {
  853. nextTick(() => {
  854. if (newMonitorDataGroupNum && !newLoading) {
  855. setModelType(props.modalType, newMonitorDataGroupNum);
  856. }
  857. });
  858. });
  859. watch(() => props.deviceId, async(deviceId) => {
  860. if(deviceId){
  861. await getCamera(deviceId, playerRef.value, );
  862. }
  863. })
  864. onBeforeUnmount(() => {
  865. removeCamera();
  866. });
  867. onMounted(async () => {
  868. await getMonitor(true);
  869. await mountedThree().then(() => {
  870. loading.value = false;
  871. });
  872. await getCamera(props.deviceId, playerRef.value);
  873. });
  874. onUnmounted(() => {
  875. destroy();
  876. removeCamera()
  877. if (timer) {
  878. clearTimeout(timer);
  879. timer = undefined;
  880. }
  881. });
  882. </script>
  883. <style lang="less" scoped>
  884. @ventSpace: zxm;
  885. .nitrogen-box {
  886. width: 100%;
  887. height: 100%;
  888. display: flex;
  889. justify-content: center;
  890. }
  891. #nitrogenCss3D {
  892. .modal-monitor {
  893. width: 200px;
  894. position: absolute;
  895. left: 0px;
  896. top: 0px;
  897. }
  898. &:deep(.win) {
  899. margin: 0 !important;
  900. background: #00000044;
  901. }
  902. }
  903. .nitrogen-home {
  904. width: 100%;
  905. height: 100%;
  906. position: fixed;
  907. z-index: 9999;
  908. display: flex;
  909. flex-direction: column;
  910. justify-content: center;
  911. align-items: center;
  912. pointer-events: none;
  913. top: 20px;
  914. .nitrogen-container {
  915. width: 100%;
  916. height: calc(100% - 100px);
  917. display: flex;
  918. justify-content: space-between;
  919. margin-bottom: 100px;
  920. .top-box {
  921. // margin-top: 40px; //lxh
  922. position: relative;
  923. width: 100%;
  924. padding: 10px;
  925. overflow: hidden;
  926. display: flex;
  927. justify-content: space-between;
  928. .center-item-box {
  929. position: absolute;
  930. left: 50%;
  931. top: 50px;
  932. transform: translate(-48%, 0);
  933. width: calc(100% - 760px);
  934. height: 50px;
  935. display: flex;
  936. align-items: center;
  937. pointer-events: auto;
  938. .top-left {
  939. display: flex;
  940. flex: 2;
  941. color: #fff;
  942. .button-box {
  943. position: relative;
  944. width: auto;
  945. height: 32px;
  946. display: flex;
  947. align-items: center;
  948. justify-content: center;
  949. border-radius: 5px;
  950. color: #fff;
  951. padding: 10px 15px;
  952. margin: 0px 10px;
  953. box-sizing: border-box;
  954. cursor: pointer;
  955. background: linear-gradient(#1fa6cb, #127cb5);
  956. }
  957. }
  958. .top-center{
  959. display: flex;
  960. flex: 1;
  961. justify-content: center;
  962. align-items: center;
  963. font-size: 20px;
  964. color: #fff;
  965. .top-c-label{
  966. color: yellow;
  967. }
  968. }
  969. .top-right {
  970. display: flex;
  971. flex: 2;
  972. justify-content: right;
  973. align-items: center;
  974. color: #fff;
  975. .control-type {
  976. display: flex;
  977. color: #fff;
  978. .control-title {
  979. color: #73e8fe;
  980. }
  981. }
  982. }
  983. }
  984. .footer-item-box {
  985. width: calc(100% - 20px);
  986. height: auto;
  987. position: absolute;
  988. left: 50%;
  989. bottom: 30px;
  990. transform: translate(-50%);
  991. display: flex;
  992. justify-content: center;
  993. color: #fff;
  994. // box-shadow: 0 0 30px rgb(0, 153, 184) inset;
  995. pointer-events: auto;
  996. .device-detail {
  997. text-align: center;
  998. &:first-child {
  999. background-color: #00bbff11;
  1000. }
  1001. &:last-child {
  1002. .device-val,
  1003. .device-title {
  1004. border-right: 1px solid #00baffd4;
  1005. }
  1006. }
  1007. .device-val {
  1008. line-height: 36px;
  1009. border-top: 1px solid #00baffd4;
  1010. border-left: 1px solid #00baffd4;
  1011. &:last-child {
  1012. border-bottom: 1px solid #00baffd4;
  1013. }
  1014. }
  1015. }
  1016. .device-title {
  1017. width: 110px;
  1018. text-align: center;
  1019. border-top: 1px solid #00baffd4;
  1020. border-left: 1px solid #00baffd4;
  1021. line-height: 46px;
  1022. color: #00e5ff;
  1023. background-color: #00bbff21;
  1024. }
  1025. }
  1026. .lr-box {
  1027. height: fit-content;
  1028. display: flex;
  1029. flex-direction: column;
  1030. position: relative;
  1031. overflow: hidden;
  1032. z-index: 9999;
  1033. pointer-events: auto;
  1034. }
  1035. .item {
  1036. width: 335px;
  1037. height: auto;
  1038. position: relative;
  1039. border-radius: 5px;
  1040. margin-top: 10px;
  1041. margin-bottom: 0px;
  1042. pointer-events: auto;
  1043. color: #fff;
  1044. overflow: hidden;
  1045. &:first-child {
  1046. margin-top: 0px;
  1047. }
  1048. .base-title {
  1049. color: #fff;
  1050. margin-bottom: 8px;
  1051. padding-left: 10px;
  1052. position: relative;
  1053. font-size: 16px;
  1054. &::after {
  1055. content: '';
  1056. position: absolute;
  1057. display: block;
  1058. width: 4px;
  1059. height: 12px;
  1060. top: 7px;
  1061. left: 0px;
  1062. background: #45d3fd;
  1063. border-radius: 4px;
  1064. }
  1065. }
  1066. .state-item {
  1067. display: flex;
  1068. flex-direction: row;
  1069. padding: 5px;
  1070. .item-col {
  1071. width: calc(50% - 5px);
  1072. display: flex;
  1073. justify-content: center;
  1074. align-items: center;
  1075. padding-right: 4px;
  1076. background-image: linear-gradient(to right, #39a3ff00, #39a3ff10);
  1077. &:first-child {
  1078. margin-right: 10px;
  1079. }
  1080. .state-title {
  1081. color: #ffffffcc;
  1082. flex: 9;
  1083. font-size: 14px;
  1084. }
  1085. .state-val {
  1086. flex: 1;
  1087. color: #00eefffe;
  1088. margin-right: 5px;
  1089. text-align: right;
  1090. font-size: 14px;
  1091. }
  1092. .state-title1 {
  1093. color: #ffffffcc;
  1094. flex: 5;
  1095. font-size: 14px;
  1096. }
  1097. .state-val1 {
  1098. display: flex;
  1099. flex: 1;
  1100. justify-content: center;
  1101. align-items: center;
  1102. }
  1103. }
  1104. }
  1105. .signal-box {
  1106. margin: 5px 0;
  1107. display: flex;
  1108. align-items: center;
  1109. .signal-title {
  1110. color: #7af5ff;
  1111. margin: 0 5px;
  1112. }
  1113. &:last-child {
  1114. margin-right: 0px;
  1115. }
  1116. }
  1117. .list-item {
  1118. padding: 0 10px;
  1119. display: flex;
  1120. justify-content: space-between;
  1121. align-items: center;
  1122. .item-data-key {
  1123. color: #ffffff99;
  1124. }
  1125. }
  1126. .item-data-box {
  1127. color: #fff;
  1128. .state-icon {
  1129. display: inline-block;
  1130. width: 12px;
  1131. height: 12px;
  1132. border-radius: 12px;
  1133. }
  1134. .open {
  1135. border: 5px solid #133a56;
  1136. background: #4ecb73;
  1137. }
  1138. .close {
  1139. border: 5px solid #192961;
  1140. background: #6d7898;
  1141. }
  1142. }
  1143. }
  1144. .item-l {
  1145. width: 100%;
  1146. .monitor-box {
  1147. width: 100%;
  1148. .parameter-title {
  1149. position: relative;
  1150. width: 100%;
  1151. height: 14px;
  1152. margin-top: 10px;
  1153. .icon,
  1154. span {
  1155. position: absolute;
  1156. top: -10px;
  1157. }
  1158. }
  1159. .group-parameter-title {
  1160. background-image: linear-gradient(to right, #39a3ff50, #39a3ff00);
  1161. .icon {
  1162. left: -12px;
  1163. top: -17px;
  1164. }
  1165. span {
  1166. left: 18px;
  1167. }
  1168. .item-col {
  1169. background-image: linear-gradient(to right, #39a3ff00, #39a3ff10);
  1170. }
  1171. }
  1172. .device-parameter-title {
  1173. background-image: linear-gradient(to right, #3df6ff40, #3df6ff00);
  1174. .icon {
  1175. left: -10px;
  1176. top: -14px;
  1177. }
  1178. span {
  1179. left: 18px;
  1180. }
  1181. .item-col {
  1182. background-image: linear-gradient(to right, #3df6ff10, #3df6ff00);
  1183. }
  1184. }
  1185. }
  1186. // .monitor-box1 {
  1187. // height: 126px;
  1188. // }
  1189. .state-box {
  1190. height: calc(100% - 24px);
  1191. overflow-y: auto;
  1192. }
  1193. }
  1194. .right-box {
  1195. width: 330px;
  1196. margin-top: 50px;
  1197. }
  1198. .left-box {
  1199. width: 365px;
  1200. margin-top: 80px;
  1201. }
  1202. }
  1203. &:deep(.win) {
  1204. width: 100%;
  1205. margin: 0 !important;
  1206. }
  1207. }
  1208. }
  1209. &:deep(.main) {
  1210. .title {
  1211. height: 34px;
  1212. text-align: center;
  1213. font-weight: 600;
  1214. color: #7af5ff;
  1215. // background-image: url('../../../assets/img/yfj/light.png');
  1216. background-repeat: no-repeat;
  1217. background-position-x: center;
  1218. background-position-y: 100%;
  1219. background-size: 80%;
  1220. font-size: 16px;
  1221. }
  1222. .monitor-item {
  1223. width: 200px;
  1224. display: flex;
  1225. flex-direction: row;
  1226. width: auto;
  1227. margin-bottom: 3px;
  1228. .monitor-val {
  1229. color: #ffb700;
  1230. display: flex;
  1231. width: auto;
  1232. .val {
  1233. width: 80px;
  1234. // font-size: 14px;
  1235. font-size: 16px;
  1236. }
  1237. .unit {
  1238. color: #ffffffbb;
  1239. // font-size: 14px;
  1240. font-size: 16px;
  1241. }
  1242. }
  1243. }
  1244. .monitor-title {
  1245. width: 100px;
  1246. color: #7af5ff;
  1247. font-weight: 400;
  1248. // font-size: 14px;
  1249. font-size: 16px;
  1250. }
  1251. .signal-item {
  1252. display: flex;
  1253. justify-content: space-between;
  1254. // margin-bottom: 5px;
  1255. .signal-round {
  1256. display: inline-block;
  1257. width: 8px;
  1258. height: 8px;
  1259. border-radius: 50%;
  1260. margin: 0 10px;
  1261. position: relative;
  1262. &::after {
  1263. display: block;
  1264. content: '';
  1265. position: absolute;
  1266. width: 12px;
  1267. height: 12px;
  1268. top: -2px;
  1269. left: -2px;
  1270. border-radius: 50%;
  1271. }
  1272. }
  1273. .signal-round-gry {
  1274. background-color: #858585;
  1275. &::after {
  1276. background-color: #85858544;
  1277. box-shadow: 0 0 1px 1px #85858599;
  1278. }
  1279. }
  1280. .signal-round-run {
  1281. background-color: #67fc00;
  1282. &::after {
  1283. background-color: #67fc0044;
  1284. box-shadow: 0 0 1px 1px #c6ff77;
  1285. }
  1286. }
  1287. .signal-round-warning {
  1288. background-color: #e9170b;
  1289. &::after {
  1290. background-color: #e9170b44;
  1291. box-shadow: 0 0 1px 1px #e9170b;
  1292. }
  1293. }
  1294. }
  1295. }
  1296. :deep(.zxm-radio-wrapper) {
  1297. color: #fff !important;
  1298. }
  1299. :deep(.zxm-radio-group) {
  1300. color: #fff !important;
  1301. }
  1302. :deep(.zxm-radio-group .zxm-radio-wrapper) {
  1303. color: #fff !important;
  1304. }
  1305. :deep(.zxm-radio-disabled + span){
  1306. color: #fff;
  1307. }
  1308. :deep(.zxm-radio-disabled .zxm-radio-inner::after){
  1309. background-color:#0490a8;
  1310. }
  1311. </style>