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

352 lines
10 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
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
  1. <script lang="ts" setup>
  2. import homeProbe1 from 'assets/images/home/home-probe1.svg'
  3. import Environment from 'components/home/Environment.vue'
  4. import HomeFormula from 'components/home/HomeFormula.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 { FtMessageBox } from 'libs/messageBox'
  9. import { useDeviceStore } from 'stores/deviceStore'
  10. import { useGasStore } from 'stores/gasStore'
  11. import { useHomeStore } from 'stores/homeStore'
  12. import { useLiquidStore } from 'stores/liquidStore'
  13. import { computed, onMounted, ref, watchEffect } from 'vue'
  14. import { useRoute } from 'vue-router'
  15. import { roundNumber } from '@/libs/utils'
  16. import { useFormulaStore } from '@/stores/formulaStore'
  17. import { useSystemStore } from '@/stores/systemStore'
  18. const gasStore = useGasStore()
  19. const selectChannel = (channel: string, name: any) => {
  20. FtMessageBox.warning(`请确认打开${name}?`).then(() => {
  21. gasStore.selectChannel(channel)
  22. })
  23. }
  24. const route = useRoute()
  25. const homeStore = useHomeStore()
  26. const deviceStore = useDeviceStore()
  27. const liquidStore = useLiquidStore()
  28. const formulaStore = useFormulaStore()
  29. const systemStore = useSystemStore()
  30. const environmentParams = ref<Home.DisplayrelyMgrParams>(homeStore.h2O2SensorData[0])
  31. const liquidInfo = ref<Liquid.LiquidData>(liquidStore.liquidStateData)
  32. const liquidTotal = ref<number>(liquidStore.liquidTotal)
  33. const formulaInfo = ref()
  34. const loading = ref(false)
  35. onMounted(() => {
  36. watchEffect(() => {
  37. formulaInfo.value = formulaStore.currentSelectedFormulaInfo
  38. liquidTotal.value = liquidStore.liquidTotal
  39. liquidInfo.value = liquidStore.liquidStateData
  40. loading.value = systemStore.loading
  41. if (homeStore.h2O2SensorData && homeStore.h2O2SensorData.length) {
  42. styles.value = computedStyle()
  43. // console.log('homeStore.h2O2SensorData', homeStore.h2O2SensorData)
  44. environmentParams.value = {
  45. ...homeStore.h2O2SensorData[0],
  46. title: '仓内',
  47. type: 'inside',
  48. }
  49. }
  50. })
  51. })
  52. // 当前消毒液余量百分比(最大不超过100)
  53. const nowLiquidProgress = computed(() => {
  54. const now = Number(liquidInfo.value.nowLiquid)
  55. const total = Number(liquidTotal.value)
  56. if (!now || total <= 0) {
  57. return 0
  58. }
  59. // 先算出百分比并四舍五入
  60. const rawPercent = roundNumber((now / total) * 100, 0)
  61. // 如果大于100,就返回100;否则返回原值
  62. return rawPercent > 100 ? 100 : rawPercent
  63. })
  64. // 当前消毒液余量
  65. const nowLiquid = computed(() => {
  66. return roundNumber(liquidInfo.value.nowLiquid, 0)
  67. })
  68. const styles = ref<any>({
  69. gridTemplateColumns: 'repeat(2, 1fr)',
  70. gridTemplateRows: 'repeat(2, 1fr)',
  71. })
  72. const computedStyle = () => {
  73. if (
  74. deviceType.value === deviceStore.deviceTypeMap.PipeDM
  75. || deviceType.value === deviceStore.deviceTypeMap.DrawBarDM
  76. ) {
  77. return {
  78. gridTemplateColumns: 'repeat(3, 1fr)',
  79. gridTemplateRows: 'repeat(2, 1fr)',
  80. }
  81. }
  82. return {
  83. gridTemplateColumns: 'repeat(3, 1fr)',
  84. gridTemplateRows: 'repeat(2, 1fr)',
  85. }
  86. }
  87. const deviceType = computed(() => {
  88. return __DEVICE_TYPE__
  89. })
  90. </script>
  91. <template>
  92. <div class="home">
  93. <div v-if="route.path === '/home'" class="home-grid-container">
  94. <div class="home-left">
  95. <div class="left-box">
  96. <el-card
  97. v-for="item in homeStore.h2O2SensorData.filter(item => item.type !== 'WirelessExtSensor')"
  98. :key="item.sensorId"
  99. class="card"
  100. :class="{
  101. 'card-one': [deviceStore.deviceTypeMap.PipeDM].includes(deviceType),
  102. 'card-two': [deviceStore.deviceTypeMap.DrawBarDM].includes(deviceType),
  103. }"
  104. >
  105. <Environment :env-params="item" />
  106. </el-card>
  107. <el-card
  108. v-if="deviceStore.deviceTypeMap.DrawBarDM === deviceType"
  109. class="card card-three"
  110. >
  111. <div class="box">
  112. <div class="title">
  113. <div style="width: 100%; display: flex; align-items: center">
  114. <img :src="homeProbe1" alt="" style="margin-right: 10px">气路控制
  115. </div>
  116. <el-tag v-if="!gasStore.isOnline" type="danger">
  117. 离线
  118. </el-tag>
  119. </div>
  120. <div class="btn-box">
  121. <h4>当前通道{{ gasStore.currentChannel === gasStore.channelSwitcherMap[0] ? '降解通道' : gasStore.currentChannel === gasStore.channelSwitcherMap[1] ? '消毒通道' : '除湿通道' }}</h4>
  122. <el-button :type="gasStore.currentChannel === gasStore.channelSwitcherMap[0] ? 'info' : 'primary'" :disabled="(!gasStore.isOnline) || gasStore.currentChannel === gasStore.channelSwitcherMap[0]" @click="() => selectChannel(gasStore.channelSwitcherMap[0], '降解通道')">
  123. 降解通道
  124. </el-button>
  125. <el-button :type="gasStore.currentChannel === gasStore.channelSwitcherMap[1] ? 'info' : 'primary'" :disabled="(!gasStore.isOnline) || gasStore.currentChannel === gasStore.channelSwitcherMap[1]" @click="() => selectChannel(gasStore.channelSwitcherMap[1], '消毒通道')">
  126. 消毒通道
  127. </el-button>
  128. <el-button :type="gasStore.currentChannel === gasStore.channelSwitcherMap[2] ? 'info' : 'primary'" :disabled="(!gasStore.isOnline) || gasStore.currentChannel === gasStore.channelSwitcherMap[2]" @click="() => selectChannel(gasStore.channelSwitcherMap[2], '除湿通道')">
  129. 除湿通道
  130. </el-button>
  131. </div>
  132. </div>
  133. </el-card>
  134. </div>
  135. <div class="left-box">
  136. <el-card
  137. v-for="item in homeStore.h2O2SensorData.filter(item => item.type === 'WirelessExtSensor')"
  138. :key="item.sensorId"
  139. class="card"
  140. >
  141. <Environment :env-params="item" />
  142. </el-card>
  143. </div>
  144. </div>
  145. <div class="home-grid-item home-right">
  146. <!-- 正在进行的配方 -->
  147. <div class="top">
  148. <HomeFormula />
  149. <div
  150. v-if="![deviceStore.deviceTypeMap.LargeSpaceDM_B, deviceStore.deviceTypeMap.DrawBarDM].includes(deviceType)"
  151. style="margin-top: 60px"
  152. >
  153. <div class="card-progress">
  154. <!-- <div class="card-title-name"> -->
  155. <!-- <img :src="homeLiquid"> -->
  156. <!-- </div> -->
  157. <div class="card-progress-content">
  158. <el-progress size="small" :text-inside="true" :stroke-width="40" :percentage="nowLiquidProgress" />
  159. </div>
  160. </div>
  161. <div class="card-num-g">
  162. 消毒液剩余:{{ nowLiquid || 0 }}g
  163. </div>
  164. </div>
  165. </div>
  166. <div class="middle">
  167. <!-- 选择消毒的等级 -->
  168. <!-- <HomeLogLevel v-if="!formulaStore.selectedFormulaInfo?.name" /> -->
  169. <!-- 开始消毒停止消毒及状态区 -->
  170. <HomeOperation />
  171. </div>
  172. <!-- 消毒设置 -->
  173. <div
  174. class="bottom"
  175. :style="{
  176. justifyContent: deviceType === deviceStore.deviceTypeMap.PipeDM ? 'space-between' : 'space-evenly',
  177. }"
  178. >
  179. <PressureControl />
  180. <HomeSetting />
  181. </div>
  182. </div>
  183. </div>
  184. <router-view v-else />
  185. </div>
  186. </template>
  187. <style lang="scss" scoped>
  188. .bottom {
  189. display: flex;
  190. }
  191. $input-height: 3rem;
  192. .home {
  193. width: 100%;
  194. height: 100%;
  195. }
  196. .home-grid-container {
  197. height: 100%;
  198. width: 100%;
  199. display: grid;
  200. grid-template-columns: 2fr 1fr;
  201. gap: 10px;
  202. }
  203. .home-left {
  204. height: 100%;
  205. width: 100%;
  206. display: grid;
  207. grid-template-rows: repeat(2, 1fr);
  208. grid-template-columns: repeat(1, 1fr);
  209. gap: 20px;
  210. .left-box {
  211. display: flex; // 使用 Flexbox 布局
  212. flex-direction: row; // 子元素水平排列(默认值)
  213. align-items: flex-start; // 子元素顶部对齐
  214. overflow-x: auto; // 横向滚动支持
  215. width: 100%; // 父容器宽度占满
  216. gap: 10px; // 子元素之间的间距(可选)
  217. .card-one {
  218. width: 100% !important;
  219. }
  220. .card-two {
  221. width: calc((100% / 3)*2 - 10px) !important;
  222. }
  223. .card-three {
  224. width: calc(100% / 3 - 10px) !important;
  225. }
  226. .card {
  227. flex: 0 0 auto;
  228. width: calc(100% / 3 - 10px);
  229. height: 100%;
  230. min-width: 200px;
  231. border: 1px solid rgb(225, 225, 225);
  232. border-radius: 10px;
  233. background: rgba(147, 203, 255, 0.1);
  234. box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
  235. .title-line {
  236. height: 1vw;
  237. background-color: #b3d9ff;
  238. position: absolute;
  239. width: 100%;
  240. border-radius: 10px 10px 0 0;
  241. margin: -2.12rem;
  242. }
  243. .card-title-name {
  244. display: flex;
  245. align-items: center;
  246. gap: 10px;
  247. font-size: 20px;
  248. padding: 1rem;
  249. }
  250. }
  251. }
  252. }
  253. .home-right {
  254. padding: 10px;
  255. background: linear-gradient(180deg, rgba(147, 203, 255, 1) -190%, #ffffff 24%);
  256. background: rgba(147, 203, 255, 0.1);
  257. border-radius: 10px;
  258. box-shadow: 0 1px 5px 0 rgba(9, 39, 62, 0.15);
  259. display: flex;
  260. flex-direction: column;
  261. justify-content: space-between;
  262. }
  263. .middle {
  264. display: flex;
  265. flex-direction: column;
  266. gap: 5px;
  267. padding: 5px 0;
  268. }
  269. .el-button {
  270. /* background-color: #2892f3 !important;*/
  271. }
  272. .card-center-1 {
  273. grid-column: 1 / -1; // 占据整行
  274. justify-self: center; // 横向居中
  275. }
  276. .card-center-2 {
  277. grid-column: 1 / 3; // 占据整行
  278. justify-self: center; // 横向居中
  279. }
  280. :deep(.el-card__body) {
  281. height: 100%;
  282. }
  283. .card-progress {
  284. margin-top: 10px;
  285. padding: 0 10px;
  286. display: flex;
  287. justify-content: center;
  288. align-items: center;
  289. .card-title-name {
  290. margin-right: 10px;
  291. }
  292. .card-progress-content {
  293. width: 100%;
  294. }
  295. }
  296. .card-num-g {
  297. text-align: center;
  298. font-size: 15px;
  299. color: #3f4349;
  300. font-weight: bold;
  301. margin-top: 10px;
  302. }
  303. .title {
  304. display: flex;
  305. align-items: center;
  306. justify-content: space-between;
  307. gap: 10px;
  308. font-size: 18px;
  309. padding: 10px;
  310. }
  311. .box {
  312. height: 100%;
  313. display: flex;
  314. flex-direction: column;
  315. justify-content: space-between;
  316. padding: 10px 0;
  317. }
  318. .btn-box {
  319. flex: 1;
  320. display: flex;
  321. flex-direction: column;
  322. justify-content: center;
  323. align-items: center;
  324. gap: 20px;
  325. .el-button {
  326. margin: 0;
  327. }
  328. }
  329. </style>