浏览代码

feat(删除权益): 删除权益

tangning 3 年之前
父节点
当前提交
18e64eea6d
共有 3 个文件被更改,包括 31 次插入2 次删除
  1. 11 0
      src/api/rightsEnterprises/list.ts
  2. 16 1
      src/views/rightsEnterprises/list.vue
  3. 4 1
      src/views/staff/detailsModal.vue

+ 11 - 0
src/api/rightsEnterprises/list.ts

@@ -25,6 +25,7 @@ enum Api {
   allListType = '/zfb-api/zfb/shop/staffPerm/allListType',
   deviceType = '/zfb-api/zfb/cameraIncrement/incrementTypes',
   addCamrea = '/zfb-api/zfb/cameraIncrement/add',
+  deleteRights = '/zfb-api/zfb/shop/staffPerm/delete',
 }
 
 /**
@@ -139,6 +140,16 @@ export const unbindRights = (params) =>
     },
   });
 
+export const deleteRights = (params) =>
+  defHttp.post<Result>({
+    url: Api.deleteRights,
+    params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });
+
 export const unbindCamera = (params) =>
   defHttp.post<Result>({
     url: Api.cameraUnbind,

+ 16 - 1
src/views/rightsEnterprises/list.vue

@@ -28,6 +28,15 @@
               onClick: handleDelete.bind(null, record),
             },
             {
+              color: 'error',
+              label: '删除',
+              ifShow: !record.userId,
+              popConfirm: {
+                title: '是否确认删除',
+                confirm: deleteConfirm.bind(null, record),
+              },
+            },
+            {
               label: '解绑',
               ifShow:
                 getCheckRole([RoleEnum.PLAT_ADMIN]) &&
@@ -53,7 +62,7 @@
   import { uploadApi } from '/@/api/sys/upload';
   import BindModal from './BindModal.vue';
   import addModal from './addModal.vue';
-  import { staffList, unbindRights } from '/@/api/rightsEnterprises/list';
+  import { staffList, unbindRights, deleteRights } from '/@/api/rightsEnterprises/list';
   import { useI18n } from '/@/hooks/web/useI18n';
   // import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
   import dayjs from 'dayjs';
@@ -276,6 +285,11 @@
           ...modelRef,
         });
       }
+      async function deleteConfirm(record) {
+        let res = await deleteRights({ id: record.id });
+        console.log('deleteRights', res);
+        reload();
+      }
       function handleUpBind(record) {
         createConfirm({
           iconType: 'warning',
@@ -304,6 +318,7 @@
         register,
         handleEdit,
         handleDelete,
+        deleteConfirm,
         uploadApi: uploadApi as any,
         RoleEnum,
         surplusSubNum,

+ 4 - 1
src/views/staff/detailsModal.vue

@@ -73,8 +73,11 @@
                   return Promise.reject(t('common.phoneError'));
                 }
                 try {
+                  if (title.value == '编辑') {
+                    return Promise.resolve();
+                  }
                   let res = await checkUserApi({ phone: value });
-                  console.log('res', res);
+                  console.log('res', res, 'title', title.value);
                   if (res == true) {
                     return Promise.resolve();
                   } else {