LAPTOP-16IUEB3P\Lenovo 3 anni fa
parent
commit
48a2b298ad

+ 13 - 0
src/api/system/organization/index.js

@@ -108,3 +108,16 @@ export async function checkExistence (jobNumber) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+
+/**
+ * 解除绑定用户账号
+ * @param id 人员id
+ */
+export async function unbindLoginName (id) {
+  const res = await request.get('/main/user/unbind/' + id);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 26 - 3
src/views/system/organization/components/org-user-list.vue

@@ -55,6 +55,15 @@
         >
           修改
         </el-link>
+        <el-link
+          v-if="row.loginName"
+          type="primary"
+          :underline="false"
+          icon="el-icon-unlock"
+          @click="toUnBind(row)"
+        >
+          解绑
+        </el-link>
         <el-popconfirm
           class="ele-action"
           title="确定要删除此用户吗?"
@@ -82,7 +91,7 @@
 <script>
   import OrgUserSearch from './org-user-search.vue';
   import OrgUserEdit from './org-user-edit.vue';
-  import { getUserPage , removePersonnel } from '@/api/system/organization';
+  import { getUserPage , removePersonnel , unbindLoginName } from '@/api/system/organization';
 
   export default {
     components: { OrgUserSearch, OrgUserEdit },
@@ -161,8 +170,8 @@
           {
             columnKey: 'action',
             label: '操作',
-            width: 130,
-            align: 'center',
+            width: 200,
+            align: 'left',
             resizable: false,
             slot: 'action',
             showOverflowTooltip: true
@@ -202,6 +211,20 @@
         this.current = row;
         this.showEdit = true;
       },
+
+      // 解除绑定
+      toUnBind(row){
+        const loading = this.$loading({ lock: true });
+        unbindLoginName(row.id).then(res=>{
+           loading.close();
+           this.$message.success('解绑成功');
+           this.reload();
+        })
+        .catch((e) => {
+          loading.close();
+          this.$message.error(e.message);
+        });
+      },
       /* 删除 */
       remove(row) {
         const loading = this.$loading({ lock: true });

+ 1 - 1
src/views/system/user/components/role-select.vue

@@ -43,7 +43,7 @@
       }
       listRoles(params)
         .then(res => {
-          this.data = res.records;
+          this.data = res.list;
         })
         .catch((e) => {
           this.$message.error(e.message);