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

348 lines
9.6 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
  1. <template>
  2. <div class="test_container">
  3. <div class="common_set switch_wrap">
  4. <p class="title">加液蠕动泵</p>
  5. <p class="num">{{ Math.abs(testStore.chargingPump) }} RPM</p>
  6. <div class="btn_wrap">
  7. <div
  8. :class="testStore.feedingPeristalticPumpStatus ? 'close' : 'open'"
  9. @click="changeFeedingStatus(1)"
  10. >
  11. 打开
  12. </div>
  13. <div
  14. :class="!testStore.feedingPeristalticPumpStatus ? 'close' : 'open'"
  15. @click="changeFeedingStatus(2)"
  16. >
  17. 关闭
  18. </div>
  19. </div>
  20. </div>
  21. <div class="common_set switch_wrap">
  22. <p class="title">喷液蠕动泵</p>
  23. <p class="num">{{ testStore.sprinklerPump }} RPM</p>
  24. <div class="btn_wrap">
  25. <div
  26. :class="testStore.sprayPeristalticPump ? 'close' : 'open'"
  27. @click="changeSprayStatus(1)"
  28. >
  29. 打开
  30. </div>
  31. <div
  32. :class="!testStore.sprayPeristalticPump ? 'close' : 'open'"
  33. @click="changeSprayStatus(2)"
  34. >
  35. 关闭
  36. </div>
  37. </div>
  38. </div>
  39. <div class="common_set switch_wrap">
  40. <p class="title">空压机</p>
  41. <p class="num">{{ testStore?.airCompressorObj?.currentVal }} A</p>
  42. <div class="btn_wrap">
  43. <div
  44. :class="testStore.airCompressor ? 'close' : 'open'"
  45. @click="changeAirStatus(1)"
  46. >
  47. 打开
  48. </div>
  49. <div
  50. :class="!testStore.airCompressor ? 'close' : 'open'"
  51. @click="changeAirStatus(2)"
  52. >
  53. 关闭
  54. </div>
  55. </div>
  56. </div>
  57. <div class="common_set switch_wrap">
  58. <p class="title">风机</p>
  59. <p class="num">{{ testStore?.airBlowerObj?.currentVal }} RPM</p>
  60. <div class="btn_wrap">
  61. <div
  62. :class="testStore.draughtFan ? 'close' : 'open'"
  63. @click="changeDraughtStatus(1)"
  64. >
  65. 打开
  66. </div>
  67. <div
  68. :class="!testStore.draughtFan ? 'close' : 'open'"
  69. @click="changeDraughtStatus(2)"
  70. >
  71. 关闭
  72. </div>
  73. </div>
  74. </div>
  75. <div class="common_set switch_wrap">
  76. <p class="title">加热片</p>
  77. <p class="num">{{ testStore?.heatingStripObj?.currentVal }} </p>
  78. <div class="btn_wrap">
  79. <div
  80. :class="testStore.heatingStrip ? 'close' : 'open'"
  81. @click="changeHeatingStatus(1)"
  82. >
  83. 打开
  84. </div>
  85. <div
  86. :class="!testStore.heatingStrip ? 'close' : 'open'"
  87. @click="changeHeatingStatus(2)"
  88. >
  89. 关闭
  90. </div>
  91. </div>
  92. </div>
  93. <div class="common_set update_wrap">
  94. <p class="title">水浸1</p>
  95. <p class="num">{{ testStore.waterImmersionSensor1 ? '有水' : '没水' }}</p>
  96. <div class="btn_wrap" @click="handleUpdate">更新读取水浸状态</div>
  97. </div>
  98. <div class="common_set update_wrap">
  99. <p class="title">水浸2</p>
  100. <p class="num">{{ testStore.waterImmersionSensor2 ? '有水' : '没水' }}</p>
  101. <div class="btn_wrap" @click="handleUpdate">更新读取水浸状态</div>
  102. </div>
  103. <div class="common_set update_wrap">
  104. <p class="title">液位</p>
  105. <p class="num">{{ deviceStore.disinfectantCapacity }} kPa/100g</p>
  106. <div class="btn_wrap" @click="handleUpdate">更新读取液位状态</div>
  107. </div>
  108. <div class="common_set info_wrap">
  109. <p class="title">仓内</p>
  110. <p class="info">温度 {{ deviceStore.binTemperature }} </p>
  111. <p class="info">湿度 {{ deviceStore.binHumidity }} </p>
  112. <p class="info">过氧化氢浓度 {{ deviceStore.binHP }} PPM</p>
  113. </div>
  114. <div class="common_set info_wrap">
  115. <p class="title">环境1</p>
  116. <p class="info">温度 {{ deviceStore.envirTemperature1 }} </p>
  117. <p class="info">湿度 {{ deviceStore.envirHumidity1 }} </p>
  118. <p class="info">过氧化氢浓度 {{ deviceStore.envirHP1 }} PPM</p>
  119. </div>
  120. <div class="common_set info_wrap">
  121. <p class="title">环境2</p>
  122. <p class="info">温度 {{ deviceStore.envirTemperature2 }} </p>
  123. <p class="info">湿度 {{ deviceStore.envirHumidity2 }} </p>
  124. <p class="info">过氧化氢浓度 {{ deviceStore.envirHP2 }} PPM</p>
  125. </div>
  126. </div>
  127. </template>
  128. <script setup>
  129. import { ref } from 'vue'
  130. import {
  131. useTestStore,
  132. useDeviceStore,
  133. useWebSocketStore,
  134. useSettingStore,
  135. } from '@/store'
  136. import {
  137. someAirSwitchJSON,
  138. liquidpumpctrlJSON,
  139. getStateJSON,
  140. } from '@/mock/command'
  141. const testStore = useTestStore()
  142. const deviceStore = useDeviceStore()
  143. const websocketStore = useWebSocketStore()
  144. const settingStore = useSettingStore()
  145. const handleUpdate = () => {
  146. websocketStore.sendCommandMsg(getStateJSON)
  147. }
  148. const changeFeedingStatus = flag => {
  149. if (flag == 1) {
  150. if (!testStore.feedingPeristalticPumpStatus) {
  151. // 发送打开指令
  152. websocketStore.sendCommandMsg(
  153. liquidpumpctrlJSON(1, settingStore.addLiquidConfigVal),
  154. )
  155. testStore.updateFeedingPeristalticPumpStatus(true)
  156. }
  157. } else {
  158. if (testStore.feedingPeristalticPumpStatus) {
  159. websocketStore.sendCommandMsg(liquidpumpctrlJSON(1, 0))
  160. testStore.updateFeedingPeristalticPumpStatus(false)
  161. }
  162. }
  163. }
  164. const changeSprayStatus = flag => {
  165. if (flag == 1) {
  166. if (!testStore.sprayPeristalticPump) {
  167. websocketStore.sendCommandMsg(
  168. liquidpumpctrlJSON(2, settingStore.sprayLiquidConfigVal),
  169. )
  170. testStore.updateSprayPeristalticPump(true)
  171. }
  172. } else {
  173. if (testStore.sprayPeristalticPump) {
  174. websocketStore.sendCommandMsg(liquidpumpctrlJSON(2, 0))
  175. testStore.updateSprayPeristalticPump(false)
  176. }
  177. }
  178. }
  179. const changeHeatingStatus = flag => {
  180. if (flag == 1) {
  181. if (!testStore.heatingStrip) {
  182. websocketStore.sendCommandMsg(someAirSwitchJSON(4, 1))
  183. websocketStore.sendCommandMsg(someAirSwitchJSON(5, 1))
  184. testStore.updateHeatingStrip(true)
  185. }
  186. } else {
  187. if (testStore.heatingStrip) {
  188. websocketStore.sendCommandMsg(someAirSwitchJSON(4, 0))
  189. websocketStore.sendCommandMsg(someAirSwitchJSON(5, 0))
  190. testStore.updateHeatingStrip(false)
  191. }
  192. }
  193. }
  194. const changeAirStatus = flag => {
  195. if (flag == 1) {
  196. if (!testStore.airCompressor) {
  197. websocketStore.sendCommandMsg(someAirSwitchJSON(0, 1))
  198. websocketStore.sendCommandMsg(someAirSwitchJSON(1, 1))
  199. testStore.updateAirCompressor(true)
  200. }
  201. } else {
  202. if (testStore.airCompressor) {
  203. websocketStore.sendCommandMsg(someAirSwitchJSON(0, 0))
  204. websocketStore.sendCommandMsg(someAirSwitchJSON(1, 0))
  205. testStore.updateAirCompressor(false)
  206. }
  207. }
  208. }
  209. const changeDraughtStatus = flag => {
  210. if (flag == 1) {
  211. if (!testStore.draughtFan) {
  212. websocketStore.sendCommandMsg(someAirSwitchJSON(2, 1))
  213. websocketStore.sendCommandMsg(someAirSwitchJSON(3, 1))
  214. testStore.updateDraughtFan(true)
  215. }
  216. } else {
  217. if (testStore.draughtFan) {
  218. websocketStore.sendCommandMsg(someAirSwitchJSON(2, 0))
  219. websocketStore.sendCommandMsg(someAirSwitchJSON(3, 0))
  220. testStore.updateDraughtFan(false)
  221. }
  222. }
  223. }
  224. </script>
  225. <style lang="scss" scoped>
  226. .test_container {
  227. margin-bottom: 30px;
  228. height: 580px;
  229. overflow: scroll;
  230. box-sizing: border-box;
  231. background: #ffffff;
  232. border-radius: 16px;
  233. padding: 20px;
  234. display: grid;
  235. row-gap: 20px;
  236. column-gap: 20px;
  237. grid-template-columns: repeat(2, 1fr);
  238. grid-template-rows: repeat(5, 1fr);
  239. .common_set {
  240. width: 580px;
  241. height: 80px;
  242. box-sizing: border-box;
  243. border-radius: 14px;
  244. background: #f6f6f6;
  245. display: flex;
  246. align-items: center;
  247. .title {
  248. font-family: Source Han Sans CN;
  249. font-size: 20px;
  250. font-weight: 500;
  251. letter-spacing: 0.06em;
  252. color: #000000;
  253. width: 106px;
  254. }
  255. .num {
  256. font-family: Source Han Sans CN;
  257. font-size: 14px;
  258. font-weight: 500;
  259. letter-spacing: 0.1em;
  260. color: #000000;
  261. }
  262. }
  263. .switch_wrap {
  264. padding: 0 17px 0 40px;
  265. justify-content: space-between;
  266. .btn_wrap {
  267. display: flex;
  268. align-items: center;
  269. .open {
  270. margin-right: 10px;
  271. width: 87px;
  272. height: 45px;
  273. border-radius: 23px;
  274. background: #06518b;
  275. display: flex;
  276. align-items: center;
  277. justify-content: center;
  278. font-family: Source Han Sans CN;
  279. font-size: 14px;
  280. font-weight: 500;
  281. letter-spacing: 0.1em;
  282. color: #ffffff;
  283. }
  284. .close {
  285. width: 87px;
  286. height: 45px;
  287. border-radius: 23px;
  288. background: #ffffff;
  289. display: flex;
  290. align-items: center;
  291. justify-content: center;
  292. font-family: Source Han Sans CN;
  293. font-size: 14px;
  294. font-weight: 500;
  295. letter-spacing: 0.1em;
  296. color: #d8d8d8;
  297. }
  298. }
  299. }
  300. .update_wrap {
  301. padding: 0 17px 0 40px;
  302. justify-content: space-between;
  303. .btn_wrap {
  304. width: 184px;
  305. height: 45px;
  306. border-radius: 23px;
  307. background: #06518b;
  308. display: flex;
  309. align-items: center;
  310. justify-content: center;
  311. font-family: Source Han Sans CN;
  312. font-size: 14px;
  313. font-weight: 500;
  314. letter-spacing: 0.1em;
  315. color: #ffffff;
  316. }
  317. }
  318. .info_wrap {
  319. padding: 0 32px 0 40px;
  320. justify-content: space-between;
  321. .title {
  322. font-family: Source Han Sans CN;
  323. font-size: 20px;
  324. font-weight: 500;
  325. letter-spacing: 0.06em;
  326. color: #000000;
  327. width: 57px;
  328. white-space: nowrap;
  329. }
  330. .info {
  331. font-family: Source Han Sans CN;
  332. font-size: 14px;
  333. font-weight: 500;
  334. letter-spacing: 0.1em;
  335. color: #06518b;
  336. }
  337. }
  338. }
  339. </style>