Browse Source

添加系统设置页面

master
zhangjiming 5 months ago
parent
commit
9f9ee4c8bb
  1. 1
      src/assets/menuIcon/n_setting.svg
  2. 1
      src/assets/menuIcon/s_setting.svg
  3. 10
      src/router/index.ts
  4. 13
      src/stores/setting.ts
  5. 10
      src/views/components/menu.ts
  6. 69
      src/views/sysSetting/SysSetting.vue

1
src/assets/menuIcon/n_setting.svg

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="80" height="80" viewBox="0 0 80 80"><g><g><ellipse cx="40" cy="40" rx="40" ry="40" fill="#EEEFF8" fill-opacity="1"/></g><g><g><path d="M57.7309,36.6424L54.4199,35.1065C52.2821,34.1115,51.0169,31.80957,51.2919,29.41513L51.7134,25.70348C49.9764,24.13487,47.9673,22.91636,45.7913,22.111649L42.809,24.29289C40.9002,25.70218,38.3223,25.67794,36.438900000000004,24.23298L33.5495,22C31.3612,22.766417,29.33189,23.9468,27.56639,25.48018L27.92691,29.18911C28.16995,31.58721,26.871940000000002,33.8705,24.71933,34.8315L21.35269,36.3074C20.9039103,38.6357,20.883231,41.0297,21.291719,43.3658L24.60269,44.9071C26.74368,45.8995,28.01241,48.202,27.73869,50.5985L27.30925,54.2911C29.0484,55.858,31.056800000000003,57.0779,33.2313,57.8884L36.1897,55.7098C38.098,54.2997,40.6759,54.3229,42.559799999999996,55.767L45.4705,58C47.6601,57.2361,49.6906,56.0565,51.456199999999995,54.5225L51.0984,50.8054C50.8651,48.409099999999995,52.158699999999996,46.1352,54.306,45.1685L57.6461,43.6953C58.0967,41.3643,58.1179,38.9679,57.7044,36.6287L57.7309,36.6424ZM39.5113,49.514700000000005C34.3981,49.514700000000005,30.25307,45.2566,30.25307,40.0041C30.25307,34.7515,34.3981,30.49349,39.5113,30.49349C44.6245,30.49349,48.7696,34.7515,48.7696,40.0041C48.7696,45.2566,44.6245,49.514700000000005,39.5113,49.514700000000005Z" fill="#4F85FB" fill-opacity="1" style="mix-blend-mode:passthrough"/></g><g><path d="M39.503226597900394,32.666666984558105C35.85293659790039,32.6648691245581,32.89285659790039,35.650166984558105,32.89285659790039,39.3333369845581C32.89285659790039,43.01646698455811,35.85293659790039,46.0017669845581,39.503226597900394,45.99996698455811C43.15095659790039,45.998166984558104,46.10715659790039,43.01396698455811,46.10715659790039,39.3333369845581C46.10715659790039,35.65270698455811,43.15095659790039,32.66846320455811,39.503226597900394,32.666666984558105ZM39.503226597900394,43.0462669845581C37.535416597900394,42.95376698455811,35.98716659790039,41.316986984558106,35.98716659790039,39.329296984558106C35.98716659790039,37.34159698455811,37.535416597900394,35.704856984558106,39.503226597900394,35.61227698455811C41.495636597900386,35.7097269845581,43.08915659790039,37.317586984558105,43.185756597900394,39.3279469845581C43.17395659790039,41.372516984558104,41.52956659790039,43.024566984558106,39.503226597900394,43.0274669845581L39.503226597900394,43.0462669845581Z" fill="#4F85FB" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></g></g></svg>

