From 1d13e9fa5d193e4d355e9b8597795968520eb05c Mon Sep 17 00:00:00 2001 From: zhangjiming Date: Fri, 21 Feb 2025 16:50:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=8A=A0=E7=83=AD=E5=99=A8ID?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=8A=A0=E7=83=AD=E5=8C=BA=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/sysConfig/sysConfig.ts | 19 +++++++++++-------- src/stores/setting.ts | 14 +++++++++++++- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/services/sysConfig/sysConfig.ts b/src/services/sysConfig/sysConfig.ts index 47d9787..671f88a 100644 --- a/src/services/sysConfig/sysConfig.ts +++ b/src/services/sysConfig/sysConfig.ts @@ -3,19 +3,21 @@ import httpRequest from "../httpRequest"; export type ConfigCategory = "heat_area" | "solution_area" | "lid_area" | "sys_setting"; +export type ConfigSubItem = { + id: number; + name: string; + code: string; + value: string; + hardwareId: string; // 加热器ID + valueObj?: { x: number; y: number; z: number }; +} + export type ConfigItem = { id: number; name: string; code: ConfigCategory; value: string; - - children: { - id: number; - name: string; - code: string; - value: string; - valueObj?: { x: number; y: number; z: number }; - }[]; + children: ConfigSubItem[]; }; export function getConfig() { @@ -30,6 +32,7 @@ export type Container = { id: number; type: 0 | 1; // 0:酸液 1:废液 solutionId: number; + pumpId: number; }; export function getContainerList() { diff --git a/src/stores/setting.ts b/src/stores/setting.ts index 4420a68..4c2aa52 100644 --- a/src/stores/setting.ts +++ b/src/stores/setting.ts @@ -1,5 +1,5 @@ import type { Liquid } from "@/services/liquid/liquidManage"; -import type { ConfigItem, Container } from "@/services/sysConfig/sysConfig"; +import type { ConfigItem, ConfigSubItem, Container } from "@/services/sysConfig/sysConfig"; import { defineStore } from "pinia"; import { computed, ref } from "vue"; import * as R from "ramda"; @@ -55,6 +55,17 @@ export const useSettingStore = defineStore("setting", () => { }); }); + const heatAreaHardwareIdMap = computed(() => { + const heatAreas = (configs.value || []).find(c => c.code === "heat_area")?.children || []; + return R.reduce( + (acc, curr) => { + acc[curr.hardwareId] = curr; + return acc; + }, + {}, + heatAreas + ); + }); const actionAreaConfig = computed(() => { if (!configs.value) return { valueObj: { x: 0, y: 0, z: 0 } }; const c = configs.value.find(c => c.code === "solution_area")?.children[0]; @@ -90,6 +101,7 @@ export const useSettingStore = defineStore("setting", () => { heatContainerWithLiquid, heatContainers, availableLiquids, + heatAreaHardwareIdMap, setLiquidList, setContainerConf, setConfigs,