gasPumpHome.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. <template>
  2. <div class="monitor-container">
  3. <div id="FlowSensor" class="FlowSensor-box" style="position: absolute; display: none">
  4. <div class="elementContent" v-if="selectData['deviceType'] == 'pump_under' || selectData['deviceType'] == 'pump_n12m2pq'">
  5. <fourBorderBg>
  6. <template v-for="(item, index) in modelMonitor" :key="index">
  7. <div class="gas-monitor-row">
  8. <div class="title">{{ item.title }}</div>
  9. <div class="value">{{ selectData[item.code] ? selectData[item.code] : '-' }}</div>
  10. </div>
  11. </template>
  12. </fourBorderBg>
  13. <!-- <p style="color: #50c8fc;"><span class="data-title">抽采泵流量(m³):</span>{{ formatNum(selectData.FlowSensor_InputFlux) }}</p> -->
  14. </div>
  15. </div>
  16. <div v-if="selectData['netStatus'] == 0" class="device-state">网络断开</div>
  17. <div class="lr left-box">
  18. <div class="left-container">
  19. <div class="monitor-box">
  20. <ventBox1>
  21. <template #title>
  22. <div>瓦斯泵</div>
  23. </template>
  24. <template #container>
  25. <div v-for="key in 2" :key="key">
  26. <div class="parameter-title group-parameter-title"
  27. ><SvgIcon class="icon" size="14" name="pulp-title" /><span>{{ key }}#瓦斯泵磁力启动器</span></div
  28. >
  29. <div class="input-box">
  30. <div v-for="(item, index) in pumpMonitorData" class="input-item" :key="index">
  31. <div class="title">{{ item.title }}:</div>
  32. <template v-if="item.type !== 'sign' && item.type !== 'warning'">
  33. <div class="value">{{
  34. selectData && selectData[item.code.replace('Starter', `Starter${key + 4}`)]
  35. ? formatNum(selectData[item.code.replace('Starter', `Starter${key + 4}`)], 1)
  36. : '-'
  37. }}</div>
  38. </template>
  39. <template v-else>
  40. <div class="value">
  41. <span
  42. :class="{
  43. 'signal-round': true,
  44. 'signal-round-run': item.type === 'sign' && selectData[item.code.replace('Starter', `Starter${key + 4}`)] == '1',
  45. 'signal-round-gry': selectData[item.code.replace('Starter', `Starter${key + 4}`)] == '0',
  46. 'signal-round-warning': item.type === 'warning' && selectData[item.code.replace('Starter', `Starter${key + 4}`)] == '1',
  47. }"
  48. ></span>
  49. </div>
  50. </template>
  51. </div>
  52. </div>
  53. </div>
  54. </template>
  55. </ventBox1>
  56. <ventBox1 class="vent-margin-t-10">
  57. <template #title>
  58. <div>注水泵</div>
  59. </template>
  60. <template #container>
  61. <div v-for="key in 2" :key="key">
  62. <div class="parameter-title group-parameter-title"
  63. ><SvgIcon class="icon" size="14" name="pulp-title" /><span>{{ key }}#注水泵</span></div
  64. >
  65. <div class="input-box">
  66. <div v-for="(item, index) in waterPumpData" class="input-item" :key="index">
  67. <div class="title">{{ item.title }}:</div>
  68. <template v-if="item.type !== 'sign'">
  69. <div class="value">{{
  70. selectData && selectData[item.code.replace('WaterfloodPump', `WaterfloodPump${key}`)]
  71. ? formatNum(selectData[item.code.replace('WaterfloodPump', `WaterfloodPump${key}`)], 1)
  72. : '-'
  73. }}</div>
  74. </template>
  75. <template v-else>
  76. <div class="value">
  77. <span
  78. :class="{
  79. 'signal-round': true,
  80. 'signal-round-run': selectData[item.code.replace('WaterfloodPump', `WaterfloodPump${key}`)],
  81. 'signal-round-gry': selectData[item.code.replace('WaterfloodPump', `WaterfloodPump${key}`)] == '0',
  82. }"
  83. ></span>
  84. </div>
  85. </template>
  86. </div>
  87. </div>
  88. </div>
  89. </template>
  90. </ventBox1>
  91. <ventBox1 class="vent-margin-t-10">
  92. <template #title>
  93. <div>排水泵</div>
  94. </template>
  95. <template #container>
  96. <div v-for="key in 2" :key="key">
  97. <div class="parameter-title group-parameter-title"
  98. ><SvgIcon class="icon" size="14" name="pulp-title" /><span>{{ key }}#排水泵</span></div
  99. >
  100. <div class="input-box">
  101. <div v-for="(item, index) in dewateringPumpData" class="input-item" :key="index">
  102. <div class="title">{{ item.title }}:</div>
  103. <template v-if="item.type !== 'sign'">
  104. <div class="value">{{
  105. selectData && selectData[item.code.replace('DewateringPump', `DewateringPump${key}`)]
  106. ? formatNum(selectData[item.code.replace('DewateringPump', `DewateringPump${key}`)], 1)
  107. : '-'
  108. }}</div>
  109. </template>
  110. <template v-else>
  111. <div class="value">
  112. <span
  113. :class="{
  114. 'signal-round': true,
  115. 'signal-round-run': selectData[item.code.replace('DewateringPump', `DewateringPump${key}`)],
  116. 'signal-round-gry': selectData[item.code.replace('DewateringPump', `DewateringPump${key}`)] == '0',
  117. }"
  118. ></span>
  119. </div>
  120. </template>
  121. </div>
  122. </div>
  123. </div>
  124. </template>
  125. </ventBox1>
  126. </div>
  127. </div>
  128. </div>
  129. <div class="lr right-box">
  130. <div class="item-box sensor-container">
  131. <ventBox1 class="vent-margin-t-10">
  132. <template #title>
  133. <div>泵站远程集中控制</div>
  134. </template>
  135. <template #container>
  136. <div class="top-btn">
  137. <div class="btn-group">
  138. <a-button class="btn-item" type="primary" @click="handlerFn('zfw')">总复位</a-button>
  139. <a-button class="btn-item" type="default" disabled @click="handlerFn('change')">一键切换</a-button>
  140. </div>
  141. <div class="btn-group">
  142. <a-button style="width: calc(100% - 16px); padding: 0 8px" type="primary" @click="openModal">瓦斯泵控制</a-button>
  143. </div>
  144. <div>
  145. <div class="control-item">
  146. <div class="control-title">控制模式:</div>
  147. <a-radio-group v-model:value="selectData['ykjdqh']" @change="changeCtr">
  148. <a-radio :value="'0'">就地</a-radio>
  149. <a-radio :value="'1'">远程</a-radio>
  150. </a-radio-group>
  151. </div>
  152. <div class="control-item">
  153. <div class="control-title">检修模式:</div>
  154. <a-radio-group v-model:value="selectData['jxmsqh']" @change="changeMode">
  155. <a-radio :value="'0'">关闭</a-radio>
  156. <a-radio :value="'1'">开启</a-radio>
  157. </a-radio-group>
  158. </div>
  159. </div>
  160. </div>
  161. </template>
  162. </ventBox1>
  163. <ventBox1 class="vent-margin-t-10">
  164. <template #title>
  165. <div>阀门运行状态</div>
  166. </template>
  167. <template #container>
  168. <div class="state-header">
  169. <div class="header-item" v-for="(header, index) in stateWarningHeader" :key="index">{{ header }}</div>
  170. </div>
  171. <div class="">
  172. <div v-for="key in 2" :key="key">
  173. <div class="device-row" v-for="(valveType, index) in valveCtrlType" :key="index">
  174. <div class="state">#{{ key }}{{ valveType.title }} </div>
  175. <div class="state" v-for="(state, i) in valveWarningState" :key="i">
  176. <span v-if="state.code == '_CtrlMode'">{{
  177. selectData[`CentrifugalPump${key}_${valveType.code}${state.code}`] == '1' ? '控制' : '-'
  178. }}</span>
  179. <span
  180. v-else
  181. :class="{
  182. 'signal-round': true,
  183. 'signal-round-run': selectData[`CentrifugalPump${key}_${valveType.code}${state.code}`] == '1',
  184. 'signal-round-gry': selectData[`CentrifugalPump${key}_${valveType.code}${state.code}`] == '0',
  185. }"
  186. ></span>
  187. </div>
  188. </div>
  189. </div>
  190. </div>
  191. </template>
  192. </ventBox1>
  193. </div>
  194. <!-- <div class="item-box" >
  195. <LivePlayer id="fm-player1" style="height: 250px;" ref="player1" :videoUrl="flvURL1()" muted live loading controls />
  196. </div> -->
  197. </div>
  198. <div ref="playerRef" class="player-box"></div>
  199. </div>
  200. <DetailModal @register="register" :device-type="deviceType" :device-id="deviceId" />
  201. <PasswordModal
  202. :modal-is-show="passwordModalIsShow"
  203. modal-title="密码检验"
  204. :modal-type="handlerType"
  205. @handle-ok="handleOK"
  206. @handle-cancel="handleCancel"
  207. />
  208. </template>
  209. <script setup lang="ts">
  210. import { ref, onMounted, onUnmounted, reactive, defineProps, watch, inject, nextTick, onBeforeUnmount } from 'vue';
  211. import ventBox1 from '/@/components/vent/ventBox1.vue';
  212. import { setModelType } from '../gasPump.threejs';
  213. import {
  214. stateWarningHeader,
  215. valveWarningState,
  216. pumpMonitorData,
  217. waterPumpData,
  218. dewateringPumpData,
  219. modelMonitor,
  220. valveCtrlType,
  221. } from '../gasPump.data';
  222. import { list } from '../gasPump.api';
  223. import { SvgIcon } from '/@/components/Icon';
  224. import { formatNum } from '/@/utils/ventutil';
  225. import DetailModal from './DetailModal.vue';
  226. import { useModal } from '/@/components/Modal';
  227. import { deviceControlApi } from '/@/api/vent/index';
  228. import PasswordModal from '../../comment/components/PasswordModal.vue';
  229. import { message } from 'ant-design-vue';
  230. import fourBorderBg from '/@/components/vent/fourBorderBg.vue';
  231. import { useCamera } from '/@/hooks/system/useCamera';
  232. const globalConfig = inject('globalConfig');
  233. const props = defineProps({
  234. deviceId: {
  235. type: String,
  236. require: true,
  237. },
  238. deviceType: {
  239. type: String,
  240. require: true,
  241. },
  242. });
  243. const [register, { openModal }] = useModal();
  244. const loading = ref(false);
  245. const tabActiveKey = ref(1);
  246. const passwordModalIsShow = ref(false);
  247. const handlerType = ref('');
  248. const playerRef = ref();
  249. // 监测数据
  250. const selectData = ref({
  251. pump1: false,
  252. pump2: false,
  253. pump3: false,
  254. pump4: false,
  255. waterPump1: false,
  256. waterPump2: false,
  257. waterPump3: false,
  258. waterPump4: false,
  259. inValve1: false,
  260. outValve1: false,
  261. inValve2: false,
  262. outValve2: false,
  263. inValve3: false,
  264. outValve3: false,
  265. inValve4: false,
  266. outValve4: false,
  267. jxmsqh: '1',
  268. ykjdqh: '1',
  269. FlowSensor_InputFlux: '-',
  270. deviceType: '',
  271. });
  272. const { getCamera, removeCamera } = useCamera();
  273. // https获取监测数据
  274. let timer: null | NodeJS.Timeout = null;
  275. function getMonitor(flag?) {
  276. if (Object.prototype.toString.call(timer) === '[object Null]') {
  277. return new Promise((resolve) => {
  278. timer = setTimeout(
  279. async () => {
  280. if (props.deviceId) {
  281. const data = await getDataSource(props.deviceId);
  282. selectData.value = data;
  283. // Object.assign(selectData, data);
  284. }
  285. if (timer) {
  286. timer = null;
  287. }
  288. resolve(null);
  289. await getMonitor();
  290. loading.value = false;
  291. },
  292. flag ? 0 : 1000
  293. );
  294. });
  295. }
  296. }
  297. async function getDataSource(systemID) {
  298. const res = await list({ devicetype: props.deviceType, ids: systemID });
  299. const result = res.msgTxt[0]['datalist'][0];
  300. Object.assign(result, result['readData']);
  301. return result;
  302. }
  303. function handler(passWord, paramcode) {
  304. let value = '';
  305. if (paramcode == 'ykjdqh') {
  306. value = selectData.value['ykjdqh'] == '1' ? '2' : '1';
  307. }
  308. if (paramcode == 'jxmsqh') {
  309. value = selectData.value['jxmsqh'] == '1' ? '2' : '1';
  310. }
  311. const data = {
  312. deviceid: selectData.value['deviceID'],
  313. devicetype: selectData.value['deviceType'],
  314. paramcode: paramcode,
  315. password: passWord,
  316. value: value,
  317. };
  318. deviceControlApi(data)
  319. .then((res) => {
  320. if (globalConfig.History_Type == 'remote') {
  321. message.success('指令已下发至生产管控平台成功!');
  322. } else {
  323. message.success('指令已下发成功!');
  324. }
  325. })
  326. .catch((err) => {
  327. message.success('控制异常');
  328. });
  329. }
  330. function changeCtr(e) {
  331. if (e.target.value == 1) {
  332. // 就地
  333. handlerType.value = 'jxmsqh';
  334. } else if (e.target.value == 2) {
  335. // 远程
  336. handlerType.value = 'jxmsqh';
  337. }
  338. passwordModalIsShow.value = true;
  339. }
  340. function changeMode(e) {
  341. if (e.target.value == 1) {
  342. // 检修开
  343. handlerType.value = 'ykjdqh';
  344. } else if (e.target.value == 2) {
  345. // 检修关
  346. handlerType.value = 'ykjdqh';
  347. }
  348. passwordModalIsShow.value = true;
  349. }
  350. function handlerFn(paramcode) {
  351. handlerType.value = paramcode;
  352. passwordModalIsShow.value = true;
  353. }
  354. function handleOK(passWord, handlerState) {
  355. handler(passWord, handlerState);
  356. passwordModalIsShow.value = false;
  357. handlerType.value = '';
  358. }
  359. function handleCancel() {
  360. passwordModalIsShow.value = false;
  361. handlerType.value = '';
  362. }
  363. // 喷粉操作
  364. function handlerDevice(code, data) {}
  365. watch(
  366. () => props.deviceType,
  367. () => {
  368. removeCamera();
  369. nextTick(async () => {
  370. if (props.deviceType == 'pump_over') {
  371. setModelType('gasPump');
  372. } else if (props.deviceType == 'pump_under' || props.deviceType == 'pump_n12m2pq') {
  373. setModelType('gasPumpUnder');
  374. }
  375. });
  376. }
  377. );
  378. watch(
  379. () => props.deviceId,
  380. async (deviceID) => {
  381. removeCamera();
  382. if (deviceID) await getCamera(deviceID, playerRef.value);
  383. }
  384. );
  385. onMounted(async () => {
  386. timer = null;
  387. await getMonitor(true);
  388. // if (selectData && selectData['deviceID']) await getCamera(selectData['deviceID'], playerRef.value);
  389. });
  390. onBeforeUnmount(() => {
  391. removeCamera();
  392. });
  393. onUnmounted(() => {
  394. removeCamera();
  395. if (timer) {
  396. clearTimeout(timer);
  397. timer = undefined;
  398. }
  399. });
  400. </script>
  401. <style lang="less" scoped>
  402. @import '/@/design/vent/modal.less';
  403. @import '../../comment/less/workFace.less';
  404. @ventSpace: zxm;
  405. .elementContent {
  406. :deep(.main-container) {
  407. display: flex;
  408. flex-wrap: wrap;
  409. width: 690px;
  410. padding: 10px 12px 10px 15px;
  411. border: 1px solid #d3e1ff33;
  412. background-color: #061c2a55;
  413. box-shadow: 0 0 15px #3b567f55;
  414. background-color: #38383833;
  415. .gas-monitor-row {
  416. display: flex;
  417. flex-direction: row;
  418. flex-wrap: wrap;
  419. color: #fff;
  420. line-height: 32px;
  421. .title {
  422. width: 250px;
  423. color: #baeaff;
  424. }
  425. .value {
  426. width: 80px;
  427. color: #efae05;
  428. }
  429. }
  430. }
  431. }
  432. .device-state {
  433. width: 100%;
  434. position: absolute;
  435. top: 20px;
  436. color: #e90000;
  437. display: flex;
  438. justify-content: center;
  439. font-size: 20px;
  440. }
  441. .lr {
  442. margin-top: 0 !important;
  443. }
  444. .left-box {
  445. width: 360px !important;
  446. direction: rtl;
  447. overflow-y: auto;
  448. overflow-x: hidden;
  449. height: calc(100% - 60px);
  450. margin-top: 30px !important;
  451. .left-container {
  452. direction: ltr;
  453. }
  454. }
  455. .right-box {
  456. width: 350px !important;
  457. overflow-y: auto;
  458. overflow-x: hidden;
  459. .environment-monitor {
  460. .item {
  461. flex: 1;
  462. margin: 0 5px;
  463. .title {
  464. color: #7ae5ff;
  465. text-align: center;
  466. margin-bottom: 2px;
  467. }
  468. .num {
  469. width: 100%;
  470. height: 30px;
  471. text-align: center;
  472. border-top: 2px solid #50c8fc;
  473. border-radius: 4px;
  474. background-image: linear-gradient(#2e4d5955, #3780b499, #2e465955);
  475. }
  476. }
  477. }
  478. .pool-box {
  479. width: 327px;
  480. height: 65px;
  481. padding: 0 5px;
  482. background: url('/@/assets/images/vent/pump1.png') no-repeat;
  483. background-size: cover;
  484. background-origin: content-box;
  485. margin-top: 2px;
  486. .num {
  487. color: aqua;
  488. }
  489. .center {
  490. padding-right: 5px;
  491. }
  492. }
  493. }
  494. .player-box {
  495. position: absolute;
  496. height: 100%;
  497. width: 100%;
  498. padding: 0 20px 0 20px;
  499. z-index: 9999;
  500. display: flex;
  501. align-items: end;
  502. bottom: 80px;
  503. :deep(#LivePlayerBox) {
  504. display: flex;
  505. justify-content: end;
  506. }
  507. }
  508. .control-group {
  509. display: flex;
  510. // justify-content: space-around;
  511. flex-wrap: wrap;
  512. margin: 4px 0;
  513. .control-item {
  514. display: flex;
  515. flex-direction: column;
  516. justify-content: center;
  517. align-items: center;
  518. padding: 1px 10px;
  519. .control-item-title {
  520. color: #a6dce9;
  521. position: relative;
  522. }
  523. .control-item-state {
  524. width: 86px;
  525. height: 31px;
  526. background: url('/@/assets/images/vent/control-switch-bg1.png');
  527. display: flex;
  528. justify-content: center;
  529. align-items: center;
  530. color: #fff;
  531. }
  532. .button-box {
  533. position: relative;
  534. padding: 5px;
  535. border: 1px transparent solid;
  536. background-clip: border-box;
  537. border-radius: 5px;
  538. margin-left: 8px;
  539. }
  540. .a-button {
  541. pointer-events: auto;
  542. }
  543. &::v-deep .a-button--mini {
  544. padding: 6px 10px;
  545. }
  546. &::v-deep .a-button--mini.is-round {
  547. padding: 6px 10px;
  548. }
  549. }
  550. }
  551. .input-box {
  552. width: calc(100%);
  553. display: flex;
  554. flex-direction: row !important;
  555. flex-wrap: wrap !important;
  556. .input-item {
  557. width: calc(50% - 8px);
  558. padding: 0 2px;
  559. &:nth-child(2n) {
  560. margin-left: 4px;
  561. }
  562. }
  563. }
  564. .btn-group {
  565. display: flex;
  566. justify-content: space-around;
  567. .btn-item {
  568. width: 82px;
  569. text-align: center;
  570. }
  571. }
  572. .top-btn {
  573. .btn-group {
  574. margin-bottom: 8px;
  575. .btn-item {
  576. width: calc(50% - 16px);
  577. margin: 0 4px;
  578. }
  579. }
  580. .control-item {
  581. margin-left: 10px;
  582. margin-bottom: 8px;
  583. display: flex;
  584. .control-title {
  585. width: 150px;
  586. color: #73e8fe;
  587. }
  588. }
  589. }
  590. .state-header {
  591. display: flex;
  592. color: #73e8fe;
  593. .header-item {
  594. width: 25%;
  595. text-align: center;
  596. }
  597. }
  598. .device-row {
  599. display: flex;
  600. margin-top: 10px;
  601. .state {
  602. width: 25%;
  603. text-align: center;
  604. font-size: 13px;
  605. }
  606. }
  607. :deep(.@{ventSpace}-tabs-tabpane-active) {
  608. overflow: auto;
  609. }
  610. </style>