feat(dacli): webapi 镜像 org 命令 (CI 关卡 G 总体 FAIL=0)
This commit is contained in:
1 parent
6b2becd458
commit
72ced8a42e
2 files changed
+103
-8
No files matched your search
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* webapi/permission.ts — 镜像 web 端 permission/organize.ts (v3.0+ regression audit P0)
|
||||
*
|
||||
* web/apps/jnpf-web-apps-main/src/api/permission/organize.ts 12 函数:
|
||||
* getOrganizeSyncList / getOrganizeList / create / update / getInfo / delOrganize
|
||||
* exportExcel / templateDownload / importData / importPreview / exportExceptionData
|
||||
*
|
||||
* v3.0+ (2026-06-29) 新增原因:
|
||||
* - CI 关卡 G 标识 org 0 webapi 引用为 FAIL
|
||||
* - cmd-review 已知 org 是"经验复刻", 应 webapi 镜像
|
||||
*/
|
||||
import { JnpfClient } from '../core/client.ts'
|
||||
import { loadWebModule } from './_loader.ts'
|
||||
|
||||
const ORG_SRC = '/home/ubuntu/ccWorkDir/web/apps/jnpf-web-apps-main/src/api/permission/organize.ts'
|
||||
|
||||
let cached: any = null
|
||||
|
||||
export async function initWebapi(client: JnpfClient): Promise<void> {
|
||||
if (cached) return
|
||||
const { initDefHttpShim } = await import('./_defhttp_shim.ts')
|
||||
initDefHttpShim(client)
|
||||
cached = await loadWebModule(ORG_SRC)
|
||||
}
|
||||
|
||||
export function isWebapiLoaded(): boolean {
|
||||
return cached !== null
|
||||
}
|
||||
|
||||
export namespace OrgData {
|
||||
export interface CreateParams {
|
||||
parentId?: string
|
||||
category?: string
|
||||
fullName: string
|
||||
enCode: string
|
||||
sortCode?: number
|
||||
description?: string
|
||||
enabledMark?: number
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
export interface ListParams {
|
||||
keyword?: string
|
||||
parentId?: string
|
||||
category?: string
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export const loadOrg: any = new Proxy({} as any, {
|
||||
get(_target, prop) {
|
||||
if (!cached) {
|
||||
throw new Error(`permission/organize 模块未初始化, 请先 await initWebapi(client)`)
|
||||
}
|
||||
return cached[prop]
|
||||
},
|
||||
})
|
||||
|
||||
/** 获取组织列表 */
|
||||
export async function getOrganizeList(params?: OrgData.ListParams): Promise<unknown> {
|
||||
return loadOrg.getOrganizeList(params)
|
||||
}
|
||||
|
||||
/** 异步获取组织子树 (parentId) */
|
||||
export async function getOrganizeSyncList(parentId: string): Promise<unknown> {
|
||||
return loadOrg.getOrganizeSyncList({ parentId })
|
||||
}
|
||||
|
||||
/** 创建组织 */
|
||||
export async function createOrg(params: OrgData.CreateParams): Promise<unknown> {
|
||||
return loadOrg.create(params)
|
||||
}
|
||||
|
||||
/** 更新组织 */
|
||||
export async function updateOrg(params: OrgData.CreateParams & { id: string }): Promise<unknown> {
|
||||
return loadOrg.update(params)
|
||||
}
|
||||
|
||||
/** 获取组织详情 */
|
||||
export async function getOrgInfo(id: string): Promise<unknown> {
|
||||
return loadOrg.getInfo(id)
|
||||
}
|
||||
|
||||
/** 删除组织 */
|
||||
export async function delOrganize(id: string): Promise<unknown> {
|
||||
return loadOrg.delOrganize(id)
|
||||
}
|
||||
Reference in new issue
Block a user