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

303 lines
7.6 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
  1. <template>
  2. <div class="liquid_contaienr">
  3. <div class="header_wrap">
  4. <div class="set_wrap" v-if="tabType == 1">
  5. <van-field
  6. type="number"
  7. v-model="addLiquidVal"
  8. :clickable="true"
  9. :maxlength="3"
  10. readonly
  11. @touchstart.stop="numberKeyboardShow = true"
  12. class="add_liquid_input"
  13. />
  14. <p class="title">设置加液</p>
  15. </div>
  16. <div
  17. :class="
  18. operatorStore.replenishingFluidsWorkState
  19. ? 'btn mr active'
  20. : 'btn mr '
  21. "
  22. v-if="tabType == 1"
  23. @click="stopAdd"
  24. >
  25. 停止加液
  26. </div>
  27. <div
  28. :class="
  29. operatorStore.replenishingFluidsWorkState ? 'btn' : 'btn active'
  30. "
  31. v-if="tabType == 1"
  32. @click="startAdd"
  33. >
  34. 开始加液
  35. </div>
  36. <div
  37. :class="operatorStore.drainingWorkState ? 'btn mr active' : 'btn mr '"
  38. v-if="tabType == 2"
  39. @click="stopPop"
  40. >
  41. 停止排液
  42. </div>
  43. <div
  44. :class="operatorStore.drainingWorkState ? 'btn' : 'btn active'"
  45. v-if="tabType == 2"
  46. @click="startTabLiquid"
  47. >
  48. 开始排液
  49. </div>
  50. </div>
  51. <div
  52. class="add_liquid"
  53. v-if="operatorStore.replenishingFluidsWorkState == 1 && tabType == 1"
  54. >
  55. <svg
  56. xmlns="http://www.w3.org/2000/svg"
  57. xmlns:xlink="http://www.w3.org/1999/xlink"
  58. fill="none"
  59. version="1.1"
  60. width="29.999204635620117"
  61. height="29.999876022338867"
  62. viewBox="0 0 29.999204635620117 29.999876022338867"
  63. >
  64. <g>
  65. <path
  66. d="M14.9997,0C6.7157,0,0,6.71555,0,14.9997C0,23.2839,6.7157,29.9999,14.9997,29.9999C19.1418,29.9999,22.8916,28.3208,25.606,25.6063C28.3204,22.8918,29.9992,19.1417,29.9992,14.9997C29.9992,6.7157,23.2838,0,14.9997,0ZM11.0395,23.4572L11.0395,6.54144L23.6346,14.9997L11.0395,23.4573L11.0395,23.4572Z"
  67. fill="#FF9A2D"
  68. fill-opacity="1"
  69. />
  70. </g>
  71. </svg>
  72. <p class="text">正在加液...</p>
  73. </div>
  74. <div
  75. class="add_liquid"
  76. v-if="operatorStore.drainingWorkState == 1 && tabType == 2"
  77. >
  78. <svg
  79. xmlns="http://www.w3.org/2000/svg"
  80. xmlns:xlink="http://www.w3.org/1999/xlink"
  81. fill="none"
  82. version="1.1"
  83. width="29.999204635620117"
  84. height="29.999876022338867"
  85. viewBox="0 0 29.999204635620117 29.999876022338867"
  86. >
  87. <g>
  88. <path
  89. d="M14.9997,0C6.7157,0,0,6.71555,0,14.9997C0,23.2839,6.7157,29.9999,14.9997,29.9999C19.1418,29.9999,22.8916,28.3208,25.606,25.6063C28.3204,22.8918,29.9992,19.1417,29.9992,14.9997C29.9992,6.7157,23.2838,0,14.9997,0ZM11.0395,23.4572L11.0395,6.54144L23.6346,14.9997L11.0395,23.4573L11.0395,23.4572Z"
  90. fill="#FF9A2D"
  91. fill-opacity="1"
  92. />
  93. </g>
  94. </svg>
  95. <p class="text">正在排液...</p>
  96. </div>
  97. <div class="chart">
  98. <div
  99. class="liquid_column"
  100. :style="{
  101. '--height': `${
  102. ((disinfectantCapacity <= 0 ? 0 : disinfectantCapacity) / 5000) *
  103. 427
  104. }px`,
  105. }"
  106. >
  107. <p class="indicator">
  108. {{ disinfectantCapacity <= 0 ? 0 : disinfectantCapacity }}g
  109. </p>
  110. </div>
  111. </div>
  112. <LiquidModal
  113. v-if="tabType == 2 && tipModalVisible"
  114. :hideTabLiquid="hideTabLiquid"
  115. />
  116. <van-number-keyboard
  117. v-model="addLiquidVal"
  118. :show="numberKeyboardShow"
  119. :maxlength="3"
  120. @blur="numberKeyboardShow = false"
  121. />
  122. </div>
  123. </template>
  124. <script setup>
  125. import LiquidModal from './dialogs/LiquidModal.vue'
  126. import { useDeviceStore, useWebSocketStore, useOperatorStore } from '@/store'
  127. import { ref } from 'vue'
  128. import { storeToRefs } from 'pinia'
  129. import {
  130. startReplenishingFluidsJSON,
  131. stopReplenishingFluidsJSON,
  132. stopDrainingJSON,
  133. } from '@/mock/command'
  134. const numberKeyboardShow = ref(false)
  135. const operatorStore = useOperatorStore()
  136. const props = defineProps({
  137. tabType: {
  138. type: Number,
  139. },
  140. })
  141. const addLiquidVal = ref(1)
  142. const tipModalVisible = ref(false)
  143. const webSocketStore = useWebSocketStore()
  144. const isPopLiquidStatus = ref(false)
  145. const startAdd = () => {
  146. if (!operatorStore.replenishingFluidsWorkState) {
  147. console.log(startReplenishingFluidsJSON(parseInt(addLiquidVal.value)))
  148. webSocketStore.sendCommandMsg(
  149. startReplenishingFluidsJSON(parseInt(addLiquidVal.value)),
  150. )
  151. }
  152. }
  153. const stopAdd = () => {
  154. if (operatorStore.replenishingFluidsWorkState) {
  155. webSocketStore.sendCommandMsg(stopReplenishingFluidsJSON)
  156. }
  157. }
  158. const stopPop = () => {
  159. if (operatorStore.drainingWorkState) {
  160. webSocketStore.sendCommandMsg(stopDrainingJSON)
  161. }
  162. }
  163. const startTabLiquid = () => {
  164. if (!operatorStore.drainingWorkState) {
  165. tipModalVisible.value = true
  166. }
  167. }
  168. const hideTabLiquid = () => {
  169. tipModalVisible.value = false
  170. }
  171. const deviceStore = useDeviceStore()
  172. const { disinfectantCapacity } = storeToRefs(deviceStore)
  173. </script>
  174. <style lang="scss" scoped>
  175. .liquid_contaienr {
  176. margin-bottom: 30px;
  177. height: 580px;
  178. box-sizing: border-box;
  179. background: #ffffff;
  180. border-radius: 16px;
  181. padding: 30px;
  182. padding-bottom: 23px;
  183. position: relative;
  184. .header_wrap {
  185. display: flex;
  186. align-items: center;
  187. justify-content: flex-end;
  188. position: relative;
  189. margin-bottom: 39px;
  190. .set_wrap {
  191. position: relative;
  192. width: 227px;
  193. height: 45px;
  194. background: url(../assets/img/liquid/oper.png) no-repeat;
  195. background-size: 227px 45px;
  196. .title {
  197. position: absolute;
  198. left: 22px;
  199. top: 12px;
  200. font-family: Source Han Sans CN;
  201. font-size: 14px;
  202. font-weight: normal;
  203. line-height: normal;
  204. letter-spacing: 0.1em;
  205. color: #0e0e0e;
  206. }
  207. .add_liquid_input {
  208. position: absolute;
  209. left: 113px;
  210. top: 11px;
  211. width: 40px;
  212. height: 20px;
  213. padding: 0;
  214. color: #0e0e0e;
  215. font-family: Source Han Sans CN;
  216. font-weight: 500;
  217. font-size: 14;
  218. }
  219. }
  220. .btn {
  221. width: 140px;
  222. height: 45px;
  223. border-radius: 23px;
  224. background: #f6f6f6;
  225. display: flex;
  226. align-items: center;
  227. justify-content: center;
  228. font-family: Source Han Sans CN;
  229. font-size: 14px;
  230. font-weight: normal;
  231. line-height: normal;
  232. letter-spacing: 0.1em;
  233. color: #d8d8d8;
  234. }
  235. .mr {
  236. margin: 0 16px;
  237. }
  238. .active {
  239. background: #06518b;
  240. color: #fff;
  241. }
  242. }
  243. .add_liquid {
  244. position: absolute;
  245. left: 382px;
  246. top: 33px;
  247. display: flex;
  248. align-items: center;
  249. .text {
  250. margin-left: 16px;
  251. font-family: Source Han Sans CN;
  252. font-size: 26px;
  253. font-weight: normal;
  254. line-height: normal;
  255. letter-spacing: 0.06em;
  256. color: #ff9a2d;
  257. }
  258. }
  259. .chart {
  260. position: absolute;
  261. left: 310px;
  262. bottom: 23px;
  263. width: 600px;
  264. height: 452px;
  265. background: url(../assets/img/liquid/chart.png) no-repeat;
  266. background-size: 600px 452px;
  267. .liquid_column {
  268. position: absolute;
  269. left: 96px;
  270. bottom: 13px;
  271. width: 491px;
  272. height: var(--height);
  273. border-radius: 0px 12px 12px 0px;
  274. background: linear-gradient(0deg, #06518b 0%, rgba(6, 81, 139, 0.7) 58%);
  275. .indicator {
  276. position: absolute;
  277. top: -10px;
  278. right: -50px;
  279. font-family: Source Han Sans CN;
  280. font-size: 12px;
  281. font-weight: 500;
  282. line-height: normal;
  283. letter-spacing: 0.06em;
  284. color: #06518b;
  285. }
  286. }
  287. }
  288. }
  289. </style>