gasPumpHome.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. <template>
  2. <div id="FlowSensor" class="FlowSensor-box" style="position: absolute; z-index: -1;" v-if="selectData.FlowSensor_InputFlux">
  3. <div ref="elementContent" class="elementContent" >
  4. <p style="color: #50c8fc;"><span class="data-title">抽采泵流量(m³):</span>{{ formatNum(selectData.FlowSensor_InputFlux) }}</p>
  5. </div>
  6. </div>
  7. <div class="monitor-container">
  8. <div class="lr left-box">
  9. <div class="left-container">
  10. <div class="monitor-box">
  11. <ventBox1>
  12. <template #title>
  13. <div>抽采泵</div>
  14. </template>
  15. <template #container>
  16. <div v-for="key in 2" :key="key">
  17. <div class="parameter-title group-parameter-title"><SvgIcon class="icon" size="14" name="pulp-title"/><span>{{ key }}#抽采泵</span></div>
  18. <div class="input-box">
  19. <div v-for="(item, index) in pumpMonitorData" class="input-item" :key="index">
  20. <template v-if="selectData[item.code.replace('CentrifugalPump', `CentrifugalPump${key}`)] != undefined">
  21. <div class="title">{{ item.title }}:</div>
  22. <template v-if="item.type !== 'sign'">
  23. <div class="value">{{ selectData && selectData[item.code.replace('CentrifugalPump', `CentrifugalPump${key}`)] ? formatNum(selectData[item.code.replace('CentrifugalPump', `CentrifugalPump${key}`)]) : '-' }}</div>
  24. </template>
  25. <template v-else>
  26. <div class="value">
  27. <span :class="{ 'signal-round': true, 'signal-round-run': selectData[item.code.replace('CentrifugalPump', `CentrifugalPump${key}`)] == '1', 'signal-round-gry': selectData[item.code.replace('CentrifugalPump', `CentrifugalPump${key}`)] == '0' }"></span>
  28. </div>
  29. </template>
  30. </template>
  31. </div>
  32. </div>
  33. </div>
  34. </template>
  35. </ventBox1>
  36. <ventBox1 class="vent-margin-t-10">
  37. <template #title>
  38. <div>注水泵</div>
  39. </template>
  40. <template #container>
  41. <div v-for="key in 2" :key="key">
  42. <div class="parameter-title group-parameter-title"><SvgIcon class="icon" size="14" name="pulp-title"/><span>{{ key }}#注水泵</span></div>
  43. <div class="input-box">
  44. <div v-for="(item, index) in waterPumpData" class="input-item" :key="index">
  45. <template v-if="selectData[item.code.replace('WaterfloodPump', `WaterfloodPump${key}`)] != undefined">
  46. <div class="title">{{ item.title }}:</div>
  47. <template v-if="item.type !== 'sign'">
  48. <div class="value">{{ selectData && selectData[item.code.replace('WaterfloodPump', `WaterfloodPump${key}`)] ? formatNum(selectData[item.code.replace('WaterfloodPump', `WaterfloodPump${key}`)]) : '-' }}</div>
  49. </template>
  50. <template v-else>
  51. <div class="value">
  52. <span :class="{ 'signal-round': true, 'signal-round-run': selectData[item.code.replace('WaterfloodPump', `WaterfloodPump${key}`)], 'signal-round-gry': selectData[item.code.replace('WaterfloodPump', `WaterfloodPump${key}`)]=='0' }"></span>
  53. </div>
  54. </template>
  55. </template>
  56. </div>
  57. </div>
  58. </div>
  59. </template>
  60. </ventBox1>
  61. <ventBox1 class="vent-margin-t-10">
  62. <template #title>
  63. <div>排水泵</div>
  64. </template>
  65. <template #container>
  66. <div v-for="key in 2" :key="key">
  67. <div class="parameter-title group-parameter-title"><SvgIcon class="icon" size="14" name="pulp-title"/><span>{{ key }}#排水泵</span></div>
  68. <div class="input-box">
  69. <div v-for="(item, index) in dewateringPumpData" class="input-item" :key="index">
  70. <template v-if="selectData[item.code.replace('DewateringPump', `DewateringPump${key}`)] != undefined">
  71. <div class="title">{{ item.title }}:</div>
  72. <template v-if="item.type !== 'sign'">
  73. <div class="value">{{ selectData && selectData[item.code.replace('DewateringPump', `DewateringPump${key}`)] ? formatNum(selectData[item.code.replace('DewateringPump', `DewateringPump${key}`)]) : '-' }}</div>
  74. </template>
  75. <template v-else>
  76. <div class="value">
  77. <span :class="{ 'signal-round': true, 'signal-round-run': selectData[item.code.replace('DewateringPump', `DewateringPump${key}`)], 'signal-round-gry': selectData[item.code.replace('DewateringPump', `DewateringPump${key}`)] == '0' }"></span>
  78. </div>
  79. </template>
  80. </template>
  81. </div>
  82. </div>
  83. </div>
  84. </template>
  85. </ventBox1>
  86. </div>
  87. </div>
  88. </div>
  89. <div class="lr right-box">
  90. <div class="item-box sensor-container">
  91. <ventBox1 class="vent-margin-t-10">
  92. <template #title>
  93. <div>泵站远程集中控制</div>
  94. </template>
  95. <template #container>
  96. <div class="top-btn">
  97. <div class="btn-group">
  98. <a-button class="btn-item" type="primary" @click="handlerFn('zfw')">总复位</a-button>
  99. <a-button class="btn-item" type="default" disabled @click="handlerFn('change')">一键切换</a-button>
  100. </div>
  101. <div class="btn-group">
  102. <a-button style="width: calc(100% - 16px); padding: 0 8px;" type="primary" @click="openModal">瓦斯泵控制</a-button>
  103. </div>
  104. <div>
  105. <div class="control-item">
  106. <div class="control-title">控制模式:</div>
  107. <a-radio-group v-model:value="selectData['ykjdqh']" @change="changeCtr">
  108. <a-radio :value="'0'">就地</a-radio>
  109. <a-radio :value="'1'">远程</a-radio>
  110. </a-radio-group>
  111. </div>
  112. <div class="control-item">
  113. <div class="control-title">检修模式:</div>
  114. <a-radio-group v-model:value="selectData['jxmsqh']" @change="changeMode">
  115. <a-radio :value="'0'">关闭</a-radio>
  116. <a-radio :value="'1'">开启</a-radio>
  117. </a-radio-group>
  118. </div>
  119. </div>
  120. </div>
  121. </template>
  122. </ventBox1>
  123. <ventBox1 class="vent-margin-t-10">
  124. <template #title>
  125. <div>阀门运行状态</div>
  126. </template>
  127. <template #container>
  128. <div class="state-header">
  129. <div class="header-item" v-for="(header, index) in stateHeader" :key="index">{{ header }}</div>
  130. </div>
  131. <div class="">
  132. <div v-for="key in 2" :key="key">
  133. <div class="device-row" v-for="(valveType, index) in valveCtrlType" :key="index">
  134. <div class="state" >#{{ key }}{{ valveType.title }} </div>
  135. <div class="state" v-for="(state, i) in valveState" :key="i" >
  136. <span v-if="state.code == '_CtrlMode'">{{ selectData[`CentrifugalPump${key}_${valveType.code}${state.code}`] == '1' ? '控制' : '-' }}</span>
  137. <span v-else :class="{ 'signal-round': true, 'signal-round-run': selectData[`CentrifugalPump${key}_${valveType.code}${state.code}`] == '1', 'signal-round-gry': selectData[`CentrifugalPump${key}_${valveType.code}${state.code}`] == '0' }"></span>
  138. </div>
  139. </div>
  140. </div>
  141. </div>
  142. </template>
  143. </ventBox1>
  144. </div>
  145. <!-- <div class="item-box" >
  146. <LivePlayer id="fm-player1" style="height: 250px;" ref="player1" :videoUrl="flvURL1()" muted live loading controls />
  147. </div> -->
  148. </div>
  149. </div>
  150. <DetailModal @register="register" :deviceType="deviceType" :deviceId="deviceId"/>
  151. <PasswordModal :modal-is-show="passwordModalIsShow" modal-title="密码检验" :modal-type="handlerType" @handle-ok="handleOK"
  152. @handle-cancel="handleCancel"/>
  153. </template>
  154. <script setup lang="ts">
  155. import { onBeforeMount, ref, onMounted, onUnmounted, reactive, defineProps, watch } from 'vue';
  156. import ventBox1 from '/@/components/vent/ventBox1.vue'
  157. import { mountedThree, destroy, setModelType } from '../gasPump.threejs';
  158. import { stateHeader, valveState, pumpMonitorData, waterPumpData, dewateringPumpData, pumpCtrlType, valveCtrlType, valveCtrl, PumpCtrlItems, pumpCtrl } from '../gasPump.data'
  159. import { list } from '../gasPump.api';
  160. import { SvgIcon } from '/@/components/Icon'
  161. import { formatNum } from '/@/utils/ventutil'
  162. import DetailModal from './DetailModal.vue'
  163. import { useModal } from '/@/components/Modal';
  164. import { deviceControlApi } from '/@/api/vent/index';
  165. import PasswordModal from '../../comment/components/PasswordModal.vue'
  166. import { message } from 'ant-design-vue';
  167. const props = defineProps({
  168. deviceId: {
  169. type: String,
  170. require: true
  171. },
  172. deviceType: {
  173. type: String,
  174. require: true
  175. }
  176. })
  177. const [register, { openModal }] = useModal()
  178. const loading = ref(false);
  179. const tabActiveKey = ref(1)
  180. const passwordModalIsShow = ref(false)
  181. const handlerType = ref('')
  182. // 默认初始是第一行
  183. // 监测数据
  184. const selectData = reactive({
  185. pump1: false,
  186. pump2: false,
  187. pump3: false,
  188. pump4: false,
  189. waterPump1: false,
  190. waterPump2: false,
  191. waterPump3: false,
  192. waterPump4: false,
  193. inValve1: false,
  194. outValve1: false,
  195. inValve2: false,
  196. outValve2: false,
  197. inValve3: false,
  198. outValve3: false,
  199. inValve4: false,
  200. outValve4: false,
  201. jxmsqh: '1',
  202. ykjdqh: '1',
  203. FlowSensor_InputFlux: '-',
  204. });
  205. const flvURL1 = () => {
  206. return `https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv`;
  207. // return ''
  208. };
  209. // https获取监测数据
  210. let timer: null | NodeJS.Timeout = null;
  211. function getMonitor(flag?) {
  212. if (Object.prototype.toString.call(timer) === '[object Null]') {
  213. timer = setTimeout(async () => {
  214. if (props.deviceId) {
  215. const data = await getDataSource(props.deviceId)
  216. Object.assign(selectData, data);
  217. }
  218. if (timer) {
  219. timer = null;
  220. }
  221. await getMonitor();
  222. loading.value = false
  223. }, flag ? 0 : 1000);
  224. }
  225. };
  226. async function getDataSource(systemID) {
  227. const res = await list({ devicetype: props.deviceType, ids: systemID });
  228. const result = res.msgTxt[0]['datalist'][0];
  229. Object.assign(result, result['readData'])
  230. return result
  231. }
  232. function handler(passWord, paramcode) {
  233. let value = null
  234. if(paramcode == 'ykjdqh'){
  235. value = selectData['ykjdqh'] == '1' ? '2' : '1'
  236. }
  237. if (paramcode == 'jxmsqh') {
  238. value = selectData['jxmsqh'] == '1' ? '2' : '1'
  239. }
  240. const data = {
  241. deviceid: selectData.deviceID,
  242. devicetype: selectData.deviceType,
  243. paramcode: paramcode,
  244. password: passWord,
  245. value: value,
  246. };
  247. deviceControlApi(data).then((res) => {
  248. message.success('控制成功成功!');
  249. }).catch((err) => {
  250. message.success('控制异常');
  251. });
  252. }
  253. function changeCtr(e) {
  254. if(e.target.value == 1){
  255. // 就地
  256. handlerType.value = 'jxmsqh'
  257. }else if(e.target.value == 2) {
  258. // 远程
  259. handlerType.value = 'jxmsqh'
  260. }
  261. passwordModalIsShow.value = true;
  262. }
  263. function changeMode(e) {
  264. if (e.target.value == 1) {
  265. // 检修开
  266. handlerType.value = 'ykjdqh'
  267. } else if (e.target.value == 2) {
  268. // 检修关
  269. handlerType.value = 'ykjdqh'
  270. }
  271. passwordModalIsShow.value = true;
  272. }
  273. function handlerFn(paramcode){
  274. handlerType.value = paramcode
  275. passwordModalIsShow.value = true;
  276. }
  277. function handleOK(passWord, handlerState) {
  278. handler(passWord, handlerState)
  279. passwordModalIsShow.value = false;
  280. handlerType.value = ''
  281. }
  282. function handleCancel() {
  283. passwordModalIsShow.value = false;
  284. handlerType.value = ''
  285. };
  286. // 喷粉操作
  287. function handlerDevice(code, data) {
  288. }
  289. watch(() => props.deviceType, () => {
  290. // if(props.deviceType == 'pump_over'){
  291. // setModelType('gasPump')
  292. // }else if(props.deviceType == 'pump_under') {
  293. // setModelType('gasPumpUnder')
  294. // }
  295. })
  296. onBeforeMount(() => {
  297. });
  298. onMounted(async() => {
  299. timer = null
  300. await getMonitor(true)
  301. });
  302. onUnmounted(() => {
  303. if (timer) {
  304. clearTimeout(timer);
  305. timer = undefined;
  306. }
  307. });
  308. </script>
  309. <style lang="less" scoped>
  310. @import '/@/design/vent/modal.less';
  311. @import '../../comment/less/workFace.less';
  312. @ventSpace: zxm;
  313. .lr{
  314. margin-top: 0 !important;
  315. }
  316. .left-box{
  317. width: 360px !important;
  318. direction: rtl;
  319. overflow-y: auto;
  320. overflow-x: hidden;
  321. height: calc(100% - 30px);
  322. .left-container{
  323. margin-top: 30px;
  324. direction: ltr;
  325. }
  326. }
  327. .right-box{
  328. width: 350px !important;
  329. .environment-monitor{
  330. .item{
  331. flex: 1;
  332. margin: 0 5px;
  333. .title{
  334. color: #7ae5ff;
  335. text-align: center;
  336. margin-bottom: 2px;
  337. }
  338. .num{
  339. width: 100%;
  340. height: 30px;
  341. text-align: center;
  342. border-top: 2px solid #50c8fc;
  343. border-radius: 4px;
  344. background-image: linear-gradient( #2e4d5955, #3780b499, #2E465955);
  345. }
  346. }
  347. }
  348. .pool-box{
  349. width: 327px;
  350. height: 65px;
  351. padding: 0 5px;
  352. background: url('/@/assets/images/vent/pump1.png') no-repeat;
  353. background-size: cover;
  354. background-origin: content-box;
  355. margin-top: 2px;
  356. .num{
  357. color: aqua;
  358. }
  359. .center{
  360. padding-right: 5px;
  361. }
  362. }
  363. }
  364. .control-group{
  365. display: flex;
  366. // justify-content: space-around;
  367. flex-wrap: wrap;
  368. margin: 4px 0;
  369. .control-item {
  370. display: flex;
  371. flex-direction: column;
  372. justify-content: center;
  373. align-items: center;
  374. padding: 1px 10px;
  375. .control-item-title{
  376. color: #A6DCE9;
  377. position: relative;
  378. }
  379. .control-item-state{
  380. width: 86px;
  381. height: 31px;
  382. background: url('/@/assets/images/vent/control-switch-bg1.png');
  383. display: flex;
  384. justify-content: center;
  385. align-items: center;
  386. color: #fff;
  387. }
  388. .button-box {
  389. position: relative;
  390. padding: 5px;
  391. border: 1px transparent solid;
  392. background-clip: border-box;
  393. border-radius: 5px;
  394. margin-left: 8px;
  395. }
  396. .a-button {
  397. pointer-events: auto;
  398. }
  399. &::v-deep .a-button--mini {
  400. padding: 6px 10px;
  401. }
  402. &::v-deep .a-button--mini.is-round {
  403. padding: 6px 10px;
  404. }
  405. }
  406. }
  407. .input-box{
  408. width: calc(100%);
  409. display: flex;
  410. flex-direction: row !important;
  411. flex-wrap: wrap !important;
  412. .input-item{
  413. width: calc(50% - 8px);
  414. padding: 0 2px;
  415. &:nth-child(2n){
  416. margin-left: 4px;
  417. }
  418. }
  419. }
  420. .btn-group{
  421. display: flex;
  422. justify-content: space-around;
  423. .btn-item{
  424. width: 82px;
  425. text-align: center;
  426. }
  427. }
  428. .top-btn{
  429. .btn-group{
  430. margin-bottom: 8px;
  431. .btn-item{
  432. width: calc(50% - 16px);
  433. margin: 0 4px;
  434. }
  435. }
  436. .control-item{
  437. margin-left: 10px;
  438. margin-bottom: 8px;
  439. display: flex;
  440. .control-title{
  441. width: 150px;
  442. color: #73e8fe;
  443. }
  444. }
  445. }
  446. .state-header{
  447. display: flex;
  448. color: #73e8fe;
  449. .header-item{
  450. width: 25%;
  451. text-align: center;
  452. }
  453. }
  454. .device-row{
  455. display: flex;
  456. margin-top: 10px;
  457. .state{
  458. width: 25%;
  459. text-align: center;
  460. font-size: 13px;
  461. }
  462. }
  463. :deep(.@{ventSpace}-tabs-tabpane-active) {
  464. overflow: auto;
  465. }
  466. </style>