1
src/assets/menuIcon/s_setting.svg

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="80" height="80" viewBox="0 0 80 80"><g><g><ellipse cx="40" cy="40" rx="40" ry="40" fill="#479CF1" fill-opacity="1"/></g><g><g><path d="M57.7309,36.6424L54.4199,35.1065C52.2821,34.1115,51.0169,31.80957,51.2919,29.41513L51.7134,25.70348C49.9764,24.13487,47.9673,22.91636,45.7913,22.111649L42.809,24.29289C40.9002,25.70218,38.3223,25.67794,36.438900000000004,24.23298L33.5495,22C31.3612,22.766417,29.33189,23.9468,27.56639,25.48018L27.92691,29.18911C28.16995,31.58721,26.871940000000002,33.8705,24.71933,34.8315L21.35269,36.3074C20.9039103,38.6357,20.883231,41.0297,21.291719,43.3658L24.60269,44.9071C26.74368,45.8995,28.01241,48.202,27.73869,50.5985L27.30925,54.2911C29.0484,55.858,31.056800000000003,57.0779,33.2313,57.8884L36.1897,55.7098C38.098,54.2997,40.6759,54.3229,42.559799999999996,55.767L45.4705,58C47.6601,57.2361,49.6906,56.0565,51.456199999999995,54.5225L51.0984,50.8054C50.8651,48.409099999999995,52.158699999999996,46.1352,54.306,45.1685L57.6461,43.6953C58.0967,41.3643,58.1179,38.9679,57.7044,36.6287L57.7309,36.6424ZM39.5113,49.514700000000005C34.3981,49.514700000000005,30.25307,45.2566,30.25307,40.0041C30.25307,34.7515,34.3981,30.49349,39.5113,30.49349C44.6245,30.49349,48.7696,34.7515,48.7696,40.0041C48.7696,45.2566,44.6245,49.514700000000005,39.5113,49.514700000000005Z" fill="#FFFFFF" fill-opacity="1" style="mix-blend-mode:passthrough"/></g><g><path d="M39.503226597900394,32.666666984558105C35.85293659790039,32.6648691245581,32.89285659790039,35.650166984558105,32.89285659790039,39.3333369845581C32.89285659790039,43.01646698455811,35.85293659790039,46.0017669845581,39.503226597900394,45.99996698455811C43.15095659790039,45.998166984558104,46.10715659790039,43.01396698455811,46.10715659790039,39.3333369845581C46.10715659790039,35.65270698455811,43.15095659790039,32.66846320455811,39.503226597900394,32.666666984558105ZM39.503226597900394,43.0462669845581C37.535416597900394,42.95376698455811,35.98716659790039,41.316986984558106,35.98716659790039,39.329296984558106C35.98716659790039,37.34159698455811,37.535416597900394,35.704856984558106,39.503226597900394,35.61227698455811C41.495636597900386,35.7097269845581,43.08915659790039,37.317586984558105,43.185756597900394,39.3279469845581C43.17395659790039,41.372516984558104,41.52956659790039,43.024566984558106,39.503226597900394,43.0274669845581L39.503226597900394,43.0462669845581Z" fill="#FFFFFF" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></g></g></svg>

10
src/router/index.ts

