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

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