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

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