From ab146709c8660193f0b695769d8fff02d5a901e5 Mon Sep 17 00:00:00 2001 From: zhangjiming Date: Wed, 19 Feb 2025 20:00:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E6=B6=B2=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 13 ++++++++- src/router/index.ts | 2 +- src/services/sysConfig/sysConfig.ts | 12 ++++++++ src/stores/setting.ts | 41 ++++++++++++++++++++++++--- src/views/addLiquid/addLiquid.vue | 32 +++++++++++++++++++++ src/views/oreManage/components/StepItemEx.vue | 28 ++++++++++++------ 6 files changed, 113 insertions(+), 15 deletions(-) create mode 100644 src/views/addLiquid/addLiquid.vue diff --git a/src/App.vue b/src/App.vue index d3594a2..d7c5166 100644 --- a/src/App.vue +++ b/src/App.vue @@ -3,8 +3,9 @@ import { useRouter } from "vue-router"; import { exceptionOb } from "./services/httpRequest"; import { createWebSocket, sharedWsUrl } from "./services/socket"; import { onMounted } from "vue"; -import { getConfig } from "./services/sysConfig/sysConfig"; +import { getConfig, getContainerList } from "./services/sysConfig/sysConfig"; import { useSettingStore } from "./stores/setting"; +import { getLiquidList } from "./services/liquid/liquidManage"; const router = useRouter(); const settingStore = useSettingStore(); @@ -20,6 +21,16 @@ onMounted(() => { settingStore.setConfigs(res.data); } }); + getLiquidList({ pageNum: 1, pageSize: 9999 }).then(res => { + if (res.success) { + settingStore.setLiquidList(res.data.list) + } + }); + getContainerList().then(res => { + if (res.success) { + settingStore.setContainerConf(res.data); + } + }); }); diff --git a/src/router/index.ts b/src/router/index.ts index 491672d..5ce44ce 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -47,7 +47,7 @@ const router = createRouter({ { path: "/addLiquid", name: "addLiquid", - component: () => import("../views/addLiquid/index.vue"), + component: () => import("../views/addLiquid/addLiquid.vue"), }, { path: "/liquidConfig", diff --git a/src/services/sysConfig/sysConfig.ts b/src/services/sysConfig/sysConfig.ts index 97979c5..8a5dc81 100644 --- a/src/services/sysConfig/sysConfig.ts +++ b/src/services/sysConfig/sysConfig.ts @@ -25,3 +25,15 @@ export function getConfig() { export function updateConfig(params: { id: number; value: string }[]) { return httpRequest({ url: "/api/sys/updateConfig", method: "PUT", params }); } + +export type Container = { + id: number; + type: 0 | 1; // 0:酸液 1:废液 + solutionId: number; +}; +export function getContainerList() { + return httpRequest>({ url: "/api/container/list" }); +} +export function updateContainer(id: number, solutionId: number) { + return httpRequest({ url: `/api/container/${id}`, method: "PUT", params: { solutionId } }); +} diff --git a/src/stores/setting.ts b/src/stores/setting.ts index 5924219..304f4b0 100644 --- a/src/stores/setting.ts +++ b/src/stores/setting.ts @@ -1,6 +1,8 @@ -import type { ConfigItem } from "@/services/sysConfig/sysConfig"; +import type { Liquid } from "@/services/liquid/liquidManage"; +import type { ConfigItem, Container } from "@/services/sysConfig/sysConfig"; import { defineStore } from "pinia"; import { computed, ref } from "vue"; +import * as R from 'ramda'; export const useSettingStore = defineStore("setting", () => { const configs = ref(); @@ -8,6 +10,24 @@ export const useSettingStore = defineStore("setting", () => { configs.value = usr; }; + const containerConf = ref(); + const setContainerConf = (containers: Container[]) => { + containerConf.value = containers; + }; + + const liquidList = ref(); + const setLiquidList = (liquids: Liquid[]) => { + liquidList.value = liquids; + }; + + const heatContainers = computed(() => { + if (!containerConf.value) return []; + return containerConf.value.filter(c => c.type === 0); + }); + const availableLiquids = computed(() => { + const solIds = heatContainers.value.filter(h => h.solutionId).map(h => h.solutionId) + return R.innerJoin((record, id) => record.id === id, liquidList.value || [], solIds) + }) const heatAreaConfig = computed(() => { if (!configs.value) return []; return (configs.value.find(c => c.code === "heat_area")?.children || []).map(c => { @@ -17,14 +37,14 @@ export const useSettingStore = defineStore("setting", () => { }); 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 [x, y, z] = c!.value.split(","); return { ...c, valueObj: { x: +x, y: +y, z: +z } }; }); const capAreaConfig = 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 === "lid_area")?.children[0]; const [x, y, z] = c!.value.split(","); return { ...c, valueObj: { x: +x, y: +y, z: +z } }; @@ -39,5 +59,18 @@ export const useSettingStore = defineStore("setting", () => { return heatAreaConfig.value.map(c => ({ label: c.name, value: c.id })); }); - return { heatAreaConfig,areaOptions, actionAreaConfig, capAreaConfig, systemSetting, setConfigs }; + return { + heatAreaConfig, + areaOptions, + actionAreaConfig, + capAreaConfig, + systemSetting, + containerConf, + liquidList, + heatContainers, + availableLiquids, + setLiquidList, + setContainerConf, + setConfigs, + }; }); diff --git a/src/views/addLiquid/addLiquid.vue b/src/views/addLiquid/addLiquid.vue new file mode 100644 index 0000000..d530b3c --- /dev/null +++ b/src/views/addLiquid/addLiquid.vue @@ -0,0 +1,32 @@ + + diff --git a/src/views/oreManage/components/StepItemEx.vue b/src/views/oreManage/components/StepItemEx.vue index b65c6d1..46d71de 100644 --- a/src/views/oreManage/components/StepItemEx.vue +++ b/src/views/oreManage/components/StepItemEx.vue @@ -7,12 +7,18 @@