137 lines
3.4 KiB
TypeScript
137 lines
3.4 KiB
TypeScript
import { defHttp } from '/@/utils/http/axios';
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
|
const { createConfirm } = useMessage();
|
|
|
|
enum Api {
|
|
list = '/health-emergency/emergency/scheduleCustom/list',
|
|
save = '/health-emergency/emergency/scheduleCustom/add',
|
|
edit = '/health-emergency/emergency/scheduleCustom/edit',
|
|
deleteOne = '/health-emergency/emergency/scheduleCustom/delete',
|
|
deleteBatch = '/health-emergency/emergency/scheduleCustom/deleteBatch',
|
|
importExcel = '/health-emergency/emergency/scheduleCustom/importExcel',
|
|
exportXls = '/health-emergency/emergency/scheduleCustom/exportXls',
|
|
queryById = '/emergency/scheduleCustom/queryById',
|
|
delCustom = '/health-emergency/emergency/scheduleCustom/delCustom',
|
|
updateScheduleCustom = '/health-emergency/emergency/scheduleCustom/updateScheduleCustom',
|
|
}
|
|
|
|
/**
|
|
* 导出api
|
|
* @param params
|
|
*/
|
|
export const getExportUrl = Api.exportXls;
|
|
|
|
export const queryByIdUrl = Api.queryById;
|
|
|
|
/**
|
|
* 导入api
|
|
*/
|
|
export const getImportUrl = Api.importExcel;
|
|
|
|
/**
|
|
* 列表接口
|
|
* @param params
|
|
*/
|
|
export const list = (params) => defHttp.get({ url: Api.list, params });
|
|
|
|
/**
|
|
* 删除单个
|
|
*/
|
|
export const deleteOne = (params, handleSuccess) => {
|
|
createConfirm({
|
|
iconType: 'warning',
|
|
title: '确认删除',
|
|
content: '是否删除选中数据',
|
|
okText: '确认',
|
|
cancelText: '取消',
|
|
onOk: () =>
|
|
defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
|
|
handleSuccess();
|
|
}),
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 批量删除
|
|
* @param params
|
|
*/
|
|
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 customDeleteOne = (params, handleSuccess) => {
|
|
createConfirm({
|
|
iconType: 'warning',
|
|
title: '确认删除',
|
|
content: '是否删除该数据',
|
|
okText: '确认',
|
|
cancelText: '取消',
|
|
onOk: () => {
|
|
return defHttp.post({ url: Api.delCustom, data: params }).then(() => {
|
|
console.log('查询');
|
|
handleSuccess();
|
|
});
|
|
},
|
|
});
|
|
};
|
|
/**
|
|
* 保存或者更新
|
|
* @param params
|
|
*/
|
|
export const saveOrUpdate = (params, isUpdate) => {
|
|
const url = isUpdate ? Api.edit : Api.updateScheduleCustom;
|
|
return defHttp.post({ url: url, params });
|
|
};
|
|
/**
|
|
* 专业人员列表
|
|
* */
|
|
export const professional = () => {
|
|
const arr = [
|
|
{
|
|
label: '张1',
|
|
value: '张1111',
|
|
},
|
|
{
|
|
label: '张2',
|
|
value: '张2222',
|
|
},
|
|
{
|
|
label: '张3',
|
|
value: '张3333',
|
|
},
|
|
];
|
|
return new Promise((resolve) => resolve(arr));
|
|
};
|
|
|
|
/**
|
|
* 专业人员列表
|
|
* */
|
|
export const operator = () => {
|
|
const arr = [
|
|
{
|
|
label: '李1',
|
|
value: '李1111',
|
|
},
|
|
{
|
|
label: '李2',
|
|
value: '李2222',
|
|
},
|
|
{
|
|
label: '李3',
|
|
value: '李3333',
|
|
},
|
|
];
|
|
return new Promise((resolve) => resolve(arr));
|
|
};
|