修改: bug
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m47s

This commit is contained in:
sexygoat
2026-02-27 17:40:02 +08:00
parent f1cb1e53c8
commit 4470a4ef04
17 changed files with 908 additions and 544 deletions

View File

@@ -190,6 +190,7 @@
{ label: '权限类型', prop: 'perm_type' },
{ label: '菜单路径', prop: 'url' },
{ label: '适用端口', prop: 'platform' },
// { label: '可用角色类型', prop: 'available_for_role_types' },
{ label: '状态', prop: 'status' },
{ label: '排序', prop: 'sort' },
{ label: '操作', prop: 'operation' }
@@ -242,7 +243,7 @@
{
prop: 'perm_name',
label: '权限名称',
width: 200
width: 240
},
{
prop: 'perm_code',
@@ -276,6 +277,24 @@
return platformMap[row.platform || 'all'] || row.platform
}
},
// {
// prop: 'available_for_role_types',
// label: '可用角色类型',
// width: 160,
// formatter: (row: PermissionTreeNode) => {
// if (!row.available_for_role_types) {
// return '-'
// }
// const roleTypeMap: Record<string, string> = {
// '1': '平台角色',
// '2': '客户角色'
// }
// const types = row.available_for_role_types
// .split(',')
// .map((type) => roleTypeMap[type.trim()] || type)
// return types.join(', ')
// }
// },
{
prop: 'status',
label: '状态',
@@ -417,7 +436,7 @@
}
// 显示对话框
const showDialog = (type: string, row?: PermissionTreeNode) => {
const showDialog = async (type: string, row?: PermissionTreeNode) => {
dialogVisible.value = true
dialogType.value = type
@@ -428,18 +447,35 @@
if (type === 'edit' && row) {
currentRow.value = row
currentPermissionId.value = row.id
// 需要从API获取完整的权限数据,因为树节点可能不包含所有字段
// 暂时使用树节点的数据
Object.assign(form, {
perm_name: row.perm_name,
perm_code: row.perm_code,
perm_type: row.perm_type,
parent_id: undefined, // 树结构中没有parent_id需要从API获取
url: row.url || '',
platform: row.platform || 'all',
sort: row.sort || 0,
status: row.status ?? CommonStatus.ENABLED
})
// 从API获取完整的权限数据包含parent_id
try {
const response = await PermissionService.getPermission(row.id)
if (response.code === 0 && response.data) {
Object.assign(form, {
perm_name: response.data.perm_name,
perm_code: response.data.perm_code,
perm_type: response.data.perm_type,
parent_id: response.data.parent_id || undefined,
url: response.data.url || '',
platform: response.data.platform || 'all',
sort: response.data.sort || 0,
status: response.data.status ?? CommonStatus.ENABLED
})
}
} catch (error) {
console.error('获取权限详情失败:', error)
// 如果API获取失败使用树节点数据作为备选
Object.assign(form, {
perm_name: row.perm_name,
perm_code: row.perm_code,
perm_type: row.perm_type,
parent_id: undefined,
url: row.url || '',
platform: row.platform || 'all',
sort: row.sort || 0,
status: row.status ?? CommonStatus.ENABLED
})
}
} else {
currentPermissionId.value = 0
resetForm()