Преглед изворни кода

调整企业微信的参与人搜索

Lijy пре 1 година
родитељ
комит
70002c08d0
1 измењених фајлова са 36 додато и 14 уклоњено
  1. 36 14
      fhKeeper/formulahousekeeper/timesheet/src/views/project/projectInside.vue

+ 36 - 14
fhKeeper/formulahousekeeper/timesheet/src/views/project/projectInside.vue

@@ -364,15 +364,15 @@
                     v-model="participantsFilterText">
                     v-model="participantsFilterText">
                     </el-input>
                     </el-input>
 
 
-                    <div v-if="user.userNameNeedTranslate == '1' && false">
-                        <el-input placeholder="请输入内容" v-model.trim="wxFilterText" class="input-with-select">
+                    <div v-if="user.userNameNeedTranslate == '1'">
+                        <el-input placeholder="请输输入关键字过滤" v-model.trim="participantsFilterText" class="input-with-select">
                             <el-button slot="append" icon="el-icon-search" @click="echartDepartment()"></el-button>
                             <el-button slot="append" icon="el-icon-search" @click="echartDepartment()"></el-button>
                         </el-input>
                         </el-input>
                     </div>
                     </div>
 
 
                     <el-tree :data="deptMembData" show-checkbox :props="defaultProps" node-key="id"
                     <el-tree :data="deptMembData" show-checkbox :props="defaultProps" node-key="id"
                         ref="chooseMembTree2" @check-change="onTreeItemChange" :default-checked-keys="alreadyPartArray"
                         ref="chooseMembTree2" @check-change="onTreeItemChange" :default-checked-keys="alreadyPartArray"
-                        highlight-current  :filter-node-method="filterNode">
+                        highlight-current  :filter-node-method="filterNode" v-loading="filterNodeFlag">
                         <span class="custom-tree-node" slot-scope="{ node, data }">
                         <span class="custom-tree-node" slot-scope="{ node, data }">
                             <span v-if="user.userNameNeedTranslate == '1'">
                             <span v-if="user.userNameNeedTranslate == '1'">
                                 <span v-if="node.data.children">
                                 <span v-if="node.data.children">
@@ -1494,13 +1494,22 @@
 
 
                 hideCompleted: false,
                 hideCompleted: false,
 
 
-                wxFilterText: ''
+                wxFilterText: '',
+
+                filterNodeFlag: false,
+                filterNodePersonnel: []
             };
             };
             
             
         },
         },
         watch: {
         watch: {
             participantsFilterText(val) {
             participantsFilterText(val) {
-                this.$refs.chooseMembTree2.filter(val);
+                let { userNameNeedTranslate } = JSON.parse(sessionStorage.getItem("user"))
+                if(userNameNeedTranslate != 1) {
+                    this.$refs.chooseMembTree2.filter(val);
+                }
+                if(!val) {
+                    this.$refs.chooseMembTree2.filter(val);
+                }
             }
             }
         },
         },
         methods: {
         methods: {
@@ -1671,8 +1680,13 @@
             },
             },
             // 筛选逻辑
             // 筛选逻辑
             filterNode(value, data) {
             filterNode(value, data) {
+                let { userNameNeedTranslate } = this.user
                 if (!value) return true;
                 if (!value) return true;
-                return data.label.indexOf(value) !== -1;
+                if(userNameNeedTranslate != '1') {
+                    return data.label.indexOf(value) !== -1;
+                } else {
+                    return this.filterNodePersonnel.some(item => item.includes(data.label))
+                }
             },
             },
             // 选中改变
             // 选中改变
             onTreeItemChange() {
             onTreeItemChange() {
@@ -3714,25 +3728,33 @@
             // 企业微信搜索
             // 企业微信搜索
             echartDepartment() {
             echartDepartment() {
                 console.log('我点击了搜索')
                 console.log('我点击了搜索')
-                if(this.wxFilterText != '') {
-                    this.http.post("/department/listAllMemb", {
-                        keyword: this.wxFilterText,
-                        cursor: ''
+                if(this.participantsFilterText != '') {
+                    this.filterNodeFlag = true
+                    this.http.post("/user/getEmployeeList", {
+                        keyword: this.participantsFilterText,
+                        cursor: '',
+                        departmentId: -1,
+                        pageIndex: 1,
+                        pageSize: 1000
                     },
                     },
                     res => {
                     res => {
                         if (res.code == "ok") {
                         if (res.code == "ok") {
-                            var list = res.data.data;
-                            this.setUserToDept(list);
-                            this.deptMembData = list;
-                            this.$forceUpdate()
+                            // var list = res.data.data;
+                            // this.setUserToDept(list);
+                            // this.deptMembData = list;
+                            // this.$forceUpdate()
+                            this.filterNodePersonnel = res.data.records.map(item => item.name)
+                            this.$refs.chooseMembTree2.filter(this.participantsFilterText);
                         } else {
                         } else {
                             this.$message({
                             this.$message({
                                 message: res.msg,
                                 message: res.msg,
                                 type: "error"
                                 type: "error"
                             });
                             });
                         }
                         }
+                        this.filterNodeFlag = false
                     },
                     },
                     error => {
                     error => {
+                        this.filterNodeFlag = false
                         this.$message({
                         this.$message({
                             message: error,
                             message: error,
                             type: "error"
                             type: "error"