60 lines
2.7 KiB
Vue
60 lines
2.7 KiB
Vue
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',
|
||
bizTypesForBinding = '/print/bizTemplateBind/bizTypesForBinding',
|
||
permWhitelist = '/print/bizTemplateBind/permWhitelist',
|
||
parseTemplateFields = '/print/bizTemplateBind/parseTemplateFields',
|
||
previewMappedData = '/print/bizTemplateBind/previewMappedData',
|
||
detailSlots = '/print/bizTemplateBind/detailSlots',
|
||
bizFieldsForDetailSlot = '/print/bizTemplateBind/bizFieldsForDetailSlot',
|
||
}
|
||
|
||
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 });
|
||
/** 新增/编辑绑定时可选业务(受打印业务白名单过滤);后端批量查缓存与菜单,数据多时延长超时 */
|
||
export const bizTypesForBinding = () =>
|
||
defHttp.get({ url: Api.bizTypesForBinding, timeout: 120000 });
|
||
/** 白名单:已勾选菜单 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 });
|
||
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 });
|
||
|
||
/** 主实体上可作为明细的数据属性(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,
|
||
});
|