loki 3 年之前
父节点
当前提交
59e233bf6f

+ 3 - 0
src/api/system/account.js

@@ -26,3 +26,6 @@ export const getUserRole = ({ id, ...params }) =>
 
 export const updateUserRole = ({ id, ...params }) =>
   api.put(`/yxl-back-end/framework/uiac/account/${id}/account-role`, params);
+
+export const lockAccount = id =>
+  api.del(`/yxl-back-end/framework/uiac/account/is-locked/${id}`, {});

+ 0 - 1
src/utils/dialog-helper.js

@@ -20,7 +20,6 @@ import PhotoMultUpload from 'views/photographerManagement/photoVerify/modal/Mult
 import AliOssMulti from 'views/photographerManagement/photoVerify/modal/ali-oss-multi.vue';
 import UpdateAppItem from 'views/baseManagement/updateList/modal/ItemModal.vue';
 import AccountRole from 'views/systemManagement/accountManagement/modal/RoleModal.vue';
-// import AccountRole from 'views/systemManagement/accountManagement/modal/RoleModal.vue';
 
 const modal = (Component, props) => {
   let _component = null;

+ 22 - 1
src/views/systemManagement/accountManagement/index.vue

@@ -40,7 +40,7 @@
 <script>
 import toolbar from './toolbar';
 import mxFilterList from '@/mixins/filterList';
-import { getPage, getCount } from '@/api/system/account';
+import { getPage, getCount, lockAccount } from '@/api/system/account';
 
 export default {
   name: 'AccountManagement',
@@ -146,6 +146,20 @@ export default {
                 '分配角色'
               )
             );
+            action.push(
+              h(
+                'el-button',
+                {
+                  props: {
+                    type: 'text'
+                  },
+                  on: {
+                    click: () => this.handlerLockAccount(row.id)
+                  }
+                },
+                row.isLocked ? '解封' : '禁用'
+              )
+            );
 
             return h('div', action);
           }
@@ -185,6 +199,13 @@ export default {
         }
         this.loadCallBack(data);
       }
+    },
+    async handlerLockAccount(id) {
+      const { success, msg } = await lockAccount(id);
+      if (success) {
+        this.$g_emit('account_reload');
+        this.$success('保存成功!');
+      }
     }
   }
 };

+ 52 - 52
src/views/systemManagement/accountManagement/modal/RoleModal.vue

@@ -2,7 +2,7 @@
   <el-dialog
     :title="title"
     :visible.sync="modal"
-    width="80%"
+    width="40%"
     :close-on-click-modal="false"
     @close="
       res => {
@@ -10,7 +10,7 @@
       }
     "
   >
-    <el-form ref="form" :model="form" :rules="rules" label-width="150px">
+    <el-form ref="form" :model="form" label-width="80px">
       <el-form-item label="角色列表" prop="auditStatus">
         <el-checkbox-group v-model="form.roles">
           <el-checkbox
@@ -40,62 +40,62 @@ export default {
     id: {
       type: String,
       default: ''
-    },
+    }
+  },
 
-    data() {
-      return {
-        title: '用户分配角色',
-        modal: true,
-        form: {
-          roles: []
-        },
-        options: []
-      };
-    },
+  data() {
+    return {
+      title: '用户分配角色',
+      modal: true,
+      form: {
+        roles: []
+      },
+      options: []
+    };
+  },
 
-    watch: {
-      id: {
-        handler(id) {
-          id && this.loadData();
-        },
-        immediate: true
-      }
-    },
+  watch: {
+    id: {
+      handler(id) {
+        id && this.loadData();
+      },
+      immediate: true
+    }
+  },
 
-    mounted() {
-      this.loadList();
-    },
+  mounted() {
+    this.loadList();
+  },
 
-    methods: {
-      async loadList() {
-        const { data } = await getList();
-        this.options = data.map(x => ({ key: x.code, label: x.name }));
-      },
-      async loadData() {
-        const { success, data, msg } = await getUserRole({
-          id: this.id
-        });
-        if (success) {
-          this.form = data;
-        }
-      },
+  methods: {
+    async loadList() {
+      const { data } = await getList();
+      this.options = data.map(x => ({ key: x.code, label: x.name }));
+    },
+    async loadData() {
+      const { success, data, msg } = await getUserRole({
+        id: this.id
+      });
+      if (success) {
+        this.form = data;
+      }
+    },
 
-      handleConfirm() {
-        this.$refs.form.validate(async valid => {
-          if (valid) {
-            const params = {
-              roles: this.form.roles
-            };
-            if (this.id) params.id = this.id;
-            const { success, msg } = await updateUserRole(params);
-            if (success) {
-              this.$success('保存成功!');
-              this.modal = false;
-              this.$g_emit('account_reload');
-            }
+    handleConfirm() {
+      this.$refs.form.validate(async valid => {
+        if (valid) {
+          const params = {
+            roles: this.form.roles
+          };
+          if (this.id) params.id = this.id;
+          const { success, msg } = await updateUserRole(params);
+          if (success) {
+            this.$success('保存成功!');
+            this.modal = false;
+            this.$g_emit('account_reload');
           }
-        });
-      }
+        }
+      });
     }
   }
 };