消毒机设备
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.

423 lines
11 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <script lang="ts" setup>
  2. import { sendCmd } from 'apis/system'
  3. import { roundNumber } from 'libs/utils'
  4. import { useDebugStore } from 'stores/debugStore'
  5. import { useHomeStore } from 'stores/homeStore'
  6. import { ref, watchEffect } from 'vue'
  7. const homeStore = useHomeStore()
  8. const debugStore = useDebugStore()
  9. const h2O2SensorData = ref<Home.DisplayrelyMgrParams[]>(homeStore.h2O2SensorData)
  10. const sprayPumpGpmValue = ref<number>(5)
  11. const airLeakDetectTestMode = ref<string>('disinfection')
  12. watchEffect(() => {
  13. const hdData = homeStore.h2O2SensorData
  14. if (hdData && hdData.length) {
  15. h2O2SensorData.value = [...hdData]
  16. }
  17. })
  18. // 加液
  19. const liquidFillingPumpDoLiquidFilling = async () => {
  20. const data = {
  21. className: 'TestPageCtrlService',
  22. fnName: 'liquidFillingPumpDoLiquidFilling',
  23. params: {},
  24. }
  25. await sendCmd(data)
  26. }
  27. // 排液
  28. const liquidFillingPumpDoLiquidDischarge = async () => {
  29. const data = {
  30. className: 'TestPageCtrlService',
  31. fnName: 'liquidFillingPumpDoLiquidDischarge',
  32. params: {},
  33. }
  34. sendCmd(data)
  35. }
  36. // 停止加液 或 排液。停止电机
  37. const liquidFillingPumpDoStop = () => {
  38. const data = {
  39. className: 'TestPageCtrlService',
  40. fnName: 'liquidFillingPumpDoStop',
  41. params: {},
  42. }
  43. sendCmd(data)
  44. }
  45. // 打开空压机
  46. const airCompressorDoOpen = () => {
  47. const data = {
  48. className: 'TestPageCtrlService',
  49. fnName: 'airCompressorDoOpen',
  50. params: {},
  51. }
  52. sendCmd(data)
  53. }
  54. // 关闭空压机
  55. const airCompressorDoClose = () => {
  56. const data = {
  57. className: 'TestPageCtrlService',
  58. fnName: 'airCompressorDoClose',
  59. params: {},
  60. }
  61. sendCmd(data)
  62. }
  63. // 打开加热
  64. const heatingDoOpen = () => {
  65. const data = {
  66. className: 'TestPageCtrlService',
  67. fnName: 'heatingDoOpen',
  68. params: {},
  69. }
  70. sendCmd(data)
  71. }
  72. // 关闭加热
  73. const heatingDoClose = () => {
  74. const data = {
  75. className: 'TestPageCtrlService',
  76. fnName: 'heatingDoClose',
  77. params: {},
  78. }
  79. sendCmd(data)
  80. }
  81. // 喷液泵控制 喷液(gpm)
  82. const sprayPumpDoForward = () => {
  83. const data = {
  84. className: 'TestPageCtrlService',
  85. fnName: 'sprayPumpDoForward',
  86. params: {
  87. gpm: sprayPumpGpmValue.value,
  88. },
  89. }
  90. sendCmd(data)
  91. }
  92. // 喷液泵控制 回流(gpm)
  93. const sprayPumpDoBackward = () => {
  94. const data = {
  95. className: 'TestPageCtrlService',
  96. fnName: 'sprayPumpDoBackward',
  97. params: {
  98. gpm: sprayPumpGpmValue.value,
  99. },
  100. }
  101. sendCmd(data)
  102. }
  103. // 喷液泵控制 停止
  104. const onClosePump = () => {
  105. const data = {
  106. className: 'TestPageCtrlService',
  107. fnName: 'sprayPumpDoStop',
  108. params: {},
  109. }
  110. sendCmd(data)
  111. }
  112. // 打开风机
  113. const blowerDoOpen = () => {
  114. const data = {
  115. className: 'TestPageCtrlService',
  116. fnName: 'blowerDoOpen',
  117. params: {},
  118. }
  119. sendCmd(data)
  120. }
  121. // 关闭风机
  122. const blowerDoClose = () => {
  123. const data = {
  124. className: 'TestPageCtrlService',
  125. fnName: 'blowerDoClose',
  126. params: {},
  127. }
  128. sendCmd(data)
  129. }
  130. // 气密性测试模式切换
  131. const airLeakDetectTestModeDoSetMode = () => {
  132. const data = {
  133. className: 'TestPageCtrlService',
  134. fnName: 'airLeakDetectTestModeDoSetMode',
  135. params: {
  136. mode: airLeakDetectTestMode.value,
  137. },
  138. }
  139. sendCmd(data)
  140. }
  141. // 打印测试
  142. const printerDoTest = () => {
  143. const data = {
  144. className: 'TestPageCtrlService',
  145. fnName: 'printerDoTest',
  146. params: {},
  147. }
  148. sendCmd(data)
  149. }
  150. </script>
  151. <template>
  152. <div class="dashboard-container">
  153. <main class="main-content">
  154. <!-- 上下布局 -->
  155. <section class="debug-env">
  156. <!-- 左侧HO 传感器数据 -->
  157. <div class="debug-env-left">
  158. <div v-for="(item, index) in h2O2SensorData" :key="index" class="debug-left-lh env-lh">
  159. <div class="debug-env-content">
  160. <div class="debug-label env-content-p" style="text-align: right; width: 8rem">
  161. {{ index === 0 ? '仓内环境' : item.title || `探头${index}` }}
  162. </div>
  163. <div class="env-content-p">
  164. <span>温度</span>
  165. <span class="debug-text">{{ roundNumber(item.temp, 2) }}</span>°C
  166. </div>
  167. <div class="env-content-p">
  168. <span>湿度</span>
  169. <span class="debug-text">{{ roundNumber(item.rh, 2) }}</span>%RH
  170. </div>
  171. <div class="env-content-p">
  172. <span>HO浓度</span>
  173. <span class="debug-text">{{ roundNumber(item.h2o2, 2) }}</span>ppm
  174. </div>
  175. </div>
  176. </div>
  177. </div>
  178. <!-- 右侧电机电流 & 加热温度 -->
  179. <div class="debug-env-right">
  180. <div class="env-content-p">
  181. <span class="label">空压机电流</span>
  182. <span class="value">
  183. <span class="debug-text">{{ debugStore.debugPageState?.airCompressorCurrent ?? 0 }}</span>
  184. <span class="unit">A</span>
  185. </span>
  186. </div>
  187. <div class="env-content-p">
  188. <span class="label">风机电流</span>
  189. <span class="value">
  190. <span class="debug-text">{{ debugStore.debugPageState?.blowerCurrent ?? 0 }}</span>
  191. <span class="unit">A</span>
  192. </span>
  193. </div>
  194. <div class="env-content-p">
  195. <span class="label">加热片电流</span>
  196. <span class="value">
  197. <span class="debug-text">{{ debugStore.debugPageState?.heaterCurrent ?? 0 }}</span>
  198. <span class="unit">A</span>
  199. </span>
  200. </div>
  201. </div>
  202. </section>
  203. <hr class="divider">
  204. <div class="debug-lower">
  205. <section>
  206. <div>
  207. <div class="debug-left-lh">
  208. <div class="debug-label">
  209. 加液泵控制
  210. </div>
  211. <div>
  212. <bt-button type="primary" button-text="加液" @click="liquidFillingPumpDoLiquidFilling" />
  213. </div>
  214. <div>
  215. <bt-button type="primary" button-text="排空" @click="liquidFillingPumpDoLiquidDischarge" />
  216. </div>
  217. <div>
  218. <bt-button button-text="停止" @click="liquidFillingPumpDoStop" />
  219. </div>
  220. </div>
  221. <div class="debug-left-lh">
  222. <div class="debug-label">
  223. 空压机控制
  224. </div>
  225. <div>
  226. <bt-button type="primary" button-text="打开" @click="airCompressorDoOpen" />
  227. </div>
  228. <div>
  229. <bt-button button-text="关闭" @click="airCompressorDoClose" />
  230. </div>
  231. </div>
  232. <div class="debug-left-lh">
  233. <div class="debug-label">
  234. 加热片控制
  235. </div>
  236. <div>
  237. <bt-button type="primary" button-text="打开" @click="heatingDoOpen" />
  238. </div>
  239. <div>
  240. <bt-button button-text="关闭" @click="heatingDoClose" />
  241. </div>
  242. </div>
  243. <div class="debug-left-lh">
  244. <div class="debug-label">
  245. 气密性阀门模式
  246. </div>
  247. <div class="debug-bw">
  248. <el-select v-model="airLeakDetectTestMode" placeholder="请选择模式" style="width: 100%">
  249. <el-option label="消毒模式" value="disinfection" />
  250. <el-option label="加压模式" value="inflation" />
  251. <el-option label="泄露测试模式" value="leakTest" />
  252. </el-select>
  253. </div>
  254. <div>
  255. <bt-button type="primary" button-text="切换" @click="airLeakDetectTestModeDoSetMode" />
  256. </div>
  257. </div>
  258. </div>
  259. </section>
  260. <section class="debug-right">
  261. <div>
  262. <div class="debug-left-lh">
  263. <div class="debug-label">
  264. 喷液泵控制
  265. </div>
  266. <div class="debug-bw">
  267. <el-select v-model="sprayPumpGpmValue" placeholder="请选择加液量" style="width: 100%">
  268. <el-option
  269. v-for="opt in [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]"
  270. :key="opt"
  271. :label="`${opt} gpm`"
  272. :value="opt"
  273. />
  274. </el-select>
  275. </div>
  276. <div>
  277. <bt-button type="primary" button-text="喷液" @click="sprayPumpDoForward" />
  278. </div>
  279. <div>
  280. <bt-button type="primary" button-text="回流" @click="sprayPumpDoBackward" />
  281. </div>
  282. <div>
  283. <bt-button button-text="停止" @click="onClosePump" />
  284. </div>
  285. </div>
  286. <div class="debug-left-lh">
  287. <div class="debug-label">
  288. 风机控制
  289. </div>
  290. <div>
  291. <bt-button type="primary" button-text="打开" @click="blowerDoOpen" />
  292. </div>
  293. <div>
  294. <bt-button button-text="关闭" @click="blowerDoClose" />
  295. </div>
  296. </div>
  297. <div class="debug-left-lh">
  298. <div class="debug-label">
  299. 打印机测试
  300. </div>
  301. <div>
  302. <bt-button type="primary" button-text="测试" @click="printerDoTest" />
  303. </div>
  304. </div>
  305. </div>
  306. </section>
  307. </div>
  308. </main>
  309. </div>
  310. </template>
  311. <style lang="scss" scoped>
  312. $lineHeight: 12vh;
  313. .main-content {
  314. height: $main-container-height;
  315. overflow: hidden;
  316. background: $gradient-color;
  317. padding: 4vh;
  318. font-size: 20px;
  319. .debug-upper {
  320. display: grid;
  321. grid-template-columns: repeat(2, 1fr);
  322. grid-template-rows: auto auto;
  323. }
  324. .debug-lower {
  325. display: grid;
  326. grid-template-columns: repeat(2, 1fr);
  327. }
  328. .debug-left {
  329. .debug-inside {
  330. display: flex;
  331. gap: 1rem;
  332. }
  333. }
  334. }
  335. .divider {
  336. margin-top: 4vh;
  337. margin-bottom: 4vh;
  338. }
  339. .debug-env {
  340. display: flex;
  341. align-items: flex-start;
  342. }
  343. .debug-left-lh {
  344. display: flex;
  345. gap: 1rem;
  346. height: $lineHeight;
  347. .debug-env-content {
  348. display: flex;
  349. .env-content-p {
  350. padding: 5px;
  351. }
  352. }
  353. }
  354. .debug-env-right {
  355. display: flex;
  356. flex-direction: column;
  357. gap: 0.5rem;
  358. margin-left: 20rem;
  359. align-items: flex-start;
  360. }
  361. .env-content-p {
  362. display: flex;
  363. align-items: center;
  364. gap: 0.5rem;
  365. font-size: 1rem;
  366. }
  367. .debug-env-right .env-content-p {
  368. display: flex;
  369. align-items: center;
  370. }
  371. .debug-env-right .env-content-p .label {
  372. display: inline-block;
  373. width: 6.5rem; /* 根据最长文字“加热片电流”微调 */
  374. text-align: right;
  375. margin-right: 0.75rem;
  376. }
  377. .debug-env-right .env-content-p .value {
  378. display: flex;
  379. align-items: baseline;
  380. gap: 0.2rem;
  381. }
  382. .debug-env-right .env-content-p .debug-text {
  383. font-weight: bold;
  384. color: #2892f3;
  385. }
  386. .debug-env-right .env-content-p .unit {
  387. font-size: 0.9em;
  388. }
  389. .env-lh {
  390. height: 5vh;
  391. }
  392. .debug-bw {
  393. width: 10vw;
  394. }
  395. .debug-label {
  396. width: 18vw;
  397. text-align: end;
  398. }
  399. .debug-text {
  400. color: #2892f3;
  401. padding: 5px;
  402. }
  403. </style>