diff --git a/src/api/platformIam.ts b/src/api/platformIam.ts index 96fcaeeb..8c1f2c87 100644 --- a/src/api/platformIam.ts +++ b/src/api/platformIam.ts @@ -1,11 +1,11 @@ import { http, unwrapApiResponse, type ApiEnvelope } from '@/api/http' export interface PlatformPermissionResource { - id: number - tenantId: number + id: number | string + tenantId: number | string appCode: 'PLATFORM' permissionType: 'MENU' | 'BUTTON' - parentId: number + parentId: number | string permissionCode: string permissionName: string routePath: string | null @@ -64,7 +64,7 @@ export interface CreatePlatformPermissionRequest { type: 'MENU' | 'BUTTON' code: string name: string - parentId: number + parentId: number | string routePath: string | null httpMethod: null sortNo: number diff --git a/src/utils/platformPermission.test.ts b/src/utils/platformPermission.test.ts new file mode 100644 index 00000000..381a73ee --- /dev/null +++ b/src/utils/platformPermission.test.ts @@ -0,0 +1,36 @@ +import { describe, expect, it } from 'vitest' +import { mapPlatformPermission } from '@/utils/platformPermission' + +describe('mapPlatformPermission', () => { + it('treats the string root parent as a root node and preserves long ids', () => { + expect(mapPlatformPermission({ + id: '2082813911786024961', + tenantId: '0', + appCode: 'PLATFORM', + permissionType: 'MENU', + parentId: '0', + permissionCode: 'platform:audit', + permissionName: '审计管理', + routePath: '/audit', + httpMethod: null, + sortNo: 50, + status: 'ACTIVE', + })).toMatchObject({ id: '2082813911786024961', parentId: null, code: 'platform:audit' }) + }) + + it('preserves a long string parent id for child resources', () => { + expect(mapPlatformPermission({ + id: '2082813911786024962', + tenantId: '0', + appCode: 'PLATFORM', + permissionType: 'BUTTON', + parentId: '2082813911786024961', + permissionCode: 'platform:audit:list', + permissionName: '操作日志', + routePath: null, + httpMethod: null, + sortNo: 10, + status: 'ACTIVE', + })).toMatchObject({ id: '2082813911786024962', parentId: '2082813911786024961', type: '按钮' }) + }) +}) diff --git a/src/utils/platformPermission.ts b/src/utils/platformPermission.ts new file mode 100644 index 00000000..05e4638c --- /dev/null +++ b/src/utils/platformPermission.ts @@ -0,0 +1,17 @@ +import type { PlatformPermissionResource } from '@/api/platformIam' +import type { Permission } from '@/types/admin' + +export function mapPlatformPermission(item: PlatformPermissionResource): Permission { + const parentId = String(item.parentId) + return { + id: String(item.id), + parentId: parentId === '0' ? null : parentId, + name: item.permissionName, + code: item.permissionCode, + type: item.permissionType === 'BUTTON' ? '按钮' : '菜单', + path: item.routePath ?? '', + method: item.httpMethod ?? '-', + status: item.status === 'ACTIVE' ? '启用' : '停用', + sort: item.sortNo, + } +} diff --git a/src/views/CounterpartiesView.vue b/src/views/CounterpartiesView.vue index 49d32e32..143024d2 100644 --- a/src/views/CounterpartiesView.vue +++ b/src/views/CounterpartiesView.vue @@ -120,12 +120,12 @@ function addressText(item: Counterparty) {

往来单位档案

平台维护完整主数据;企业客户端仅可只读选择已启用的发货单位和收货单位。

+ -
diff --git a/src/views/CustomersView.vue b/src/views/CustomersView.vue index a411cbc5..a437536e 100644 --- a/src/views/CustomersView.vue +++ b/src/views/CustomersView.vue @@ -135,6 +135,15 @@ function exportCustomers() {

客户档案

共 {{ filteredRows.length }} 家企业,客户资料与注册审核统一管理。

+ + + @@ -144,15 +153,6 @@ function exportCustomers() { - - - diff --git a/src/views/EnterpriseReviewsView.vue b/src/views/EnterpriseReviewsView.vue index 7364860b..83dc6bdb 100644 --- a/src/views/EnterpriseReviewsView.vue +++ b/src/views/EnterpriseReviewsView.vue @@ -216,6 +216,15 @@ onBeforeUnmount(clearPreviewUrl)

企业资料审核

仅展示后端返回的待审核记录,提交审核时使用审核单 ID。

+ + +