Переглянути джерело

调整移动端查看日报的选择部门的样式和部门和人员的联动

Lijy 1 рік тому
батько
коміт
e5a1e8eeda

+ 50 - 16
fhKeeper/formulahousekeeper/timesheet_h5/src/views/view/index.vue

@@ -24,7 +24,7 @@
                     </van-cell>
                 </van-sticky>
                 <van-sticky :offset-top="134" class="one_report_select">
-                    <van-cell title="选择人员" clickable :value="userNameValue" @click="selectUserShow = true"
+                    <van-cell title="选择人员" clickable :value="userNameValue" @click="showUserPopu()"
                         value-class="userNameValue">
                         <template #extra>
                             <van-icon v-if="selectPeopleVal.name" name="close" class="clearSeach"
@@ -36,7 +36,7 @@
                                     <ww-open-data type='userName' :openid='selectPeopleVal.name'></ww-open-data>
                                 </span>
                             </span>
-                            <span v-else>{{ userNameValue }}</span>
+                            <span v-else>{{ selectPeopleVal.name }}</span>
                         </template>
                     </van-cell>
                 </van-sticky>
@@ -194,8 +194,8 @@
             <van-popup v-model="selectUserShow" position="bottom" style="height: 90%">
                 <div class="popupDiv">
                     <div class="popupSearch">
-                        <van-search v-model.trim="searchInputValue" placeholder="输入员工姓名搜索" @clear="userListSearch" @search="userListSearch"
-                            shape="round" background="#F4F4F4"></van-search>
+                        <van-search v-model.trim="searchInputValue" placeholder="输入员工姓名搜索" @clear="userListSearch"
+                            @search="userListSearch" shape="round" background="#F4F4F4"></van-search>
                     </div>
 
                     <div class="popupCon conBorder" style="flex: 1;background-color: #fff;">
@@ -233,7 +233,7 @@
                             <span v-else>请选择部门</span>
                         </span>
                     </div>
-                    <div class="popupCon conBorder comTree" style="flex: 1;">
+                    <div class="popupCon conBorder comTree popupTree" style="flex: 1;">
                         <el-tree :data="departmentList" :props="defaultProps" @node-click="treeNodeClick">
                             <span class="custom-tree-node" slot-scope="{ node }">
                                 <span v-if="user.userNameNeedTranslate == '1'">
@@ -280,8 +280,9 @@ export default {
             statusTxt: ["待审核", "已通过", "已驳回", "待提交"],
             selectUserShow: false,
             searchInputValue: '',
-            userList: '',
-            showUserList: '',
+            userList: [],
+            showUserList: [],
+            firstUserList: [],
             userIdList: '',
             userNameValue: '',
             selectPeopleVal: {},
@@ -309,16 +310,23 @@ export default {
         back() {
             history.back();
         },
-        getUsers() {
+        getUsers(flag = true) {
+            let deptId = this.selectDepartmentText[0] && this.selectDepartmentText[0].id
             this.$axios.post("/user/getEmployeeList", {
-                departmentId: -1,
+                departmentId: deptId || -1,
                 pageIndex: 1,
                 pageSize: -1
             })
                 .then(res => {
                     if (res.code == "ok") {
-                        this.userList = res.data.records;
-                        this.showUserList = res.data.records
+                        if(flag) {
+                            this.userList = res.data.records;
+                            this.showUserList = res.data.records
+                            this.firstUserList = res.data.records
+                        } else {
+                            this.userList = res.data.records;
+                            this.showUserList = res.data.records
+                        }
                     } else {
                         this.$toast.fail('获取失败');
                     }
@@ -336,7 +344,7 @@ export default {
         },
         userListSearch(val) {
             const { userNameNeedTranslate } = this.user
-            if(!this.searchInputValue) {
+            if (!this.searchInputValue) {
                 this.showUserList = JSON.parse(JSON.stringify(this.userList))
                 return
             }
@@ -347,8 +355,10 @@ export default {
             }
 
             if (userNameNeedTranslate == 1) {
+                let deptId = this.selectDepartmentText[0] && this.selectDepartmentText[0].id
                 this.$axios.post("/user/getEmployeeList", {
-                    departmentId: -1, pageIndex: 1, pageSize: 200,
+                    departmentId: deptId || -1, 
+                    pageIndex: 1, pageSize: -1,
                     keyword: this.searchInputValue, status: '',
                     roleId: '', cursor: '', onlyDirect: 0, matchingType: 0
                 })
@@ -376,11 +386,20 @@ export default {
                 this.selectPeopleVal = {}
             }
             if (str == 'dept') {
-                this.departmentText = '',
-                    this.selectDepartmentText = []
+                this.departmentText = ''
+                this.selectDepartmentText = []
             }
             this.getReport()
         },
+        showUserPopu() {
+            if (!this.departmentText) {
+                this.showUserList = JSON.parse(JSON.stringify(this.firstUserList))
+            } else {
+                this.showUserList = JSON.parse(JSON.stringify(this.userList))
+            }
+            this.searchInputValue = ''
+            this.selectUserShow = true
+        },
         treeNodeClick(item) {
             this.selectDepartmentText = [item]
         },
@@ -391,6 +410,7 @@ export default {
             }
             this.departmentText = this.selectDepartmentText[0].label
             this.selectDepartmentShow = false
+            this.getUsers(false)
             this.getReport()
         },
         // 时间转换
@@ -431,6 +451,7 @@ export default {
                 forbidClick: true,
                 duration: 0
             });
+            this.nowTime = '2023-04-13'
             let pames = {
                 date: this.nowTime,
             }
@@ -509,6 +530,19 @@ export default {
 </script>
 
 <style lang="less" scoped>
+.popupTree {
+    font-size: 20px;
+    padding: 20px 10px;
+
+    /deep/ .el-tree-node {
+        margin-bottom: 10px;
+    }
+
+    /deep/ .el-tree-node__content>.el-tree-node__expand-icon {
+        font-size: 20px;
+    }
+}
+
 .login_form {
     margin-top: 46px;
 }
@@ -549,7 +583,7 @@ export default {
     background: #fff;
     padding: 10px 10px;
     border-radius: 6px;
-    font-size: 14px;
+    font-size: 20px;
     color: #606266;
 }