管道式消毒机
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

759 lines
19 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="device_container">
  3. <div class="row_wrap">
  4. <p class="title">注射蠕动泵速率(g/min)</p>
  5. <p class="num">
  6. <van-field
  7. type="number"
  8. v-model="sprayLiquidConfigVal"
  9. :clickable="true"
  10. :formatter="formatter7"
  11. readonly
  12. @click.stop="hideClickKey(2)"
  13. />
  14. </p>
  15. </div>
  16. <div class="row_wrap">
  17. <p class="title">消毒停止过氧化氢浓度(ppm)</p>
  18. <p class="num">
  19. <van-field
  20. type="number"
  21. v-model="stoped_gs"
  22. :clickable="true"
  23. :formatter="formatter1"
  24. readonly
  25. @click.stop="hideClickKey(3)"
  26. />
  27. </p>
  28. </div>
  29. <div class="row_wrap">
  30. <p class="title">消毒继续过氧化氢浓度(ppm)</p>
  31. <p class="num">
  32. <van-field
  33. type="number"
  34. v-model="continued_gs"
  35. :clickable="true"
  36. :formatter="formatter2"
  37. readonly
  38. @click.stop="hideClickKey(4)"
  39. />
  40. </p>
  41. </div>
  42. <div class="row_wrap">
  43. <p class="title">消毒停止相对湿度(%RH)</p>
  44. <p class="num">
  45. <van-field
  46. type="number"
  47. v-model="stoped_humi"
  48. :clickable="true"
  49. :formatter="formatter9"
  50. readonly
  51. @click.stop="hideClickKey(9)"
  52. />
  53. </p>
  54. </div>
  55. <div class="row_wrap">
  56. <p class="title">消毒继续相对湿度(%RH)</p>
  57. <p class="num">
  58. <van-field
  59. type="number"
  60. v-model="continued_humi"
  61. :clickable="true"
  62. :formatter="formatter10"
  63. readonly
  64. @click.stop="hideClickKey(10)"
  65. />
  66. </p>
  67. </div>
  68. <div class="row_wrap">
  69. <p class="title">消毒停止过氧化氢相对饱和度(%RS)</p>
  70. <p class="num">
  71. <van-field
  72. type="number"
  73. :formatter="formatter3"
  74. v-model="stoped_satur"
  75. :clickable="true"
  76. readonly
  77. @click.stop="hideClickKey(5)"
  78. />
  79. </p>
  80. </div>
  81. <div class="row_wrap">
  82. <p class="title">消毒继续过氧化氢相对饱和度(%RS)</p>
  83. <p class="num">
  84. <van-field
  85. type="number"
  86. :formatter="formatter4"
  87. v-model="continued_satur"
  88. :clickable="true"
  89. readonly
  90. @click.stop="hideClickKey(6)"
  91. />
  92. </p>
  93. </div>
  94. <div class="row_wrap">
  95. <p class="title">Log等级</p>
  96. <div class="num">
  97. <p class="log">6</p>
  98. </div>
  99. </div>
  100. <!-- <div class="row_wrap" v-if="operatorStore.disinfectStatus != 1">
  101. <p class="title">允许消毒最大湿度(%RH)</p>
  102. <p class="num">
  103. <van-field
  104. :formatter="formatter5"
  105. type="number"
  106. v-model="max_humidity"
  107. :clickable="true"
  108. readonly
  109. @click.stop="hideClickKey(7)"
  110. />
  111. </p>
  112. </div>
  113. <div class="row_wrap" v-if="operatorStore.disinfectStatus != 1">
  114. <p class="title">预热时间(s)</p>
  115. <p class="num">
  116. <van-field
  117. :formatter="formatter8"
  118. type="number"
  119. v-model="pre_heat_time_s"
  120. :clickable="true"
  121. readonly
  122. @click.stop="hideClickKey(8)"
  123. />
  124. </p>
  125. </div> -->
  126. <van-number-keyboard
  127. v-model="addLiquidConfigVal"
  128. :title="addLiquidConfigVal"
  129. :show="addLiquidConfigValShow"
  130. @input="val => handleInput(val, 1)"
  131. theme="custom"
  132. close-button-text="配置"
  133. @close="setAddliquidVal"
  134. @blur="addLiquidConfigValShow = false"
  135. />
  136. <van-number-keyboard
  137. v-model="sprayLiquidConfigVal"
  138. @input="val => handleInput(val, 2)"
  139. :title="sprayLiquidConfigVal"
  140. :show="sprayLiquidConfigValShow"
  141. theme="custom"
  142. @close="setSprayLiquidVal"
  143. close-button-text="配置"
  144. @blur="sprayLiquidConfigValShow = false"
  145. />
  146. <van-number-keyboard
  147. v-model="stoped_gs"
  148. @input="val => handleInput(val, 3)"
  149. :title="stoped_gs"
  150. :show="stoped_gsShow"
  151. theme="custom"
  152. @close="setStopedGsVal"
  153. close-button-text="配置"
  154. @blur="stoped_gsShow = false"
  155. />
  156. <van-number-keyboard
  157. v-model="continued_gs"
  158. @input="val => handleInput(val, 4)"
  159. :title="continued_gs"
  160. @close="setcontinuedGsVal"
  161. :show="continued_gsShow"
  162. theme="custom"
  163. close-button-text="配置"
  164. @blur="continued_gsShow = false"
  165. />
  166. <van-number-keyboard
  167. v-model="stoped_satur"
  168. @input="val => handleInput(val, 5)"
  169. :title="stoped_satur"
  170. @close="setstopedSaturVal"
  171. :show="stoped_saturShow"
  172. theme="custom"
  173. close-button-text="配置"
  174. @blur="stoped_saturShow = false"
  175. />
  176. <van-number-keyboard
  177. v-model="continued_satur"
  178. @input="val => handleInput(val, 6)"
  179. :title="continued_satur"
  180. @close="setContinuedSaturVal"
  181. :show="continued_saturShow"
  182. theme="custom"
  183. close-button-text="配置"
  184. @blur="continued_saturShow = false"
  185. />
  186. <van-number-keyboard
  187. v-model="max_humidity"
  188. @input="val => handleInput(val, 7)"
  189. :title="max_humidity"
  190. @close="setMaxHumidityVal"
  191. :show="max_humidityShow"
  192. theme="custom"
  193. close-button-text="配置"
  194. @blur="max_humidityShow = false"
  195. />
  196. <van-number-keyboard
  197. theme="custom"
  198. close-button-text="配置"
  199. @input="val => handleInput(val, 8)"
  200. @close="setHeat_timeVal"
  201. v-model="pre_heat_time_s"
  202. :title="pre_heat_time_s"
  203. :show="pre_heat_time_sShow"
  204. @blur="pre_heat_time_sShow = false"
  205. />
  206. <van-number-keyboard
  207. @input="val => handleInput(val, 9)"
  208. theme="custom"
  209. close-button-text="配置"
  210. @close="setstoped_humiVal"
  211. v-model="stoped_humi"
  212. :title="stoped_humi"
  213. :show="stoped_humiShow"
  214. @blur="stoped_humiShow = false"
  215. />
  216. <van-number-keyboard
  217. theme="custom"
  218. @input="val => handleInput(val, 10)"
  219. close-button-text="配置"
  220. @close="setcontinued_humiVal"
  221. v-model="continued_humi"
  222. :title="continued_humi"
  223. :show="continued_humiShow"
  224. @blur="continued_humiShow = false"
  225. />
  226. <div class="btns">
  227. <div class="btn">保存</div>
  228. <div class="btn ml" @click="hiddleSettingModal">返回</div>
  229. </div>
  230. </div>
  231. </template>
  232. <script setup>
  233. import { ref } from 'vue'
  234. import { showSuccessToast, showFailToast } from 'vant'
  235. import { useSettingStore, useWebSocketStore, useOperatorStore } from '@/store'
  236. import { storeToRefs } from 'pinia'
  237. import { setSettingValJSON } from '@/mock/command'
  238. const settingStore = useSettingStore()
  239. const webSocketStore = useWebSocketStore()
  240. const operatorStore = useOperatorStore()
  241. const {
  242. max_humidity,
  243. continued_satur,
  244. stoped_satur,
  245. continued_gs,
  246. stoped_gs,
  247. addLiquidConfigVal,
  248. sprayLiquidConfigVal,
  249. stoped_humi,
  250. continued_humi,
  251. allSettingList,
  252. pre_heat_time_s,
  253. } = storeToRefs(settingStore)
  254. const pre_heat_time_sShow = ref(false)
  255. const addLiquidConfigValShow = ref(false)
  256. const sprayLiquidConfigValShow = ref(false)
  257. const stoped_gsShow = ref(false)
  258. const continued_gsShow = ref(false)
  259. const stoped_saturShow = ref(false)
  260. const continued_saturShow = ref(false)
  261. const max_humidityShow = ref(false)
  262. const stoped_humiShow = ref(false)
  263. const continued_humiShow = ref(false)
  264. const isFirstClick = ref(true)
  265. const props = defineProps({
  266. hideSettingModal: {
  267. type: Function,
  268. },
  269. })
  270. const hiddleSettingModal = () => {
  271. props.hideSettingModal()
  272. }
  273. const hideClickKey = flag => {
  274. isFirstClick.value = true
  275. stoped_humiShow.value = false
  276. continued_humiShow.value = false
  277. pre_heat_time_sShow.value = false
  278. addLiquidConfigValShow.value = false
  279. sprayLiquidConfigValShow.value = false
  280. stoped_gsShow.value = false
  281. continued_gsShow.value = false
  282. stoped_saturShow.value = false
  283. continued_saturShow.value = false
  284. max_humidityShow.value = false
  285. if (flag == 1) {
  286. addLiquidConfigValShow.value = true
  287. }
  288. if (flag == 2) {
  289. sprayLiquidConfigValShow.value = true
  290. }
  291. if (flag == 3) {
  292. stoped_gsShow.value = true
  293. }
  294. if (flag == 4) {
  295. continued_gsShow.value = true
  296. }
  297. if (flag == 5) {
  298. stoped_saturShow.value = true
  299. }
  300. if (flag == 6) {
  301. continued_saturShow.value = true
  302. }
  303. if (flag == 7) {
  304. max_humidityShow.value = true
  305. }
  306. if (flag == 8) {
  307. pre_heat_time_sShow.value = true
  308. }
  309. if (flag == 9) {
  310. stoped_humiShow.value = true
  311. }
  312. if (flag == 10) {
  313. continued_humiShow.value = true
  314. }
  315. }
  316. const handleInput = (value, index) => {
  317. if (isFirstClick.value) {
  318. if (index == 1) {
  319. setTimeout(() => {
  320. addLiquidConfigVal.value = value + ''
  321. })
  322. }
  323. if (index == 2) {
  324. setTimeout(() => {
  325. sprayLiquidConfigVal.value = value + ''
  326. })
  327. }
  328. if (index == 3) {
  329. setTimeout(() => {
  330. stoped_gs.value = value + ''
  331. })
  332. }
  333. if (index == 4) {
  334. setTimeout(() => {
  335. continued_gs.value = value + ''
  336. })
  337. }
  338. if (index == 5) {
  339. setTimeout(() => {
  340. stoped_satur.value = value + ''
  341. })
  342. }
  343. if (index == 6) {
  344. setTimeout(() => {
  345. continued_satur.value = value + ''
  346. })
  347. }
  348. if (index == 7) {
  349. setTimeout(() => {
  350. max_humidity.value = value + ''
  351. })
  352. }
  353. if (index == 8) {
  354. setTimeout(() => {
  355. pre_heat_time_s.value = value + ''
  356. })
  357. }
  358. if (index == 9) {
  359. setTimeout(() => {
  360. stoped_humi.value = value + ''
  361. })
  362. }
  363. if (index == 10) {
  364. setTimeout(() => {
  365. continued_humi.value = value + ''
  366. })
  367. }
  368. isFirstClick.value = false
  369. }
  370. }
  371. const formatter1 = value => {
  372. if (parseInt(value) == 0) {
  373. return '0'
  374. }
  375. let arr = settingStore.allSettingList.filter(item => item.name == 'stoped_gs')
  376. if (arr && arr.length > 0) {
  377. if (parseInt(value) > arr[0].val_upper_limit) {
  378. return arr[0].val_upper_limit + ''
  379. }
  380. if (parseInt(value) < arr[0].val_lower_limit) {
  381. return arr[0].val_lower_limit + ''
  382. }
  383. }
  384. return value.replace(/^0+/gi, '')
  385. }
  386. const formatter2 = value => {
  387. if (parseInt(value) == 0) {
  388. return '0'
  389. }
  390. let arr = settingStore.allSettingList.filter(
  391. item => item.name == 'continued_gs',
  392. )
  393. if (arr && arr.length > 0) {
  394. if (parseInt(value) > arr[0].val_upper_limit) {
  395. return arr[0].val_upper_limit + ''
  396. }
  397. if (parseInt(value) < arr[0].val_lower_limit) {
  398. return arr[0].val_lower_limit + ''
  399. }
  400. }
  401. return value.replace(/^0+/gi, '')
  402. }
  403. const formatter3 = value => {
  404. if (parseInt(value) == 0) {
  405. return '0'
  406. }
  407. let arr = settingStore.allSettingList.filter(
  408. item => item.name == 'stoped_satur',
  409. )
  410. if (arr && arr.length > 0) {
  411. if (parseInt(value) > arr[0].val_upper_limit) {
  412. return arr[0].val_upper_limit + ''
  413. }
  414. if (parseInt(value) < arr[0].val_lower_limit) {
  415. return arr[0].val_lower_limit + ''
  416. }
  417. }
  418. return value.replace(/^0+/gi, '')
  419. }
  420. const formatter4 = value => {
  421. if (parseInt(value) == 0) {
  422. return '0'
  423. }
  424. let arr = settingStore.allSettingList.filter(
  425. item => item.name == 'continued_satur',
  426. )
  427. if (arr && arr.length > 0) {
  428. if (parseInt(value) > arr[0].val_upper_limit) {
  429. return arr[0].val_upper_limit + ''
  430. }
  431. if (parseInt(value) < arr[0].val_lower_limit) {
  432. return arr[0].val_lower_limit + ''
  433. }
  434. }
  435. return value.replace(/^0+/gi, '')
  436. }
  437. const formatter5 = value => {
  438. if (parseInt(value) == 0) {
  439. return '0'
  440. }
  441. let arr = settingStore.allSettingList.filter(
  442. item => item.name == 'max_humidity',
  443. )
  444. if (arr && arr.length > 0) {
  445. if (parseInt(value) > arr[0].val_upper_limit) {
  446. return arr[0].val_upper_limit + ''
  447. }
  448. if (parseInt(value) < arr[0].val_lower_limit) {
  449. return arr[0].val_lower_limit + ''
  450. }
  451. }
  452. return value.replace(/^0+/gi, '')
  453. }
  454. const formatter6 = value => {
  455. if (parseInt(value) == 0) {
  456. return '0'
  457. }
  458. let arr = settingStore.allSettingList.filter(
  459. item => item.name == 'drainage_pump_speed',
  460. )
  461. if (arr && arr.length > 0) {
  462. if (parseInt(value) > arr[0].val_upper_limit) {
  463. return arr[0].val_upper_limit + ''
  464. }
  465. if (parseInt(value) < arr[0].val_lower_limit) {
  466. return arr[0].val_lower_limit + ''
  467. }
  468. }
  469. return value.replace(/^0+/gi, '')
  470. }
  471. const formatter7 = value => {
  472. if (parseInt(value) == 0) {
  473. return '0'
  474. }
  475. let arr = settingStore.allSettingList.filter(
  476. item => item.name == 'injection_pump_speed',
  477. )
  478. if (arr && arr.length > 0) {
  479. if (parseInt(value) > arr[0].val_upper_limit) {
  480. return arr[0].val_upper_limit + ''
  481. }
  482. if (parseInt(value) < arr[0].val_lower_limit) {
  483. return arr[0].val_lower_limit + ''
  484. }
  485. }
  486. return value.replace(/^0+/gi, '')
  487. }
  488. const formatter8 = value => {
  489. if (parseInt(value) == 0) {
  490. return '0'
  491. }
  492. let arr = settingStore.allSettingList.filter(
  493. item => item.name == 'pre_heat_time_s',
  494. )
  495. if (arr && arr.length > 0) {
  496. if (parseInt(value) > arr[0].val_upper_limit) {
  497. return arr[0].val_upper_limit + ''
  498. }
  499. if (parseInt(value) < arr[0].val_lower_limit) {
  500. return arr[0].val_lower_limit + ''
  501. }
  502. }
  503. return value.replace(/^0+/gi, '')
  504. }
  505. const formatter9 = value => {
  506. if (parseInt(value) == 0) {
  507. return '0'
  508. }
  509. let arr = settingStore.allSettingList.filter(
  510. item => item.name == 'stoped_humi',
  511. )
  512. if (arr && arr.length > 0) {
  513. if (parseInt(value) > arr[0].val_upper_limit) {
  514. return arr[0].val_upper_limit + ''
  515. }
  516. if (parseInt(value) < arr[0].val_lower_limit) {
  517. return arr[0].val_lower_limit + ''
  518. }
  519. }
  520. return value.replace(/^0+/gi, '')
  521. }
  522. const formatter10 = value => {
  523. if (parseInt(value) == 0) {
  524. return '0'
  525. }
  526. let arr = settingStore.allSettingList.filter(
  527. item => item.name == 'continued_humi',
  528. )
  529. if (arr && arr.length > 0) {
  530. if (parseInt(value) > arr[0].val_upper_limit) {
  531. return arr[0].val_upper_limit + ''
  532. }
  533. if (parseInt(value) < arr[0].val_lower_limit) {
  534. return arr[0].val_lower_limit + ''
  535. }
  536. }
  537. return value.replace(/^0+/gi, '')
  538. }
  539. const setAddliquidVal = () => {
  540. const val = parseInt(addLiquidConfigVal.value)
  541. if (isNaN(val)) {
  542. showFailToast('设置失败,请填写正确参数')
  543. return
  544. }
  545. settingStore.changeAddLiquidConfigVal(val)
  546. webSocketStore.sendCommandMsg(setSettingValJSON('drainage_pump_speed', val))
  547. showSuccessToast('设置成功')
  548. }
  549. const setStopedGsVal = () => {
  550. const val = parseInt(stoped_gs.value)
  551. if (isNaN(val)) {
  552. showFailToast('设置失败,请填写正确参数')
  553. return
  554. }
  555. settingStore.updateStopedGs(val)
  556. webSocketStore.sendCommandMsg(setSettingValJSON('stoped_gs', val))
  557. showSuccessToast('设置成功')
  558. }
  559. const setcontinuedGsVal = () => {
  560. const val = parseInt(continued_gs.value)
  561. if (isNaN(val)) {
  562. showFailToast('设置失败,请填写正确参数')
  563. return
  564. }
  565. settingStore.updateContinuedGs(val)
  566. webSocketStore.sendCommandMsg(setSettingValJSON('continued_gs', val))
  567. showSuccessToast('设置成功')
  568. }
  569. const setstopedSaturVal = () => {
  570. const val = parseInt(stoped_satur.value)
  571. if (isNaN(val)) {
  572. showFailToast('设置失败,请填写正确参数')
  573. return
  574. }
  575. settingStore.updateStopedSatur(val)
  576. webSocketStore.sendCommandMsg(setSettingValJSON('stoped_satur', val))
  577. showSuccessToast('设置成功')
  578. }
  579. const setContinuedSaturVal = () => {
  580. const val = parseInt(continued_satur.value)
  581. if (isNaN(val)) {
  582. showFailToast('设置失败,请填写正确参数')
  583. return
  584. }
  585. settingStore.updateContinuedSatur(val)
  586. webSocketStore.sendCommandMsg(setSettingValJSON('continued_satur', val))
  587. showSuccessToast('设置成功')
  588. }
  589. const setMaxHumidityVal = () => {
  590. const val = parseInt(max_humidity.value)
  591. if (isNaN(val)) {
  592. showFailToast('设置失败,请填写正确参数')
  593. return
  594. }
  595. settingStore.updateMaxHumidity(val)
  596. webSocketStore.sendCommandMsg(setSettingValJSON('max_humidity', val))
  597. showSuccessToast('设置成功')
  598. }
  599. const setHeat_timeVal = () => {
  600. const val = parseInt(pre_heat_time_s.value)
  601. if (isNaN(val)) {
  602. showFailToast('设置失败,请填写正确参数')
  603. return
  604. }
  605. settingStore.updatePre_heat_time_s(val)
  606. webSocketStore.sendCommandMsg(setSettingValJSON('pre_heat_time_s', val))
  607. showSuccessToast('设置成功')
  608. }
  609. const setstoped_humiVal = () => {
  610. const val = parseInt(stoped_humi.value)
  611. if (isNaN(val)) {
  612. showFailToast('设置失败,请填写正确参数')
  613. return
  614. }
  615. settingStore.updateStopedHumi(val)
  616. webSocketStore.sendCommandMsg(setSettingValJSON('stoped_humi', val))
  617. showSuccessToast('设置成功')
  618. }
  619. const setcontinued_humiVal = () => {
  620. const val = parseInt(continued_humi.value)
  621. if (isNaN(val)) {
  622. showFailToast('设置失败,请填写正确参数')
  623. return
  624. }
  625. settingStore.updateContinuedHumi(val)
  626. webSocketStore.sendCommandMsg(setSettingValJSON('continued_humi', val))
  627. showSuccessToast('设置成功')
  628. }
  629. const setSprayLiquidVal = () => {
  630. const val = parseInt(sprayLiquidConfigVal.value)
  631. if (isNaN(val)) {
  632. showFailToast('设置失败,请填写正确参数')
  633. return
  634. }
  635. settingStore.changeSprayLiquidConfigVal(val)
  636. webSocketStore.sendCommandMsg(setSettingValJSON('injection_pump_speed', val))
  637. showSuccessToast('设置成功')
  638. }
  639. </script>
  640. <style lang="scss" scoped>
  641. .device_container {
  642. box-sizing: border-box;
  643. width: 100%;
  644. height: 580px;
  645. display: grid;
  646. overflow: scroll;
  647. grid-template-columns: repeat(2, 1fr);
  648. row-gap: 20px;
  649. column-gap: 20px;
  650. padding: 20px;
  651. padding-bottom: 180px;
  652. position: relative;
  653. .btns {
  654. position: absolute;
  655. right: 20px;
  656. bottom: 20px;
  657. width: 300px;
  658. height: 68px;
  659. display: flex;
  660. align-items: center;
  661. justify-content: flex-end;
  662. .btn {
  663. width: 111px;
  664. height: 38px;
  665. border-radius: 19px;
  666. background: #06518b;
  667. display: flex;
  668. align-items: center;
  669. justify-content: center;
  670. font-family: Source Han Sans CN;
  671. font-size: 14px;
  672. font-weight: normal;
  673. line-height: normal;
  674. letter-spacing: 0.1em;
  675. color: #ffffff;
  676. }
  677. .ml {
  678. margin-left: 20px;
  679. }
  680. }
  681. .row_wrap {
  682. // width: 726px;
  683. height: 80px;
  684. border-radius: 14px;
  685. background: #f6f6f6;
  686. box-sizing: border-box;
  687. padding: 0 18px 0 40px;
  688. display: flex;
  689. align-items: center;
  690. justify-content: space-between;
  691. .title {
  692. font-family: Zona Pro;
  693. white-space: nowrap;
  694. font-size: 20px;
  695. font-weight: normal;
  696. letter-spacing: 0.06em;
  697. color: #000000;
  698. }
  699. .num {
  700. font-family: Source Han Sans CN;
  701. font-size: 14px;
  702. font-weight: 500;
  703. letter-spacing: 0.1em;
  704. color: #000000;
  705. display: flex;
  706. align-items: center;
  707. .log {
  708. width: 182px;
  709. display: flex;
  710. align-items: center;
  711. justify-content: center;
  712. }
  713. }
  714. .btn {
  715. width: 87px;
  716. height: 45px;
  717. border-radius: 23px;
  718. background: #06518b;
  719. font-family: Source Han Sans CN;
  720. font-size: 14px;
  721. font-weight: normal;
  722. letter-spacing: 0.1em;
  723. color: #ffffff;
  724. display: flex;
  725. align-items: center;
  726. justify-content: center;
  727. }
  728. }
  729. }
  730. </style>