gasPumpHome.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  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 = reactive({
  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. Object.assign(selectData, data);
  283. }
  284. if (timer) {
  285. timer = null;
  286. }
  287. resolve(null);
  288. await getMonitor();
  289. loading.value = false;
  290. },
  291. flag ? 0 : 1000
  292. );
  293. });
  294. }
  295. }
  296. async function getDataSource(systemID) {
  297. const res = await list({ devicetype: props.deviceType, ids: systemID });
  298. const result = res.msgTxt[0]['datalist'][0];
  299. Object.assign(result, result['readData']);
  300. return result;
  301. }
  302. function handler(passWord, paramcode) {
  303. let value = '';
  304. if (paramcode == 'ykjdqh') {
  305. value = selectData['ykjdqh'] == '1' ? '2' : '1';
  306. }
  307. if (paramcode == 'jxmsqh') {
  308. value = selectData['jxmsqh'] == '1' ? '2' : '1';
  309. }
  310. const data = {
  311. deviceid: selectData['deviceID'],
  312. devicetype: selectData['deviceType'],
  313. paramcode: paramcode,
  314. password: passWord,
  315. value: value,
  316. };
  317. deviceControlApi(data)
  318. .then((res) => {
  319. if (globalConfig.History_Type == 'remote') {
  320. message.success('指令已下发至生产管控平台成功!');
  321. } else {
  322. message.success('指令已下发成功!');
  323. }
  324. })
  325. .catch((err) => {
  326. message.success('控制异常');
  327. });
  328. }
  329. function changeCtr(e) {
  330. if (e.target.value == 1) {
  331. // 就地
  332. handlerType.value = 'jxmsqh';
  333. } else if (e.target.value == 2) {
  334. // 远程
  335. handlerType.value = 'jxmsqh';
  336. }
  337. passwordModalIsShow.value = true;
  338. }
  339. function changeMode(e) {
  340. if (e.target.value == 1) {
  341. // 检修开
  342. handlerType.value = 'ykjdqh';
  343. } else if (e.target.value == 2) {
  344. // 检修关
  345. handlerType.value = 'ykjdqh';
  346. }
  347. passwordModalIsShow.value = true;
  348. }
  349. function handlerFn(paramcode) {
  350. handlerType.value = paramcode;
  351. passwordModalIsShow.value = true;
  352. }
  353. function handleOK(passWord, handlerState) {
  354. handler(passWord, handlerState);
  355. passwordModalIsShow.value = false;
  356. handlerType.value = '';
  357. }
  358. function handleCancel() {
  359. passwordModalIsShow.value = false;
  360. handlerType.value = '';
  361. }
  362. // 喷粉操作
  363. function handlerDevice(code, data) {}
  364. watch(
  365. () => props.deviceType,
  366. () => {
  367. removeCamera();
  368. nextTick(async () => {
  369. if (props.deviceType == 'pump_over') {
  370. setModelType('gasPump');
  371. } else if (props.deviceType == 'pump_under' || props.deviceType == 'pump_n12m2pq') {
  372. setModelType('gasPumpUnder');
  373. }
  374. });
  375. }
  376. );
  377. watch(
  378. () => props.deviceId,
  379. async (deviceID) => {
  380. removeCamera();
  381. if (deviceID) await getCamera(deviceID, playerRef.value);
  382. }
  383. );
  384. onMounted(async () => {
  385. timer = null;
  386. await getMonitor(true);
  387. // if (selectData && selectData['deviceID']) await getCamera(selectData['deviceID'], playerRef.value);
  388. });
  389. onBeforeUnmount(() => {
  390. removeCamera();
  391. });
  392. onUnmounted(() => {
  393. removeCamera();
  394. if (timer) {
  395. clearTimeout(timer);
  396. timer = undefined;
  397. }
  398. });
  399. </script>
  400. <style lang="less" scoped>
  401. @import '/@/design/vent/modal.less';
  402. @import '../../comment/less/workFace.less';
  403. @ventSpace: zxm;
  404. .elementContent {
  405. :deep(.main-container) {
  406. display: flex;
  407. flex-wrap: wrap;
  408. width: 690px;
  409. padding: 10px 12px 10px 15px;
  410. border: 1px solid #d3e1ff33;
  411. background-color: #061c2a55;
  412. box-shadow: 0 0 15px #3b567f55;
  413. background-color: #38383833;
  414. .gas-monitor-row {
  415. display: flex;
  416. flex-direction: row;
  417. flex-wrap: wrap;
  418. color: #fff;
  419. line-height: 32px;
  420. .title {
  421. width: 250px;
  422. color: #baeaff;
  423. }
  424. .value {
  425. width: 80px;
  426. color: #efae05;
  427. }
  428. }
  429. }
  430. }
  431. .device-state {
  432. width: 100%;
  433. position: absolute;
  434. top: 20px;
  435. color: #e90000;
  436. display: flex;
  437. justify-content: center;
  438. font-size: 20px;
  439. }
  440. .lr {
  441. margin-top: 0 !important;
  442. }
  443. .left-box {
  444. width: 360px !important;
  445. direction: rtl;
  446. overflow-y: auto;
  447. overflow-x: hidden;
  448. height: calc(100% - 60px);
  449. margin-top: 30px !important;
  450. .left-container {
  451. direction: ltr;
  452. }
  453. }
  454. .right-box {
  455. width: 350px !important;
  456. overflow-y: auto;
  457. overflow-x: hidden;
  458. .environment-monitor {
  459. .item {
  460. flex: 1;
  461. margin: 0 5px;
  462. .title {
  463. color: #7ae5ff;
  464. text-align: center;
  465. margin-bottom: 2px;
  466. }
  467. .num {
  468. width: 100%;
  469. height: 30px;
  470. text-align: center;
  471. border-top: 2px solid #50c8fc;
  472. border-radius: 4px;
  473. background-image: linear-gradient(#2e4d5955, #3780b499, #2e465955);
  474. }
  475. }
  476. }
  477. .pool-box {
  478. width: 327px;
  479. height: 65px;
  480. padding: 0 5px;
  481. background: url('/@/assets/images/vent/pump1.png') no-repeat;
  482. background-size: cover;
  483. background-origin: content-box;
  484. margin-top: 2px;
  485. .num {
  486. color: aqua;
  487. }
  488. .center {
  489. padding-right: 5px;
  490. }
  491. }
  492. }
  493. .player-box {
  494. position: absolute;
  495. height: 100%;
  496. width: 100%;
  497. padding: 0 20px 0 20px;
  498. z-index: 9999;
  499. display: flex;
  500. align-items: end;
  501. bottom: 80px;
  502. :deep(#LivePlayerBox) {
  503. display: flex;
  504. justify-content: end;
  505. }
  506. }
  507. .control-group {
  508. display: flex;
  509. // justify-content: space-around;
  510. flex-wrap: wrap;
  511. margin: 4px 0;
  512. .control-item {
  513. display: flex;
  514. flex-direction: column;
  515. justify-content: center;
  516. align-items: center;
  517. padding: 1px 10px;
  518. .control-item-title {
  519. color: #a6dce9;
  520. position: relative;
  521. }
  522. .control-item-state {
  523. width: 86px;
  524. height: 31px;
  525. background: url('/@/assets/images/vent/control-switch-bg1.png');
  526. display: flex;
  527. justify-content: center;
  528. align-items: center;
  529. color: #fff;
  530. }
  531. .button-box {
  532. position: relative;
  533. padding: 5px;
  534. border: 1px transparent solid;
  535. background-clip: border-box;
  536. border-radius: 5px;
  537. margin-left: 8px;
  538. }
  539. .a-button {
  540. pointer-events: auto;
  541. }
  542. &::v-deep .a-button--mini {
  543. padding: 6px 10px;
  544. }
  545. &::v-deep .a-button--mini.is-round {
  546. padding: 6px 10px;
  547. }
  548. }
  549. }
  550. .input-box {
  551. width: calc(100%);
  552. display: flex;
  553. flex-direction: row !important;
  554. flex-wrap: wrap !important;
  555. .input-item {
  556. width: calc(50% - 8px);
  557. padding: 0 2px;
  558. &:nth-child(2n) {
  559. margin-left: 4px;
  560. }
  561. }
  562. }
  563. .btn-group {
  564. display: flex;
  565. justify-content: space-around;
  566. .btn-item {
  567. width: 82px;
  568. text-align: center;
  569. }
  570. }
  571. .top-btn {
  572. .btn-group {
  573. margin-bottom: 8px;
  574. .btn-item {
  575. width: calc(50% - 16px);
  576. margin: 0 4px;
  577. }
  578. }
  579. .control-item {
  580. margin-left: 10px;
  581. margin-bottom: 8px;
  582. display: flex;
  583. .control-title {
  584. width: 150px;
  585. color: #73e8fe;
  586. }
  587. }
  588. }
  589. .state-header {
  590. display: flex;
  591. color: #73e8fe;
  592. .header-item {
  593. width: 25%;
  594. text-align: center;
  595. }
  596. }
  597. .device-row {
  598. display: flex;
  599. margin-top: 10px;
  600. .state {
  601. width: 25%;
  602. text-align: center;
  603. font-size: 13px;
  604. }
  605. }
  606. :deep(.@{ventSpace}-tabs-tabpane-active) {
  607. overflow: auto;
  608. }
  609. </style>