From 1c0885126d015a9106d7a836dc5a1d2946a3795a Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Tue, 15 Sep 2026 14:24:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(app-config):=20=E8=99=9A=E6=8B=9F=E8=81=8C?= =?UTF-8?q?=E5=8A=A1=E7=BB=91=E5=AE=9A=E6=8C=89=E5=85=AC=E5=8F=B8=E9=9A=94?= =?UTF-8?q?=E7=A6=BB=EF=BC=8C=E7=A7=9F=E6=88=B7=E9=BB=98=E8=AE=A4=E5=B1=82?= =?UTF-8?q?=E4=B8=8D=E5=B1=95=E7=A4=BA=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 bindingEnabled(要求明确选中公司),租户默认层不加载虚拟职务绑定并清空已展示数据、复位脏标记 - 切换范围时仅在选中公司下重新加载绑定,避免误展示/误改他司数据 - getVirtualMapping/setVirtualMapping 注释澄清:CompanyUUID 缺省回落可管理公司 --- src/api/app.ts | 4 +- src/views/app/AppConfigPage.vue | 387 +++++++++++++++++++++----------- 2 files changed, 261 insertions(+), 130 deletions(-) diff --git a/src/api/app.ts b/src/api/app.ts index b2ef3d2..630ae41 100644 --- a/src/api/app.ts +++ b/src/api/app.ts @@ -175,14 +175,14 @@ export const appApi = { setStrictVisible: (AppUUID: string, StrictPositionVisible: number): Promise<{ msg: string }> => post<{ msg: string }>('/API/App/SetStrictVisible', { AppUUID, StrictPositionVisible }), - /** 管理员:应用虚拟职务↔真实职务映射(配置页读取;CompanyUUID 指定公司范围,空=当前公司) */ + /** 管理员:应用虚拟职务↔真实职务映射(配置页读取;CompanyUUID 指定公司范围,缺省回落可管理公司) */ getVirtualMapping: (AppUUID: string, CompanyUUID?: string): Promise<{ VirtualPositions: VirtualMappingItem[]; AllPositions: PositionOption[] }> => get<{ VirtualPositions: VirtualMappingItem[]; AllPositions: PositionOption[] }>( '/API/App/VirtualMapping', CompanyUUID ? { AppUUID, CompanyUUID } : { AppUUID }, ), - /** 管理员:重写虚拟职务的真实职务绑定(配置页保存;CompanyUUID 指定公司范围,空=当前公司) */ + /** 管理员:重写虚拟职务的真实职务绑定(配置页保存;CompanyUUID 指定公司范围,缺省回落可管理公司) */ setVirtualMapping: ( AppUUID: string, Mappings: { AppVirtualPositionUUID: string; PositionUUIDs: string[] }[], diff --git a/src/views/app/AppConfigPage.vue b/src/views/app/AppConfigPage.vue index 78a72e7..0e8f5b2 100644 --- a/src/views/app/AppConfigPage.vue +++ b/src/views/app/AppConfigPage.vue @@ -44,6 +44,12 @@ const scopeLabel = computed(() => { /** 是否为跨公司管理员(可看全部公司 + 复制) */ const isMultiCompany = computed(() => scope.value === 'all' || scope.value === 'tenant') +/** + * 绑定面板是否可编辑:虚拟职务绑定按公司隔离、无"租户默认"层, + * 必须落在明确选中的公司上(公司管理员恒为本公司)。 + */ +const bindingEnabled = computed(() => !!currentCompany.value) + /** 编辑副本:{Key: 用户输入值}(敏感键未改保持占位符) */ const edited = ref>({}) @@ -153,10 +159,16 @@ async function onCopy(): Promise { } } -// 切换范围(租户默认/公司)→ 配置与虚拟职务绑定均按新范围重新加载 +// 切换范围(租户默认/公司)→ 配置随范围加载;虚拟职务绑定仅在有明确公司时加载 watch(currentCompany, () => { loadConfig() - loadVirtualMapping() + if (currentCompany.value) { + loadVirtualMapping() + } else { + // 租户默认层无虚拟职务绑定:清空已展示数据并复位脏标记 + vpMappings.value = [] + vpDirty.value = false + } }) // ==================== 虚拟职务 ↔ 真实职务映射 ==================== @@ -179,7 +191,8 @@ const positionPickerConfig: EntityPickerConfig = { } async function loadVirtualMapping(): Promise { - if (!AppUUID.value) return + // 虚拟职务绑定按公司隔离:未选中具体公司(租户默认)不加载,避免误展示/误改他司数据 + if (!AppUUID.value || !currentCompany.value) return vpLoading.value = true try { const r = await appApi.getVirtualMapping(AppUUID.value, currentCompany.value || undefined) @@ -373,149 +386,194 @@ async function onRemoveTemplates(): Promise { onMounted(async () => { await initScope() await loadConfig() - await loadVirtualMapping() + // 虚拟职务绑定按公司隔离:仅在已默认选中本公司(公司管理员)时加载 + if (currentCompany.value) { + await loadVirtualMapping() + } await loadTemplateTree() })