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

216 lines
5.8 KiB

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
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
  1. <script lang="ts" setup>
  2. import homeLiquid from 'assets/images/home/home-liquid.svg'
  3. import Environment from 'components/home/Environment.vue'
  4. import HomeFormula from 'components/home/HomeFormula.vue'
  5. import HomeLogLevel from 'components/home/HomeLogLevel.vue'
  6. import HomeOperation from 'components/home/HomeOperation.vue'
  7. import HomeSetting from 'components/home/HomeSetting.vue'
  8. import { useDeviceStore } from 'stores/deviceStore'
  9. import { useHomeStore } from 'stores/homeStore'
  10. import { useLiquidStore } from 'stores/liquidStore'
  11. import { computed, ref, watchEffect } from 'vue'
  12. import { useRoute } from 'vue-router'
  13. import { roundNumber } from '@/libs/utils'
  14. import { useFormulaStore } from '@/stores/formulaStore'
  15. import { useSystemStore } from '@/stores/systemStore'
  16. const route = useRoute()
  17. const homeStore = useHomeStore()
  18. const deviceStore = useDeviceStore()
  19. const liquidStore = useLiquidStore()
  20. const formulaStore = useFormulaStore()
  21. const systemStore = useSystemStore()
  22. const environmentParams = ref<Home.DisplayrelyMgrParams>(homeStore.h2O2SensorData[0])
  23. const initEnv1 = {
  24. type: 'env1',
  25. title: '探头1',
  26. }
  27. const initEnv2 = {
  28. type: 'env2',
  29. title: '探头2',
  30. }
  31. const probe1Params = ref<Home.DisplayrelyMgrParams>(homeStore.h2O2SensorData[1] || initEnv1)
  32. const probe2Params = ref<Home.DisplayrelyMgrParams>(homeStore.h2O2SensorData[2] || initEnv2)
  33. const liquidInfo = ref<Liquid.LiquidData>(liquidStore.liquidStateData)
  34. const liquidTotal = ref<number>(liquidStore.liquidTotal)
  35. const formulaInfo = ref()
  36. const loading = ref(false)
  37. watchEffect(() => {
  38. formulaInfo.value = formulaStore.currentSelectedFormulaInfo
  39. liquidTotal.value = liquidStore.liquidTotal
  40. liquidInfo.value = liquidStore.liquidStateData
  41. loading.value = systemStore.loading
  42. if (homeStore.h2O2SensorData && homeStore.h2O2SensorData.length) {
  43. console.log('homeStore.h2O2SensorData', homeStore.h2O2SensorData)
  44. environmentParams.value = {
  45. ...homeStore.h2O2SensorData[0],
  46. title: '仓内',
  47. type: 'inside',
  48. }
  49. if (homeStore.h2O2SensorData.length === 2) {
  50. probe1Params.value = {
  51. ...homeStore.h2O2SensorData[1],
  52. title: '探头1',
  53. type: 'env1',
  54. }
  55. }
  56. if (homeStore.h2O2SensorData.length === 3) {
  57. probe1Params.value = {
  58. ...homeStore.h2O2SensorData[1],
  59. title: '探头1',
  60. type: 'env1',
  61. }
  62. probe2Params.value = {
  63. ...homeStore.h2O2SensorData[2],
  64. title: '探头2',
  65. type: 'env2',
  66. }
  67. }
  68. }
  69. })
  70. // 当前消毒液余量百分比
  71. const nowLiquidProgress = computed(() => {
  72. if (!liquidInfo.value.nowLiquid) {
  73. return 0
  74. }
  75. return roundNumber(Number((liquidInfo.value.nowLiquid / liquidTotal.value) * 100), 0)
  76. })
  77. // 当前消毒液余量
  78. const nowLiquid = computed(() => {
  79. return roundNumber(liquidInfo.value.nowLiquid, 0)
  80. })
  81. </script>
  82. <template>
  83. <div v-loading="loading" class="home">
  84. <div v-if="route.path === '/home'" class="home-grid-container">
  85. <div class="home-left">
  86. <el-card v-if="!deviceStore.isLowCost" class="card">
  87. <template #default>
  88. <!-- <div class="title-line" /> -->
  89. <div class="card-title-name">
  90. <img :src="homeLiquid"> 消毒液
  91. </div>
  92. <div class="card-progress">
  93. <div class="card-progress-content">
  94. <el-progress :text-inside="true" :stroke-width="35" :percentage="nowLiquidProgress" />
  95. </div>
  96. </div>
  97. <div class="card-num-g">
  98. {{ nowLiquid }}g
  99. </div>
  100. </template>
  101. </el-card>
  102. <el-card class="card" :class="{ 'card-center': deviceStore.isLowCost }">
  103. <Environment :env-params="environmentParams" />
  104. </el-card>
  105. <el-card class="card">
  106. <Environment :env-params="probe1Params" />
  107. </el-card>
  108. <el-card class="card">
  109. <Environment :env-params="probe2Params" />
  110. </el-card>
  111. </div>
  112. <div class="home-grid-item home-right">
  113. <!-- 正在进行的配方 -->
  114. <HomeFormula />
  115. <!-- 选择消毒的等级 -->
  116. <HomeLogLevel />
  117. <!-- 开始消毒停止消毒及状态区 -->
  118. <HomeOperation />
  119. <!-- 消毒设置 -->
  120. <HomeSetting />
  121. </div>
  122. </div>
  123. <div v-else>
  124. <router-view />
  125. </div>
  126. </div>
  127. </template>
  128. <style lang="scss" scoped>
  129. $input-height: 3rem;
  130. .home {
  131. width: 100%;
  132. height: 100%;
  133. }
  134. .home-grid-container {
  135. height: 100%;
  136. width: 100%;
  137. display: grid;
  138. grid-template-columns: 2fr 1fr;
  139. gap: 10px;
  140. }
  141. .home-left {
  142. height: 100%;
  143. display: grid;
  144. grid-template-columns: repeat(2, 1fr);
  145. grid-template-rows: repeat(2, 1fr);
  146. gap: 10px;
  147. .card {
  148. text-align: center;
  149. width: 100%;
  150. border: 1px solid rgb(225, 225, 225);
  151. position: relative;
  152. border-radius: 10px 10px 10px 10px;
  153. background: #ffffff;
  154. background: linear-gradient(180deg, rgba(147, 203, 255, 1) -190%, #ffffff 24%);
  155. .title-line {
  156. height: 1vw;
  157. background-color: #b3d9ff;
  158. position: absolute;
  159. width: 100%;
  160. border-radius: 10px 10px 0 0;
  161. margin: -2.12rem;
  162. }
  163. .card-title-name {
  164. display: flex;
  165. align-items: center;
  166. gap: 10px;
  167. font-size: 26px;
  168. padding: 1rem;
  169. }
  170. .card-progress {
  171. display: flex;
  172. justify-content: center;
  173. margin-top: 3rem;
  174. .card-progress-content {
  175. width: 92%;
  176. }
  177. }
  178. .card-num-g {
  179. margin-top: 3.5vw;
  180. font-size: 26px;
  181. font-weight: bold;
  182. }
  183. }
  184. }
  185. .home-right {
  186. background: linear-gradient(180deg, rgba(147, 203, 255, 1) -190%, #ffffff 24%);
  187. position: relative;
  188. border-radius: 10px;
  189. box-shadow: 0 1px 5px 0 rgba(9, 39, 62, 0.15);
  190. }
  191. .el-button {
  192. background-color: #2892f3 !important;
  193. }
  194. .card-center {
  195. grid-column: 1 / -1; // 占据整行
  196. justify-self: center; // 横向居中
  197. }
  198. </style>