优化
This commit is contained in:
@@ -38,6 +38,12 @@ export interface TenantCompanyProfile {
|
||||
contactName: string
|
||||
contactPhone: string
|
||||
contactEmail: string
|
||||
contactWechat: string
|
||||
enterpriseType: string
|
||||
establishedDate: string
|
||||
registeredCapital: number | string | null
|
||||
registeredCapitalCurrency: string
|
||||
registeredAddress: string
|
||||
auditStatus: MerchantTenantStatus
|
||||
}
|
||||
|
||||
@@ -70,6 +76,7 @@ export interface TenantRole {
|
||||
description: string
|
||||
status: TenantRecordStatus
|
||||
builtin: boolean
|
||||
memberCount: number
|
||||
permissionIds: string[]
|
||||
permissionCodes: string[]
|
||||
}
|
||||
@@ -77,6 +84,13 @@ export interface TenantRole {
|
||||
const allPermissionCodes = TENANT_PERMISSION_GROUPS.flatMap((group) => group.items.map((item) => item.code))
|
||||
const mappedMerchantPermissionCodes = new Set(Object.values(FRONTEND_TO_MERCHANT_PERMISSION_CODES).flat())
|
||||
|
||||
function formatLastLoginAt(value: string | null) {
|
||||
if (!value) return '从未登录'
|
||||
const date = new Date(value)
|
||||
if (Number.isNaN(date.getTime())) return '-'
|
||||
return date.toLocaleString('zh-CN', { hour12: false })
|
||||
}
|
||||
|
||||
const emptyCompany: TenantCompanyProfile = {
|
||||
companyName: '',
|
||||
creditCode: '',
|
||||
@@ -84,6 +98,12 @@ const emptyCompany: TenantCompanyProfile = {
|
||||
contactName: '',
|
||||
contactPhone: '',
|
||||
contactEmail: '',
|
||||
contactWechat: '',
|
||||
enterpriseType: '',
|
||||
establishedDate: '',
|
||||
registeredCapital: null,
|
||||
registeredCapitalCurrency: '',
|
||||
registeredAddress: '',
|
||||
auditStatus: 'PROFILE_REQUIRED',
|
||||
}
|
||||
|
||||
@@ -107,6 +127,12 @@ export const useTenantAdministrationStore = defineStore('tenant-administration',
|
||||
contactName: profile.contactName,
|
||||
contactPhone: profile.contactPhone,
|
||||
contactEmail: profile.contactEmail ?? '',
|
||||
contactWechat: profile.contactWechat ?? '',
|
||||
enterpriseType: profile.enterpriseType ?? '',
|
||||
establishedDate: profile.establishedDate ?? '',
|
||||
registeredCapital: profile.registeredCapital,
|
||||
registeredCapitalCurrency: profile.registeredCapitalCurrency ?? '',
|
||||
registeredAddress: profile.registeredAddress ?? '',
|
||||
auditStatus: profile.status,
|
||||
}
|
||||
qualifications.value = qualificationRecords.map((item) => ({
|
||||
@@ -119,7 +145,7 @@ export const useTenantAdministrationStore = defineStore('tenant-administration',
|
||||
} as const)[item.qualificationType],
|
||||
fileName: item.documentUrl.split('/').pop() || '资质文件',
|
||||
status: normalizeQualificationStatus(item.status),
|
||||
expiresAt: '-',
|
||||
expiresAt: item.validTo || '长期有效',
|
||||
updatedAt: '-',
|
||||
documentUrl: item.documentUrl,
|
||||
}))
|
||||
@@ -141,6 +167,7 @@ export const useTenantAdministrationStore = defineStore('tenant-administration',
|
||||
description: role.description ?? '暂无角色说明',
|
||||
status: role.status === 'ACTIVE' ? 'ACTIVE' : 'INACTIVE',
|
||||
builtin: role.roleType === 'SYSTEM',
|
||||
memberCount: role.memberCount,
|
||||
permissionIds: grantedIds,
|
||||
permissionCodes: role.roleType === 'SYSTEM' && role.roleCode === 'MERCHANT_OWNER' ? [...allPermissionCodes] : effectivePermissionCodes,
|
||||
}
|
||||
@@ -150,12 +177,12 @@ export const useTenantAdministrationStore = defineStore('tenant-administration',
|
||||
return {
|
||||
id: String(member.membershipId),
|
||||
name: member.displayName || `企业成员 ${member.membershipId}`,
|
||||
account: member.memberNo || `用户 ${member.authUserId}`,
|
||||
account: member.username,
|
||||
phone: member.phone ?? '',
|
||||
email: member.email ?? '',
|
||||
roleIds: member.roleIds.map(String),
|
||||
status: member.status === 'ACTIVE' ? 'ACTIVE' : 'INACTIVE',
|
||||
lastLoginAt: '服务端未提供',
|
||||
lastLoginAt: formatLastLoginAt(member.lastLoginAt),
|
||||
isAdministrator: member.memberType === 'OWNER',
|
||||
}
|
||||
}
|
||||
@@ -189,6 +216,12 @@ export const useTenantAdministrationStore = defineStore('tenant-administration',
|
||||
contactName: updated.contactName,
|
||||
contactPhone: updated.contactPhone,
|
||||
contactEmail: updated.contactEmail ?? '',
|
||||
contactWechat: updated.contactWechat ?? '',
|
||||
enterpriseType: updated.enterpriseType ?? '',
|
||||
establishedDate: updated.establishedDate ?? '',
|
||||
registeredCapital: updated.registeredCapital,
|
||||
registeredCapitalCurrency: updated.registeredCapitalCurrency ?? '',
|
||||
registeredAddress: updated.registeredAddress ?? '',
|
||||
auditStatus: updated.status,
|
||||
}
|
||||
}
|
||||
@@ -285,7 +318,7 @@ export const useTenantAdministrationStore = defineStore('tenant-administration',
|
||||
}
|
||||
|
||||
function roleMemberCount(roleId: string) {
|
||||
return members.value.filter((member) => member.roleIds.includes(roleId)).length
|
||||
return roles.value.find((role) => role.id === roleId)?.memberCount ?? 0
|
||||
}
|
||||
|
||||
function roleNames(roleIds: readonly string[]) {
|
||||
|
||||
Reference in New Issue
Block a user