大空间消毒机
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.

364 lines
8.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
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. roomSize.value = props.input.match(/\d+/g)[0]
  122. })
  123. const changeLogVal = val => {
  124. logVal.value = val
  125. logVisible.value = false
  126. }
  127. const startDisinfect = () => {
  128. // 改变开始消毒状态 如果已经开始则不可点击
  129. if (![1, 2].includes(operatorStore.disinfectStatus)) {
  130. if (roomSize.value == 0) {
  131. showFailToast('请调整房间大小设置,不能为0')
  132. } else {
  133. localStorage.removeItem('bin')
  134. localStorage.removeItem('envir1')
  135. localStorage.removeItem('envir2')
  136. localStorage.clear()
  137. webSocketStore.sendCommandMsg(
  138. startDisinfectionJSON(logVal.value, roomSize.value),
  139. )
  140. props.changeShowOperator(false)
  141. }
  142. }
  143. }
  144. const showLogPicker = () => {
  145. if (![1, 2].includes(operatorStore.disinfectStatus)) {
  146. logVisible.value = true
  147. }
  148. }
  149. const timer = ref(null)
  150. onMounted(() => {
  151. timer.value = setInterval(() => {
  152. webSocketStore.sendCommandMsg(getStateJSON)
  153. }, 1000)
  154. })
  155. onUnmounted(() => {
  156. timer.value = null
  157. })
  158. </script>
  159. <style lang="scss" scoped>
  160. .operator_main_content {
  161. margin-bottom: 30px;
  162. height: 580px;
  163. box-sizing: border-box;
  164. display: flex;
  165. align-items: center;
  166. .left_contaienr {
  167. margin-right: 30px;
  168. width: 766px;
  169. height: 580px;
  170. box-sizing: border-box;
  171. border-radius: 16px;
  172. background: #ffffff;
  173. padding: 20px;
  174. .info_cards {
  175. width: 726px;
  176. height: 470px;
  177. box-sizing: border-box;
  178. display: grid;
  179. grid-template-columns: repeat(2, 1fr);
  180. grid-template-rows: repeat(2, 1fr);
  181. column-gap: 20px;
  182. row-gap: 20px;
  183. margin-bottom: 20px;
  184. .card {
  185. width: 353px;
  186. height: 225px;
  187. border-radius: 17.5px;
  188. background: #06518b;
  189. }
  190. }
  191. .warn_wrap {
  192. display: flex;
  193. align-items: center;
  194. justify-content: space-between;
  195. box-sizing: border-box;
  196. padding: 0 20px;
  197. width: 726px;
  198. height: 50px;
  199. border-radius: 6px;
  200. background: #f6f6f6;
  201. .warn_text {
  202. font-family: Source Han Sans CN;
  203. font-size: 12px;
  204. font-weight: 500;
  205. letter-spacing: 0.1em;
  206. color: #fa1c1c;
  207. }
  208. .detail_btn {
  209. width: 105px;
  210. height: 31px;
  211. border-radius: 16px;
  212. background: #06518b;
  213. display: flex;
  214. align-items: center;
  215. justify-content: center;
  216. font-family: Source Han Sans CN;
  217. font-size: 12px;
  218. font-weight: normal;
  219. letter-spacing: 0.1em;
  220. color: #ffffff;
  221. }
  222. }
  223. }
  224. .right_container {
  225. height: 580px;
  226. box-sizing: border-box;
  227. border-radius: 16px;
  228. background: #ffffff;
  229. flex: 1;
  230. padding: 42px;
  231. padding-top: 32px;
  232. .setting_title {
  233. width: 340px;
  234. height: 45px;
  235. border-radius: 23px;
  236. background: #06518b;
  237. padding: 0 24px;
  238. box-sizing: border-box;
  239. display: flex;
  240. align-items: center;
  241. justify-content: space-between;
  242. font-family: Source Han Sans CN;
  243. font-size: 14px;
  244. font-weight: normal;
  245. letter-spacing: 0.1em;
  246. color: #ffffff;
  247. margin-bottom: 41px;
  248. }
  249. .set_form {
  250. width: 340px;
  251. height: 190px;
  252. box-sizing: border-box;
  253. margin-bottom: 41px;
  254. overflow: hidden;
  255. background: url(../assets/img/operator/form.png) no-repeat;
  256. background-size: 100% 100%;
  257. position: relative;
  258. .room_size {
  259. position: absolute;
  260. top: 45px;
  261. left: 23px;
  262. width: 189px;
  263. height: 20px;
  264. text-align: center;
  265. border: none;
  266. outline: none;
  267. }
  268. .log {
  269. position: absolute;
  270. top: 145px;
  271. left: 0px;
  272. width: 240px;
  273. height: 42px;
  274. text-align: center;
  275. display: flex;
  276. align-items: center;
  277. justify-content: center;
  278. font-family: Source Han Sans CN;
  279. font-size: 14px;
  280. font-weight: 500;
  281. letter-spacing: 0.06em;
  282. color: #0e0e0e;
  283. }
  284. }
  285. .start {
  286. margin-bottom: 30px;
  287. width: 340px;
  288. height: 45px;
  289. border-radius: 23px;
  290. background: #06518b;
  291. display: flex;
  292. align-items: center;
  293. justify-content: center;
  294. font-family: Source Han Sans CN;
  295. font-size: 14px;
  296. font-weight: normal;
  297. letter-spacing: 0.1em;
  298. color: #ffffff;
  299. }
  300. .cant {
  301. background: #f4f4f4;
  302. }
  303. .progress {
  304. width: 340px;
  305. height: 114px;
  306. border-radius: 16px;
  307. opacity: 1;
  308. background: #f6f6f6;
  309. box-sizing: border-box;
  310. padding: 27px 24px 18px 27px;
  311. .title {
  312. font-family: Source Han Sans CN;
  313. font-size: 12px;
  314. font-weight: 350;
  315. letter-spacing: 0.06em;
  316. color: #9e9e9e;
  317. margin-bottom: 13px;
  318. }
  319. .time {
  320. text-align: center;
  321. padding: 10px;
  322. }
  323. .tube {
  324. width: 292px;
  325. height: 14px;
  326. border-radius: 7px;
  327. background: #ffffff;
  328. margin-bottom: 11px;
  329. position: relative;
  330. overflow: hidden;
  331. .pro {
  332. position: absolute;
  333. left: 0;
  334. top: 0;
  335. height: 14px;
  336. width: var(--width);
  337. border-radius: 7px;
  338. background: #06518b;
  339. }
  340. }
  341. .num {
  342. display: flex;
  343. justify-content: flex-end;
  344. font-family: Source Han Sans CN;
  345. font-size: 10px;
  346. font-weight: normal;
  347. letter-spacing: 0.06em;
  348. color: #9e9e9e;
  349. }
  350. }
  351. }
  352. }
  353. </style>