Quellcode durchsuchen

feat:员工管理-绑定企微账号,排除已绑定的企微账号

caoliqin vor 1 Woche
Ursprung
Commit
d887bae093
1 geänderte Dateien mit 11 neuen und 4 gelöschten Zeilen
  1. 11 4
      src/views/company/components/selectQwUser.vue

+ 11 - 4
src/views/company/components/selectQwUser.vue

@@ -46,7 +46,7 @@
       @selection-change="handleSelectionChange"
     >
       <!-- 添加多选列 -->
-      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column type="selection" width="55" align="center" :selectable="checkSelectable" />
       <el-table-column label="企微昵称" align="center" prop="qwUserName" />
       <el-table-column label="企微账号" align="center" prop="qwUserId" />
       <el-table-column label="企微所属部门" align="center" prop="departmentName" />
@@ -129,6 +129,10 @@ export default {
     updateCorpId(){
       this.getList();
     },
+    // 检查是否可选择(状态不为1的用户才可选择)
+    checkSelectable(row, index) {
+      return row.status !== 1;
+    },
     /** 查询客户列表 */
     getList() {
       this.loading = true;
@@ -148,9 +152,10 @@ export default {
     // 设置预选中的项
     setPreSelectedItems() {
       if (this.preSelectedUserIds.length > 0 && this.customerList.length > 0) {
-        // 找到需要预选中的行
+        // 找到需要预选中的行,排除状态为1的用户
         const selectedRows = this.customerList.filter(row =>
-          this.preSelectedUserIds.includes(row.id)
+          this.preSelectedUserIds.includes(row.id) &&
+          row.status !== 1
         );
 
         // 设置选中状态
@@ -164,7 +169,9 @@ export default {
 
     // 多选处理
     handleSelectionChange(selection) {
-      this.selectedUsers = selection;
+      this.selectedUsers = selection.filter(item =>
+        item.status !== 1
+      );
     },
 
     // 批量绑定选择