浏览代码

产品分类-批量删除api

jingbb 6 月之前
父节点
当前提交
382c5644ee
共有 1 个文件被更改,包括 23 次插入2 次删除
  1. 23 2
      src/views/BasicData/api/productCassification.api.ts

+ 23 - 2
src/views/BasicData/api/productCassification.api.ts

@@ -1,11 +1,13 @@
 import { defHttp } from '/@/utils/http/axios';
 import { Modal } from 'ant-design-vue';
-
+import { useMessage } from "/@/hooks/web/useMessage";
+const { createConfirm } = useMessage();
 enum Api {
   list = '/baseCode/baseProductClass/list',
   save = '/baseCode/baseProductClass/add',
   edit = '/baseCode/baseProductClass/edit',
   deleteDict = '/baseCode/baseProductClass/delete',
+  deleteBatch = 'baseCode/baseProductClass/deleteBatch',
 }
 
 export const list = (params) => defHttp.get({ url: Api.list, params });
@@ -28,4 +30,23 @@ export const deleteDict = (params, handleSuccess) => {
   return defHttp.delete({ url: Api.deleteDict, 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();
+      });
+    }
+  });
+}