57 lines
1.9 KiB
Vue
57 lines
1.9 KiB
Vue
|
|
import { defHttp } from '/@/utils/http/axios';
|
|||
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|||
|
|
|
|||
|
|
const { createConfirm } = useMessage();
|
|||
|
|
|
|||
|
|
enum Api {
|
|||
|
|
list = '/xslmes/mesXslCustomer/list',
|
|||
|
|
queryById = '/xslmes/mesXslCustomer/queryById',
|
|||
|
|
save = '/xslmes/mesXslCustomer/add',
|
|||
|
|
edit = '/xslmes/mesXslCustomer/edit',
|
|||
|
|
updateStatus = '/xslmes/mesXslCustomer/updateStatus',
|
|||
|
|
deleteOne = '/xslmes/mesXslCustomer/delete',
|
|||
|
|
deleteBatch = '/xslmes/mesXslCustomer/deleteBatch',
|
|||
|
|
importExcel = '/xslmes/mesXslCustomer/importExcel',
|
|||
|
|
exportXls = '/xslmes/mesXslCustomer/exportXls',
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export const getExportUrl = Api.exportXls;
|
|||
|
|
export const getImportUrl = Api.importExcel;
|
|||
|
|
|
|||
|
|
export const list = (params) => defHttp.get({ url: Api.list, params });
|
|||
|
|
|
|||
|
|
export const queryById = (params: { id: string }) => defHttp.get({ url: Api.queryById, params });
|
|||
|
|
|
|||
|
|
export const deleteOne = (params, handleSuccess) => {
|
|||
|
|
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
|
|||
|
|
handleSuccess();
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
export const batchDelete = (params, handleSuccess) => {
|
|||
|
|
createConfirm({
|
|||
|
|
iconType: 'warning',
|
|||
|
|
title: '确认删除',
|
|||
|
|
content: '是否删除选中数据',
|
|||
|
|
okText: '确认',
|
|||
|
|
cancelText: '取消',
|
|||
|
|
onOk: () => {
|
|||
|
|
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
|
|||
|
|
handleSuccess();
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
export const saveOrUpdate = (params, isUpdate) => {
|
|||
|
|
const url = isUpdate ? Api.edit : Api.save;
|
|||
|
|
return defHttp.post({ url, params });
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
/** 启用/停用:status 0 启用 1 停用(与供应商管理 MesXslSupplier.api.updateStatus 一致) */
|
|||
|
|
export const updateStatus = (params: { id: string; status: string }, handleSuccess?: () => void) => {
|
|||
|
|
return defHttp.post({ url: Api.updateStatus, params }, { joinParamsToUrl: true }).then(() => {
|
|||
|
|
handleSuccess?.();
|
|||
|
|
});
|
|||
|
|
};
|