@ -1,5 +1,6 @@
import { createRouter, createWebHistory } from "vue-router"; import { createRouter, createWebHistory } from "vue-router";
import UserManage from "@/views/userManage/UserManage.vue"; import UserManage from "@/views/userManage/UserManage.vue";
import SysSetting from "@/views/sysSetting/SysSetting.vue";
import Debug from "@/views/debug/debug.vue"; import Debug from "@/views/debug/debug.vue";
import { useUserStore } from "@/stores/user"; import { useUserStore } from "@/stores/user";
@ -7,8 +8,8 @@ const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL), history: createWebHistory(import.meta.env.BASE_URL),
routes: [ routes: [
{ {
path: '/',
redirect:'/login'
path: "/",
redirect: "/login",
}, },
{ {
path: "/login", path: "/login",
@ -65,6 +66,11 @@ const router = createRouter({
component: UserManage, component: UserManage,
}, },
{ {
path: "/sysSetting",
name: "sysSetting",
component: SysSetting,
},
{
path: "/debug", path: "/debug",
name: "debug", name: "debug",
component: Debug, component: Debug,

13
src/stores/setting.ts

@ -94,6 +94,16 @@ export const useSettingStore = defineStore("setting", () => {
return configs.value.find(c => c.code === "sys_setting")?.children || []; return configs.value.find(c => c.code === "sys_setting")?.children || [];
}); });
const liquidWarningSetting = computed(() => {
return systemSetting.value.find(s => s.code === "sys_setting_volume");
});
const abnormalAreaSetting = computed(() => {
return systemSetting.value.find(s => s.code === "sys_setting_abnormal_area");
});
const deviceInfo = computed(() => {
return systemSetting.value.find(s => s.code === "sys_setting_info");
});
const areaOptions = computed(() => { const areaOptions = computed(() => {
return heatAreaConfig.value.map(c => ({ label: c.name, value: c.id })); return heatAreaConfig.value.map(c => ({ label: c.name, value: c.id }));
}); });
@ -107,6 +117,9 @@ export const useSettingStore = defineStore("setting", () => {
actionAreaConfig, actionAreaConfig,
capAreaConfig, capAreaConfig,
systemSetting, systemSetting,
liquidWarningSetting,
abnormalAreaSetting,
deviceInfo,
containerConf, containerConf,
liquidList, liquidList,
liquidIdMap, liquidIdMap,

10
src/views/components/menu.ts

@ -20,6 +20,9 @@ import n_ore from "/src/assets/menuIcon/n_ore.svg";
import s_user from "/src/assets/menuIcon/s_user.svg"; import s_user from "/src/assets/menuIcon/s_user.svg";
import n_user from "/src/assets/menuIcon/n_user.svg"; import n_user from "/src/assets/menuIcon/n_user.svg";
import s_setting from "/src/assets/menuIcon/s_setting.svg";
import n_setting from "/src/assets/menuIcon/n_setting.svg";
import s_debug from "/src/assets/menuIcon/s_debug.svg"; import s_debug from "/src/assets/menuIcon/s_debug.svg";
import n_debug from "/src/assets/menuIcon/n_debug.svg"; import n_debug from "/src/assets/menuIcon/n_debug.svg";
@ -75,6 +78,13 @@ const menuIcon = [
}, },
{ {
id: 7, id: 7,
name: "系统设置",
s_icon: s_setting,
n_icon: n_setting,
path: "/sysSetting",
},
{
id: 8,
name: "调试", name: "调试",
s_icon: s_debug, s_icon: s_debug,
n_icon: n_debug, n_icon: n_debug,

69
src/views/sysSetting/SysSetting.vue

@ -0,0 +1,69 @@
<template>
<div class="component-page overflow-auto px-8 py-6 text-text flex flex-col gap-2">
<section>
<h1 class="text-xl font-medium pl-2 my-4">溶液量低提示</h1>
<div class="bg-[#FBFBFB] border border-[#DADADA] rounded py-4 px-10 flex items-center gap-2">
<span>设置溶液提醒量</span>
<el-input
v-if="!!settingStore.liquidWarningSetting"
v-model.number="settingStore.liquidWarningSetting.value"
style="width: 140px"
@change="onLiquidChange" />
<span>ml</span>
</div>
</section>
<section>
<h1 class="text-xl font-medium pl-2 my-4">异常处理区</h1>
<div class="bg-[#FBFBFB] border border-[#DADADA] rounded py-4 px-10 flex items-center gap-2">
<span>设置异常处理区</span>
<el-select
v-if="!!settingStore.abnormalAreaSetting"
v-model="settingStore.abnormalAreaSetting.value"
placeholder="Select"
style="width: 140px"
@change="onAbnormalChange">
<el-option
v-for="item in settingStore.areaOptions"
:key="item.value"
:label="item.label"
:value="item.value.toString()" />
</el-select>
</div>
</section>
<section>
<h1 class="text-xl font-medium pl-2 my-4">设备信息</h1>
<div class="bg-[#FBFBFB] border border-[#DADADA] rounded py-4 px-10 flex items-center gap-2">
<span>设备号</span>
<span>{{ settingStore.deviceInfo?.value }}</span>
</div>
</section>
</div>
</template>
<script setup lang="ts">
import { updateConfig } from "@/services/sysConfig/sysConfig";
import { useSettingStore } from "@/stores/setting";
import { ElMessage } from "element-plus";
const settingStore = useSettingStore();
function onLiquidChange(val: number) {
console.log(val);
const id = settingStore.liquidWarningSetting?.id || 0;
updateConfig([{ id, value: val.toString() }]).then(res => {
if (res.success) {
} else {
ElMessage.error(res.msg);
}
});
}
function onAbnormalChange(val: string) {
console.log(val);
const id = settingStore.abnormalAreaSetting?.id || 0;
updateConfig([{ id, value: val.toString() }]).then(res => {
if (res.success) {
} else {
ElMessage.error(res.msg);
}
});
}
</script>
Loading…
Cancel
Save