loki 3 năm trước cách đây
mục cha
commit
2e40dc397c

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

@@ -20,3 +20,9 @@ export const delItem = ({ id, ...params }) =>
 
 export const getSelectList = params =>
   api.get(`/yxl-back-end/framework/uiac/account/search-select`, params);
+
+export const getUserRole = ({ id, ...params }) =>
+  api.get(`/yxl-back-end/framework/uiac/account/${id}/account-role`, params);
+
+export const updateUserRole = ({ id, ...params }) =>
+  api.put(`/yxl-back-end/framework/uiac/account/${id}/account-role`, params);

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

@@ -19,6 +19,8 @@ import PhotoUpload from 'views/photographerManagement/photoVerify/modal/ItemModa
 import PhotoMultUpload from 'views/photographerManagement/photoVerify/modal/MultItemModal.vue';
 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;
@@ -41,6 +43,13 @@ const modal = (Component, props) => {
   document.body.appendChild(_component.$el);
 };
 
+let AccountRoleModal = data => {
+  modal(AccountRole, data);
+};
+Vue.prototype.$AccountRoleModal = params => {
+  AccountRoleModal(params);
+};
+
 let UpdateAppItemModal = data => {
   modal(UpdateAppItem, data);
 };

+ 37 - 6
src/views/systemManagement/accountManagement/index.vue

@@ -107,7 +107,8 @@ export default {
           width: '120',
           type: 'tag',
           fetchTagType: val => 'info',
-          tagName: row => row.gender === 0 ? '未知' : row.gender === 1 ? '男' : '女'
+          tagName: row =>
+            row.gender === 0 ? '未知' : row.gender === 1 ? '男' : '女'
         },
         {
           key: 'createAt',
@@ -121,15 +122,45 @@ export default {
           type: 'tag',
           fetchTagType: val => (val ? 'danger' : 'info'),
           tagName: row => (row.isLocked ? '是' : '否')
+        },
+        {
+          key: 'action',
+          name: '操作',
+          width: '120',
+          render: (h, { row }) => {
+            const action = [];
+            action.push(
+              h(
+                'el-button',
+                {
+                  props: {
+                    type: 'text'
+                  },
+                  on: {
+                    click: () =>
+                      this.$AccountRoleModal({
+                        id: row.id
+                      })
+                  }
+                },
+                '分配角色'
+              )
+            );
+
+            return h('div', action);
+          }
         }
-        // {
-        //   key: 'action',
-        //   name: '操作',
-        //   width: '120'
-        // }
       ]
     };
   },
+
+  created() {
+    this.$g_on('account_reload', this.reload);
+  },
+
+  beforeDestroy() {
+    this.$g_off('account_reload', this.reload);
+  },
   methods: {
     async pageChange(page) {
       this.pagination.page = page;