浏览代码

提交按周填报的文件(移动端)

Lijy 1 年之前
父节点
当前提交
bf2cb834d3

+ 3 - 2
fhKeeper/formulahousekeeper/timesheet_h5/src/views/cost/cost.vue

@@ -6,7 +6,7 @@
             <van-calendar v-model="costDateShow" type="range" :allow-same-day="true" :show-confirm="false" @confirm="dateConfirm" :min-date="minDate" :max-date="maxDate" />
             <van-tabs v-model="active" @change="activeChange" background="#20a0ff" title-active-color="#fff" title-inactive-color="#3c3c45" style="height:1.17333rem;">
                 <van-tab title="项目"></van-tab>
-                <van-tab title="项目分类"></van-tab>
+                <van-tab title="项目分类" v-if="user.companyId != '1071'"></van-tab>
             </van-tabs>
         </van-sticky>
     </div>
@@ -82,7 +82,8 @@ export default {
             costDateTitle: '',
             costDate: [],
             costDateShow: false,
-            timeCostList: []
+            timeCostList: [],
+            user: JSON.parse(localStorage.userInfo),
         }
     },
     mounted() {

文件差异内容过多而无法显示
+ 2248 - 0
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/weekEdit-01.vue


+ 158 - 17
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/weekEdit.vue

@@ -60,7 +60,7 @@
                     </van-popup>
                     <!--任务分组 -->
                     <van-field  readonly  name="groupId" v-if="user.company.packageProject==1&&item.taskGroups != null && item.taskGroups.length > 0" clickable 
-                        :value="item.groupName" label="任务分组" placeholder="请选择任务分组" 
+                        :value="item.groupName" :label="user.timeType.enableNewWeeklyfill == 1 ? '分组' : '任务分组'" :placeholder="user.timeType.enableNewWeeklyfill == 1 ? '请选择分组' : '请选择任务分组'" 
                     @click="clickPickTaskGroup(index, item)" />
                     <van-popup v-model="item.showPickerTaskGroup" position="bottom">
                         <van-picker show-toolbar :columns="item.taskGroups" value-key="name" @confirm="choseTaskGroup" 
@@ -291,7 +291,7 @@
                         icon="plus" color="#ffffff" ><span style="color:#999;text-align:center;padding: 0 5px;"> 添加工时  </span></van-tag>
                     </div>
                     
-                    <div class="overtime" v-if="((user.timeType.fillOvertime || (isWeekend && user.timeType.lockWorktime != 1)) || (isCorpWX&&canEdit))">
+                    <div class="overtime" v-if="((user.timeType.fillOvertime || (isWeekend && user.timeType.lockWorktime != 1)) || (isCorpWX&&canEdit)) && user.timeType.enableNewWeeklyfill != 1">
                         <div class="overTimeClas">
                             <van-checkbox  v-model="item.isOvertime" style="width: 4.3rem;">加班</van-checkbox>
                             <van-field v-model="item.overtimeHours" type="number" :disabled="item.isOvertime==null||item.isOvertime==0"
@@ -827,7 +827,7 @@
 
                 this.showPickerUserddp = false;
                 //获取子项目
-                if(this.user.timeType.mainProjectState != 1){
+                if(this.user.timeType.mainProjectState != 1 && this.user.timeType.enableNewWeeklyfill != 1){
                     this.getSubprojectList(this.currentForm.domains[this.proIdx]);
                 }
                 //加载项目相关的工程进度
@@ -835,19 +835,21 @@
                     this.getProjectProfessions(this.currentForm.domains[this.proIdx],index);
                 }
                 //获取任务分组
-                this.getTaskGroups(this.currentForm.domains[this.proIdx], this.proIdx);
-
-                // 获取1相关维度
-                this.getTaskList(domainItem.projectId)
-
-                //获取相关日报提交选择人
-                domainItem.projectAuditorId = null;
-                domainItem.projectAuditorName = null;
-                domainItem.auditUserList = null;
-                //获取项目审核人
-                var curProject = this.project.filter(p=>p.id == domainItem.projectId)[0];
-                if (this.user.timeType.reportAuditType == 0) {
-                    this.getProjectAuditorList(domainItem, index);
+                if(this.user.timeType.enableNewWeeklyfill == 1) { // 针对物奇获取项目分组
+                    this.getProjectGroup(this.currentForm.domains[this.proIdx], this.proIdx)
+                } else {
+                    this.getTaskGroups(this.currentForm.domains[this.proIdx], this.proIdx);
+                    // 获取1相关维度
+                    this.getTaskList(domainItem.projectId)
+                    //获取相关日报提交选择人
+                    domainItem.projectAuditorId = null;
+                    domainItem.projectAuditorName = null;
+                    domainItem.auditUserList = null;
+                    //获取项目审核人
+                    var curProject = this.project.filter(p=>p.id == domainItem.projectId)[0];
+                    if (this.user.timeType.reportAuditType == 0) {
+                        this.getProjectAuditorList(domainItem, index);
+                    }
                 }
             },
             //获取项目下的任务分组
@@ -1364,6 +1366,9 @@
             },
             clickPickTaskGroup(i, item) {
                 // if (!this.canEdit) return;
+                if(this.user.timeType.enableNewWeeklyfill == 1) {
+                    return
+                }
                 this.clickIndex = i;
                 item.showPickerTaskGroup = true;
                 this.$forceUpdate();
@@ -1617,6 +1622,22 @@
             // 提交日报
             submitReport() {
                 this.form[this.inbtn] = this.currentForm
+
+                // 针对物奇做的判断
+                if(this.user.timeType.enableNewWeeklyfill == 1){
+                    const { allday } = this.user.timeType // 系统设置的每日工作时间
+                    const { next, error, group } = this.judgeStrange(this.form)
+                    if(!next){
+                        if(error.length > 0) {
+                            this.$toast(`【${error.join('、')}】填写工时合计非 ${allday} 小时`)
+                        } else {
+                            this.$toast(`${group.join('、')} 请选择项目分组`)
+                        }
+                        
+                        return
+                    }
+                }
+
                 //检查子项目
                 if (this.user.timeType.subProMustFill == 1) {
                     for(let i in this.form){
@@ -1951,7 +1972,6 @@
 
                 }
                 
-                // return
                 const toast = this.$toast.loading({
                     forbidClick: true,
                     duration: 0
@@ -2037,6 +2057,127 @@
                         alert(JSON.stringify(res));
                     }
                 });
+            },
+
+            // 针对物奇定制私人按周填报写的方法
+            async getProjectGroup(domainItem, index) {
+                const { data } = await this.$axios.post("/task-group/listProjectGroupAndAuditor", {projectId: domainItem.projectId})
+                if(!data) {
+                    return
+                }
+                if(data.length == 0) {
+                    this.$toast.fail('分组未设置,请联系该项目管理人员');
+                }
+                if(data.length == 1) {
+                    domainItem.groupId = data[0].id;
+                    domainItem.groupName = data[0].name;
+                    domainItem.projectAuditorId = data[0].inchargerId;
+                    domainItem.projectAuditorName = data[0].inchargerName;
+                    if (!data[0].inchargerId) {
+                        this.$toast.fail(`【${data[0].name}】分组未设置审批人,请联系该项目管理人员`);
+                    }
+                }
+                const newArr = data.map(item => {
+                    const { inchargerId, inchargerName } = item;
+                    return {
+                        auditorId: inchargerId,
+                        auditorName: inchargerName
+                    };
+                });
+
+                domainItem.taskGroups = data;
+                domainItem.auditUserList = newArr;
+                this.$forceUpdate();
+            },
+            // 提交数据物奇的判断
+            judgeStrange(from) {
+                console.log(from, '<======== 要判断的fom表单')
+                const newFrom = JSON.parse(JSON.stringify(from))
+                const arrList = Object.values(newFrom).flatMap(({ domains, createDate }) =>
+                    domains.map(({ workingTime, projectId, projectName, groupId }) => ({
+                        dateTime: createDate,
+                        workingTime,
+                        projectId,
+                        projectName,
+                        groupId,
+                        weeks: this.getNewWeek(createDate)
+                    }))
+                );
+                console.log(arrList, '<==== 判断的数据')
+                let { strArr, groupArr } = this.judgmentData(arrList)
+                let strDataArr = this.getWeek(strArr);
+                let strGroupArr = groupArr
+
+                if(strDataArr.length > 0 || strGroupArr.length > 0) {
+                    return {
+                        next: false,
+                        error: [...new Set(strDataArr)],
+                        group: [...new Set(strGroupArr)]
+                    }
+                } else {
+                    return {
+                        next: true,
+                        error: [],
+                        group: []
+                    }
+                }
+            },
+            // 判断是否小于系统设置的每日工作时间
+            judgmentData(data) {
+                const { allday } = this.user.timeType // 系统设置的每日工作时间
+                const result = [];
+                data.forEach((item) => {
+                    const date = item.dateTime;
+                    const index = result.findIndex((arr) => arr[0].dateTime === date);
+
+                    if (index === -1) {
+                        result.push([item]);
+                    } else {
+                        result[index].push(item);
+                    }
+                });
+
+                const strArr = result
+                    .filter((arr) => arr[0].projectId)
+                    .filter(
+                        (arr) => arr.reduce((sum, item) => sum + (+item.workingTime || 0), 0) != allday
+                    )
+                    .map((arr) => arr[0].dateTime);
+
+                const groupArr = data
+                    .filter(item => item.projectId && !item.groupId)
+                    .map(({ dateTime, weeks, projectName }) => `【${dateTime} ${weeks} 中的 (${projectName})项目】`);
+
+                return { strArr, groupArr }
+            },
+            // YYYY-MM-DD 转成 周几
+            getWeek(arr) {
+                const weekArr = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
+                for (let i = 0; i < arr.length; i++) {
+                    const date = new Date(arr[i]);
+                    const week = weekArr[date.getDay()];
+                    arr[i] = `${arr[i]} ${week}`;
+                }
+                return arr;
+            },
+            getNewWeek(data) {
+                const weekArr = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
+                const date = new Date(data);
+                return weekArr[date.getDay()];
+            },
+            // 重新定义获取接口
+            async newPost(url, param) {
+                return new Promise((resolve, reject) => {
+                    this.$axios.post(url, param,
+                        res => {
+                            resolve(res)
+                        },
+                        error => {
+                            this.$toast.fail(error);
+                            reject(error)
+                        }
+                    )
+                });
             }
         },
         

+ 3 - 1
fhKeeper/formulahousekeeper/timesheet_h5/src/views/index/index.vue

@@ -185,7 +185,9 @@
                 for (var i in list) {
                     if(list[i].name == '工时报告') {
                         this.routers.push({name: '查看日报',url: '/calendar',icon: 'description'})
-                        this.routers.push({name: '填写日报',url: '/edit',icon: 'edit'})
+                        if(this.user.companyId != '1071') { // 针对物奇公司去掉填写日报
+                            this.routers.push({name: '填写日报',url: '/edit',icon: 'edit'})
+                        }
                         // if (this.user.companyId == 817 || this.user.companyId == 7 || this.user.companyId == 10) {
                             this.routers.push({name: '按周填报',url: '/weekEdit',icon: 'records'})
                         // }