nitrogenHome2.vue 43 KB

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