From ef8de119a90cf0fcbc9643f3be4859e10b2c8c61 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 28 Sep 2026 13:55:36 +0800 Subject: [PATCH] =?utf8?q?=E6=96=B0=E5=A2=9E=E9=A2=86=E5=9F=9F=E5=BC=B9?= =?utf8?q?=E7=AA=97=EF=BC=9A=E5=A2=9E=E5=8A=A0=E9=BB=98=E8=AE=A4=E9=A2=9C?= =?utf8?q?=E8=89=B2=E7=BC=96=E8=BE=91=EF=BC=9B=E4=BF=AE=E5=A4=8D=E8=BE=93?= =?utf8?q?=E5=85=A5=E6=A1=86=E5=8F=8C=E9=87=8D=E8=BE=B9=E6=A1=86=EF=BC=88?= =?utf8?q?=E5=8E=BB=E9=99=A4=20el-input=5F=5Finner=20=E5=A4=9A=E4=BD=99?= =?utf8?q?=E8=BE=B9=E6=A1=86=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src-vue/Home.vue | 42 ++++++++++++++++++++++++++++++------ src-vue/styles/ui-system.css | 6 +++--- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/src-vue/Home.vue b/src-vue/Home.vue index ca42329..e733d7d 100644 --- a/src-vue/Home.vue +++ b/src-vue/Home.vue @@ -105,6 +105,17 @@ const deviceTemplateDomain = ref((() => { try { return new URLSearchParams(windo const domainOptions = ref([]); const addingDomain = ref(false); const newDomainName = ref(""); +const newDomainColor = ref(""); + +// 领域默认颜色配置:与领域方案首页标签、编辑弹窗同一套色板(web-ui-builder / antd 设计体系) +const DOMAIN_COLORS = [ + { value: "blue", label: "蓝" }, + { value: "cyan", label: "青" }, + { value: "orange", label: "橙" }, + { value: "green", label: "绿" }, + { value: "purple", label: "紫" }, + { value: "red", label: "红" }, +]; const view = ref("table"); const siteEditSection = ref("basic"); @@ -374,14 +385,14 @@ const saveMu = async (selected) => { try { const saved = await fetchDb(`/sites/${site.value.id}/mu`, { method: "PUT", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ selected }) }); site.value = saved; } catch (e) { notify("MU 选择保存失败: " + e.ElMessage); throw e; } }; -const addDomain = async (name) => { +const addDomain = async (name, color) => { const n = (name || "").trim(); if (!n) return; if (n.length > 6) { notify("领域名称不超过 6 个字"); return; } - try { await fetchDb("/domains", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ name: n }) }); await reloadDomains(); } + try { await fetchDb("/domains", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ name: n, color: color || "" }) }); await reloadDomains(); } catch (e) { notify("添加领域失败: " + e.ElMessage); } }; -const doAddDomain = async () => { if (!newDomainName.value.trim()) return; await addDomain(newDomainName.value); addingDomain.value = false; newDomainName.value = ""; }; +const doAddDomain = async () => { if (!newDomainName.value.trim()) return; await addDomain(newDomainName.value, newDomainColor.value); addingDomain.value = false; newDomainName.value = ""; newDomainColor.value = ""; }; const uploadFile = async (file) => { if (!site.value) return; const reader = new FileReader(); reader.readAsDataURL(file); @@ -596,7 +607,7 @@ function onMenuOpenChange(keys) { resourceNavOpen.value = keys.includes("resourc 导入领域方案 ← 返回方案列表 清除领域筛选:{{ domainOptions.find((d) => d.id === domainFilter)?.name || '' }} - + 新增领域 + + 新增领域 @@ -643,13 +654,30 @@ function onMenuOpenChange(keys) { resourceNavOpen.value = keys.includes("resourc - +

新增领域

创建后可在领域方案和站点基本信息中直接选择。

- + + - 取消 + 取消 创建
diff --git a/src-vue/styles/ui-system.css b/src-vue/styles/ui-system.css index 57af44a..d9ae096 100644 --- a/src-vue/styles/ui-system.css +++ b/src-vue/styles/ui-system.css @@ -88,15 +88,15 @@ html,body{font-family:var(--ant-font-family);font-size:var(--ant-font-size);colo .station-ui-modal .el-dialog__headerbtn .el-dialog__close{font-size:16px;color:color-mix(in srgb,var(--ant-color-text-base) 45%,transparent)} .station-ui-modal .el-dialog__title{font-size:22px;font-weight:600;line-height:1.4454;color:color-mix(in srgb,var(--ant-color-text-base) 88%,transparent)} .station-ui-modal .el-dialog__body{padding:0;font-size:var(--ant-font-size);color:var(--ant-color-text-base)} -.station-ui-modal.dlg-box .el-input__inner{font-size:var(--ant-font-size)} +.station-ui-modal.dlg-box .el-input__inner{font-size:var(--ant-font-size);border:0} .station-ui-modal .modal-body{padding:0;max-height:70vh;overflow:auto} .station-ui-modal .el-dialog__footer{margin-top:var(--ant-padding-lg)} .station-ui-modal .station-modal-actions .el-button{margin:0} /* 领域配置:默认颜色配置(swatch / dot),复用 antd 预设色板(web-ui-builder 设计体系) */ .domain-color-dot{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:8px;vertical-align:middle;border:1px solid color-mix(in srgb,var(--ant-color-text-base) 10%,transparent)} .domain-color-dot.tag-blue{background:#1677ff}.domain-color-dot.tag-cyan{background:#13c2c2}.domain-color-dot.tag-orange{background:#fa8c16}.domain-color-dot.tag-green{background:#52c41a}.domain-color-dot.tag-purple{background:#722ed1}.domain-color-dot.tag-red{background:#f5222d}.domain-color-dot.tag-default{background:#8c8c8c} -.domain-edit-dialog .field{display:block;margin-bottom:16px} -.domain-edit-dialog .field-label{display:block;font-size:var(--ant-font-size-sm);color:var(--ant-color-text-secondary);margin-bottom:6px} +.domain-edit-dialog .field,.domain-create-dialog .field{display:block;margin-bottom:16px} +.domain-edit-dialog .field-label,.domain-create-dialog .field-label{display:block;font-size:var(--ant-font-size-sm);color:var(--ant-color-text-secondary);margin-bottom:6px} .domain-color-picker{display:flex;gap:10px;flex-wrap:wrap} .domain-color-swatch{width:28px;height:28px;border-radius:var(--ant-border-radius);border:1px solid var(--ant-color-border);cursor:pointer;padding:0;transition:box-shadow .15s} .domain-color-swatch.tag-blue{background:#1677ff}.domain-color-swatch.tag-cyan{background:#13c2c2}.domain-color-swatch.tag-orange{background:#fa8c16}.domain-color-swatch.tag-green{background:#52c41a}.domain-color-swatch.tag-purple{background:#722ed1}.domain-color-swatch.tag-red{background:#f5222d}.domain-color-swatch.tag-default{background:#8c8c8c} -- 2.43.0