feat(app): 管理员视角安装分布——市场卡片标记可管理范围内已装该应用的公司名,管理范围内任意公司已装即显示管理
This commit is contained in:
1 parent
2746fe4ce9
commit
eb0df83267
2 files changed
+45
-6
No files matched your search
@@ -20,6 +20,8 @@ export interface AppItem {
|
|||||||
TenantAuth?: number
|
TenantAuth?: number
|
||||||
/** 指定公司安装状态(当前公司维度) */
|
/** 指定公司安装状态(当前公司维度) */
|
||||||
CompanyInstalled?: number
|
CompanyInstalled?: number
|
||||||
|
/** 管理员视角:可管理范围内已装该应用的公司名列表(非管理员为空) */
|
||||||
|
InstalledCompanies?: string[]
|
||||||
UserEnabled?: number
|
UserEnabled?: number
|
||||||
ApplyStatus?: number
|
ApplyStatus?: number
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,10 +99,10 @@ async function onConfirmInstall(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 租户管理员:安装/停用企业功能。
|
/** 租户管理员:安装/停用企业功能。
|
||||||
* 已安装 → 打开管理弹窗(公司级开关);未安装 → 打开安装弹窗(全租户/指定公司) */
|
* 管理范围内已装(含非本公司)→ 打开管理弹窗(公司级开关);未装 → 打开安装弹窗 */
|
||||||
async function toggleInstall(a: AppItem): Promise<void> {
|
async function toggleInstall(a: AppItem): Promise<void> {
|
||||||
try {
|
try {
|
||||||
if (a.TenantInstalled || a.CompanyInstalled) {
|
if (hasManageableInstall(a)) {
|
||||||
await openManageDialog(a)
|
await openManageDialog(a)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -217,11 +217,22 @@ async function applyAuth(a: AppItem): Promise<void> {
|
|||||||
function marketActionDesc(a: AppItem): string {
|
function marketActionDesc(a: AppItem): string {
|
||||||
if (a.AuthRequired && a.ApplyStatus === 1) return '授权申请中'
|
if (a.AuthRequired && a.ApplyStatus === 1) return '授权申请中'
|
||||||
if (a.TenantInstalled) return '企业已安装(全租户)'
|
if (a.TenantInstalled) return '企业已安装(全租户)'
|
||||||
|
// 管理员视角:管理范围内任意公司已装(含非本公司)→ 提示安装分布
|
||||||
|
if (isAdmin.value && (a.InstalledCompanies?.length || 0) > 0) {
|
||||||
|
return `已安装于 ${a.InstalledCompanies!.length} 家公司`
|
||||||
|
}
|
||||||
if (a.CompanyInstalled) return '企业已安装(本公司)'
|
if (a.CompanyInstalled) return '企业已安装(本公司)'
|
||||||
if (a.UserEnabled) return '个人已启用'
|
if (a.UserEnabled) return '个人已启用'
|
||||||
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 {
|
function isAppUsable(a: AppItem): boolean {
|
||||||
if (a.TenantInstalled) return true
|
if (a.TenantInstalled) return true
|
||||||
@@ -275,6 +286,18 @@ onMounted(loadMarket)
|
|||||||
<el-tag :type="typeLabel(a.AppType).type" size="small">{{ typeLabel(a.AppType).text }}</el-tag>
|
<el-tag :type="typeLabel(a.AppType).type" size="small">{{ typeLabel(a.AppType).text }}</el-tag>
|
||||||
</div>
|
</div>
|
||||||
<div class="app-desc">{{ a.AppDesc || '暂无描述' }}</div>
|
<div class="app-desc">{{ a.AppDesc || '暂无描述' }}</div>
|
||||||
|
<!-- 管理员视角:标记管理范围内已装该应用的公司(含非本公司) -->
|
||||||
|
<div v-if="isAdmin && a.InstalledCompanies?.length" class="app-installed-companies">
|
||||||
|
<span class="app-installed-label">管理范围内已装:</span>
|
||||||
|
<el-tag
|
||||||
|
v-for="n in a.InstalledCompanies"
|
||||||
|
:key="n"
|
||||||
|
size="small"
|
||||||
|
type="success"
|
||||||
|
effect="plain"
|
||||||
|
class="app-installed-tag"
|
||||||
|
>{{ n }}</el-tag>
|
||||||
|
</div>
|
||||||
<div class="app-foot">
|
<div class="app-foot">
|
||||||
<span v-if="marketActionDesc(a)" class="app-status">{{ marketActionDesc(a) }}</span>
|
<span v-if="marketActionDesc(a)" class="app-status">{{ marketActionDesc(a) }}</span>
|
||||||
<span v-else-if="a.ApplyStatus === 2" class="app-status ok">已授权</span>
|
<span v-else-if="a.ApplyStatus === 2" class="app-status ok">已授权</span>
|
||||||
@@ -286,8 +309,8 @@ onMounted(loadMarket)
|
|||||||
<template v-if="a.AppType === 'enterprise'">
|
<template v-if="a.AppType === 'enterprise'">
|
||||||
<el-button v-if="isAdmin && isAppUsable(a)" size="small" type="info" plain @click="openConfig(a)">配置</el-button>
|
<el-button v-if="isAdmin && isAppUsable(a)" size="small" type="info" plain @click="openConfig(a)">配置</el-button>
|
||||||
<el-button v-if="isAdmin" size="small" type="primary"
|
<el-button v-if="isAdmin" size="small" type="primary"
|
||||||
:plain="!!(a.TenantInstalled || a.CompanyInstalled)" @click="toggleInstall(a)">
|
:plain="hasManageableInstall(a)" @click="toggleInstall(a)">
|
||||||
{{ a.TenantInstalled || a.CompanyInstalled ? '管理' : '安装' }}
|
{{ hasManageableInstall(a) ? '管理' : '安装' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-tag v-else size="small" type="info" effect="plain">由企业管理员开通</el-tag>
|
<el-tag v-else size="small" type="info" effect="plain">由企业管理员开通</el-tag>
|
||||||
</template>
|
</template>
|
||||||
@@ -307,8 +330,8 @@ onMounted(loadMarket)
|
|||||||
<template v-if="isAdmin">
|
<template v-if="isAdmin">
|
||||||
<el-button v-if="isAppUsable(a)" size="small" type="info" plain @click="openConfig(a)">配置</el-button>
|
<el-button v-if="isAppUsable(a)" size="small" type="info" plain @click="openConfig(a)">配置</el-button>
|
||||||
<el-button size="small" type="primary"
|
<el-button size="small" type="primary"
|
||||||
:plain="!!(a.TenantInstalled || a.CompanyInstalled)" @click="toggleInstall(a)">
|
:plain="hasManageableInstall(a)" @click="toggleInstall(a)">
|
||||||
{{ a.TenantInstalled || a.CompanyInstalled ? '管理' : '安装' }}
|
{{ hasManageableInstall(a) ? '管理' : '安装' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
<el-button v-else size="small" :type="a.UserEnabled ? 'danger' : 'primary'"
|
<el-button v-else size="small" :type="a.UserEnabled ? 'danger' : 'primary'"
|
||||||
@@ -512,6 +535,20 @@ onMounted(loadMarket)
|
|||||||
color: var(--el-text-color-secondary);
|
color: var(--el-text-color-secondary);
|
||||||
min-height: 36px;
|
min-height: 36px;
|
||||||
}
|
}
|
||||||
|
.app-installed-companies {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 4px;
|
||||||
|
font-size: 12px;
|
||||||
|
.app-installed-label {
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.app-installed-tag {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
.app-foot {
|
.app-foot {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
Reference in new issue
Block a user