gasPumpHome.vue 19 KB

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