修复页面bug
This commit is contained in:
@@ -38,19 +38,54 @@ export interface TenantInfo {
|
||||
}
|
||||
|
||||
export const tenantApi = {
|
||||
getAccessibleTenants: () => request('/tenant/accessible', { method: 'GET' }),
|
||||
switchTenant: (tenantId: string) => request('/tenant/switch', { method: 'POST', params: { tenantId } }),
|
||||
getCurrentTenant: () => request('/tenant/current', { method: 'GET' }),
|
||||
resetToDefaultTenant: () => request('/tenant/reset', { method: 'POST' }),
|
||||
createTenant: (data: Partial<TenantInfo>) => request('/tenant/hierarchy/create', { method: 'POST', data }),
|
||||
updateTenant: (data: Partial<TenantInfo>) => request('/tenant/hierarchy/update', { method: 'PUT', data }),
|
||||
deleteTenant: (tenantId: string) => request(`/tenant/hierarchy/delete`, { method: 'DELETE', params: { tenantId } }),
|
||||
// 可访问租户树(保持后端原始返回,避免破坏既有前端逻辑)
|
||||
getAccessibleTenants: () => request('/api-user/tenant/accessible', { method: 'GET' }),
|
||||
// 切换当前查询租户(新)
|
||||
switchTenant: (tenantId: string) => request('/api-user/tenant/switch-query', { method: 'POST', params: { tenantId } }),
|
||||
// 当前租户详情(新)
|
||||
getCurrentTenant: () => request('/api-user/tenant/current/info', { method: 'GET' }),
|
||||
// 当前查询范围统计(新)
|
||||
getScopeStats: () => request('/api-user/tenant/scope/stats', { method: 'GET' }),
|
||||
// 重置为默认租户
|
||||
resetToDefaultTenant: () => request('/api-user/tenant/reset', { method: 'POST' }),
|
||||
// 租户层级 CRUD
|
||||
createTenant: async (data: Partial<TenantInfo>) => {
|
||||
const res: any = await request('/api-user/tenant/hierarchy/create', { method: 'POST', data });
|
||||
// 兼容 resp_code 结构
|
||||
if (typeof res?.resp_code !== 'undefined') return { success: res.resp_code === 0, msg: res.resp_msg, data: res.data } as any;
|
||||
if (typeof res?.success !== 'undefined') return res;
|
||||
return { success: true, data: res } as any;
|
||||
},
|
||||
updateTenant: async (data: Partial<TenantInfo>) => {
|
||||
const res: any = await request('/api-user/tenant/hierarchy/update', { method: 'PUT', data });
|
||||
if (typeof res?.resp_code !== 'undefined') return { success: res.resp_code === 0, msg: res.resp_msg, data: res.data } as any;
|
||||
if (typeof res?.success !== 'undefined') return res;
|
||||
return { success: true, data: res } as any;
|
||||
},
|
||||
deleteTenant: async (tenantId: string) => {
|
||||
const res: any = await request('/api-user/tenant/hierarchy/delete', { method: 'DELETE', params: { tenantId } });
|
||||
if (typeof res?.resp_code !== 'undefined') return { success: res.resp_code === 0, msg: res.resp_msg, data: res.data } as any;
|
||||
if (typeof res?.success !== 'undefined') return res;
|
||||
return { success: true, data: res } as any;
|
||||
},
|
||||
getTenantList: (params: { parentTenantId?: string; tenantName?: string; status?: number; current?: number; pageSize?: number; }) =>
|
||||
request('/tenant/hierarchy/list', {
|
||||
request('/api-user/tenant/hierarchy/list', {
|
||||
method: 'GET',
|
||||
params: { ...params, page: params.current, size: params.pageSize },
|
||||
}),
|
||||
getTenantDetail: (tenantId: string) => request(`/tenant/hierarchy/detail/${tenantId}`, { method: 'GET' }),
|
||||
getTenantDetail: async (tenantId: string) => {
|
||||
const res: any = await request(`/api-user/tenant/hierarchy/detail/${tenantId}`, { method: 'GET' });
|
||||
if (typeof res?.resp_code !== 'undefined') return { success: res.resp_code === 0, msg: res.resp_msg, data: res.data } as any;
|
||||
if (typeof res?.success !== 'undefined') return res;
|
||||
return { success: true, data: res } as any;
|
||||
},
|
||||
// 规范化获取详情,供表单使用(可选导出)
|
||||
getTenantDetailStd: async (tenantId: string) => {
|
||||
const res: any = await request(`/api-user/tenant/hierarchy/detail/${tenantId}`, { method: 'GET' });
|
||||
if (typeof res?.resp_code !== 'undefined') return { success: res.resp_code === 0, msg: res.resp_msg, data: res.data } as any;
|
||||
if (typeof res?.success !== 'undefined') return res;
|
||||
return { success: true, data: res } as any;
|
||||
},
|
||||
};
|
||||
|
||||
declare global {
|
||||
|
||||
Reference in New Issue
Block a user