大空间消毒机
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.

747 lines
19 KiB

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