新型管道消毒机前端代码
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.

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