gasPumpHome.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  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'].startsWith('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>
  28. </div>
  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>
  64. </div>
  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>
  99. </div>
  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?.startsWith('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/theme.less';
  403. @import '/@/design/vent/modal.less';
  404. @import '../../comment/less/workFace.less';
  405. @ventSpace: zxm;
  406. .elementContent {
  407. :deep(.main-container) {
  408. display: flex;
  409. flex-wrap: wrap;
  410. width: 690px;
  411. padding: 10px 12px 10px 15px;
  412. border: 1px solid #d3e1ff33;
  413. background-color: #061c2a55;
  414. box-shadow: 0 0 15px #3b567f55;
  415. background-color: #38383833;
  416. .gas-monitor-row {
  417. display: flex;
  418. flex-direction: row;
  419. flex-wrap: wrap;
  420. color: #fff;
  421. line-height: 32px;
  422. .title {
  423. width: 250px;
  424. color: #baeaff;
  425. }
  426. .value {
  427. width: 80px;
  428. color: #efae05;
  429. }
  430. }
  431. }
  432. }
  433. .device-state {
  434. width: 100%;
  435. position: absolute;
  436. top: 20px;
  437. color: #e90000;
  438. display: flex;
  439. justify-content: center;
  440. font-size: 20px;
  441. }
  442. .lr {
  443. margin-top: 0 !important;
  444. }
  445. .left-box {
  446. width: 360px !important;
  447. direction: rtl;
  448. overflow-y: auto;
  449. overflow-x: hidden;
  450. height: calc(100% - 60px);
  451. margin-top: 30px !important;
  452. .left-container {
  453. direction: ltr;
  454. }
  455. }
  456. .right-box {
  457. width: 350px !important;
  458. overflow-y: auto;
  459. overflow-x: hidden;
  460. .environment-monitor {
  461. .item {
  462. flex: 1;
  463. margin: 0 5px;
  464. .title {
  465. color: #7ae5ff;
  466. text-align: center;
  467. margin-bottom: 2px;
  468. }
  469. .num {
  470. width: 100%;
  471. height: 30px;
  472. text-align: center;
  473. border-top: 2px solid #50c8fc;
  474. border-radius: 4px;
  475. background-image: linear-gradient(#2e4d5955, #3780b499, #2e465955);
  476. }
  477. }
  478. }
  479. .pool-box {
  480. width: 327px;
  481. height: 65px;
  482. padding: 0 5px;
  483. background: url('/@/assets/images/vent/pump1.png') no-repeat;
  484. background-size: cover;
  485. background-origin: content-box;
  486. margin-top: 2px;
  487. .num {
  488. color: aqua;
  489. }
  490. .center {
  491. padding-right: 5px;
  492. }
  493. }
  494. }
  495. .player-box {
  496. position: absolute;
  497. height: 100%;
  498. width: 100%;
  499. padding: 0 20px 0 20px;
  500. z-index: 9999;
  501. display: flex;
  502. align-items: end;
  503. bottom: 80px;
  504. :deep(#LivePlayerBox) {
  505. display: flex;
  506. justify-content: end;
  507. }
  508. }
  509. .control-group {
  510. display: flex;
  511. // justify-content: space-around;
  512. flex-wrap: wrap;
  513. margin: 4px 0;
  514. .control-item {
  515. display: flex;
  516. flex-direction: column;
  517. justify-content: center;
  518. align-items: center;
  519. padding: 1px 10px;
  520. .control-item-title {
  521. color: #a6dce9;
  522. position: relative;
  523. }
  524. .control-item-state {
  525. width: 86px;
  526. height: 31px;
  527. background: url('/@/assets/images/vent/control-switch-bg1.png');
  528. display: flex;
  529. justify-content: center;
  530. align-items: center;
  531. color: #fff;
  532. }
  533. .button-box {
  534. position: relative;
  535. padding: 5px;
  536. border: 1px transparent solid;
  537. background-clip: border-box;
  538. border-radius: 5px;
  539. margin-left: 8px;
  540. }
  541. .a-button {
  542. pointer-events: auto;
  543. }
  544. &::v-deep .a-button--mini {
  545. padding: 6px 10px;
  546. }
  547. &::v-deep .a-button--mini.is-round {
  548. padding: 6px 10px;
  549. }
  550. }
  551. }
  552. .input-box {
  553. width: calc(100%);
  554. display: flex;
  555. flex-direction: row !important;
  556. flex-wrap: wrap !important;
  557. .input-item {
  558. width: calc(50% - 8px);
  559. padding: 0 2px;
  560. &:nth-child(2n) {
  561. margin-left: 4px;
  562. }
  563. }
  564. }
  565. .btn-group {
  566. display: flex;
  567. justify-content: space-around;
  568. .btn-item {
  569. width: 82px;
  570. text-align: center;
  571. }
  572. }
  573. .top-btn {
  574. .btn-group {
  575. margin-bottom: 8px;
  576. .btn-item {
  577. width: calc(50% - 16px);
  578. margin: 0 4px;
  579. }
  580. }
  581. .control-item {
  582. margin-left: 10px;
  583. margin-bottom: 8px;
  584. display: flex;
  585. .control-title {
  586. width: 150px;
  587. color: var(--vent-font-action-link);
  588. }
  589. }
  590. }
  591. .state-header {
  592. display: flex;
  593. color: var(--vent-font-action-link);
  594. .header-item {
  595. width: 25%;
  596. text-align: center;
  597. }
  598. }
  599. .device-row {
  600. display: flex;
  601. margin-top: 10px;
  602. .state {
  603. width: 25%;
  604. text-align: center;
  605. font-size: 13px;
  606. }
  607. }
  608. :deep(.@{ventSpace}-tabs-tabpane-active) {
  609. overflow: auto;
  610. }
  611. </style>