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

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