diff --git a/src/api/app.ts b/src/api/app.ts index 6e8945a..8865326 100644 --- a/src/api/app.ts +++ b/src/api/app.ts @@ -20,6 +20,8 @@ export interface AppItem { TenantAuth?: number /** 指定公司安装状态(当前公司维度) */ CompanyInstalled?: number + /** 管理员视角:可管理范围内已装该应用的公司名列表(非管理员为空) */ + InstalledCompanies?: string[] UserEnabled?: number ApplyStatus?: number } diff --git a/src/views/app/AppMarket.vue b/src/views/app/AppMarket.vue index 8327e03..8dc8939 100644 --- a/src/views/app/AppMarket.vue +++ b/src/views/app/AppMarket.vue @@ -99,10 +99,10 @@ async function onConfirmInstall(): Promise { } /** 租户管理员:安装/停用企业功能。 - * 已安装 → 打开管理弹窗(公司级开关);未安装 → 打开安装弹窗(全租户/指定公司) */ + * 管理范围内已装(含非本公司)→ 打开管理弹窗(公司级开关);未装 → 打开安装弹窗 */ async function toggleInstall(a: AppItem): Promise { try { - if (a.TenantInstalled || a.CompanyInstalled) { + if (hasManageableInstall(a)) { await openManageDialog(a) return } @@ -217,11 +217,22 @@ async function applyAuth(a: AppItem): Promise { function marketActionDesc(a: AppItem): string { if (a.AuthRequired && a.ApplyStatus === 1) return '授权申请中' if (a.TenantInstalled) return '企业已安装(全租户)' + // 管理员视角:管理范围内任意公司已装(含非本公司)→ 提示安装分布 + if (isAdmin.value && (a.InstalledCompanies?.length || 0) > 0) { + return `已安装于 ${a.InstalledCompanies!.length} 家公司` + } if (a.CompanyInstalled) return '企业已安装(本公司)' if (a.UserEnabled) return '个人已启用' return '' } +/** 管理范围内是否存在安装(租户/本公司/管理范围内任意公司)→ 决定显示"管理"还是"安装" */ +function hasManageableInstall(a: AppItem): boolean { + if (a.TenantInstalled || a.CompanyInstalled) return true + if (isAdmin.value && (a.InstalledCompanies?.length || 0) > 0) return true + return false +} + /** 应用是否当前可用(已装/已启用 → 可打开) */ function isAppUsable(a: AppItem): boolean { if (a.TenantInstalled) return true @@ -275,6 +286,18 @@ onMounted(loadMarket) {{ typeLabel(a.AppType).text }}
{{ a.AppDesc || '暂无描述' }}
+ +
+ 管理范围内已装: + {{ n }} +
{{ marketActionDesc(a) }} 已授权 @@ -286,8 +309,8 @@ onMounted(loadMarket) @@ -307,8 +330,8 @@ onMounted(loadMarket)