2026-05-12 14:09:41 +08:00
|
|
|
|
import { defHttp } from '/@/utils/http/axios';
|
|
|
|
|
|
import { Modal } from 'ant-design-vue';
|
|
|
|
|
|
|
|
|
|
|
|
enum Api {
|
|
|
|
|
|
list = '/mes/material/rawMaterialInspectStd/list',
|
|
|
|
|
|
save = '/mes/material/rawMaterialInspectStd/add',
|
|
|
|
|
|
edit = '/mes/material/rawMaterialInspectStd/edit',
|
|
|
|
|
|
deleteOne = '/mes/material/rawMaterialInspectStd/delete',
|
|
|
|
|
|
deleteBatch = '/mes/material/rawMaterialInspectStd/deleteBatch',
|
|
|
|
|
|
importExcel = '/mes/material/rawMaterialInspectStd/importExcel',
|
|
|
|
|
|
exportXls = '/mes/material/rawMaterialInspectStd/exportXls',
|
|
|
|
|
|
queryById = '/mes/material/rawMaterialInspectStd/queryById',
|
|
|
|
|
|
queryLineList = '/mes/material/rawMaterialInspectStd/queryLineListByStdId',
|
|
|
|
|
|
setEnable = '/mes/material/rawMaterialInspectStd/setEnable',
|
2026-05-18 11:13:55 +08:00
|
|
|
|
queryPrinters = '/mes/material/rawMaterialInspectStd/queryPrinters',
|
|
|
|
|
|
prepareNativePrint = '/mes/material/rawMaterialInspectStd/prepareNativePrint',
|
|
|
|
|
|
printPdf = '/mes/material/rawMaterialInspectStd/printPdf',
|
2026-05-12 14:09:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export const getExportUrl = Api.exportXls;
|
|
|
|
|
|
export const getImportUrl = Api.importExcel;
|
|
|
|
|
|
export const list = (params) => defHttp.get({ url: Api.list, params });
|
|
|
|
|
|
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
|
|
|
|
|
|
export const queryLineListByStdId = (params) => defHttp.get({ url: Api.queryLineList, params });
|
|
|
|
|
|
|
|
|
|
|
|
export const deleteOne = (params, handleSuccess) =>
|
|
|
|
|
|
defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
|
|
|
|
|
|
|
|
|
|
|
|
export const batchDelete = (params, handleSuccess) => {
|
|
|
|
|
|
Modal.confirm({
|
|
|
|
|
|
title: '确认删除',
|
|
|
|
|
|
content: '是否删除选中数据',
|
|
|
|
|
|
okText: '确认',
|
|
|
|
|
|
cancelText: '取消',
|
|
|
|
|
|
onOk: () =>
|
|
|
|
|
|
defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => handleSuccess()),
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export const saveOrUpdate = (params, isUpdate) => defHttp.post({ url: isUpdate ? Api.edit : Api.save, params });
|
|
|
|
|
|
|
|
|
|
|
|
export const setEnable = (params) => defHttp.post({ url: Api.setEnable, params });
|
2026-05-18 11:13:55 +08:00
|
|
|
|
|
|
|
|
|
|
export const queryPrinters = () => defHttp.get({ url: Api.queryPrinters });
|
|
|
|
|
|
|
|
|
|
|
|
export const prepareNativePrint = (id: string) =>
|
|
|
|
|
|
defHttp.get({
|
|
|
|
|
|
url: Api.prepareNativePrint,
|
|
|
|
|
|
params: { id, _t: Date.now() },
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/** id + 前端生成的 pdfBase64;printerName 空则用默认队列(与原材料卡片一致) */
|
|
|
|
|
|
export const printPdf = (data: { id: string; printerName?: string; pdfBase64: string; fileName?: string }) =>
|
|
|
|
|
|
defHttp.post({ url: Api.printPdf, data, timeout: 3 * 60 * 1000 });
|