From f7bfa8b62d131e166f080c1d622486ef0856fa4f Mon Sep 17 00:00:00 2001 From: LiLongLong <13717757313@163.com> Date: Tue, 27 May 2025 20:26:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=9B=BE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/styles/variable.scss | 1 + src/components/common/BTButton/index.vue | 8 +- .../common/CascadingSelectModal/index.vue | 290 +++++++++++++++++++++ src/components/formula/FormulaConfig.vue | 4 +- src/components/home/HomeFormula.vue | 1 - src/components/home/HomeOperation.vue | 1 + src/components/home/HomeSetting.vue | 154 ++++++++--- src/components/home/LineChart.vue | 123 +++++++++ src/components/home/chart.vue | 72 ----- src/layouts/default.vue | 4 +- src/libs/constant.ts | 11 + src/router/routes.ts | 2 +- src/stores/formulaStore.ts | 1 - src/stores/homeStore.ts | 26 +- src/types/home.d.ts | 12 + src/views/formula/index.vue | 1 + src/views/home/chart.vue | 190 ++++++++++++++ src/views/home/index.vue | 8 +- 18 files changed, 784 insertions(+), 125 deletions(-) create mode 100644 src/components/common/CascadingSelectModal/index.vue create mode 100644 src/components/home/LineChart.vue delete mode 100644 src/components/home/chart.vue create mode 100644 src/views/home/chart.vue diff --git a/src/assets/styles/variable.scss b/src/assets/styles/variable.scss index 666e30e..6e62db4 100644 --- a/src/assets/styles/variable.scss +++ b/src/assets/styles/variable.scss @@ -4,3 +4,4 @@ $danger-color: #DF1515; $warn-color: #EE8223; $info-color: #909399; $gradient-color: linear-gradient(185deg, rgb(175 216 255) -90%, #fff 24%); +$main-container: calc(100vh - 16vh) \ No newline at end of file diff --git a/src/components/common/BTButton/index.vue b/src/components/common/BTButton/index.vue index 738f0fb..c9fe4db 100644 --- a/src/components/common/BTButton/index.vue +++ b/src/components/common/BTButton/index.vue @@ -62,6 +62,11 @@ const props = defineProps({ type: String, default: '16px', }, + // padding + padding: { + type: String, + default: '.714vw 1.339vw', + }, }) const emits = defineEmits(['click']) @@ -89,6 +94,7 @@ const handleClick = (event: MouseEvent) => { borderRadius, fontSize: textSize, fontWeight: 400, + padding, }" @click="handleClick" > @@ -99,6 +105,6 @@ const handleClick = (event: MouseEvent) => { diff --git a/src/components/common/CascadingSelectModal/index.vue b/src/components/common/CascadingSelectModal/index.vue new file mode 100644 index 0000000..db1d9e7 --- /dev/null +++ b/src/components/common/CascadingSelectModal/index.vue @@ -0,0 +1,290 @@ + + + + + diff --git a/src/components/formula/FormulaConfig.vue b/src/components/formula/FormulaConfig.vue index 2e9d846..efd3f4e 100644 --- a/src/components/formula/FormulaConfig.vue +++ b/src/components/formula/FormulaConfig.vue @@ -213,8 +213,8 @@ const openKeyboardType = (labelName: string) => { bottom: 5rem; display: flex; justify-content: center; - margin-left: 24vw; - position: absolute; + position:absolute; + margin-left: 20rem; } .default-btn{ margin-top: 1rem; diff --git a/src/components/home/HomeFormula.vue b/src/components/home/HomeFormula.vue index 4dbfaee..0d5b4ed 100644 --- a/src/components/home/HomeFormula.vue +++ b/src/components/home/HomeFormula.vue @@ -31,7 +31,6 @@ watchEffect(() => { .home-right-title{ display: grid; grid-template-columns: 1fr 1fr; - height: 2rem; .title-formula{ display: flex; justify-self: start; diff --git a/src/components/home/HomeOperation.vue b/src/components/home/HomeOperation.vue index f49a271..c8e9e7a 100644 --- a/src/components/home/HomeOperation.vue +++ b/src/components/home/HomeOperation.vue @@ -25,6 +25,7 @@ const onStartDisinfect = () => { } if (disinfectionState.value.state === 'disinfection') { countdownTimer.value = new CountdownTimer(10 * 60 * 1000, (times: string) => { + homeStore.updateHomeRemainTime(times) curStateRemainTimeS.value = times }) countdownTimer.value.init() diff --git a/src/components/home/HomeSetting.vue b/src/components/home/HomeSetting.vue index 538ac95..5d1d174 100644 --- a/src/components/home/HomeSetting.vue +++ b/src/components/home/HomeSetting.vue @@ -1,10 +1,12 @@ + + + + diff --git a/src/components/home/chart.vue b/src/components/home/chart.vue deleted file mode 100644 index 2b6b7b2..0000000 --- a/src/components/home/chart.vue +++ /dev/null @@ -1,72 +0,0 @@ - - - - - diff --git a/src/layouts/default.vue b/src/layouts/default.vue index 6595c03..90ab711 100644 --- a/src/layouts/default.vue +++ b/src/layouts/default.vue @@ -241,9 +241,7 @@ const onLogout = () => { } .content { width: 100%; - height: 100%; - border-radius: 10px; - box-shadow: 0 0 1px rgba(0, 0, 0, 0.1); + height: $main-container; padding: 10px; } .footer-expand { diff --git a/src/libs/constant.ts b/src/libs/constant.ts index e0bf577..b5b41d1 100644 --- a/src/libs/constant.ts +++ b/src/libs/constant.ts @@ -18,6 +18,17 @@ export const formulaNameMap: Record = { loglevel: '消毒等级', } +// 空气压力初始化数据 +export const PARSSURE_DATA = { + intensitys: { + constantPressure: null, + negativePressure: ['0%', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'], + positivePressure: ['0%', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'], + }, + typeDisplayNames: ['恒压', '正压', '负压'], + types: ['constantPressure', 'positivePressure', 'negativePressure'], +} + // 配方是否可配置初始数据 export const FORMULA_CONFIG_DATA: Formula.FormulaConfig[] = [ { diff --git a/src/router/routes.ts b/src/router/routes.ts index c4f8fae..ed260f7 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -32,7 +32,7 @@ const authRoutes: RouteRecordRaw[] = [ }, { path: 'chart', name: 'chart', - component: () => import('components/home/chart.vue'), + component: () => import('views/home/chart.vue'), }], }, { diff --git a/src/stores/formulaStore.ts b/src/stores/formulaStore.ts index 0471af4..8bd7c4e 100644 --- a/src/stores/formulaStore.ts +++ b/src/stores/formulaStore.ts @@ -62,7 +62,6 @@ export const useFormulaStore = defineStore('formula', () => { updateLogLevels(item) } }) - console.log('names--', JSON.stringify(names), names) } const updateLogLevels = (logLevelItem: Formula.FormulaConfig) => { diff --git a/src/stores/homeStore.ts b/src/stores/homeStore.ts index 15c2a10..145f994 100644 --- a/src/stores/homeStore.ts +++ b/src/stores/homeStore.ts @@ -1,3 +1,5 @@ +import { sendCmd } from 'apis/system' +import { PARSSURE_DATA } from 'libs/constant' import { defineStore } from 'pinia' import { ref } from 'vue' @@ -44,6 +46,7 @@ export const useHomeStore = defineStore('home', () => { const h2O2SensorData = ref(h2O2Data) const liquidData = ref(liquidItem) const liquidTotal = ref(2500) + const curStateRemainTime = ref() const logLevelList = [{ label: '1级', value: 1, @@ -68,6 +71,20 @@ export const useHomeStore = defineStore('home', () => { } } + // 压力值 + const pressureConfig = ref(PARSSURE_DATA) + const getPressureConfig = async () => { + const pressureParams = { + className: 'PipelinePressureControl', + fnName: 'getConfig', + params: {}, + } + const res = await sendCmd(pressureParams) + if (res.rely) { + pressureConfig.value = res.rely + } + } + const updateHomeLiquid = (liquidInfo: Home.LiquidData) => { liquidData.value = liquidInfo } @@ -121,6 +138,10 @@ export const useHomeStore = defineStore('home', () => { const updateHomeDisinfectionState = (disinfectState: Home.DisinfectState) => { disinfectionState.value = disinfectState } + + const updateHomeRemainTime = (timer: string) => { + curStateRemainTime.value = timer + } return { // 变量 h2O2SensorData, @@ -129,7 +150,8 @@ export const useHomeStore = defineStore('home', () => { logLevelList, deviceStete, disinfectionState, - + pressureConfig, + curStateRemainTime, // 方法 updateHomeData, updateHomeLiquid, @@ -137,5 +159,7 @@ export const useHomeStore = defineStore('home', () => { stopDisinfect, setDeviceState, updateHomeDisinfectionState, + getPressureConfig, + updateHomeRemainTime, } }) diff --git a/src/types/home.d.ts b/src/types/home.d.ts index d41c5d5..c9cb098 100644 --- a/src/types/home.d.ts +++ b/src/types/home.d.ts @@ -45,4 +45,16 @@ declare namespace Home { interface Map { [key: string]: any } + + interface Intensitys { + constantPressure: null + negativePressure: string[] + positivePressure: string[] + } + + interface ParssureData { + intensitys: Intensitys + typeDisplayNames: string[] + types: string[] + } } diff --git a/src/views/formula/index.vue b/src/views/formula/index.vue index bed0a0d..ea2d19c 100644 --- a/src/views/formula/index.vue +++ b/src/views/formula/index.vue @@ -65,6 +65,7 @@ const onAddFormula = () => { grid-column: 2 / 4; box-shadow: 0px 1px 5px 0px rgba(9, 39, 62, 0.15); background: $gradient-color; + position: relative; } } diff --git a/src/views/home/chart.vue b/src/views/home/chart.vue new file mode 100644 index 0000000..80ea4fc --- /dev/null +++ b/src/views/home/chart.vue @@ -0,0 +1,190 @@ + + + + + diff --git a/src/views/home/index.vue b/src/views/home/index.vue index b8840fa..6aae19b 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -97,12 +97,11 @@ const nowLiquidProgress = computed(() => { .home-grid-container { display: grid; grid-template-columns: repeat(3, 1fr); - gap: 1rem; + gap: 1.5rem; } .home-merged-cell { - grid-column: 1 / span 2; + grid-column: 1 / 2; background-color: #ff6b6b; - width: 66vw; } .home-left { display: grid; @@ -112,7 +111,7 @@ const nowLiquidProgress = computed(() => { .card { text-align: center; height: 40.1vh; - width: 30vw; + width: 30.5vw; border: 1px solid rgb(225, 225, 225); position: relative; border-radius: 10px 10px 10px 10px; @@ -153,6 +152,7 @@ const nowLiquidProgress = computed(() => { width: 31vw; height: 83vh; background: $gradient-color; + position: relative; } .el-button { background-color: #2892F3 !important;