新型管道消毒机前端代码
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.

211 lines
6.9 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
  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 :src="activeTab == 1 ? A2 : A1" class="icon" alt="" />
  32. </div>
  33. <div
  34. :class="activeTab == '2' ? 'tab active' : 'tab'"
  35. @click="changeTab('2')"
  36. >
  37. <p class="text">下管道</p>
  38. <div class="percent">{{ bottomText }}</div>
  39. <img :src="activeTab == 2 ? A2 : A1" class="icon" alt="" />
  40. </div>
  41. </div>
  42. <div class="right_container">
  43. <van-picker
  44. v-if="activeTab == 1"
  45. :columns="columns"
  46. :show-toolbar="false"
  47. visible-option-num="3"
  48. option-height="42"
  49. v-model="selectedValuesTop"
  50. @change="topChange"
  51. />
  52. <van-picker
  53. v-if="activeTab == 2"
  54. :columns="columns"
  55. :show-toolbar="false"
  56. visible-option-num="3"
  57. option-height="42"
  58. @change="bottomChange"
  59. v-model="selectedValuesBottom"
  60. />
  61. </div>
  62. </div>
  63. </div>
  64. </template>
  65. <script setup>
  66. import A1 from '@/assets/img/air/1.png'
  67. import A2 from '@/assets/img/air/2.png'
  68. import { useSealStore, useWebSocketStore } from '@/store'
  69. import {
  70. AirInletProportionalValve_setStateJSON,
  71. AirOutletProportionalValve_setStateJSON,
  72. airInletProportionalValve_getStateJSON,
  73. AirOutletProportionalValve_getStateJSON,
  74. } from '@/mock/command'
  75. import { ref, onMounted } from 'vue'
  76. const activeTab = ref('1')
  77. const sealStore = useSealStore()
  78. const webSocketStore = useWebSocketStore()
  79. const changeTab = tab => {
  80. activeTab.value = tab
  81. }
  82. const topText = ref('0%')
  83. const bottomText = ref('0%')
  84. const topChange = ({ selectedOptions, selectedValues }) => {
  85. topText.value = selectedOptions[0].text
  86. webSocketStore.sendCommandMsg(
  87. AirInletProportionalValve_setStateJSON([parseInt(selectedValues[0]) * 10]),
  88. )
  89. sealStore.updateAirInletProportionalValue(parseInt(selectedValues[0]) * 10)
  90. }
  91. const bottomChange = ({ selectedOptions, selectedValues }) => {
  92. bottomText.value = selectedOptions[0].text
  93. webSocketStore.sendCommandMsg(
  94. AirOutletProportionalValve_setStateJSON([parseInt(selectedValues[0]) * 10]),
  95. )
  96. sealStore.updateAirOutletProportionalValue(parseInt(selectedValues[0]) * 10)
  97. }
  98. const columns = ref([
  99. { text: '0%', value: '0' },
  100. { text: '10%', value: '1' },
  101. { text: '20%', value: '2' },
  102. { text: '30%', value: '3' },
  103. { text: '40%', value: '4' },
  104. { text: '50%', value: '5' },
  105. { text: '60%', value: '6' },
  106. { text: '70%', value: '7' },
  107. { text: '80%', value: '8' },
  108. { text: '90%', value: '9' },
  109. { text: '100%', value: '10' },
  110. ])
  111. const selectedValuesTop = ref(['0'])
  112. const selectedValuesBottom = ref(['0'])
  113. onMounted(() => {
  114. webSocketStore.sendCommandMsg(airInletProportionalValve_getStateJSON)
  115. webSocketStore.sendCommandMsg(AirOutletProportionalValve_getStateJSON)
  116. })
  117. </script>
  118. <style lang="scss" scoped>
  119. .air_switch_config_container {
  120. box-sizing: border-box;
  121. .header {
  122. display: flex;
  123. align-items: center;
  124. margin-bottom: 12px;
  125. .title {
  126. margin-left: 8px;
  127. font-family: 思源黑体;
  128. font-size: 24px;
  129. font-weight: 500;
  130. line-height: normal;
  131. letter-spacing: 0.06em;
  132. color: #ffffff;
  133. }
  134. }
  135. .opers_box {
  136. display: flex;
  137. align-items: center;
  138. height: 151px;
  139. justify-content: space-between;
  140. .left_container {
  141. width: 337px;
  142. height: 151px;
  143. .tab {
  144. width: 337px;
  145. height: 68px;
  146. border-radius: 6px;
  147. background: #1f6397;
  148. box-sizing: border-box;
  149. padding-left: 25px;
  150. padding-right: 22px;
  151. display: flex;
  152. align-items: center;
  153. justify-content: space-between;
  154. .text {
  155. font-family: 思源黑体;
  156. font-size: 16px;
  157. font-weight: normal;
  158. line-height: normal;
  159. letter-spacing: 0.06em;
  160. color: #ffffff;
  161. }
  162. .percent {
  163. width: 69px;
  164. height: 36px;
  165. border-radius: 8px;
  166. display: flex;
  167. align-items: center;
  168. justify-content: center;
  169. font-family: Source Han Sans;
  170. font-size: 20px;
  171. font-weight: bold;
  172. line-height: normal;
  173. letter-spacing: 0.06em;
  174. font-feature-settings: 'kern' on;
  175. color: #ffffff;
  176. }
  177. .icon {
  178. width: 22px;
  179. height: 22px;
  180. }
  181. }
  182. .active {
  183. .percent {
  184. background: #06518b;
  185. }
  186. }
  187. .mb {
  188. margin-bottom: 15px;
  189. }
  190. }
  191. .right_container {
  192. width: 339px;
  193. height: 146px;
  194. border-radius: 6px;
  195. box-sizing: border-box;
  196. background: #fff;
  197. overflow: hidden;
  198. }
  199. }
  200. }
  201. .van-ellipsis {
  202. font-size: 26px;
  203. }
  204. </style>