gasPumpHome.vue 19 KB

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