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

368 lines
8.7 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
2 years ago
  1. <template>
  2. <div class="operator_main_content">
  3. <div class="left_contaienr">
  4. <div class="info_cards">
  5. <div class="card">
  6. <DisinfectantLiquidInfo />
  7. </div>
  8. <div class="card">
  9. <EnvironmentInfo :cardType="1" />
  10. </div>
  11. <div class="card">
  12. <EnvironmentInfo :cardType="2" />
  13. </div>
  14. <div class="card">
  15. <EnvironmentInfo :cardType="3" />
  16. </div>
  17. </div>
  18. <div class="warn_wrap">
  19. <p class="warn_text">警报信息</p>
  20. <div
  21. class="detail_btn"
  22. v-if="
  23. operatorStore.disinfectStatus != 0 &&
  24. operatorStore.disinfectStatus != 3
  25. "
  26. @click="toDetail"
  27. >
  28. 详情
  29. </div>
  30. </div>
  31. </div>
  32. <div class="right_container">
  33. <div class="setting_title">
  34. <p>消毒设置</p>
  35. <p>SET</p>
  36. </div>
  37. <div class="set_form">
  38. <input
  39. type="number"
  40. :disabled="[1, 2].includes(operatorStore.disinfectStatus)"
  41. v-model="roomSize"
  42. class="room_size"
  43. id="room_size"
  44. @focus="handleShowKeyBoard"
  45. />
  46. <div class="log" @click="showLogPicker">{{ logVal }}</div>
  47. </div>
  48. <div
  49. :class="
  50. [1, 2].includes(operatorStore.disinfectStatus)
  51. ? 'start cant'
  52. : 'start'
  53. "
  54. @click="startDisinfect"
  55. >
  56. 开始消毒
  57. </div>
  58. <div class="progress">
  59. <p class="title">预计剩余时间</p>
  60. <!-- <div class="tube">
  61. <div
  62. class="pro"
  63. :style="{
  64. '--width': '50px',
  65. }"
  66. ></div>
  67. </div>
  68. <div class="num">000/100</div> -->
  69. <div class="time">
  70. {{
  71. operatorStore.estimatedRemainingTimeS == 0
  72. ? '已结束'
  73. : `${operatorStore.estimatedRemainingTimeS} S`
  74. }}
  75. </div>
  76. </div>
  77. </div>
  78. <!-- <WarnModal /> -->
  79. <LogPicker
  80. v-if="logVisible"
  81. :changeLogVal="changeLogVal"
  82. :logVal="logVal"
  83. />
  84. </div>
  85. </template>
  86. <script setup>
  87. import LogPicker from 'cpns/dialogs/LogPicker'
  88. import WarnModal from 'cpns/dialogs/WarnModal'
  89. import DisinfectantLiquidInfo from 'cpns/info/DisinfectantLiquidInfo'
  90. import EnvironmentInfo from 'cpns/info/EnvironmentInfo'
  91. import { ref, watch, onMounted, onUnmounted } from 'vue'
  92. import { useOperatorStore, useWebSocketStore } from '@/store'
  93. import { startDisinfectionJSON, getStateJSON } from '@/mock/command'
  94. import { showSuccessToast, showFailToast } from 'vant'
  95. const operatorStore = useOperatorStore()
  96. const webSocketStore = useWebSocketStore()
  97. const props = defineProps({
  98. changeShowOperator: {
  99. type: Function,
  100. },
  101. handleShowKeyBoard: {
  102. type: Function,
  103. },
  104. hideKeyBoard: {
  105. type: Function,
  106. },
  107. input: {
  108. type: String,
  109. },
  110. })
  111. const toDetail = () => {
  112. // 判断当前消毒任务是否开始,如果开始时才生效 否则点击不生效
  113. if (operatorStore.disinfectStatus != 0) {
  114. props.changeShowOperator(false)
  115. }
  116. }
  117. const logVisible = ref(false)
  118. const logVal = ref(1)
  119. const roomSize = ref(0)
  120. watch(() => {
  121. if (props.input) {
  122. roomSize.value = props.input?.match(/\d+/g)[0]
  123. } else {
  124. roomSize.value = 0
  125. }
  126. })
  127. const changeLogVal = val => {
  128. logVal.value = val
  129. logVisible.value = false
  130. }
  131. const startDisinfect = () => {
  132. // 改变开始消毒状态 如果已经开始则不可点击
  133. if (![1, 2].includes(operatorStore.disinfectStatus)) {
  134. if (roomSize.value == 0) {
  135. showFailToast('请调整房间大小设置,不能为0')
  136. } else {
  137. localStorage.removeItem('bin')
  138. localStorage.removeItem('envir1')
  139. localStorage.removeItem('envir2')
  140. localStorage.clear()
  141. webSocketStore.sendCommandMsg(
  142. startDisinfectionJSON(logVal.value, roomSize.value),
  143. )
  144. props.changeShowOperator(false)
  145. }
  146. }
  147. }
  148. const showLogPicker = () => {
  149. if (![1, 2].includes(operatorStore.disinfectStatus)) {
  150. logVisible.value = true
  151. }
  152. }
  153. const timer = ref(null)
  154. onMounted(() => {
  155. timer.value = setInterval(() => {
  156. webSocketStore.sendCommandMsg(getStateJSON)
  157. }, 1000)
  158. })
  159. onUnmounted(() => {
  160. timer.value = null
  161. })
  162. </script>
  163. <style lang="scss" scoped>
  164. .operator_main_content {
  165. margin-bottom: 30px;
  166. height: 580px;
  167. box-sizing: border-box;
  168. display: flex;
  169. align-items: center;
  170. .left_contaienr {
  171. margin-right: 30px;
  172. width: 766px;
  173. height: 580px;
  174. box-sizing: border-box;
  175. border-radius: 16px;
  176. background: #ffffff;
  177. padding: 20px;
  178. .info_cards {
  179. width: 726px;
  180. height: 470px;
  181. box-sizing: border-box;
  182. display: grid;
  183. grid-template-columns: repeat(2, 1fr);
  184. grid-template-rows: repeat(2, 1fr);
  185. column-gap: 20px;
  186. row-gap: 20px;
  187. margin-bottom: 20px;
  188. .card {
  189. width: 353px;
  190. height: 225px;
  191. border-radius: 17.5px;
  192. background: #06518b;
  193. }
  194. }
  195. .warn_wrap {
  196. display: flex;
  197. align-items: center;
  198. justify-content: space-between;
  199. box-sizing: border-box;
  200. padding: 0 20px;
  201. width: 726px;
  202. height: 50px;
  203. border-radius: 6px;
  204. background: #f6f6f6;
  205. .warn_text {
  206. font-family: Source Han Sans CN;
  207. font-size: 12px;
  208. font-weight: 500;
  209. letter-spacing: 0.1em;
  210. color: #fa1c1c;
  211. }
  212. .detail_btn {
  213. width: 105px;
  214. height: 31px;
  215. border-radius: 16px;
  216. background: #06518b;
  217. display: flex;
  218. align-items: center;
  219. justify-content: center;
  220. font-family: Source Han Sans CN;
  221. font-size: 12px;
  222. font-weight: normal;
  223. letter-spacing: 0.1em;
  224. color: #ffffff;
  225. }
  226. }
  227. }
  228. .right_container {
  229. height: 580px;
  230. box-sizing: border-box;
  231. border-radius: 16px;
  232. background: #ffffff;
  233. flex: 1;
  234. padding: 42px;
  235. padding-top: 32px;
  236. .setting_title {
  237. width: 340px;
  238. height: 45px;
  239. border-radius: 23px;
  240. background: #06518b;
  241. padding: 0 24px;
  242. box-sizing: border-box;
  243. display: flex;
  244. align-items: center;
  245. justify-content: space-between;
  246. font-family: Source Han Sans CN;
  247. font-size: 14px;
  248. font-weight: normal;
  249. letter-spacing: 0.1em;
  250. color: #ffffff;
  251. margin-bottom: 41px;
  252. }
  253. .set_form {
  254. width: 340px;
  255. height: 190px;
  256. box-sizing: border-box;
  257. margin-bottom: 41px;
  258. overflow: hidden;
  259. background: url(../assets/img/operator/form.png) no-repeat;
  260. background-size: 100% 100%;
  261. position: relative;
  262. .room_size {
  263. position: absolute;
  264. top: 45px;
  265. left: 23px;
  266. width: 189px;
  267. height: 20px;
  268. text-align: center;
  269. border: none;
  270. outline: none;
  271. }
  272. .log {
  273. position: absolute;
  274. top: 145px;
  275. left: 0px;
  276. width: 240px;
  277. height: 42px;
  278. text-align: center;
  279. display: flex;
  280. align-items: center;
  281. justify-content: center;
  282. font-family: Source Han Sans CN;
  283. font-size: 14px;
  284. font-weight: 500;
  285. letter-spacing: 0.06em;
  286. color: #0e0e0e;
  287. }
  288. }
  289. .start {
  290. margin-bottom: 30px;
  291. width: 340px;
  292. height: 45px;
  293. border-radius: 23px;
  294. background: #06518b;
  295. display: flex;
  296. align-items: center;
  297. justify-content: center;
  298. font-family: Source Han Sans CN;
  299. font-size: 14px;
  300. font-weight: normal;
  301. letter-spacing: 0.1em;
  302. color: #ffffff;
  303. }
  304. .cant {
  305. background: #f4f4f4;
  306. }
  307. .progress {
  308. width: 340px;
  309. height: 114px;
  310. border-radius: 16px;
  311. opacity: 1;
  312. background: #f6f6f6;
  313. box-sizing: border-box;
  314. padding: 27px 24px 18px 27px;
  315. .title {
  316. font-family: Source Han Sans CN;
  317. font-size: 12px;
  318. font-weight: 350;
  319. letter-spacing: 0.06em;
  320. color: #9e9e9e;
  321. margin-bottom: 13px;
  322. }
  323. .time {
  324. text-align: center;
  325. padding: 10px;
  326. }
  327. .tube {
  328. width: 292px;
  329. height: 14px;
  330. border-radius: 7px;
  331. background: #ffffff;
  332. margin-bottom: 11px;
  333. position: relative;
  334. overflow: hidden;
  335. .pro {
  336. position: absolute;
  337. left: 0;
  338. top: 0;
  339. height: 14px;
  340. width: var(--width);
  341. border-radius: 7px;
  342. background: #06518b;
  343. }
  344. }
  345. .num {
  346. display: flex;
  347. justify-content: flex-end;
  348. font-family: Source Han Sans CN;
  349. font-size: 10px;
  350. font-weight: normal;
  351. letter-spacing: 0.06em;
  352. color: #9e9e9e;
  353. }
  354. }
  355. }
  356. }
  357. </style>