Преглед изворни кода

Merge branch 'master' of http://git.cc-lotus.info/service-platform/web-test into master

wxy пре 4 година
родитељ
комит
927d92a0c9

+ 26 - 33
src/views/superAdminCenter/user/index.vue

@@ -216,6 +216,7 @@ import upload from '@/components/uploadone.vue';
 import dataTable from '@/components/data-table.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: users } = createNamespacedHelpers('users');
+const { mapActions: authUser } = createNamespacedHelpers('authUser');
 const { mapActions: expertsuser } = createNamespacedHelpers('expertsuser');
 export default {
   name: 'index',
@@ -246,6 +247,7 @@ export default {
     this.search();
   },
   methods: {
+    ...authUser({ authdelete: 'delete' }),
     ...users(['fetch', 'create', 'query', 'update', 'delete', 'userquery']),
     ...expertsuser({ exportuserFetch: 'fetch', exportuserCreate: 'create', exportuserUpdate: 'update' }),
     async search({ skip = 0, limit = 10, pid = '', ...info } = {}) {
@@ -339,8 +341,6 @@ export default {
         }
       }
     },
-    // 删除
-    // handleDelete() {},
     // 取消
     handleClose() {
       this.dialog = false;
@@ -361,38 +361,31 @@ export default {
     //   this.$set(this, `form`, data);
     //   this.dialog = true;
     // },
-    async handleDelete(id) {
-      const res = await this.delete(id);
-      if (this.$checkRes(res)) {
-        this.$message({
-          message: '删除信息成功',
-          type: 'success',
-        });
-        this.search();
-      }
+    // 刪除
+    async handleDelete(data) {
+      this.$confirm('您确定要删除此信息吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      })
+        .then(async () => {
+          console.log(data);
+          if (data.role == '4' || data.role == '5') {
+            let res = await this.delete(data.id);
+            if (this.$checkRes(res)) {
+              res = await this.authdelete(data.id);
+              if (this.$checkRes(res)) {
+                this.$message({
+                  message: '删除信息成功',
+                  type: 'success',
+                });
+                this.search();
+              }
+            }
+          }
+        })
+        .catch(() => {});
     },
-    //删除
-    // async handleDelete(id) {
-    //   console.log(this.form);
-    //   console.log('-----------');
-    //   this.$confirm('您确定要删除此信息吗?', '提示', {
-    //     confirmButtonText: '确定',
-    //     cancelButtonText: '取消',
-    //     type: 'warning',
-    //   })
-    //     .then(async () => {
-    //       const res = await this.delete(id);
-    //       console.log(this.form);
-    //       if (this.$checkRes(res)) {
-    //         this.$message({
-    //           message: '删除信息成功',
-    //           type: 'success',
-    //         });
-    //         this.search();
-    //       }
-    //     })
-    //     .catch(() => {});
-    // },
   },
   computed: {
     ...mapState(['user']),

+ 1 - 1
src/views/superAdminCenter/user/parts/one.vue

@@ -71,7 +71,7 @@ export default {
       // console.log('hhhh1');
     },
     handleDelete(data) {
-      this.$emit('handleDelete', data.id);
+      this.$emit('handleDelete', data);
     },
   },
   computed: {

+ 1 - 1
src/views/superAdminCenter/user/parts/three.vue

@@ -70,7 +70,7 @@ export default {
       this.$emit('handleEdit', data);
     },
     handleDelete(data) {
-      this.$emit('handleDelete', data.id);
+      this.$emit('handleDelete', data);
     },
   },
   computed: {

+ 1 - 1
src/views/superAdminCenter/user/parts/two.vue

@@ -70,7 +70,7 @@ export default {
       this.$emit('handleEdit', data);
     },
     handleDelete(data) {
-      this.$emit('handleDelete', data.id);
+      this.$emit('handleDelete', data);
     },
   },
   computed: {