Browse Source

根据加热器ID获取加热区对象

master
zhangjiming 5 months ago
parent
commit
1d13e9fa5d
  1. 19
      src/services/sysConfig/sysConfig.ts
  2. 14
      src/stores/setting.ts

19
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 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 = { export type ConfigItem = {
id: number; id: number;
name: string; name: string;
code: ConfigCategory; code: ConfigCategory;
value: string; value: string;
children: {
id: number;
name: string;
code: string;
value: string;
valueObj?: { x: number; y: number; z: number };
}[];
children: ConfigSubItem[];
}; };
export function getConfig() { export function getConfig() {
@ -30,6 +32,7 @@ export type Container = {
id: number; id: number;
type: 0 | 1; // 0:酸液 1:废液 type: 0 | 1; // 0:酸液 1:废液
solutionId: number; solutionId: number;
pumpId: number;
}; };
export function getContainerList() { export function getContainerList() {

14
src/stores/setting.ts

@ -1,5 +1,5 @@
import type { Liquid } from "@/services/liquid/liquidManage"; 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 { defineStore } from "pinia";
import { computed, ref } from "vue"; import { computed, ref } from "vue";
import * as R from "ramda"; 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<ConfigSubItem, { [p: string]: ConfigSubItem }>(
(acc, curr) => {
acc[curr.hardwareId] = curr;
return acc;
},
{},
heatAreas
);
});
const actionAreaConfig = computed(() => { const actionAreaConfig = computed(() => {
if (!configs.value) return { valueObj: { x: 0, y: 0, z: 0 } }; if (!configs.value) return { valueObj: { x: 0, y: 0, z: 0 } };
const c = configs.value.find(c => c.code === "solution_area")?.children[0]; const c = configs.value.find(c => c.code === "solution_area")?.children[0];
@ -90,6 +101,7 @@ export const useSettingStore = defineStore("setting", () => {
heatContainerWithLiquid, heatContainerWithLiquid,
heatContainers, heatContainers,
availableLiquids, availableLiquids,
heatAreaHardwareIdMap,
setLiquidList, setLiquidList,
setContainerConf, setContainerConf,
setConfigs, setConfigs,

Loading…
Cancel
Save