nitrogenHome2.vue 53 KB

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