1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- import {defHttp} from '/@/utils/http/axios';
- import { useMessage } from "/@/hooks/web/useMessage";
- const { createConfirm } = useMessage();
- enum Api {
- list = '/cuspCode/cuspCustomerProfile/list',
- save='/cuspCode/cuspCustomerProfile/add',
- edit='/cuspCode/cuspCustomerProfile/edit',
- deleteOne = '/cuspCode/cuspCustomerProfile/delete',
- deleteBatch = '/cuspCode/cuspCustomerProfile/deleteBatch',
- importExcel = '/cuspCode/cuspCustomerProfile/importExcel',
- exportXls = '/cuspCode/cuspCustomerProfile/exportXls',
- cuspCustomerProfileManList = '/cuspCode/cuspCustomerProfile/queryCuspCustomerProfileManByMainId',
- }
- /**
- * 导出api
- * @param params
- */
- export const getExportUrl = Api.exportXls;
- /**
- * 导入api
- */
- export const getImportUrl = Api.importExcel;
- /**
- * 查询子表数据
- * @param params
- */
- export const cuspCustomerProfileManList = Api.cuspCustomerProfileManList;
- /**
- * 列表接口
- * @param params
- */
- export const list = (params) =>
- defHttp.get({url: Api.list, params});
- /**
- * 删除单个
- */
- export const deleteOne = (params,handleSuccess) => {
- return 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();
- });
- }
- });
- }
- /**
- * 保存或者更新
- * @param params
- */
- export const saveOrUpdate = (params, isUpdate) => {
- let url = isUpdate ? Api.edit : Api.save;
- return defHttp.post({url: url, params});
- }
|