123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- import { defHttp } from '/@/utils/http/axios';
- import { Modal } from 'ant-design-vue';
- enum Api {
- list = '/safety/reportDataSyn/list',
- save = '/safety/reportDataSyn/add',
- edit = '/safety/reportDataSyn/edit',
- deleteById = '/safety/reportDataSyn/delete',
- readReportData= '/safety/reportDataSyn/readReportData',//手动从报表里提取数据
- importData = '/safety/reportDataSyn/importData',//导入
- exportData='/safety/reportDataSyn/exportData'//导出
- }
- /**
- * 导出
- * @param params
- */
- export const getExportUrl = (params) => defHttp.get({ url: Api.exportData, params, responseType: 'blob' });
- /**
- * 导入api
- */
- export const getImportUrl = (params, handleSuccess) => {
- return defHttp.post({ headers: { 'Content-Type': 'multipart/form-data' }, url: Api.importData, params }).then(() => {
- handleSuccess();
- });
- };
- /**
- * 手动从报表里提取数据
- * @param params
- */
- export const readReportData = (params) => {
- return defHttp.get({ url: Api.readReportData, params }, { joinParamsToUrl: true })
- };
- /**
- * 列表接口
- * @param params
- */
- export const list = (params) => defHttp.get({ url: Api.list, params });
- /**
- * 删除用户
- */
- export const deleteById = (params, handleSuccess) => {
- return defHttp.delete({ url: Api.deleteById, params }, { joinParamsToUrl: true }).then(() => {
- handleSuccess();
- });
- };
- /**
- * 批量删除用户
- * @param params
- */
- export const batchDeleteById = (params, handleSuccess) => {
- Modal.confirm({
- title: '确认删除',
- content: '是否删除选中数据',
- okText: '确认',
- cancelText: '取消',
- onOk: () => {
- return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
- handleSuccess();
- });
- },
- });
- };
- /**
- * 保存或者更新用户
- * @param params
- */
- export const saveOrUpdate = (params, isUpdate) => {
- const url = isUpdate ? Api.edit : Api.save;
- return defHttp.post({ url: url, params });
- };
|