以 ckcloudManage a44810c 为基础,只保留资产页面(台账、单据、基础数据、同步任务)、 登录/错误/个人资料等公共页面,以及资产单据“查看流程”用到的流程详情页; 统一登录应用编码默认 CK_ASSET,标题“资产管理”,本地端口 9090。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
import request from '@/config/axios'
|
||||
import type { MenuVO } from '@/api/system/menu'
|
||||
import type { RoleVO } from '@/api/system/role'
|
||||
import type { TagVO } from '@/api/system/tag'
|
||||
|
||||
/** 配置范围与后端枚举保持一致,仅用于文件和本次操作。 */
|
||||
export enum ApplicationConfigSection {
|
||||
MENUS = 'MENUS',
|
||||
ROLES = 'ROLES',
|
||||
TAGS = 'TAGS'
|
||||
}
|
||||
|
||||
/** 应用注册下独立授权的配置迁移按钮。 */
|
||||
export const ApplicationConfigPermission = {
|
||||
EXPORT: 'system:application:config-export',
|
||||
IMPORT: 'system:application:config-import'
|
||||
} as const
|
||||
|
||||
export const applicationConfigSections = [
|
||||
{ value: ApplicationConfigSection.MENUS, label: '菜单配置' },
|
||||
{ value: ApplicationConfigSection.ROLES, label: '角色配置(含权限绑定)' },
|
||||
{ value: ApplicationConfigSection.TAGS, label: '数据权限定义' }
|
||||
]
|
||||
|
||||
/** 与后端导入策略保持一致。 */
|
||||
export enum ApplicationConfigImportMode {
|
||||
MERGE = 'MERGE',
|
||||
REPLACE = 'REPLACE'
|
||||
}
|
||||
|
||||
/** 完整应用配置文件,引用现有字段,不包含人员授权、密钥或接入配置。 */
|
||||
export interface ApplicationConfigPackage {
|
||||
formatVersion: number
|
||||
complete: boolean
|
||||
sections?: ApplicationConfigSection[]
|
||||
applicationName: string
|
||||
applicationCode: string
|
||||
menus: Omit<MenuVO, 'createTime'>[]
|
||||
roles: Omit<RoleVO, 'createTime' | 'tags'>[]
|
||||
tags: Omit<TagVO, 'createTime' | 'roleCount'>[]
|
||||
roleMenus: { roleId: number; menuId: number }[]
|
||||
roleTags: { roleId: number; tagId: number; tagValue?: string }[]
|
||||
departments: { id: number; name: string; orgCode?: string }[]
|
||||
}
|
||||
|
||||
export interface ApplicationConfigChange {
|
||||
category: string
|
||||
action: string
|
||||
name: string
|
||||
detail: string
|
||||
}
|
||||
|
||||
export interface ApplicationConfigDeptMapping {
|
||||
sourceId: number
|
||||
sourceName: string
|
||||
sourceCode?: string
|
||||
targetId?: number
|
||||
targetName?: string
|
||||
}
|
||||
|
||||
export interface ApplicationConfigPreview {
|
||||
token?: string
|
||||
sourceName: string
|
||||
sourceCode: string
|
||||
targetName: string
|
||||
targetCode: string
|
||||
codeMismatch: boolean
|
||||
changes: ApplicationConfigChange[]
|
||||
errors: string[]
|
||||
warnings: string[]
|
||||
departments: ApplicationConfigDeptMapping[]
|
||||
}
|
||||
|
||||
/** 按实际变更在后端逐项校验已有增删改与授权权限。 */
|
||||
export const previewApplicationConfig = (data: {
|
||||
applicationId: number
|
||||
mode: ApplicationConfigImportMode
|
||||
sections: ApplicationConfigSection[]
|
||||
config: ApplicationConfigPackage
|
||||
departmentMappings: Record<number, number>
|
||||
includePresets: boolean
|
||||
}): Promise<ApplicationConfigPreview> =>
|
||||
request.post({ url: '/system/application/config/preview', data })
|
||||
|
||||
export const exportApplicationConfig = (
|
||||
applicationId: number,
|
||||
sections?: ApplicationConfigSection[]
|
||||
): Promise<ApplicationConfigPackage> =>
|
||||
request.get({
|
||||
url: '/system/application/config/export',
|
||||
params: { applicationId, sections: sections?.join(',') }
|
||||
})
|
||||
|
||||
/** 正式执行只提交服务端凭证,不能在确认后偷偷更换文件或目标。 */
|
||||
export const importApplicationConfig = (
|
||||
token: string,
|
||||
confirmCodeMismatch: boolean
|
||||
): Promise<boolean> =>
|
||||
request.post({ url: '/system/application/config/import', data: { token, confirmCodeMismatch } })
|
||||
Reference in New Issue
Block a user