消毒机设备
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.

223 lines
6.0 KiB

2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <script lang="ts" setup>
  2. import { syncSendCmd } from 'apis/system'
  3. import homeFinish from 'assets/images/home/home-finish.svg'
  4. import homeSettingSvg from 'assets/images/home/home-setting.svg'
  5. import Config from 'components/home/config.vue'
  6. import HomeFormula from 'components/home/HomeFormula.vue'
  7. import LineChart from 'components/home/LineChart.vue'
  8. import { stopTimer } from 'libs/countdownTimer'
  9. import { deviceStateMap } from 'libs/utils'
  10. import { cloneDeep } from 'lodash'
  11. import { provide, ref, watchEffect } from 'vue'
  12. import { useRouter } from 'vue-router'
  13. import { useFormulaStore } from '@/stores/formulaStore'
  14. import { useHomeStore } from '@/stores/homeStore'
  15. const configRef = ref()
  16. provide<(methods: Home.GrandsonMethods) => void>('registerGrandsonMethods', (methods) => {
  17. configRef.value = methods
  18. })
  19. const router = useRouter()
  20. const formulaStore = useFormulaStore()
  21. const homeStore = useHomeStore()
  22. const formulaInfo = ref()
  23. const disinfectionState = ref(homeStore.disinfectionState)
  24. const curStateRemainTime = ref(homeStore.curStateRemainTime)
  25. const disinfectFormulaVisible = ref(false)
  26. const isDeviceIdle = ref(homeStore.isDeviceIdle)
  27. const loading = ref(false)
  28. const h2O2SensorData = ref(homeStore.h2O2SensorData)
  29. watchEffect(() => {
  30. formulaInfo.value = formulaStore.currentSelectedFormulaInfo
  31. disinfectionState.value = homeStore.disinfectionState
  32. curStateRemainTime.value = homeStore.curStateRemainTime
  33. isDeviceIdle.value = homeStore.isDeviceIdle
  34. h2O2SensorData.value = homeStore.h2O2SensorData.map((item, index) => {
  35. return {
  36. ...item,
  37. title: index === 0 ? '仓内' : `探头${index}`,
  38. chartId: index === 0 ? 'inside' : `env${index}`,
  39. }
  40. })
  41. })
  42. const onDisinfectConfig = () => {
  43. disinfectFormulaVisible.value = true
  44. }
  45. // 结束消毒
  46. const onFinishDisinfect = async () => {
  47. stopTimer()
  48. const stopParams = {
  49. className: 'DisinfectionCtrlServiceExt',
  50. fnName: 'stop',
  51. params: {
  52. loglevel: formulaStore.loglevel,
  53. },
  54. }
  55. loading.value = true
  56. syncSendCmd(stopParams).then((res) => {
  57. if (res.ackcode === 0) {
  58. loading.value = false
  59. }
  60. })
  61. }
  62. const onSave = () => {
  63. const formData = configRef.value?.getFormData()
  64. formulaStore.updateSelectedFormulaDataByList(cloneDeep(formData))
  65. onClose()
  66. }
  67. const goHome = () => {
  68. router.back()
  69. }
  70. const onClose = () => {
  71. disinfectFormulaVisible.value = false
  72. }
  73. </script>
  74. <template>
  75. <main v-loading="loading" class="main-content">
  76. <div class="line-chart-title">
  77. <div v-if="formulaInfo && formulaInfo.name" class="line-chart-formula">
  78. <HomeFormula style="background: #e0f0ff" />
  79. </div>
  80. <div class="line-chart-set">
  81. <bt-button
  82. v-if="!isDeviceIdle"
  83. button-text="运行参数"
  84. text-size="14px"
  85. border-radius="5px"
  86. height="3.5rem"
  87. text-color="#1989fa"
  88. padding="0.8vw"
  89. @click="onDisinfectConfig"
  90. >
  91. <template #icon>
  92. <img :src="homeSettingSvg" width="15" alt="">
  93. </template>
  94. </bt-button>
  95. </div>
  96. </div>
  97. <div
  98. class="line-chart-content"
  99. :style="{ 'grid-template-columns': `repeat(${homeStore.h2O2SensorData.length},1fr)` }"
  100. >
  101. <div v-for="(item, index) in homeStore.allData" :key="index">
  102. <LineChart :env-data="item.data" />
  103. </div>
  104. </div>
  105. <div class="line-chart-bottom">
  106. <div class="home-chart-time">
  107. <div v-if="!homeStore.isDeviceIdle" class="home-remain-time">
  108. <div class="home-chart-label">
  109. <span v-if="disinfectionState.state === 'disinfection'"> 预计剩余时间: </span>
  110. <span v-else> 消毒状态 </span>
  111. </div>
  112. <div v-if="curStateRemainTime" class="home-chart-value">
  113. {{ curStateRemainTime }}
  114. </div>
  115. <div v-else class="home-chart-value">
  116. {{ deviceStateMap[disinfectionState.state] }}
  117. </div>
  118. </div>
  119. </div>
  120. <div class="home-chart-btn">
  121. <bt-button
  122. v-if="!isDeviceIdle"
  123. button-text="结束消毒"
  124. bg-color="#FF6767"
  125. text-color="#FFFFFF"
  126. width="15vw"
  127. height="7vh"
  128. text-size="24px"
  129. border-radius="12px"
  130. @click="onFinishDisinfect"
  131. >
  132. <template #icon>
  133. <img :src="homeFinish" alt="">
  134. </template>
  135. </bt-button>
  136. <bt-button
  137. button-text="返回"
  138. width="10vw"
  139. height="7vh"
  140. text-color="#1989fa"
  141. text-size="24px"
  142. border-radius="12px"
  143. @click="goHome"
  144. />
  145. </div>
  146. </div>
  147. <ft-dialog v-model="disinfectFormulaVisible" title="运行参数" width="80vw" :ok-handle="onSave" @cancel="onClose">
  148. <div>
  149. <Config ref="configRef" />
  150. </div>
  151. </ft-dialog>
  152. </main>
  153. </template>
  154. <style lang="scss" scoped>
  155. .main-content {
  156. overflow: hidden;
  157. background: $gradient-color;
  158. height: $main-container-height;
  159. .line-chart-formula {
  160. width: 40vw;
  161. //background: #E0F0FF;
  162. height: 3.5rem;
  163. display: flex;
  164. justify-content: center;
  165. align-items: center;
  166. //border: 1px solid #E0F0FF;
  167. border-radius: 10px;
  168. margin-left: 2rem;
  169. }
  170. .line-chart-set {
  171. display: flex;
  172. justify-content: end;
  173. align-items: center;
  174. width: 65vw;
  175. }
  176. .line-chart-title {
  177. height: 15%;
  178. display: flex;
  179. align-items: center;
  180. }
  181. .line-chart-content {
  182. display: grid;
  183. height: 65%;
  184. }
  185. .line-chart-bottom {
  186. height: 15%;
  187. display: flex;
  188. padding-right: 20px;
  189. .home-chart-btn {
  190. display: flex;
  191. justify-content: end;
  192. width: 65%;
  193. }
  194. .home-chart-time {
  195. width: 35%;
  196. .home-remain-time {
  197. background: #f6fafe;
  198. width: 27vw;
  199. height: 8vh;
  200. border-radius: 12px;
  201. display: flex;
  202. align-items: center;
  203. justify-content: center;
  204. font-size: 24px;
  205. gap: 10px;
  206. margin-left: 1rem;
  207. .home-chart-value {
  208. color: #2892f3;
  209. }
  210. }
  211. }
  212. }
  213. }
  214. </style>