拉杆箱消毒机
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.

753 lines
18 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
  1. <template>
  2. <div class="device_container">
  3. <div class="row_wrap">
  4. <p class="title">注射蠕动泵速率(g/min)</p>
  5. <p class="num">
  6. <my-input type="number" class="field_font" theme="custom" close-text="配置"
  7. v-model:value="sprayLiquidConfigVal"
  8. :formatter="formatter7"
  9. @done="setSprayLiquidVal"
  10. ></my-input>
  11. </p>
  12. </div>
  13. <div class="row_wrap">
  14. <p class="title">消毒停止过氧化氢浓度(ppm)</p>
  15. <p class="num">
  16. <my-input type="number" class="field_font" theme="custom" close-text="配置"
  17. v-model:value="stoped_gs"
  18. :formatter="formatter1"
  19. @done="setStopedGsVal"
  20. ></my-input>
  21. </p>
  22. </div>
  23. <div class="row_wrap">
  24. <p class="title">消毒继续过氧化氢浓度(ppm)</p>
  25. <p class="num">
  26. <my-input type="number" class="field_font" theme="custom" close-text="配置"
  27. v-model:value="continued_gs"
  28. :formatter="formatter2"
  29. @done="setcontinuedGsVal"
  30. ></my-input>
  31. </p>
  32. </div>
  33. <div class="row_wrap">
  34. <p class="title">消毒停止相对湿度(%RH)</p>
  35. <p class="num">
  36. <my-input type="number" class="field_font" theme="custom" close-text="配置"
  37. v-model:value="stoped_humi"
  38. :formatter="formatter9"
  39. @done="setstoped_humiVal"
  40. ></my-input>
  41. </p>
  42. </div>
  43. <div class="row_wrap">
  44. <p class="title">消毒继续相对湿度(%RH)</p>
  45. <p class="num">
  46. <my-input type="number" class="field_font" theme="custom" close-text="配置"
  47. v-model:value="continued_humi"
  48. :formatter="formatter10"
  49. @done="setcontinued_humiVal"
  50. ></my-input>
  51. </p>
  52. </div>
  53. <div class="row_wrap">
  54. <p class="title">消毒停止过氧化氢相对饱和度(%RS)</p>
  55. <p class="num">
  56. <my-input type="number" class="field_font" theme="custom" close-text="配置"
  57. v-model:value="stoped_satur"
  58. :formatter="formatter3"
  59. @done="setstopedSaturVal"
  60. ></my-input>
  61. </p>
  62. </div>
  63. <div class="row_wrap">
  64. <p class="title">消毒继续过氧化氢相对饱和度(%RS)</p>
  65. <p class="num">
  66. <my-input type="number" class="field_font" theme="custom" close-text="配置"
  67. v-model:value="continued_satur"
  68. :formatter="formatter4"
  69. @done="setContinuedSaturVal"
  70. ></my-input>
  71. </p>
  72. </div>
  73. <div class="row_wrap" @click="showLogPicker">
  74. <p class="title">Log等级</p>
  75. <div class="num">
  76. <p class="log">{{ logVal }}</p>
  77. </div>
  78. </div>
  79. <div class="row_wrap">
  80. <p class="title">配方名称</p>
  81. <div>
  82. <input
  83. id="id_formula"
  84. v-model="formula_id"
  85. class="formula_input"
  86. placeholder="请输入配方名称"
  87. type="text"
  88. name=""
  89. />
  90. </div>
  91. </div>
  92. <van-number-keyboard
  93. v-model="addLiquidConfigVal"
  94. :title="addLiquidConfigVal"
  95. :show="addLiquidConfigValShow"
  96. @input="val => handleInput(val, 1)"
  97. theme="custom"
  98. close-button-text="配置"
  99. @close="setAddliquidVal"
  100. @blur="addLiquidConfigValShow = false"
  101. />
  102. <van-number-keyboard
  103. v-model="max_humidity"
  104. @input="val => handleInput(val, 7)"
  105. :title="max_humidity"
  106. @close="setMaxHumidityVal"
  107. :show="max_humidityShow"
  108. theme="custom"
  109. close-button-text="配置"
  110. @blur="max_humidityShow = false"
  111. />
  112. <van-number-keyboard
  113. theme="custom"
  114. close-button-text="配置"
  115. @input="val => handleInput(val, 8)"
  116. @close="setHeat_timeVal"
  117. v-model="pre_heat_time_s"
  118. :title="pre_heat_time_s"
  119. :show="pre_heat_time_sShow"
  120. @blur="pre_heat_time_sShow = false"
  121. />
  122. <LogPicker
  123. v-if="logVisible"
  124. :hiddenLogVisible="hiddenLogVisible"
  125. :changeLogVal="changeLogVal"
  126. :logVal="logVal"
  127. />
  128. <div class="btns">
  129. <div class="btn" @click="save">保存</div>
  130. <div class="btn ml" @click="hiddleSettingModal">返回</div>
  131. </div>
  132. <div class="key_wrap" v-show="showkeyboard" id="keyboard_formula">
  133. <SimpleKeyboard @onChange="onChange" :input="formula_id" />
  134. </div>
  135. </div>
  136. </template>
  137. <script setup>
  138. import { ref, onMounted } from 'vue'
  139. import SimpleKeyboard from 'cpns/SimpleKeyboard'
  140. import { showSuccessToast, showFailToast } from 'vant'
  141. import { useSettingStore, useWebSocketStore, useOperatorStore } from '@/store'
  142. import { storeToRefs } from 'pinia'
  143. import {
  144. setSettingValJSON,
  145. addFormulaJSON,
  146. getAllFormulaJSON,
  147. } from '@/mock/command'
  148. import LogPicker from 'cpns/dialogs/LogPicker'
  149. const settingStore = useSettingStore()
  150. const webSocketStore = useWebSocketStore()
  151. const operatorStore = useOperatorStore()
  152. const max_humidity = ref('0')
  153. const continued_satur = ref('0')
  154. const stoped_satur = ref('0')
  155. const continued_gs = ref('0')
  156. const stoped_gs = ref('0')
  157. const addLiquidConfigVal = ref('0')
  158. const sprayLiquidConfigVal = ref('0')
  159. const stoped_humi = ref('0')
  160. const continued_humi = ref('0')
  161. const pre_heat_time_s = ref('0')
  162. const pre_heat_time_sShow = ref(false)
  163. const addLiquidConfigValShow = ref(false)
  164. const sprayLiquidConfigValShow = ref(false)
  165. const stoped_gsShow = ref(false)
  166. const continued_gsShow = ref(false)
  167. const stoped_saturShow = ref(false)
  168. const continued_saturShow = ref(false)
  169. const max_humidityShow = ref(false)
  170. const stoped_humiShow = ref(false)
  171. const continued_humiShow = ref(false)
  172. const logVisible = ref(false)
  173. const logVal = ref('6')
  174. const formula_id = ref('')
  175. const save = () => {
  176. if (formula_id.value == '') {
  177. showFailToast('配方名称不能为空')
  178. return
  179. }
  180. const data = {
  181. formula_id: formula_id.value,
  182. loglevel: logVal.value,
  183. injection_pump_speed: sprayLiquidConfigVal.value,
  184. stoped_gs: stoped_gs.value,
  185. continued_gs: continued_gs.value,
  186. stoped_satur: stoped_satur.value,
  187. continued_satur: continued_satur.value,
  188. stoped_humi: stoped_humi.value,
  189. continued_humi: continued_humi.value,
  190. }
  191. console.log(data)
  192. webSocketStore.sendCommandMsg(addFormulaJSON(data))
  193. webSocketStore.sendCommandMsg(getAllFormulaJSON)
  194. props.hideSettingModal()
  195. }
  196. const changeLogVal = val => {
  197. logVal.value = val
  198. logVisible.value = false
  199. }
  200. const hiddenLogVisible = () => {
  201. logVisible.value = false
  202. }
  203. const showLogPicker = () => {
  204. logVisible.value = true
  205. }
  206. const isFirstClick = ref(true)
  207. const props = defineProps({
  208. hideSettingModal: {
  209. type: Function,
  210. },
  211. })
  212. const hiddleSettingModal = () => {
  213. webSocketStore.sendCommandMsg(getAllFormulaJSON)
  214. props.hideSettingModal()
  215. }
  216. const hideClickKey = flag => {
  217. isFirstClick.value = true
  218. stoped_humiShow.value = false
  219. continued_humiShow.value = false
  220. pre_heat_time_sShow.value = false
  221. addLiquidConfigValShow.value = false
  222. sprayLiquidConfigValShow.value = false
  223. stoped_gsShow.value = false
  224. continued_gsShow.value = false
  225. stoped_saturShow.value = false
  226. continued_saturShow.value = false
  227. max_humidityShow.value = false
  228. if (flag == 1) {
  229. addLiquidConfigValShow.value = true
  230. }
  231. if (flag == 2) {
  232. sprayLiquidConfigValShow.value = true
  233. }
  234. if (flag == 3) {
  235. stoped_gsShow.value = true
  236. }
  237. if (flag == 4) {
  238. continued_gsShow.value = true
  239. }
  240. if (flag == 5) {
  241. stoped_saturShow.value = true
  242. }
  243. if (flag == 6) {
  244. continued_saturShow.value = true
  245. }
  246. if (flag == 7) {
  247. max_humidityShow.value = true
  248. }
  249. if (flag == 8) {
  250. pre_heat_time_sShow.value = true
  251. }
  252. if (flag == 9) {
  253. stoped_humiShow.value = true
  254. }
  255. if (flag == 10) {
  256. continued_humiShow.value = true
  257. }
  258. }
  259. const handleInput = (value, index) => {
  260. if (isFirstClick.value) {
  261. if (index == 1) {
  262. setTimeout(() => {
  263. addLiquidConfigVal.value = value + ''
  264. })
  265. }
  266. if (index == 2) {
  267. setTimeout(() => {
  268. sprayLiquidConfigVal.value = value + ''
  269. })
  270. }
  271. if (index == 3) {
  272. setTimeout(() => {
  273. stoped_gs.value = value + ''
  274. })
  275. }
  276. if (index == 4) {
  277. setTimeout(() => {
  278. continued_gs.value = value + ''
  279. })
  280. }
  281. if (index == 5) {
  282. setTimeout(() => {
  283. stoped_satur.value = value + ''
  284. })
  285. }
  286. if (index == 6) {
  287. setTimeout(() => {
  288. continued_satur.value = value + ''
  289. })
  290. }
  291. if (index == 7) {
  292. setTimeout(() => {
  293. max_humidity.value = value + ''
  294. })
  295. }
  296. if (index == 8) {
  297. setTimeout(() => {
  298. pre_heat_time_s.value = value + ''
  299. })
  300. }
  301. if (index == 9) {
  302. setTimeout(() => {
  303. stoped_humi.value = value + ''
  304. })
  305. }
  306. if (index == 10) {
  307. setTimeout(() => {
  308. continued_humi.value = value + ''
  309. })
  310. }
  311. isFirstClick.value = false
  312. }
  313. }
  314. const formatter1 = value => {
  315. if (parseInt(value) == 0) {
  316. return '0'
  317. }
  318. let arr = settingStore.allSettingList.filter(item => item.name == 'stoped_gs')
  319. if (arr && arr.length > 0) {
  320. if (parseInt(value) > arr[0].val_upper_limit) {
  321. return arr[0].val_upper_limit + ''
  322. }
  323. if (parseInt(value) < arr[0].val_lower_limit) {
  324. return arr[0].val_lower_limit + ''
  325. }
  326. }
  327. if (value == '') {
  328. return '0'
  329. }
  330. return value.replace(/^0+/gi, '')
  331. }
  332. const formatter2 = value => {
  333. if (parseInt(value) == 0) {
  334. return '0'
  335. }
  336. let arr = settingStore.allSettingList.filter(
  337. item => item.name == 'continued_gs',
  338. )
  339. if (arr && arr.length > 0) {
  340. if (parseInt(value) > arr[0].val_upper_limit) {
  341. return arr[0].val_upper_limit + ''
  342. }
  343. if (parseInt(value) < arr[0].val_lower_limit) {
  344. return arr[0].val_lower_limit + ''
  345. }
  346. }
  347. if (value == '') {
  348. return '0'
  349. }
  350. return value.replace(/^0+/gi, '')
  351. }
  352. const formatter3 = value => {
  353. if (parseInt(value) == 0) {
  354. return '0'
  355. }
  356. let arr = settingStore.allSettingList.filter(
  357. item => item.name == 'stoped_satur',
  358. )
  359. if (arr && arr.length > 0) {
  360. if (parseInt(value) > arr[0].val_upper_limit) {
  361. return arr[0].val_upper_limit + ''
  362. }
  363. if (parseInt(value) < arr[0].val_lower_limit) {
  364. return arr[0].val_lower_limit + ''
  365. }
  366. }
  367. if (value == '') {
  368. return '0'
  369. }
  370. return value.replace(/^0+/gi, '')
  371. }
  372. const formatter4 = value => {
  373. if (parseInt(value) == 0) {
  374. return '0'
  375. }
  376. let arr = settingStore.allSettingList.filter(
  377. item => item.name == 'continued_satur',
  378. )
  379. if (arr && arr.length > 0) {
  380. if (parseInt(value) > arr[0].val_upper_limit) {
  381. return arr[0].val_upper_limit + ''
  382. }
  383. if (parseInt(value) < arr[0].val_lower_limit) {
  384. return arr[0].val_lower_limit + ''
  385. }
  386. }
  387. if (value == '') {
  388. return '0'
  389. }
  390. return value.replace(/^0+/gi, '')
  391. }
  392. const formatter5 = value => {
  393. if (parseInt(value) == 0) {
  394. return '0'
  395. }
  396. let arr = settingStore.allSettingList.filter(
  397. item => item.name == 'max_humidity',
  398. )
  399. if (arr && arr.length > 0) {
  400. if (parseInt(value) > arr[0].val_upper_limit) {
  401. return arr[0].val_upper_limit + ''
  402. }
  403. if (parseInt(value) < arr[0].val_lower_limit) {
  404. return arr[0].val_lower_limit + ''
  405. }
  406. }
  407. if (value == '') {
  408. return '0'
  409. }
  410. return value.replace(/^0+/gi, '')
  411. }
  412. const formatter6 = value => {
  413. if (parseInt(value) == 0) {
  414. return '0'
  415. }
  416. let arr = settingStore.allSettingList.filter(
  417. item => item.name == 'drainage_pump_speed',
  418. )
  419. if (arr && arr.length > 0) {
  420. if (parseInt(value) > arr[0].val_upper_limit) {
  421. return arr[0].val_upper_limit + ''
  422. }
  423. if (parseInt(value) < arr[0].val_lower_limit) {
  424. return arr[0].val_lower_limit + ''
  425. }
  426. }
  427. if (value == '') {
  428. return '0'
  429. }
  430. return value.replace(/^0+/gi, '')
  431. }
  432. const formatter7 = value => {
  433. if (parseInt(value) == 0) {
  434. return '0'
  435. }
  436. let arr = settingStore.allSettingList.filter(
  437. item => item.name == 'injection_pump_speed',
  438. )
  439. if (arr && arr.length > 0) {
  440. if (parseInt(value) > arr[0].val_upper_limit) {
  441. return arr[0].val_upper_limit + ''
  442. }
  443. if (parseInt(value) < arr[0].val_lower_limit) {
  444. return arr[0].val_lower_limit + ''
  445. }
  446. }
  447. if (value == '') {
  448. return '0'
  449. }
  450. return value.replace(/^0+/gi, '')
  451. }
  452. const formatter8 = value => {
  453. if (parseInt(value) == 0) {
  454. return '0'
  455. }
  456. let arr = settingStore.allSettingList.filter(
  457. item => item.name == 'pre_heat_time_s',
  458. )
  459. if (arr && arr.length > 0) {
  460. if (parseInt(value) > arr[0].val_upper_limit) {
  461. return arr[0].val_upper_limit + ''
  462. }
  463. if (parseInt(value) < arr[0].val_lower_limit) {
  464. return arr[0].val_lower_limit + ''
  465. }
  466. }
  467. if (value == '') {
  468. return '0'
  469. }
  470. return value.replace(/^0+/gi, '')
  471. }
  472. const formatter9 = value => {
  473. if (parseInt(value) == 0) {
  474. return '0'
  475. }
  476. let arr = settingStore.allSettingList.filter(
  477. item => item.name == 'stoped_humi',
  478. )
  479. if (arr && arr.length > 0) {
  480. if (parseInt(value) > arr[0].val_upper_limit) {
  481. return arr[0].val_upper_limit + ''
  482. }
  483. if (parseInt(value) < arr[0].val_lower_limit) {
  484. return arr[0].val_lower_limit + ''
  485. }
  486. }
  487. if (value == '') {
  488. return '0'
  489. }
  490. return value.replace(/^0+/gi, '')
  491. }
  492. const formatter10 = value => {
  493. if (parseInt(value) == 0) {
  494. return '0'
  495. }
  496. let arr = settingStore.allSettingList.filter(
  497. item => item.name == 'continued_humi',
  498. )
  499. if (arr && arr.length > 0) {
  500. if (parseInt(value) > arr[0].val_upper_limit) {
  501. return arr[0].val_upper_limit + ''
  502. }
  503. if (parseInt(value) < arr[0].val_lower_limit) {
  504. return arr[0].val_lower_limit + ''
  505. }
  506. }
  507. if (value == '') {
  508. return '0'
  509. }
  510. return value.replace(/^0+/gi, '')
  511. }
  512. const setAddliquidVal = () => {
  513. const val = parseInt(addLiquidConfigVal.value)
  514. if (isNaN(val)) {
  515. showFailToast('设置失败,请填写正确参数')
  516. return
  517. }
  518. }
  519. const setStopedGsVal = () => {
  520. const val = parseInt(stoped_gs.value)
  521. if (isNaN(val)) {
  522. showFailToast('设置失败,请填写正确参数')
  523. return
  524. }
  525. }
  526. const setcontinuedGsVal = () => {
  527. const val = parseInt(continued_gs.value)
  528. if (isNaN(val)) {
  529. showFailToast('设置失败,请填写正确参数')
  530. return
  531. }
  532. }
  533. const setstopedSaturVal = () => {
  534. const val = parseInt(stoped_satur.value)
  535. if (isNaN(val)) {
  536. showFailToast('设置失败,请填写正确参数')
  537. return
  538. }
  539. }
  540. const setContinuedSaturVal = () => {
  541. const val = parseInt(continued_satur.value)
  542. if (isNaN(val)) {
  543. showFailToast('设置失败,请填写正确参数')
  544. return
  545. }
  546. }
  547. const setMaxHumidityVal = () => {
  548. const val = parseInt(max_humidity.value)
  549. if (isNaN(val)) {
  550. showFailToast('设置失败,请填写正确参数')
  551. return
  552. }
  553. }
  554. const setHeat_timeVal = () => {
  555. const val = parseInt(pre_heat_time_s.value)
  556. if (isNaN(val)) {
  557. showFailToast('设置失败,请填写正确参数')
  558. return
  559. }
  560. }
  561. const setstoped_humiVal = () => {
  562. const val = parseInt(stoped_humi.value)
  563. if (isNaN(val)) {
  564. showFailToast('设置失败,请填写正确参数')
  565. return
  566. }
  567. }
  568. const setcontinued_humiVal = () => {
  569. const val = parseInt(continued_humi.value)
  570. if (isNaN(val)) {
  571. showFailToast('设置失败,请填写正确参数')
  572. return
  573. }
  574. }
  575. const setSprayLiquidVal = () => {
  576. const val = parseInt(sprayLiquidConfigVal.value)
  577. if (isNaN(val)) {
  578. showFailToast('设置失败,请填写正确参数')
  579. return
  580. }
  581. }
  582. const showkeyboard = ref(false)
  583. const onChange = a => {
  584. formula_id.value = a
  585. }
  586. const handleShowKeyBoard = () => {
  587. showkeyboard.value = true
  588. }
  589. onMounted(() => {
  590. document.addEventListener('click', e => {
  591. let box = document.getElementById('keyboard_formula')
  592. let room = document.getElementById('id_formula')
  593. const arr = [
  594. 'hg-candidate-box-next',
  595. 'hg-candidate-box-btn-active',
  596. 'hg-candidate-box-prev',
  597. 'hg-candidate-box-list-item',
  598. ]
  599. if (
  600. !box?.contains(e.target) &&
  601. e.target != room &&
  602. !arr.includes(Array.from(e.target.classList)[0])
  603. ) {
  604. showkeyboard.value = false
  605. }
  606. })
  607. $('#id_formula').virtualkeyboard()
  608. })
  609. </script>
  610. <style lang="scss" scoped>
  611. .device_container {
  612. box-sizing: border-box;
  613. width: 100%;
  614. height: 580px;
  615. display: grid;
  616. overflow: hidden;
  617. grid-template-columns: repeat(2, 1fr);
  618. row-gap: 20px;
  619. column-gap: 20px;
  620. padding: 20px;
  621. padding-bottom: 180px;
  622. position: relative;
  623. .btns {
  624. position: absolute;
  625. right: 20px;
  626. bottom: 20px;
  627. width: 300px;
  628. height: 68px;
  629. display: flex;
  630. align-items: center;
  631. justify-content: flex-end;
  632. .btn {
  633. width: 111px;
  634. height: 38px;
  635. border-radius: 19px;
  636. background: #06518b;
  637. display: flex;
  638. align-items: center;
  639. justify-content: center;
  640. font-family: Source Han Sans CN;
  641. font-size: 14px;
  642. font-weight: normal;
  643. line-height: normal;
  644. letter-spacing: 0.1em;
  645. color: #ffffff;
  646. }
  647. .ml {
  648. margin-left: 20px;
  649. }
  650. }
  651. .row_wrap {
  652. // width: 726px;
  653. height: 80px;
  654. border-radius: 14px;
  655. background: #f6f6f6;
  656. box-sizing: border-box;
  657. padding: 0 18px 0 40px;
  658. display: flex;
  659. align-items: center;
  660. justify-content: space-between;
  661. .title {
  662. font-family: Zona Pro;
  663. white-space: nowrap;
  664. font-size: 20px;
  665. font-weight: normal;
  666. letter-spacing: 0.06em;
  667. color: #000000;
  668. }
  669. .num {
  670. font-family: Source Han Sans CN;
  671. font-size: 24px;
  672. font-weight: 500;
  673. letter-spacing: 0.1em;
  674. color: #000000;
  675. display: flex;
  676. align-items: center;
  677. .log {
  678. width: 182px;
  679. display: flex;
  680. align-items: center;
  681. justify-content: center;
  682. }
  683. :deep(.field_font) {
  684. font-size: 26px;
  685. width: 180px;
  686. }
  687. }
  688. .formula_input {
  689. border: none;
  690. height: 38px;
  691. font-size: 22px;
  692. padding: 0 12px;
  693. width: 220px;
  694. }
  695. .btn {
  696. width: 87px;
  697. height: 45px;
  698. border-radius: 23px;
  699. background: #06518b;
  700. font-family: Source Han Sans CN;
  701. font-size: 14px;
  702. font-weight: normal;
  703. letter-spacing: 0.1em;
  704. color: #ffffff;
  705. display: flex;
  706. align-items: center;
  707. justify-content: center;
  708. }
  709. }
  710. .key_wrap {
  711. position: absolute;
  712. right: 97px;
  713. bottom: 0;
  714. height: 245px;
  715. width: 520px;
  716. }
  717. }
  718. </style>