nitrogenHome_bd.vue 53 KB

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