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

627 lines
17 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="test_container">
  3. <div class="common_set switch_wrap">
  4. <p class="title">加液蠕动泵</p>
  5. <div class="num">
  6. <van-field
  7. type="number"
  8. v-model="addLiquidVal"
  9. :clickable="true"
  10. :formatter="formatter6"
  11. readonly
  12. @click.stop="hideAllKeyboards(1)"
  13. class="add_liquid_input"
  14. />
  15. <p>g/min</p>
  16. </div>
  17. <div class="num">
  18. <van-field
  19. type="number"
  20. v-model="addLiquidPower"
  21. :clickable="true"
  22. readonly
  23. :formatter="formatter"
  24. @click.stop="hideAllKeyboards(2)"
  25. class="add_liquid_input"
  26. />
  27. <p>P</p>
  28. </div>
  29. <div class="btn_wrap">
  30. <div
  31. :class="
  32. settingStore.addLiquidConfigVal > 0
  33. ? 'open success style-btn'
  34. : 'open style-btn'
  35. "
  36. @click="setAddLiquidConfig(1)"
  37. >
  38. 正转
  39. </div>
  40. <div
  41. :class="
  42. settingStore.addLiquidConfigVal < 0
  43. ? 'open success style-btn'
  44. : 'open style-btn'
  45. "
  46. @click="setAddLiquidConfig(5)"
  47. >
  48. 反转
  49. </div>
  50. <div
  51. class="open style-btn"
  52. @click="setAddLiquidConfig(3)"
  53. style="margin-right: 0"
  54. >
  55. 关闭
  56. </div>
  57. </div>
  58. </div>
  59. <div class="common_set switch_wrap">
  60. <p class="title">注射蠕动泵</p>
  61. <div class="num">
  62. <van-field
  63. type="number"
  64. :formatter="formatter7"
  65. v-model="addLiquidVal2"
  66. :clickable="true"
  67. readonly
  68. @click.stop="hideAllKeyboards(3)"
  69. class="add_liquid_input"
  70. />
  71. <p>g/min</p>
  72. </div>
  73. <div class="num">
  74. <van-field
  75. type="number"
  76. :formatter="formatter"
  77. v-model="addLiquidPower2"
  78. :clickable="true"
  79. readonly
  80. @click.stop="hideAllKeyboards(4)"
  81. class="add_liquid_input"
  82. />
  83. <p>P</p>
  84. </div>
  85. <div class="btn_wrap">
  86. <div
  87. :class="
  88. settingStore.sprayLiquidConfigVal > 0
  89. ? 'open success style-btn'
  90. : 'open style-btn'
  91. "
  92. @click="setAddLiquidConfig(2)"
  93. >
  94. 正转
  95. </div>
  96. <div
  97. :class="
  98. settingStore.sprayLiquidConfigVal < 0
  99. ? 'open success style-btn'
  100. : 'open style-btn'
  101. "
  102. @click="setAddLiquidConfig(6)"
  103. >
  104. 反转
  105. </div>
  106. <div
  107. class="open style-btn"
  108. @click="setAddLiquidConfig(4)"
  109. style="margin-right: 0"
  110. >
  111. 关闭
  112. </div>
  113. </div>
  114. </div>
  115. <div class="common_set switch_wrap">
  116. <p class="title">空压机</p>
  117. <p class="num">
  118. {{
  119. testStore?.airCompressorObj?.currentVal > 5000
  120. ? 5000
  121. : testStore?.airCompressorObj?.currentVal
  122. }}
  123. A
  124. </p>
  125. <div class="btn_wrap">
  126. <div
  127. :class="
  128. testStore.airCompressor ? 'close style-btn' : 'open style-btn'
  129. "
  130. @click="changeAirStatus(1)"
  131. >
  132. 打开
  133. </div>
  134. <div
  135. :class="
  136. !testStore.airCompressor ? 'close style-btn' : 'open style-btn'
  137. "
  138. @click="changeAirStatus(2)"
  139. >
  140. 关闭
  141. </div>
  142. </div>
  143. </div>
  144. <div class="common_set switch_wrap">
  145. <p class="title">风机</p>
  146. <p class="num">{{ testStore?.airBlowerObj?.currentVal }} r/min</p>
  147. <div class="btn_wrap">
  148. <div
  149. :class="testStore.draughtFan ? 'close style-btn' : 'open style-btn'"
  150. @click="changeDraughtStatus(1)"
  151. >
  152. 打开
  153. </div>
  154. <div
  155. :class="!testStore.draughtFan ? 'close style-btn' : 'open style-btn'"
  156. @click="changeDraughtStatus(2)"
  157. >
  158. 关闭
  159. </div>
  160. </div>
  161. </div>
  162. <div class="common_set switch_wrap">
  163. <p class="title">加热片</p>
  164. <p class="num">{{ testStore?.heatingStripObj?.currentVal }} A</p>
  165. <div class="btn_wrap">
  166. <div
  167. :class="testStore.heatingStrip ? 'close style-btn' : 'open style-btn'"
  168. @click="changeHeatingStatus(1)"
  169. >
  170. 打开
  171. </div>
  172. <div
  173. :class="
  174. !testStore.heatingStrip ? 'close style-btn' : 'open style-btn'
  175. "
  176. @click="changeHeatingStatus(2)"
  177. >
  178. 关闭
  179. </div>
  180. </div>
  181. </div>
  182. <div class="common_set update_wrap">
  183. <p class="title">水浸1</p>
  184. <p class="num">{{ testStore.waterImmersionSensor1 ? '有水' : '没水' }}</p>
  185. <div class="btn_wrap style-btn" @click="handleUpdate" style="opacity: 0">
  186. 更新读取水浸状态
  187. </div>
  188. </div>
  189. <div class="common_set update_wrap">
  190. <p class="title">水浸2</p>
  191. <p class="num">{{ testStore.waterImmersionSensor2 ? '有水' : '没水' }}</p>
  192. <div class="btn_wrap style-btn" @click="handleUpdate" style="opacity: 0">
  193. 更新读取水浸状态
  194. </div>
  195. </div>
  196. <div class="common_set update_wrap">
  197. <p class="title">液位</p>
  198. <p class="num">
  199. {{
  200. deviceStore.disinfectantCapacity <= 0
  201. ? 0
  202. : deviceStore.disinfectantCapacity
  203. }}
  204. kPa/100g
  205. </p>
  206. <div class="btn_wrap style-btn" @click="handleUpdate" style="opacity: 0">
  207. 更新读取液位状态
  208. </div>
  209. </div>
  210. <div class="common_set info_wrap">
  211. <p class="title">仓内</p>
  212. <p class="info">温度 {{ deviceStore.binTemperature }} </p>
  213. <p class="info">湿度 {{ deviceStore.binHumidity }} </p>
  214. <p class="info">过氧化氢浓度 {{ deviceStore.binHP }} PPM</p>
  215. </div>
  216. <div class="common_set info_wrap">
  217. <p class="title">环境1</p>
  218. <p class="info">温度 {{ deviceStore.envirTemperature1 }} </p>
  219. <p class="info">湿度 {{ deviceStore.envirHumidity1 }} </p>
  220. <p class="info">过氧化氢浓度 {{ deviceStore.envirHP1 }} PPM</p>
  221. </div>
  222. <div class="common_set info_wrap">
  223. <p class="title">环境2</p>
  224. <p class="info">温度 {{ deviceStore.envirTemperature2 }} </p>
  225. <p class="info">湿度 {{ deviceStore.envirHumidity2 }} </p>
  226. <p class="info">过氧化氢浓度 {{ deviceStore.envirHP2 }} PPM</p>
  227. </div>
  228. <van-number-keyboard
  229. v-model="addLiquidVal"
  230. @input="val => handleInput(val, 1)"
  231. :show="numberKeyboardShowVal"
  232. @blur="numberKeyboardShowVal = false"
  233. />
  234. <van-number-keyboard
  235. @input="val => handleInput(val, 2)"
  236. v-model="addLiquidPower"
  237. :show="numberKeyboardShowPower"
  238. @blur="numberKeyboardShowPower = false"
  239. />
  240. <van-number-keyboard
  241. @input="val => handleInput(val, 3)"
  242. v-model="addLiquidVal2"
  243. :show="numberKeyboardShowVal2"
  244. @blur="numberKeyboardShowVal2 = false"
  245. />
  246. <van-number-keyboard
  247. @input="val => handleInput(val, 4)"
  248. v-model="addLiquidPower2"
  249. :show="numberKeyboardShowPower2"
  250. @blur="numberKeyboardShowPower2 = false"
  251. />
  252. </div>
  253. </template>
  254. <script setup>
  255. import { ref } from 'vue'
  256. import {
  257. useTestStore,
  258. useDeviceStore,
  259. useWebSocketStore,
  260. useSettingStore,
  261. } from '@/store'
  262. import {
  263. someAirSwitchJSON,
  264. liquidpumpctrlJSON,
  265. getStateJSON,
  266. addLiquidCtrlJSON,
  267. } from '@/mock/command'
  268. import { showSuccessToast, showFailToast } from 'vant'
  269. const testStore = useTestStore()
  270. const deviceStore = useDeviceStore()
  271. const websocketStore = useWebSocketStore()
  272. const settingStore = useSettingStore()
  273. const addLiquidVal = ref(settingStore.addLiquidConfigVal)
  274. const addLiquidPower = ref(25)
  275. const numberKeyboardShowVal = ref(false)
  276. const numberKeyboardShowPower = ref(false)
  277. const addLiquidVal2 = ref(settingStore.sprayLiquidConfigVal)
  278. const addLiquidPower2 = ref(25)
  279. const numberKeyboardShowVal2 = ref(false)
  280. const numberKeyboardShowPower2 = ref(false)
  281. const formatter = value => {
  282. if (parseInt(value) > 31) {
  283. return '31'
  284. }
  285. return value
  286. }
  287. const formatter6 = value => {
  288. let arr = settingStore.allSettingList.filter(
  289. item => item.name == 'drainage_pump_speed',
  290. )
  291. if (arr && arr.length > 0) {
  292. if (parseInt(value) > arr[0].val_upper_limit) {
  293. return arr[0].val_upper_limit + ''
  294. }
  295. if (parseInt(value) < arr[0].val_lower_limit) {
  296. return arr[0].val_lower_limit + ''
  297. }
  298. }
  299. return value
  300. }
  301. const formatter7 = value => {
  302. let arr = settingStore.allSettingList.filter(
  303. item => item.name == 'injection_pump_speed',
  304. )
  305. if (arr && arr.length > 0) {
  306. if (parseInt(value) > arr[0].val_upper_limit) {
  307. return arr[0].val_upper_limit + ''
  308. }
  309. if (parseInt(value) < arr[0].val_lower_limit) {
  310. return arr[0].val_lower_limit + ''
  311. }
  312. }
  313. return value
  314. }
  315. const isFirstClick = ref(true)
  316. const hideAllKeyboards = flag => {
  317. isFirstClick.value = true
  318. if (flag == 1) {
  319. numberKeyboardShowVal.value = true
  320. numberKeyboardShowPower.value = false
  321. numberKeyboardShowVal2.value = false
  322. numberKeyboardShowPower2.value = false
  323. }
  324. if (flag == 2) {
  325. numberKeyboardShowPower.value = true
  326. numberKeyboardShowVal.value = false
  327. numberKeyboardShowVal2.value = false
  328. numberKeyboardShowPower2.value = false
  329. }
  330. if (flag == 3) {
  331. numberKeyboardShowVal2.value = true
  332. numberKeyboardShowPower.value = false
  333. numberKeyboardShowVal.value = false
  334. numberKeyboardShowPower2.value = false
  335. }
  336. if (flag == 4) {
  337. numberKeyboardShowPower2.value = true
  338. numberKeyboardShowPower.value = false
  339. numberKeyboardShowVal2.value = false
  340. numberKeyboardShowVal.value = false
  341. }
  342. }
  343. const handleInput = (value, index) => {
  344. if (isFirstClick.value) {
  345. if (index == 1) {
  346. setTimeout(() => {
  347. addLiquidVal.value = value + ''
  348. })
  349. }
  350. if (index == 2) {
  351. setTimeout(() => {
  352. addLiquidPower.value = value + ''
  353. })
  354. }
  355. if (index == 3) {
  356. setTimeout(() => {
  357. addLiquidVal2.value = value + ''
  358. })
  359. }
  360. if (index == 4) {
  361. setTimeout(() => {
  362. addLiquidPower2.value = value + ''
  363. })
  364. }
  365. isFirstClick.value = false
  366. }
  367. }
  368. const setAddLiquidConfig = flag => {
  369. if (flag == 1) {
  370. websocketStore.sendCommandMsg(
  371. addLiquidCtrlJSON(1, addLiquidVal.value, addLiquidPower.value),
  372. )
  373. showSuccessToast('设置成功')
  374. } else if (flag == 2) {
  375. websocketStore.sendCommandMsg(
  376. addLiquidCtrlJSON(2, addLiquidVal2.value, addLiquidPower2.value),
  377. )
  378. showSuccessToast('设置成功')
  379. } else if (flag == 3) {
  380. websocketStore.sendCommandMsg(addLiquidCtrlJSON(1, 0, addLiquidPower.value))
  381. showSuccessToast('关闭加液蠕动泵成功')
  382. } else if (flag == 5) {
  383. websocketStore.sendCommandMsg(
  384. addLiquidCtrlJSON(1, '-' + addLiquidVal.value, addLiquidPower.value),
  385. )
  386. showSuccessToast('设置成功')
  387. } else if (flag == 6) {
  388. websocketStore.sendCommandMsg(
  389. addLiquidCtrlJSON(2, '-' + addLiquidVal2.value, addLiquidPower2.value),
  390. )
  391. showSuccessToast('设置成功')
  392. } else {
  393. websocketStore.sendCommandMsg(
  394. addLiquidCtrlJSON(2, 0, addLiquidPower2.value),
  395. )
  396. showSuccessToast('关闭注射蠕动泵成功')
  397. }
  398. }
  399. const handleUpdate = () => {
  400. websocketStore.sendCommandMsg(getStateJSON)
  401. }
  402. const changeFeedingStatus = flag => {
  403. if (flag == 1) {
  404. if (!testStore.feedingPeristalticPumpStatus) {
  405. // 发送打开指令
  406. websocketStore.sendCommandMsg(
  407. liquidpumpctrlJSON(1, settingStore.addLiquidConfigVal),
  408. )
  409. testStore.updateFeedingPeristalticPumpStatus(true)
  410. }
  411. } else {
  412. if (testStore.feedingPeristalticPumpStatus) {
  413. websocketStore.sendCommandMsg(liquidpumpctrlJSON(1, 0))
  414. testStore.updateFeedingPeristalticPumpStatus(false)
  415. }
  416. }
  417. }
  418. const changeSprayStatus = flag => {
  419. if (flag == 1) {
  420. if (!testStore.sprayPeristalticPump) {
  421. websocketStore.sendCommandMsg(
  422. liquidpumpctrlJSON(2, settingStore.sprayLiquidConfigVal),
  423. )
  424. testStore.updateSprayPeristalticPump(true)
  425. }
  426. } else {
  427. if (testStore.sprayPeristalticPump) {
  428. websocketStore.sendCommandMsg(liquidpumpctrlJSON(2, 0))
  429. testStore.updateSprayPeristalticPump(false)
  430. }
  431. }
  432. }
  433. const changeHeatingStatus = flag => {
  434. if (flag == 1) {
  435. if (!testStore.heatingStrip) {
  436. websocketStore.sendCommandMsg(someAirSwitchJSON(4, 1))
  437. websocketStore.sendCommandMsg(someAirSwitchJSON(5, 1))
  438. testStore.updateHeatingStrip(true)
  439. }
  440. } else {
  441. if (testStore.heatingStrip) {
  442. websocketStore.sendCommandMsg(someAirSwitchJSON(4, 0))
  443. websocketStore.sendCommandMsg(someAirSwitchJSON(5, 0))
  444. testStore.updateHeatingStrip(false)
  445. }
  446. }
  447. }
  448. const changeAirStatus = flag => {
  449. if (flag == 1) {
  450. if (!testStore.airCompressor) {
  451. websocketStore.sendCommandMsg(someAirSwitchJSON(0, 1))
  452. websocketStore.sendCommandMsg(someAirSwitchJSON(1, 1))
  453. testStore.updateAirCompressor(true)
  454. }
  455. } else {
  456. if (testStore.airCompressor) {
  457. websocketStore.sendCommandMsg(someAirSwitchJSON(0, 0))
  458. websocketStore.sendCommandMsg(someAirSwitchJSON(1, 0))
  459. testStore.updateAirCompressor(false)
  460. }
  461. }
  462. }
  463. const changeDraughtStatus = flag => {
  464. if (flag == 1) {
  465. if (!testStore.draughtFan) {
  466. websocketStore.sendCommandMsg(someAirSwitchJSON(2, 1))
  467. websocketStore.sendCommandMsg(someAirSwitchJSON(3, 1))
  468. testStore.updateDraughtFan(true)
  469. }
  470. } else {
  471. if (testStore.draughtFan) {
  472. websocketStore.sendCommandMsg(someAirSwitchJSON(2, 0))
  473. websocketStore.sendCommandMsg(someAirSwitchJSON(3, 0))
  474. testStore.updateDraughtFan(false)
  475. }
  476. }
  477. }
  478. </script>
  479. <style lang="scss" scoped>
  480. .test_container {
  481. margin-bottom: 19px;
  482. height: 580px;
  483. overflow: scroll;
  484. box-sizing: border-box;
  485. background: #ffffff;
  486. border-radius: 16px;
  487. padding: 20px;
  488. display: grid;
  489. row-gap: 20px;
  490. column-gap: 20px;
  491. grid-template-columns: repeat(2, 1fr);
  492. grid-template-rows: repeat(5, 1fr);
  493. padding-bottom: 20px;
  494. .common_set {
  495. width: 580px;
  496. height: 73px;
  497. box-sizing: border-box;
  498. border-radius: 14px;
  499. background: #f6f6f6;
  500. display: flex;
  501. align-items: center;
  502. .title {
  503. font-family: Source Han Sans CN;
  504. font-size: 20px;
  505. font-weight: 500;
  506. letter-spacing: 0.06em;
  507. color: #000000;
  508. width: 106px;
  509. }
  510. .num {
  511. font-family: Source Han Sans CN;
  512. font-size: 13px;
  513. font-weight: 500;
  514. letter-spacing: 0.1em;
  515. color: #000000;
  516. display: flex;
  517. align-items: center;
  518. margin-right: 4px;
  519. .add_liquid_input {
  520. width: 40px;
  521. margin-right: 2px;
  522. text-align: right;
  523. height: 24px;
  524. padding: 0;
  525. color: #0e0e0e;
  526. font-family: Source Han Sans CN;
  527. font-weight: 500;
  528. font-size: 14;
  529. }
  530. }
  531. }
  532. .switch_wrap {
  533. padding: 0 17px 0 17px;
  534. justify-content: space-between;
  535. .btn_wrap {
  536. display: flex;
  537. align-items: center;
  538. .open {
  539. margin-right: 10px;
  540. width: 87px;
  541. height: 45px;
  542. border-radius: 23px;
  543. background: #06518b;
  544. display: flex;
  545. align-items: center;
  546. justify-content: center;
  547. font-family: Source Han Sans CN;
  548. font-size: 14px;
  549. font-weight: 500;
  550. letter-spacing: 0.1em;
  551. color: #ffffff;
  552. }
  553. .success {
  554. background: #1ad66e;
  555. }
  556. .close {
  557. width: 87px;
  558. height: 45px;
  559. border-radius: 23px;
  560. background: #ffffff;
  561. display: flex;
  562. align-items: center;
  563. justify-content: center;
  564. font-family: Source Han Sans CN;
  565. font-size: 14px;
  566. font-weight: 500;
  567. letter-spacing: 0.1em;
  568. color: #d8d8d8;
  569. }
  570. }
  571. }
  572. .update_wrap {
  573. padding: 0 17px 0 17px;
  574. justify-content: space-between;
  575. .btn_wrap {
  576. width: 184px;
  577. height: 45px;
  578. border-radius: 23px;
  579. background: #06518b;
  580. display: flex;
  581. align-items: center;
  582. justify-content: center;
  583. font-family: Source Han Sans CN;
  584. font-size: 14px;
  585. font-weight: 500;
  586. letter-spacing: 0.1em;
  587. color: #ffffff;
  588. }
  589. }
  590. .info_wrap {
  591. padding: 0 32px 0 17px;
  592. justify-content: space-between;
  593. .title {
  594. font-family: Source Han Sans CN;
  595. font-size: 20px;
  596. font-weight: 500;
  597. letter-spacing: 0.06em;
  598. color: #000000;
  599. width: 57px;
  600. white-space: nowrap;
  601. }
  602. .info {
  603. font-family: Source Han Sans CN;
  604. font-size: 14px;
  605. font-weight: 500;
  606. letter-spacing: 0.1em;
  607. color: #06518b;
  608. }
  609. }
  610. }
  611. </style>