Explorar o código

移动端查看日报添加部门和人员的筛选

Lijy hai 1 ano
pai
achega
9fb323f27e

+ 1 - 0
fhKeeper/formulahousekeeper/timesheet_h5/package.json

@@ -17,6 +17,7 @@
     "css-loader": "^3.6.0",
     "dingtalk-jsapi": "^2.13.42",
     "echarts": "^4.9.0",
+    "element-ui": "^2.15.14",
     "font-awesome": "^4.7.0",
     "jquery": "^3.6.1",
     "pdfh5": "^1.4.2",

+ 6 - 0
fhKeeper/formulahousekeeper/timesheet_h5/src/components/Element.js

@@ -0,0 +1,6 @@
+import Vue from 'vue'
+import { Tree, Radio, Checkbox } from 'element-ui'
+import 'element-ui/lib/theme-chalk/index.css';
+Vue.use(Tree)
+Vue.use(Radio)
+Vue.use(Checkbox)

+ 1 - 0
fhKeeper/formulahousekeeper/timesheet_h5/src/main.js

@@ -13,6 +13,7 @@ import axios from 'axios'; /* 引入axios进行地址访问*/
 Vue.prototype.$http = axios;
 
 import "@/components/Vant";
+import './components/Element.js'
 
 import { Form , Toast , Grid, GridItem , DatetimePicker , Popover,
 Picker , Dialog , NumberKeyboard , Sticky , Skeleton ,

+ 267 - 14
fhKeeper/formulahousekeeper/timesheet_h5/src/views/view/index.vue

@@ -4,9 +4,44 @@
 
         <div class="login_form">
             <van-sticky :offset-top="46">
-                <van-field readonly clickable name="datetimePicker" :value="nowTime" label="时间选择" placeholder="点击选择时间"
-                    @click="showPicker = true" />
+                <van-cell title="时间选择" clickable :value="nowTime" @click="showPicker = true" />
             </van-sticky>
+            <div v-if="user.manageDeptId != 0 || reportsCompany || reportsDept">
+                <van-sticky :offset-top="90">
+                    <van-cell title="选择部门" clickable :value="departmentText" @click="selectDepartmentShow = true">
+                        <template #extra>
+                            <van-icon v-if="departmentText" name="close" class="clearSeach"
+                                @click.stop="selectUserClear('dept')" />
+                        </template>
+                        <template #default>
+                            <span v-if="user.userNameNeedTranslate == '1'">
+                                <ww-open-data type='departmentName' :openid='departmentText'></ww-open-data>
+                            </span>
+                            <span v-else>{{ departmentText }}</span>
+                        </template>
+                    </van-cell>
+                </van-sticky>
+                <van-sticky :offset-top="134" class="one_report_select">
+                    <van-cell title="选择人员" clickable :value="userNameValue" @click="selectUserShow = true"
+                        value-class="userNameValue">
+                        <template #extra>
+                            <van-icon v-if="userNameValue" name="close" class="clearSeach"
+                                @click.stop="selectUserClear('user')" />
+                        </template>
+                        <template #default>
+                            <span v-if="user.userNameNeedTranslate == '1'">
+                                <span v-for="item, index in userNameValue.split(',')" :key="item">
+                                    <ww-open-data type='userName' :openid='item'></ww-open-data>
+                                    <span v-if="index != (userNameValue.split(',').length - 1)">,</span>
+                                </span>
+                            </span>
+                            <span v-else>{{ userNameValue }}</span>
+                        </template>
+                    </van-cell>
+                </van-sticky>
+            </div>
+
+
             <van-popup v-model="showPicker" position="bottom">
                 <van-datetime-picker v-model="currentDate" type="date" :min-date="minDate" :max-date="maxDate"
                     @confirm="changeTime" @cancel="showPicker = false" />
@@ -33,8 +68,8 @@
                         </span>
                     </div>
                     <div v-if="user.timeType.enableNewWeeklyfill == 1 && item.summary != null" style="margin-left:20px;"
-                         v-html="'<b>'+item.summaryTitle+'</b><br>'+item.summary.replace(/\r\n/g, '<br>')">
-                        
+                        v-html="'<b>' + item.summaryTitle + '</b><br>' + item.summary.replace(/\r\n/g, '<br>')">
+
                     </div>
                     <div v-for="(item1, index1) in item.data" class="one_report_data" :key="index1">
                         <div class="project_title" style="font-weight:bold;">项目:{{ item1.project }} <span
@@ -73,12 +108,16 @@
                         <div style="color:red;" v-if="item1.state == 2 && item1.rejectReason != null">原因:{{
                             item1.rejectReason }}
                         </div>
-                        <div class="project_title" v-if="item1.subProjectName != null && user.companyId != yuzhongCompId">子项目:{{ item1.subProjectName }}</div>
-                        <div class="project_title" v-if="user.companyId == yuzhongCompId" >角色:{{item1.extraField1?roleList.find(r=>r.value==item1.extraField1).label:''}}</div>
+                        <div class="project_title" v-if="item1.subProjectName != null && user.companyId != yuzhongCompId">
+                            子项目:{{ item1.subProjectName }}</div>
+                        <div class="project_title" v-if="user.companyId == yuzhongCompId">
+                            角色:{{ item1.extraField1 ? roleList.find(r => r.value == item1.extraField1).label : '' }}</div>
                         <div class="project_title" v-if="user.company.packageProject == 1 && item1.groupName != null">
                             任务分组:{{ item1.groupName }}</div>
-                        <div class="project_title" v-if="user.companyId == yuzhongCompId" >工作职责:{{item1.extraField2?item1.extraField2Name:''}}</div>
-                        <div class="project_title" v-if="user.companyId == yuzhongCompId" >工作内容:{{item1.extraField3?item1.extraField3Name:''}}</div>
+                        <div class="project_title" v-if="user.companyId == yuzhongCompId">
+                            工作职责:{{ item1.extraField2 ? item1.extraField2Name : '' }}</div>
+                        <div class="project_title" v-if="user.companyId == yuzhongCompId">
+                            工作内容:{{ item1.extraField3 ? item1.extraField3Name : '' }}</div>
                         <div class="project_title" v-if="user.company.packageProject == 1 && item1.stage != '-'">
                             投入阶段:{{ item1.stage }}</div>
                         <!--自定义维度 -->
@@ -149,16 +188,92 @@
             <van-empty v-if="report.length == 0" description="暂无日报">
                 <van-button round type="primary" class="bottom-button" @click="toWriteReport()">去填写</van-button>
             </van-empty>
+
+            <!-- 人员选择 -->
+            <van-popup v-model="selectUserShow" position="bottom" style="height: 90%">
+                <div class="popupDiv">
+                    <div class="popupSearch" v-if="user.userNameNeedTranslate != '1'">
+                        <van-search v-model="searchInputValue" placeholder="输入员工姓名搜索" @search="userListSearch" shape="round"
+                            background="#F4F4F4"></van-search>
+                    </div>
+
+                    <div class="popupCon conBorder">
+                        <div class="popupConBox" v-if="user.userNameNeedTranslate == '1'">
+                            <van-checkbox class="popupItem marginNone borderNone" v-for="(item) in showUserList"
+                                :key="item.id" v-model="item.isChecked">
+                                <span class="userNameClass_left">
+                                    <ww-open-data type='userName' :openid='item.name'></ww-open-data>
+                                </span>
+                                <span class="userNameClass_right">
+                                    {{ item.jobNumber }}
+                                </span>
+                            </van-checkbox>
+                        </div>
+                        <div class="popupConBox" v-else>
+                            <van-checkbox class="popupItem marginNone borderNone" v-for="(item) in showUserList"
+                                :key="item.id" v-model="item.isChecked">
+                                <span class="userNameClass_left">{{ item.name }}</span>
+                                <span class="userNameClass_right">{{ item.jobNumber }}</span>
+                            </van-checkbox>
+                        </div>
+                    </div>
+
+                    <div class="popupBtn">
+                        <van-button style="width:100%;background: #1989fa;color: #ffffff;" round
+                            @click="selectUserConfirm()">确定</van-button>
+                    </div>
+                </div>
+            </van-popup>
+
+            <!-- 部门选择 -->
+            <van-popup v-model="selectDepartmentShow" position="bottom" style="height: 90%">
+                <div class="popupDiv">
+                    <div class="comPaceholder">
+                        已选择部门:
+                        <span v-if="user.userNameNeedTranslate != '1'">
+                            {{ selectDepartmentText.length > 0 ? selectDepartmentText[0].label : '请选择部门' }}
+                        </span>
+                        <span v-else>
+                            <span v-if="selectDepartmentText.length > 0">
+                                <ww-open-data type='departmentName' :openid='selectDepartmentText[0].label'></ww-open-data>
+                            </span>
+                            <span v-else>请选择部门</span>
+                        </span>
+                    </div>
+                    <div class="popupCon conBorder comTree" 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'">
+                                    <span v-if="node.data.children">
+                                        <ww-open-data type='departmentName' :openid='node.label'></ww-open-data>
+                                    </span>
+                                    <span v-else>
+                                        <ww-open-data type='userName' :openid='node.label'></ww-open-data>
+                                    </span>
+                                </span>
+                                <span v-if="user.userNameNeedTranslate != '1'">
+                                    {{ node.label }}
+                                </span>
+                            </span>
+                        </el-tree>
+                    </div>
+                    <div class="popupBtn">
+                        <van-button style="width:100%;background: #1989fa;color: #ffffff;" round
+                            @click="treeBtn">确定</van-button>
+                    </div>
+                </div>
+            </van-popup>
         </div>
     </div>
 </template>
 
 <script>
 export default {
+    components: {},
     data() {
         return {
             yuzhongCompId: 3385,
-            roleList:[{value: 1,label: 'CRC&LM'},{value: 2,label: 'PM'}],
+            roleList: [{ value: 1, label: 'CRC&LM' }, { value: 2, label: 'PM' }],
             tmpPics: [],
             imgShow: false,
             hasWaiting: false,
@@ -173,6 +288,23 @@ export default {
             report: [],
             fullDayTxt: ['全天', '上午', '下午'],
             statusTxt: ["待审核", "已通过", "已驳回", "待提交"],
+            selectUserShow: false,
+            searchInputValue: '',
+            userList: '',
+            showUserList: '',
+            userIdList: '',
+            userNameValue: '',
+
+            selectDepartmentShow: false,
+            selectDepartmentText: [],
+            departmentText: '',
+            departmentList: [],
+            defaultProps: {
+                children: 'children',
+                label: 'label'
+            },
+            reportsCompany: false,
+            reportsDept: false
         };
     },
     created() {
@@ -182,12 +314,84 @@ export default {
             this.imgShow = true;
             this.tmpPics = item;
         },
-
         // 返回
         back() {
             history.back();
         },
-
+        getUsers() {
+            this.$axios.post("/user/getEmployeeList", {
+                departmentId: -1,
+                pageIndex: 1,
+                pageSize: -1
+            })
+                .then(res => {
+                    if (res.code == "ok") {
+                        this.userList = res.data.records;
+                        this.showUserList = res.data.records
+                    } else {
+                        this.$toast.fail('获取失败');
+                    }
+                }).catch(err => { this.$toast.clear(); });
+        },
+        getDepartmentList() {
+            this.$axios.post("/department/list", {})
+                .then(res => {
+                    if (res.code == "ok") {
+                        this.departmentList = res.data;
+                    } else {
+                        this.$toast.fail('获取失败');
+                    }
+                }).catch(err => { this.$toast.clear(); });
+        },
+        userListSearch(val) {
+            this.showUserList = [];
+            this.userList.forEach(u => {
+                if (u.name.startsWith(val)) {
+                    this.showUserList.push(u);
+                }
+            })
+        },
+        selectUserConfirm() {
+            this.userNameValue = '';
+            var that = this;
+            that.userIdList = '';
+            this.userList.filter(u => u.isChecked).forEach(u => {
+                that.userNameValue += (u.name + ',');
+                that.userIdList += u.id + ','
+            });
+            if (this.userNameValue.length > 0) {
+                this.userNameValue = this.userNameValue.substring(0, this.userNameValue.length - 1);
+                this.userIdList = this.userIdList.substring(0, this.userIdList.length - 1);
+            }
+            this.$forceUpdate()
+            this.selectUserShow = false
+            this.getReport()
+        },
+        selectUserClear(str) {
+            if (str == 'user') {
+                this.userNameValue = ''
+                this.userIdList = []
+                this.userList.forEach(item => { delete item.isChecked })
+                this.showUserList = this.userList
+            }
+            if (str == 'dept') {
+                this.departmentText = '',
+                    this.selectDepartmentText = []
+            }
+            this.getReport()
+        },
+        treeNodeClick(item) {
+            this.selectDepartmentText = [item]
+        },
+        treeBtn() {
+            if (this.selectDepartmentText.length <= 0) {
+                this.$toast('请选择部门');
+                return
+            }
+            this.departmentText = this.selectDepartmentText[0].label
+            this.selectDepartmentShow = false
+            this.getReport()
+        },
         // 时间转换
         format(date, pattern) {
             pattern = pattern || "yyyy-MM-dd";
@@ -226,7 +430,17 @@ export default {
                 forbidClick: true,
                 duration: 0
             });
-            this.$axios.post("/report/getReportList", { date: this.nowTime })
+            this.nowTime = '2023-04-13'
+            let pames = {
+                date: this.nowTime,
+            }
+            if (this.userIdList) {
+                pames.userId = this.userIdList
+            }
+            if (this.departmentText && this.selectDepartmentText.length > 0) {
+                pames.deptId = this.selectDepartmentText[0].id
+            }
+            this.$axios.post("/report/getReportList", pames)
                 .then(res => {
                     if (res.code == "ok") {
                         this.$toast.clear();
@@ -247,7 +461,7 @@ export default {
         // 点击编辑
         editor(item) {
             var path = '/edit';
-            if(this.user.timeType.enableNewWeeklyfill == 1) {
+            if (this.user.timeType.enableNewWeeklyfill == 1) {
                 //物奇要填到按周填报
                 path = '/weekEdit';
             }
@@ -261,7 +475,7 @@ export default {
         // 去填写日报
         toWriteReport() {
             var path = '/edit';
-            if(this.user.timeType.enableNewWeeklyfill == 1) {
+            if (this.user.timeType.enableNewWeeklyfill == 1) {
                 //物奇要填到按周填报
                 path = '/weekEdit';
             }
@@ -278,7 +492,18 @@ export default {
             this.nowTime = sessionStorage.targetDate;
             sessionStorage.removeItem('targetDate');
         }
+        const { functionList } = this.user
+        for(var i in functionList) {
+            if(functionList[i].name == '查看全公司工时') {
+                this.reportsCompany = true
+            }
+            if(functionList[i].name == '查看本部门工时') {
+                this.查看本部门工时 = true
+            }
+        }
         this.getReport();
+        this.getUsers()
+        this.getDepartmentList()
     }
 };
 </script>
@@ -293,6 +518,10 @@ export default {
     font-size: 14px;
 }
 
+.one_report_select {
+    margin-bottom: 15px;
+}
+
 .form_text {
     margin: 15px 0 15px;
     padding: 0 12px;
@@ -314,6 +543,19 @@ export default {
         line-height: 30px;
     }
 }
+
+.comPaceholder {
+    margin: 10px 15px;
+    background: #fff;
+    padding: 10px 10px;
+    border-radius: 6px;
+    font-size: 14px;
+    color: #606266;
+}
+
+.comTree {
+    background: #ffffff;
+}
 </style>
 <style lang="less">
 .van-nav-bar .van-icon,
@@ -349,4 +591,15 @@ export default {
     background-color: rgb(53, 130, 245);
     border-color: rgb(53, 130, 245);
 }
+
+.clearSeach {
+    line-height: 0.64rem;
+    position: relative;
+    left: 5px;
+}
+
+.userNameValue {
+    white-space: nowrap;
+    text-overflow: ellipsis;
+}
 </style>

+ 10 - 10
fhKeeper/formulahousekeeper/timesheet_h5/vue.config.js

@@ -5,19 +5,19 @@ const themePath = path.resolve(__dirname,'src/assets/style/theme.less');
 const Timestamp = new Date().getTime();
 
 // var ip = '47.101.180.183'
-// var ip = '47.100.37.243'
+var ip = '47.100.37.243'
 // var ip = '192.168.2.7'
 // var ip = '127.0.0.1'
 
-var os = require('os'), ip = '', ifaces = os.networkInterfaces() // 获取本机ip
-for (var i in ifaces) {
-    for (var j in ifaces[i]) {
-        var val = ifaces[i][j]
-        if (val.family === 'IPv4' && val.address !== '127.0.0.1') {
-            ip = val.address
-        }
-    }
-}
+// var os = require('os'), ip = '', ifaces = os.networkInterfaces() // 获取本机ip
+// for (var i in ifaces) {
+//     for (var j in ifaces[i]) {
+//         var val = ifaces[i][j]
+//         if (val.family === 'IPv4' && val.address !== '127.0.0.1') {
+//             ip = val.address
+//         }
+//     }
+// }
 
 module.exports = {
     runtimeCompiler: true,