Browse Source

关联账号前端修改

xujie 1 year ago
parent
commit
3614478ae9
1 changed files with 31 additions and 13 deletions
  1. 31 13
      src/views/system/user/mapperUser.vue

+ 31 - 13
src/views/system/user/mapperUser.vue

@@ -25,12 +25,12 @@
           关联人员列表
         </h3>
         <div style="margin-bottom: 10px">
-          <el-button
-            @click="openSelect"            
+          <el-button v-if="userSource === 1"
+            @click="openSelect"
             ><span class="requiredlabel">选择关联人员</span></el-button
           >
           <el-button
-            @click="deleteSelected"            
+            @click="deleteSelected"
             >批量删除</el-button
           >
         </div>
@@ -66,10 +66,25 @@
             align="center"
             show-overflow-tooltip
           >
-          </el-table-column>         
+          </el-table-column>
+          <el-table-column
+            prop="associated"
+            label="关联关系"
+            width="300px"
+            align="center"
+            show-overflow-tooltip
+          >
+            <template slot-scope="r">
+              {{
+                r.row.associated == 1
+                  ? "被关联"
+                  : "关联"
+              }}
+            </template>
+          </el-table-column>
           <el-table-column label="操作" align="center">
             <template v-slot="{ row }">
-              <el-button               
+              <el-button
                 type="text"
                 @click="removeRow(row)"
                 >删除</el-button
@@ -113,6 +128,7 @@ export default {
       selectedRows:[],
       searchUserPrap:{ source:0},
 
+      userSource: 0,
       //基础信息key
       infoKeys: [
         { label: '用户名称', key: 'username' },
@@ -143,7 +159,7 @@ export default {
       total: 0,
     };
   },
-  computed: {    
+  computed: {
   },
   created() {
   },
@@ -155,8 +171,8 @@ export default {
     },
     async show(id, other = {}) {
       this.userId=id;
-      this.tableData=[];      
-      await this.getInfo(id, other);  
+      this.tableData=[];
+      await this.getInfo(id, other);
       this.isShow = true;
     },
     getInfo(userId) {
@@ -170,6 +186,7 @@ export default {
         this.roleName = data.roleName;
         this.sex = data.sex;
         this.status = data.status;
+        this.userSource = data.source;
       });
       getUserMapper(userId).then((data) => {
         if (!data.data) return;
@@ -199,7 +216,7 @@ export default {
         }
 
       // this.tableData = this.tableData.filter((d) => selectedIds.includes(d.id));
-      
+
       // 一个机构下人只能关联一个自建账号
       for (let i = 0; i < selectList.length; i++) {
         let item = selectList[i];
@@ -249,7 +266,8 @@ export default {
       this.tableData.map((item) => item.subUserId);
       let data = {
         masterUserId: this.userId,
-        mapperUserIds: this.tableData && this.tableData.length>0 ? this.tableData.map((item) => item.subUserId):[]
+        mapperUserIds: this.tableData && this.tableData.length>0 ? this.tableData.map((item) => item.subUserId):[],
+        userSource: this.userSource
       }
       updateUserMapper(data).then((response) => {
         this.$modal.msgSuccess("关联成功");
@@ -260,9 +278,9 @@ export default {
     onClose()
     {
       this.userId=null;
-      this.tableData=[]; 
-      this.isShow=false;     
-    } 
+      this.tableData=[];
+      this.isShow=false;
+    }
   }
 };
 </script>