浏览代码

调整提交

Lijy 2 年之前
父节点
当前提交
b7d9f6032a
共有 1 个文件被更改,包括 41 次插入22 次删除
  1. 41 22
      fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue

+ 41 - 22
fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue

@@ -1032,7 +1032,7 @@
         </el-dialog>
 
         <!-- 按部门选择人员 -->
-        <el-dialog :title="$t('selectingParticipants')"  v-if="chooseParticipVisible" :visible.sync="chooseParticipVisible" :close-on-click-modal="false" customClass="customWidth" width="500px">
+        <el-dialog :title="$t('selectingParticipants')"  :visible.sync="chooseParticipVisible" :close-on-click-modal="false" customClass="customWidth" width="500px">
             <!-- <el-input style="width:100%" v-model="filterName" placeholder="请输入姓名搜索" @change="findUserInTree"></el-input> -->
             <div v-if="user.userNameNeedTranslate == '1'">
                 <el-input placeholder="请输入内容" v-model.trim="wxFilterText" class="input-with-select">
@@ -1046,7 +1046,7 @@
                     :placeholder="$t('keywordfiltering')"
                     v-model="filterText" v-if="user.userNameNeedTranslate != '1'">
                     </el-input>
-                    <el-tree :data="deptMembData" show-checkbox :props="defaultProps" node-key="id"
+                    <el-tree :data="deptMembData" show-checkbox :default-expand-all="searchPersonnelFlg" :props="defaultProps" node-key="id"
                         ref="chooseMembTree" @check-change="onTreeItemChange" :default-checked-keys="addForm.userId"
                         highlight-current  :filter-node-method="filterNode">
                         <span class="custom-tree-node" slot-scope="{ node, data }">
@@ -1462,7 +1462,10 @@ a {
                 participationId: '',
 
                 importProjectBeforeDialog: false,
-                paramData1: false
+                paramData1: false,
+                chosenListBackup: [], // 备份
+                searchPersonnelFlg: false,
+                searchPersonnelFlgnum: 1
             };
         },
         // 过滤器
@@ -2655,6 +2658,10 @@ a {
                 this.chooseParticipVisible = true;
                 this.filterText = ''
                 this.wxFilterText = ''
+                if(this.user.userNameNeedTranslate == 1) {
+                    this.getDepartment()
+                }
+                this.chosenListBackup = this.$refs.chooseMembTree.getCheckedNodes();
             },
             onTreeItemChange() {
                 var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
@@ -2692,6 +2699,11 @@ a {
             chooseParticip() {
                 this.chooseParticipVisible = false;
                 var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
+                // console.log(chosenList, '数据')
+                // return
+                if(this.searchPersonnelFlg) {
+                    chosenList = [...chosenList, ...this.chosenListBackup]
+                }
                 this.chosenMembList = chosenList.filter(item=>item.isUser == 1);
                 this.addForm.userNames = '';
                 this.addFormUserNames = []
@@ -2759,29 +2771,36 @@ a {
             // 企业微信搜索
             echartDepartment() {
                 console.log('我点击了搜索')
-                this.http.post("/department/listAllMemb", {
-                    keyword: this.wxFilterText,
-                    cursor: ''
-                },
-                res => {
-                    if (res.code == "ok") {
-                        var list = res.data.data;
-                        this.setUserToDept(list);
-                        this.deptMembData = list;
-                        console.log(this.deptMembData, '数据也')
-                    } else {
+                if(this.wxFilterText != '') {
+                    this.searchPersonnelFlg = true
+                    this.http.post("/department/listAllMemb", {
+                        keyword: this.wxFilterText,
+                        cursor: ''
+                    },
+                    res => {
+                        if (res.code == "ok") {
+                            var list = res.data.data;
+                            this.setUserToDept(list);
+                            this.deptMembData = list;
+                            console.log(this.deptMembData, '数据也')
+                            this.$forceUpdate()
+                        } else {
+                            this.$message({
+                                message: res.msg,
+                                type: "error"
+                            });
+                        }
+                    },
+                    error => {
                         this.$message({
-                            message: res.msg,
+                            message: error,
                             type: "error"
                         });
-                    }
-                },
-                error => {
-                    this.$message({
-                        message: error,
-                        type: "error"
                     });
-                });
+                } else {
+                    this.searchPersonnelFlg = false
+                    this.getDepartment()
+                }
             },
             
             setUserToDept(list) {