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,