2026-05-13 15:49:51 +08:00
|
|
|
|
import { defHttp } from '/@/utils/http/axios';
|
|
|
|
|
|
|
|
|
|
|
|
enum Api {
|
|
|
|
|
|
list = '/print/bizTemplateBind/list',
|
|
|
|
|
|
add = '/print/bizTemplateBind/add',
|
|
|
|
|
|
edit = '/print/bizTemplateBind/edit',
|
|
|
|
|
|
deleteOne = '/print/bizTemplateBind/delete',
|
|
|
|
|
|
bizTypes = '/print/bizTemplateBind/bizTypes',
|
2026-05-13 17:25:13 +08:00
|
|
|
|
bizTypesForBinding = '/print/bizTemplateBind/bizTypesForBinding',
|
|
|
|
|
|
permWhitelist = '/print/bizTemplateBind/permWhitelist',
|
2026-05-13 15:49:51 +08:00
|
|
|
|
parseTemplateFields = '/print/bizTemplateBind/parseTemplateFields',
|
|
|
|
|
|
previewMappedData = '/print/bizTemplateBind/previewMappedData',
|
2026-05-13 17:25:13 +08:00
|
|
|
|
detailSlots = '/print/bizTemplateBind/detailSlots',
|
|
|
|
|
|
bizFieldsForDetailSlot = '/print/bizTemplateBind/bizFieldsForDetailSlot',
|
2026-05-13 15:49:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export const list = (params) => defHttp.get({ url: Api.list, params });
|
|
|
|
|
|
// 与系统其它模块一致:body 走 params 键
|
|
|
|
|
|
export const add = (params) => defHttp.post({ url: Api.add, params });
|
|
|
|
|
|
export const edit = (params) => defHttp.put({ url: Api.edit, params });
|
|
|
|
|
|
export const deleteOne = (params, handleSuccess?) =>
|
|
|
|
|
|
defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => handleSuccess?.());
|
|
|
|
|
|
|
|
|
|
|
|
export const bizTypes = () => defHttp.get({ url: Api.bizTypes });
|
2026-05-14 17:11:15 +08:00
|
|
|
|
/** 新增/编辑绑定时可选业务(受打印业务白名单过滤);后端批量查缓存与菜单,数据多时延长超时 */
|
|
|
|
|
|
export const bizTypesForBinding = () =>
|
|
|
|
|
|
defHttp.get({ url: Api.bizTypesForBinding, timeout: 120000 });
|
2026-05-13 17:25:13 +08:00
|
|
|
|
/** 白名单:已勾选菜单 id + 完整业务目录 */
|
|
|
|
|
|
export const getPermWhitelist = () => defHttp.get({ url: Api.permWhitelist });
|
|
|
|
|
|
/** 勾选菜单多时后端需批量 upsert,默认 10s 易超时 */
|
|
|
|
|
|
export const savePermWhitelist = (data: { permIds: string[] }) =>
|
|
|
|
|
|
defHttp.post({ url: Api.permWhitelist, data, timeout: 3 * 60 * 1000 });
|
2026-05-13 15:49:51 +08:00
|
|
|
|
export const parseTemplateFields = (templateId: string) =>
|
|
|
|
|
|
defHttp.get({
|
|
|
|
|
|
url: Api.parseTemplateFields,
|
|
|
|
|
|
params: { templateId, _t: Date.now() },
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/** 预览映射后的打印数据 */
|
|
|
|
|
|
export const previewMappedData = (data: { bizCode: string; bizDataJson: Record<string, unknown> }) =>
|
|
|
|
|
|
defHttp.post({ url: Api.previewMappedData, data });
|
2026-05-13 17:25:13 +08:00
|
|
|
|
|
|
|
|
|
|
/** 主实体上可作为明细的数据属性(List/数组/嵌套对象) */
|
|
|
|
|
|
export const detailSlots = (bizCode: string) =>
|
|
|
|
|
|
defHttp.get<{ propertyName: string; itemEntityClassFqn: string; slotKind: string; label: string }[]>({
|
|
|
|
|
|
url: Api.detailSlots,
|
|
|
|
|
|
params: { bizCode },
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/** 反射明细元素类字段,fieldKey 已带「属性名.」前缀 */
|
|
|
|
|
|
export const bizFieldsForDetailSlot = (params: {
|
|
|
|
|
|
bizCode: string;
|
|
|
|
|
|
detailProperty: string;
|
|
|
|
|
|
slotKind?: string;
|
|
|
|
|
|
}) =>
|
|
|
|
|
|
defHttp.get<{ fieldKey: string; label: string; description?: string }[]>({
|
|
|
|
|
|
url: Api.bizFieldsForDetailSlot,
|
|
|
|
|
|
params,
|
|
|
|
|
|
});
|