管道式消毒机
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.

559 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
  1. <template>
  2. <div class="seal_test_container">
  3. <div class="left_container">
  4. <div class="title_wrap">
  5. <img class="icon" :src="SealPng" alt="" />
  6. <div class="title">实时压力表</div>
  7. </div>
  8. <div class="echarts_box" id="seal_echarts"></div>
  9. <div class="oper_box">
  10. <div class="air_box">
  11. <p class="box"></p>
  12. <p class="tit">测试前气压</p>
  13. <p class="num">
  14. {{
  15. sealStore.oldAirPressure != null
  16. ? sealStore.oldAirPressure
  17. : '--'
  18. }}KPa
  19. </p>
  20. </div>
  21. <img
  22. class="air_img"
  23. v-if="!sealStore.isStartTest"
  24. @click="newStartTest(1)"
  25. :src="StartTest"
  26. alt=""
  27. />
  28. <img
  29. class="air_img"
  30. @click="newStartTest(2)"
  31. v-if="sealStore.isStartTest"
  32. :src="StopTest"
  33. alt=""
  34. />
  35. </div>
  36. </div>
  37. <div class="right_container">
  38. <div class="header">
  39. <div class="left">
  40. <img :src="TestIcon" class="icon" alt="" />
  41. <p class="title">密封测试</p>
  42. </div>
  43. <p class="en">SEAL</p>
  44. </div>
  45. <div class="oper_box">
  46. <div class="emp_box">
  47. <div class="title">测试时间</div>
  48. <div class="num">
  49. {{ resultTime ? resultTime : '未开始' }}
  50. </div>
  51. </div>
  52. <div class="emp_box">
  53. <div class="title">气压差值</div>
  54. <div class="num">
  55. {{
  56. sealStore.differenceValue != null
  57. ? `${sealStore.differenceValue}KPa`
  58. : '未开始'
  59. }}
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. </template>
  66. <script setup>
  67. import * as echarts from 'echarts'
  68. import { ref, onMounted, onBeforeUnmount, watch } from 'vue'
  69. import SealPng from '@/assets/img/seal/seal.png'
  70. import TestIcon from '@/assets/img/seal/test.png'
  71. import StartTest from '@/assets/img/seal/starttest.png'
  72. import StopTest from '@/assets/img/seal/stoptest.png'
  73. import {
  74. someAirSwitchJSON,
  75. airCompressor_setStateJSON,
  76. airCompressor_channelCtrlJSON,
  77. AirInletProportionalValve_setStateJSON,
  78. AirOutletProportionalValve_setStateJSON,
  79. airCompressorGetPressureDirectJSON,
  80. airCompressorSetValve1JSON,
  81. airCompressorSetValve2JSON,
  82. airCompressorChannelSelectJSON,
  83. AirOutletProportionalValve_getStateJSON,
  84. airInletProportionalValve_getStateJSON,
  85. } from '@/mock/command'
  86. import { useSealStore, useTestStore, useWebSocketStore } from '@/store'
  87. const sealStore = useSealStore()
  88. const testStore = useTestStore()
  89. const websocketStore = useWebSocketStore()
  90. const sealCharts = ref(null)
  91. const sealOptions = ref({
  92. series: [
  93. {
  94. type: 'gauge',
  95. min: 0,
  96. max: 800,
  97. progress: {
  98. show: true,
  99. width: 18,
  100. itemStyle: {
  101. color: '#3442aa',
  102. },
  103. },
  104. pointer: {
  105. itemStyle: {
  106. color: '#3442aa',
  107. },
  108. },
  109. axisLine: {
  110. lineStyle: {
  111. width: 18,
  112. },
  113. },
  114. axisTick: {
  115. show: false,
  116. },
  117. splitLine: {
  118. length: 15,
  119. lineStyle: {
  120. width: 2,
  121. color: '#999',
  122. },
  123. },
  124. axisLabel: {
  125. distance: 25,
  126. color: '#999',
  127. fontSize: 20,
  128. },
  129. anchor: {
  130. show: true,
  131. showAbove: true,
  132. size: 25,
  133. itemStyle: {
  134. borderWidth: 10,
  135. borderColor: '#3442aa',
  136. },
  137. },
  138. title: {
  139. show: false,
  140. },
  141. detail: {
  142. valueAnimation: true,
  143. fontSize: 40,
  144. color: '#3442aa',
  145. formatter: '{value} KPa',
  146. offsetCenter: [0, '70%'],
  147. },
  148. data: [
  149. {
  150. value: sealStore.currentAirPressure,
  151. },
  152. ],
  153. },
  154. ],
  155. })
  156. const n_sec = ref(0) // 秒
  157. const n_min = ref(0) // 分
  158. const n_hour = ref(0) // 时
  159. const resultTime = ref('')
  160. const timerStart = ref(null)
  161. const timerReal = () => {
  162. var str_sec = n_sec.value
  163. var str_min = n_min.value
  164. var str_hour = n_hour.value
  165. if (n_sec.value < 10) {
  166. str_sec = '0' + n_sec.value
  167. }
  168. if (n_min.value < 10) {
  169. str_min = '0' + n_min.value
  170. }
  171. if (n_hour.value < 10) {
  172. str_hour = '0' + n_hour.value
  173. }
  174. resultTime.value = str_hour + ':' + str_min + ':' + str_sec
  175. n_sec.value = n_sec.value + 1
  176. if (n_sec.value > 59) {
  177. n_sec.value = 0
  178. n_min.value = n_min.value + 1
  179. }
  180. if (n_min.value > 59) {
  181. n_min.value = 0
  182. n_hour.value = n_hour.value + 1
  183. }
  184. }
  185. watch(
  186. () => sealStore.isStartTest,
  187. (newValue, oldValue) => {
  188. if (!newValue) {
  189. stopTimer()
  190. }
  191. },
  192. )
  193. const stopTimer = () => {
  194. // 改变测试前oldAirPressure为null
  195. sealStore.updateOldAirPressure(null)
  196. // 结束测试时将时间重置null
  197. clearInterval(timerStart.value)
  198. timerStart.value = null
  199. resultTime.value = null
  200. n_sec.value = 0
  201. n_min.value = 0
  202. n_hour.value = 0
  203. sealStore.updateIsStartTest(false)
  204. }
  205. const timerFunc = () => {
  206. timerReal()
  207. timerStart.value = setInterval(() => {
  208. timerReal()
  209. }, 1000)
  210. }
  211. const wait = async ms => {
  212. await new Promise(resolve => setTimeout(resolve, ms))
  213. }
  214. const newStartTest = flag => {
  215. if (flag == 1) {
  216. // 开始测试
  217. // 启动计时器
  218. timerFunc()
  219. sealStore.updateIsStartTest(true)
  220. // 空压机选通阀切换到通道2(空气)
  221. websocketStore.sendCommandMsg(airCompressorChannelSelectJSON([2]))
  222. // 空压机电子阀1打开 空压机电子阀2打开
  223. websocketStore.sendCommandMsg(airCompressorSetValve1JSON([1]))
  224. websocketStore.sendCommandMsg(airCompressorSetValve2JSON([1]))
  225. // 风机入口比例阀闭合 风机出口比例阀闭合
  226. websocketStore.sendCommandMsg(AirInletProportionalValve_setStateJSON([0]))
  227. websocketStore.sendCommandMsg(AirOutletProportionalValve_setStateJSON([0]))
  228. // 空压机打开
  229. websocketStore.sendCommandMsg(airCompressor_setStateJSON([1]))
  230. // 等待1s
  231. wait(1000)
  232. // 空压机关闭
  233. websocketStore.sendCommandMsg(airCompressor_setStateJSON([0]))
  234. // 空压机电子阀1关闭 空压机电子阀2关闭
  235. websocketStore.sendCommandMsg(airCompressorSetValve1JSON([0]))
  236. websocketStore.sendCommandMsg(airCompressorSetValve2JSON([0]))
  237. // 空压机选通阀切换到通道1 (入气口)
  238. websocketStore.sendCommandMsg(airCompressorChannelSelectJSON([1]))
  239. // 等待5s
  240. wait(5000)
  241. // 记录当前压力数值作为初始压力值
  242. websocketStore.sendCommandMsg(airCompressorGetPressureDirectJSON)
  243. }
  244. if (flag == 2) {
  245. // 停止测试
  246. /**
  247. * 空压机电子阀1打开
  248. * 空压机电子阀2打开
  249. * 空压机选通阀切换到通道1
  250. * 风机入口比例阀恢复
  251. * 风机出口比例阀恢复
  252. */
  253. websocketStore.sendCommandMsg(airCompressorSetValve1JSON([1]))
  254. websocketStore.sendCommandMsg(airCompressorSetValve2JSON([1]))
  255. websocketStore.sendCommandMsg(airCompressorChannelSelectJSON([1]))
  256. // 数值为刚开始记录的数值
  257. websocketStore.sendCommandMsg(
  258. AirInletProportionalValve_setStateJSON([
  259. sealStore.airInletProportionalInitVal,
  260. ]),
  261. )
  262. websocketStore.sendCommandMsg(
  263. AirOutletProportionalValve_setStateJSON([
  264. sealStore.airOutletProportionalInitVal,
  265. ]),
  266. )
  267. // 停止计时器
  268. stopTimer()
  269. }
  270. }
  271. const timer = ref(null)
  272. onBeforeUnmount(() => {
  273. timer.value = null
  274. timerStart.value = null
  275. clearInterval(timer.value)
  276. clearInterval(timerStart.value)
  277. })
  278. onMounted(() => {
  279. // 需要记录当前的风机入口出口比例阀数值
  280. sealCharts.value = echarts.init(document.getElementById('seal_echarts'))
  281. sealCharts.value.setOption(sealOptions.value)
  282. timer.value = setInterval(() => {
  283. sealCharts.value.setOption({
  284. series: [
  285. {
  286. type: 'gauge',
  287. min: 0,
  288. max: 800,
  289. progress: {
  290. show: true,
  291. width: 18,
  292. itemStyle: {
  293. color: '#3442aa',
  294. },
  295. },
  296. pointer: {
  297. itemStyle: {
  298. color: '#3442aa',
  299. },
  300. },
  301. axisLine: {
  302. lineStyle: {
  303. width: 18,
  304. },
  305. },
  306. axisTick: {
  307. show: false,
  308. },
  309. splitLine: {
  310. length: 15,
  311. lineStyle: {
  312. width: 2,
  313. color: '#999',
  314. },
  315. },
  316. axisLabel: {
  317. distance: 25,
  318. color: '#999',
  319. fontSize: 20,
  320. },
  321. anchor: {
  322. show: true,
  323. showAbove: true,
  324. size: 25,
  325. itemStyle: {
  326. borderWidth: 10,
  327. borderColor: '#3442aa',
  328. },
  329. },
  330. title: {
  331. show: false,
  332. },
  333. detail: {
  334. valueAnimation: true,
  335. fontSize: 40,
  336. color: '#3442aa',
  337. formatter: '{value} KPa',
  338. offsetCenter: [0, '70%'],
  339. },
  340. data: [
  341. {
  342. value: sealStore.currentAirPressure,
  343. },
  344. ],
  345. },
  346. ],
  347. })
  348. }, 1000)
  349. websocketStore.sendCommandMsg(airInletProportionalValve_getStateJSON)
  350. websocketStore.sendCommandMsg(AirOutletProportionalValve_getStateJSON)
  351. })
  352. </script>
  353. <style lang="scss" scoped>
  354. .seal_test_container {
  355. margin-bottom: 19px;
  356. height: 580px;
  357. box-sizing: border-box;
  358. border-radius: 16px;
  359. display: flex;
  360. align-items: center;
  361. .left_container {
  362. margin-right: 30px;
  363. width: 766px;
  364. height: 580px;
  365. box-sizing: border-box;
  366. border-radius: 16px;
  367. background: #ffffff;
  368. position: relative;
  369. .title_wrap {
  370. position: absolute;
  371. left: 28px;
  372. top: 28px;
  373. width: 141px;
  374. height: 31px;
  375. box-sizing: border-box;
  376. display: flex;
  377. align-items: center;
  378. .title {
  379. font-family: 思源黑体;
  380. font-size: 20px;
  381. font-weight: bold;
  382. line-height: normal;
  383. letter-spacing: 0.02em;
  384. font-feature-settings: 'kern' on;
  385. color: #000000;
  386. margin-left: 9px;
  387. }
  388. .icon {
  389. width: 30px;
  390. height: 30px;
  391. }
  392. }
  393. .oper_box {
  394. position: absolute;
  395. left: 28px;
  396. bottom: 28px;
  397. width: 710px;
  398. height: 110px;
  399. display: flex;
  400. align-items: center;
  401. justify-content: space-between;
  402. .air_img {
  403. width: 341px;
  404. height: 110px;
  405. }
  406. .air_box {
  407. width: 341px;
  408. height: 110px;
  409. border-radius: 16px;
  410. background: #f6f6f6;
  411. display: flex;
  412. align-items: center;
  413. justify-content: center;
  414. .box {
  415. width: 16px;
  416. height: 16px;
  417. background: #4359b9;
  418. margin-right: 6px;
  419. }
  420. .tit {
  421. font-family: 思源黑体;
  422. font-size: 20px;
  423. font-weight: normal;
  424. line-height: normal;
  425. letter-spacing: 0.06em;
  426. font-feature-settings: 'kern' on;
  427. color: #3d3d3d;
  428. margin-right: 8px;
  429. }
  430. .num {
  431. font-family: Source Han Sans;
  432. font-size: 30px;
  433. font-weight: bold;
  434. line-height: normal;
  435. letter-spacing: 0.06em;
  436. font-feature-settings: 'kern' on;
  437. color: #4359b9;
  438. }
  439. }
  440. }
  441. .echarts_box {
  442. height: 580px;
  443. position: absolute;
  444. left: 0;
  445. top: -36px;
  446. width: 100%;
  447. }
  448. }
  449. .right_container {
  450. height: 580px;
  451. box-sizing: border-box;
  452. border-radius: 16px;
  453. background: #ffffff;
  454. flex: 1;
  455. padding: 32px 42px;
  456. .header {
  457. display: flex;
  458. align-items: center;
  459. justify-content: space-between;
  460. box-sizing: border-box;
  461. width: 340px;
  462. height: 45px;
  463. border-radius: 245px;
  464. background: #06518b;
  465. padding-left: 17px;
  466. padding-right: 24px;
  467. margin-bottom: 20px;
  468. .left {
  469. display: flex;
  470. align-items: center;
  471. .icon {
  472. width: 16px;
  473. height: 16px;
  474. }
  475. .title {
  476. font-family: 思源黑体;
  477. font-size: 14px;
  478. font-weight: normal;
  479. line-height: normal;
  480. letter-spacing: 0.1em;
  481. margin-left: 9px;
  482. color: #ffffff;
  483. }
  484. }
  485. .en {
  486. font-family: 思源黑体;
  487. font-size: 12px;
  488. font-weight: normal;
  489. line-height: normal;
  490. letter-spacing: 0.1em;
  491. color: #ffffff;
  492. }
  493. }
  494. .oper_box {
  495. width: 340px;
  496. height: 455px;
  497. border-radius: 16px;
  498. background: #f6f6f6;
  499. box-sizing: border-box;
  500. padding: 20px;
  501. .emp_box {
  502. width: 300px;
  503. height: 198px;
  504. border-radius: 12px;
  505. background: #fff;
  506. margin-bottom: 20px;
  507. box-sizing: border-box;
  508. padding-top: 16px;
  509. padding-left: 27px;
  510. padding-right: 27px;
  511. padding-bottom: 20px;
  512. display: flex;
  513. flex-direction: column;
  514. .title {
  515. font-family: Source Han Sans;
  516. font-size: 16px;
  517. font-weight: 500;
  518. line-height: normal;
  519. letter-spacing: 0.06em;
  520. font-feature-settings: 'kern' on;
  521. color: #06518b;
  522. }
  523. .num {
  524. flex: 1;
  525. display: flex;
  526. align-items: center;
  527. justify-content: center;
  528. font-family: 思源黑体;
  529. font-size: 30px;
  530. font-weight: bold;
  531. line-height: normal;
  532. letter-spacing: 0.1em;
  533. color: #000000;
  534. border-radius: 12px;
  535. background: #fafafa;
  536. box-sizing: border-box;
  537. }
  538. }
  539. .test_png {
  540. width: 300px;
  541. height: 50px;
  542. }
  543. }
  544. }
  545. }
  546. </style>