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

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