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

331 lines
10 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
  1. <template>
  2. <div class="air_switch_config_container">
  3. <div class="header">
  4. <svg
  5. xmlns="http://www.w3.org/2000/svg"
  6. xmlns:xlink="http://www.w3.org/1999/xlink"
  7. fill="none"
  8. version="1.1"
  9. width="28"
  10. height="28"
  11. viewBox="0 0 28 28"
  12. >
  13. <g>
  14. <path
  15. d="M14,0C6.26801,0,0,6.26802,0,14C0,21.732,6.26801,28,14,28C21.732,28,28,21.732,28,14C28,6.26802,21.732,0,14,0ZM9.10859,20.4807C9.097,21.0081,8.66847,21.431,8.14073,21.4356C7.6131,21.4405,7.17713,21.0253,7.15599,20.4979L7.15599,14.4761C7.15421,13.9358,7.59264,13.4974,8.1329,13.4992C8.39231,13.4979,8.64147,13.6004,8.8248,13.784C9.00814,13.9674,9.11035,14.2167,9.10859,14.4761L9.10859,20.4807ZM9.11277,16.4831L10.5775,16.4831L10.5775,13.9308C10.5771,12.598,11.3513,11.3866,12.5608,10.827C12.5414,10.7319,12.5318,10.635,12.5322,10.5379L12.5322,9.02199L8.39528,9.02199C8.06546,9.02229,7.74915,8.89097,7.51653,8.65716C7.2839,8.42333,7.15414,8.10636,7.15602,7.77653C7.15499,7.44753,7.2848,7.13161,7.51685,6.89839C7.74891,6.66514,8.06422,6.53379,8.39324,6.53331L19.6047,6.53331C19.935,6.53331,20.2516,6.66514,20.4843,6.89948C20.717,7.13381,20.8465,7.45138,20.844,7.78166C20.8444,8.46656,20.2895,9.02198,19.6047,9.02198L15.4668,9.02198L15.4668,10.5421C15.467,10.639,15.4581,10.7358,15.4401,10.831C16.6497,11.3886,17.4242,12.5989,17.4235,13.9308L17.4235,16.4831L18.8842,16.4831L18.8842,14.4761C18.8842,13.9363,19.3218,13.4987,19.8614,13.4987C20.4013,13.4987,20.8389,13.9363,20.8389,14.4761L20.8389,20.4847C20.8414,21.0244,20.4058,21.4641,19.8661,21.4667C19.3263,21.4691,18.8867,21.0336,18.8842,20.4939L18.8842,18.9728L18.8893,18.9728L18.8893,16.4831L18.8842,16.4831L18.8842,18.9697L17.2923,18.9697C16.8744,20.4411,15.5307,21.4564,14.001,21.4564C12.4714,21.4564,11.1276,20.441,10.7096,18.9697L9.11274,18.9697"
  16. fill="#FFFFFF"
  17. fill-opacity="1"
  18. />
  19. </g>
  20. </svg>
  21. <p class="title">选择空气阀配置</p>
  22. </div>
  23. <div class="opers_box">
  24. <div class="left_container">
  25. <div
  26. :class="activeTab == '1' ? 'tab mb active' : 'tab mb'"
  27. @click="changeTab('1')"
  28. >
  29. <p class="text">正压</p>
  30. <!-- <div class="percent">{{ topText }}</div> -->
  31. <img
  32. :src="A2"
  33. @click.prevent.stop="changeTab('0')"
  34. v-if="activeTab == 1"
  35. class="icon"
  36. alt=""
  37. />
  38. <img :src="A1" v-else class="icon" alt="" />
  39. </div>
  40. <div
  41. :class="activeTab == '2' ? 'tab active' : 'tab'"
  42. @click="changeTab('2')"
  43. >
  44. <p class="text">负压</p>
  45. <!-- <div class="percent">{{ bottomText }}</div> -->
  46. <img
  47. :src="A2"
  48. @click.prevent.stop="changeTab('0')"
  49. v-if="activeTab == 2"
  50. class="icon"
  51. alt=""
  52. />
  53. <img :src="A1" v-else class="icon" alt="" />
  54. </div>
  55. </div>
  56. <div class="right_container">
  57. <van-picker
  58. v-if="activeTab == 1"
  59. :columns="columns"
  60. :show-toolbar="false"
  61. visible-option-num="3"
  62. option-height="42"
  63. v-model="selectedValuesTop"
  64. @change="topChange"
  65. />
  66. <van-picker
  67. v-if="activeTab == 2"
  68. :columns="columns"
  69. :show-toolbar="false"
  70. visible-option-num="3"
  71. option-height="42"
  72. @change="bottomChange"
  73. v-model="selectedValuesBottom"
  74. />
  75. <p class="tips" v-if="activeTab == 0">关闭</p>
  76. </div>
  77. </div>
  78. </div>
  79. </template>
  80. <script setup>
  81. import A1 from '@/assets/img/air/1.png'
  82. import A2 from '@/assets/img/air/2.png'
  83. import { useSealStore, useWebSocketStore, useSettingStore } from '@/store'
  84. import {
  85. AirInletProportionalValve_setStateJSON,
  86. AirOutletProportionalValve_setStateJSON,
  87. airInletProportionalValve_getStateJSON,
  88. getAllSettingJSON,
  89. AirOutletProportionalValve_getStateJSON,
  90. AirInOutletProportionalValve_setStateJSON,
  91. } from '@/mock/command'
  92. import { ref, onMounted, watch, computed } from 'vue'
  93. const activeTab = ref('1')
  94. const sealStore = useSealStore()
  95. const webSocketStore = useWebSocketStore()
  96. const settingStore = useSettingStore()
  97. const changeTab = tab => {
  98. activeTab.value = tab
  99. changeAir(tab)
  100. }
  101. const topText = ref('0%')
  102. const bottomText = ref('0%')
  103. const topChange = ({ selectedOptions, selectedValues }) => {
  104. topText.value = selectedOptions[0].text
  105. webSocketStore.sendCommandMsg(
  106. AirInletProportionalValve_setStateJSON([parseInt(selectedValues[0])]),
  107. )
  108. sealStore.updateAirInletProportionalValue(parseInt(selectedValues[0]))
  109. }
  110. const bottomChange = ({ selectedOptions, selectedValues }) => {
  111. bottomText.value = selectedOptions[0].text
  112. webSocketStore.sendCommandMsg(
  113. AirOutletProportionalValve_setStateJSON([parseInt(selectedValues[0])]),
  114. )
  115. sealStore.updateAirOutletProportionalValue(parseInt(selectedValues[0]))
  116. }
  117. const changeAir = tab => {
  118. // 选中正压:
  119. // 入气阀设置成10%
  120. // 出气阀设置成0
  121. // 选中负压:
  122. // 入气阀设置成0%
  123. // 出气阀设置成10%
  124. // 取消选中:
  125. // 两个阀设置成0
  126. if (tab == '0') {
  127. webSocketStore.sendCommandMsg(
  128. AirInOutletProportionalValve_setStateJSON([0, 0]),
  129. )
  130. }
  131. if (tab == '1') {
  132. webSocketStore.sendCommandMsg(
  133. AirInOutletProportionalValve_setStateJSON([
  134. settingStore.proportionalValveDefaultValue * 10,
  135. 0,
  136. ]),
  137. )
  138. selectedValuesTop.value = [
  139. settingStore.proportionalValveDefaultValue * 10 + '',
  140. ]
  141. }
  142. if (tab == '2') {
  143. webSocketStore.sendCommandMsg(
  144. AirInOutletProportionalValve_setStateJSON([
  145. 0,
  146. settingStore.proportionalValveDefaultValue * 10,
  147. ]),
  148. )
  149. selectedValuesBottom.value = [
  150. settingStore.proportionalValveDefaultValue * 10 + '',
  151. ]
  152. }
  153. }
  154. const columns = ref([
  155. { text: '10%', value: '100' },
  156. { text: '20%', value: '200' },
  157. { text: '30%', value: '300' },
  158. { text: '40%', value: '400' },
  159. { text: '50%', value: '500' },
  160. { text: '60%', value: '600' },
  161. { text: '70%', value: '700' },
  162. { text: '80%', value: '800' },
  163. { text: '90%', value: '900' },
  164. { text: '100%', value: '1000' },
  165. ])
  166. const selectedValuesTop = ref(['100'])
  167. const selectedValuesBottom = ref(['100'])
  168. const tabChange = () => {
  169. console.log('airin', sealStore.airInletProportionalInitVal[0])
  170. console.log('airout', sealStore.airOutletProportionalInitVal[0])
  171. if (
  172. sealStore.airInletProportionalInitVal == 0 &&
  173. sealStore.airOutletProportionalInitVal == 0
  174. ) {
  175. activeTab.value = '0'
  176. return
  177. }
  178. if (sealStore.airInletProportionalInitVal > 0) {
  179. activeTab.value = '1'
  180. selectedValuesTop.value = [sealStore.airInletProportionalInitVal[0] + '']
  181. return
  182. }
  183. if (sealStore.airOutletProportionalInitVal > 0) {
  184. activeTab.value = '2'
  185. selectedValuesBottom.value = [
  186. sealStore.airOutletProportionalInitVal[0] + '',
  187. ]
  188. return
  189. }
  190. activeTab.value = '0'
  191. }
  192. onMounted(() => {
  193. try {
  194. webSocketStore.sendCommandMsg(airInletProportionalValve_getStateJSON)
  195. webSocketStore.sendCommandMsg(AirOutletProportionalValve_getStateJSON)
  196. webSocketStore.sendCommandMsg(getAllSettingJSON)
  197. tabChange()
  198. } catch (error) {
  199. setTimeout(() => {
  200. webSocketStore.sendCommandMsg(getAllSettingJSON)
  201. webSocketStore.sendCommandMsg(airInletProportionalValve_getStateJSON)
  202. webSocketStore.sendCommandMsg(AirOutletProportionalValve_getStateJSON)
  203. }, 1000)
  204. }
  205. })
  206. watch(
  207. () => sealStore.airInletProportionalInitVal,
  208. (newVal, oldVal) => {
  209. selectedValuesTop.value = [newVal + '']
  210. topText.value = `${newVal / 10}%`
  211. tabChange()
  212. },
  213. )
  214. watch(
  215. () => sealStore.airOutletProportionalInitVal,
  216. (newVal, oldVal) => {
  217. selectedValuesBottom.value = [newVal + '']
  218. bottomText.value = `${newVal / 10}%`
  219. tabChange()
  220. },
  221. )
  222. </script>
  223. <style lang="scss" scoped>
  224. .air_switch_config_container {
  225. box-sizing: border-box;
  226. .header {
  227. display: flex;
  228. align-items: center;
  229. margin-bottom: 12px;
  230. .title {
  231. margin-left: 8px;
  232. font-family: 思源黑体;
  233. font-size: 24px;
  234. font-weight: 500;
  235. line-height: normal;
  236. letter-spacing: 0.06em;
  237. color: #ffffff;
  238. }
  239. }
  240. .opers_box {
  241. display: flex;
  242. align-items: center;
  243. height: 151px;
  244. justify-content: space-between;
  245. .left_container {
  246. width: 337px;
  247. height: 151px;
  248. .tab {
  249. width: 337px;
  250. height: 68px;
  251. border-radius: 6px;
  252. background: #1f6397;
  253. box-sizing: border-box;
  254. padding-left: 25px;
  255. padding-right: 22px;
  256. display: flex;
  257. align-items: center;
  258. justify-content: space-between;
  259. .text {
  260. font-family: 思源黑体;
  261. font-size: 16px;
  262. font-weight: normal;
  263. line-height: normal;
  264. letter-spacing: 0.06em;
  265. color: #ffffff;
  266. }
  267. .percent {
  268. width: 69px;
  269. height: 36px;
  270. border-radius: 8px;
  271. display: flex;
  272. align-items: center;
  273. justify-content: center;
  274. font-family: Source Han Sans;
  275. font-size: 20px;
  276. font-weight: bold;
  277. line-height: normal;
  278. letter-spacing: 0.06em;
  279. font-feature-settings: 'kern' on;
  280. color: #ffffff;
  281. }
  282. .icon {
  283. width: 22px;
  284. height: 22px;
  285. }
  286. }
  287. .active {
  288. .percent {
  289. background: #06518b;
  290. }
  291. }
  292. .mb {
  293. margin-bottom: 15px;
  294. }
  295. }
  296. .right_container {
  297. width: 339px;
  298. height: 146px;
  299. border-radius: 6px;
  300. box-sizing: border-box;
  301. background: #fff;
  302. overflow: hidden;
  303. .tips {
  304. width: 339px;
  305. height: 151px;
  306. display: flex;
  307. justify-content: center;
  308. align-items: center;
  309. font-family: 思源黑体;
  310. font-size: 28px;
  311. font-weight: bold;
  312. line-height: normal;
  313. letter-spacing: 0.1em;
  314. color: #000000;
  315. }
  316. }
  317. }
  318. }
  319. </style>