Browse Source

按周填报完善

Lijy 3 years ago
parent
commit
e8df8714a1

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/project/detail.vue

@@ -19,7 +19,7 @@
             <el-radio-group v-model="radio" @change="getList">
                 <el-radio-button label="人员"></el-radio-button>
                 <el-radio-button label="子项目"></el-radio-button>
-                <el-radio-button label="阶段"></el-radio-button>
+                <el-radio-button label="阶段" v-if="user.company.packageProject != 0"></el-radio-button>
             </el-radio-group>
         </el-col>
         

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/project/detailDep.vue

@@ -16,7 +16,7 @@
                     <span style="font-size:18px;">部门成本:<span style="color:#20a0ff;">{{cost.toFixed(2)}}元</span></span>
                 </el-form-item>
             </el-form>
-        </el-col>
+        </el-col> 
 
         <div id="container" :style="'height:' + tableHeight + 'px'"></div> 
     </section>

+ 250 - 82
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -70,7 +70,7 @@
                         </span>
                         <span style="float:right;">
                             <el-link type="primary" style="margin-right:10px;" :underline="false" @click="isSubstitude=false;fillInReport(-1,0)">填写日报</el-link>
-                            <el-link v-if="reportTimeType.type == 2" type="primary" style="margin-right:10px;" :underline="false" @click="isSubstitude=false;fillInReportss()">按周填报</el-link>
+                            <el-link v-if="reportTimeType.type == 2 || reportTimeType.type == 1 ||  reportTimeType.type == 3" type="primary" style="margin-right:10px;" :underline="false" @click="isSubstitude=false;fillInReportss()">按周填报</el-link>
                             <el-link type="primary" style="margin-right:10px;" :underline="false" @click="isSubstitude=true; fillInReport(-1,0)">代填日报</el-link>
                             <el-link type="primary" style="margin-right:10px;" :underline="false" @click="isSubstitude=false;fillInReport(-1,1)">批量填报</el-link>
                             <el-link type="primary" v-if="user.role==1||user.role==2||user.manageDeptId != 0" style="margin-right:10px;" :underline="false" @click="imports()">工时导入</el-link>
@@ -84,6 +84,7 @@
                     <div class="report_title" v-if="(user.role==0||user.role==3||user.role==5) && user.manageDeptId == 0"><span>日报列表</span>
                     <span style="float:right;" v-if="(user.role==0||user.role==3||user.role==5) && user.manageDeptId == 0">
                             <el-link type="primary" style="margin-right:10px;" :underline="false" @click="isSubstitude=false;fillInReport(-1,0)">填写日报</el-link>
+                            <el-link v-if="reportTimeType.type == 2 || reportTimeType.type == 1 ||  reportTimeType.type == 3" type="primary" style="margin-right:10px;" :underline="false" @click="isSubstitude=false;fillInReportss()">按周填报</el-link>
                             <el-link type="primary" v-if="user.leader" style="margin-right:10px;" :underline="false" @click="isSubstitude=true; fillInReport(-1,0)">代填日报</el-link>
                             <el-link type="primary" style="margin-right:10px;" :underline="false" @click="isSubstitude=false;fillInReport(-1,1)">批量填报</el-link>
                             <!-- <el-link type="primary" v-if="user.leader" style="margin-right:10px;" :underline="false" @click="isSubstitude=true; fillInReport(-1,1)">批量代填</el-link> -->
@@ -473,28 +474,40 @@
                             <!-- <el-input v-model="scope.row[item.projectName]" style="width:120px;" @input="zhoZhi(scope.row, scope.$index)"></el-input> -->
                             <el-popover placement="top" width="450" trigger="click">
                                 <div>
-                                    <div class="zhoFel">
+                                    <div class="zhoFel" v-if="reportTimeType.type == 2">
                                         <p>选择时间</p>
-                                        <el-time-picker
-                                            style="width: 355px"
-                                            is-range
-                                            v-model="scope.row[item.projectName].time"
-                                            format="HH:mm"
-                                            value-format="HH:mm"
-                                            range-separator="至"
-                                            start-placeholder="开始时间"
-                                            end-placeholder="结束时间"
-                                            placeholder="选择时间范围"
-                                            @change="zhoTimes(scope.row[item.projectName], scope.$index, index)">
-                                        </el-time-picker>
+                                        <el-time-picker style="width: 355px" is-range v-model="scope.row[item.projectName].time" format="HH:mm" value-format="HH:mm" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" placeholder="选择时间范围" @change="zhoTimes(scope.row[item.projectName], scope.$index, index)"></el-time-picker>
+                                    </div>
+                                    <div class="zhoFel" v-if="reportTimeType.type == 1">
+                                        <p>选择时长</p>
+                                        <el-select v-model="scope.row[item.projectName].workingTime" style="width: 355px;" placeholder="请选择工作时长" @change="zhoXuan(scope.row[item.projectName], scope.$index, index)">
+                                            <el-option v-for="item in timeRange" :key="item" :value="item.toFixed(1)">{{item.toFixed(1)}}</el-option>
+                                        </el-select>
+                                    </div>
+                                    <div class="zhoFel" v-if="reportTimeType.type == 3">
+                                        <p>用时占比</p>
+                                        <div style="width:355px;display: flex;align-items: center;">
+                                            <el-col span="23"><el-slider style="margin-left: 5px;width:249px;" v-model="scope.row[item.projectName].progress" :min="0" :show-tooltip="false" :step="10" @input="scope.row[item.projectName].workingTime = (reportTimeType.allday*scope.row[item.projectName].progress/100).toFixed(1)" @change="addBli(scope.row[item.projectName], scope.$index, index)"></el-slider></el-col>
+                                            <!-- <el-col span="10"><span style="margin-left:10px;float:right;"><span style="margin-right:10px;">{{domain.progress}}%</span>{{domain.workingTime}}小时</span></el-col> -->
+                                            <el-col span="10"><span style="float:right;"><span style="margin-right:10px;">{{scope.row[item.projectName].progress || 0}}%</span>{{scope.row[item.projectName].workingTime | amounts}}小时</span></el-col>
+                                        </div>
                                     </div>
                                     <div class="zhoFel">
                                         <p>工作事项</p>
                                         <el-input type="textarea" v-model="scope.row[item.projectName].con" placeholder="请输入工作事项" style="width: 355px"></el-input>
                                     </div>
                                 </div>
-                                <el-button v-if="scope.row[item.projectName].time != null && scope.row[item.projectName].time != ''" type="text" slot="reference">{{scope.row[item.projectName].time[0]}} - {{scope.row[item.projectName].time[1]}}</el-button>
-                                <el-button v-else type="text" slot="reference">请填写</el-button>
+                                <div v-if="reportTimeType.multiWorktime == 0" slot="reference">
+                                    <!-- <el-button v-if="scope.row[item.projectName].workingTime != null && scope.row[item.projectName].workingTime != '' && (reportTimeType.type == 1 || reportTimeType.type == 2 || reportTimeType.type == 3) && scope.row[item.projectName].workingTime > 0" type="text" slot="reference">{{scope.row[item.projectName].workingTime}} h</el-button> -->
+                                    <el-button v-if="scope.row[item.projectName].workingTime != null && scope.row[item.projectName].workingTime != '' && reportTimeType.type == 3 && scope.row[item.projectName].workingTime > 0" type="text" slot="reference">{{scope.row[item.projectName].workingTime}} h</el-button>
+                                    <el-button v-else-if="scope.row[item.projectName].workingTime != null && scope.row[item.projectName].workingTime != '' && reportTimeType.type == 1 && scope.row[item.projectName].workingTime > 0" type="text" slot="reference">{{scope.row[item.projectName].workingTime}} h</el-button>
+                                    <el-button v-else-if="scope.row[item.projectName].time != null && scope.row[item.projectName].time != '' && reportTimeType.type == 2" type="text" slot="reference">{{scope.row[item.projectName].time[0]}} - {{scope.row[item.projectName].time[1]}}</el-button>
+                                    <el-button v-else type="text" >请填写</el-button>
+                                </div>
+                                <div v-if="reportTimeType.multiWorktime == 1" slot="reference">
+                                    <el-button v-if="scope.row[item.projectName].time != null && scope.row[item.projectName].time != '' && reportTimeType.type == 2" type="text" slot="reference">{{scope.row[item.projectName].time[0]}} - {{scope.row[item.projectName].time[1]}}</el-button>
+                                    <el-button v-else type="text" >请填写</el-button>
+                                </div>
                             </el-popover>
                         </template>
                     </el-table-column>
@@ -906,6 +919,16 @@
                 zhoLoading: false
             };
         },
+        filters: {
+            // 过滤
+            amounts(value) {
+                if(value == NaN || value == undefined || value == 'undefined' || value == null || value == 'null') {
+                    return 0
+                }
+                var zhi = +value + 0
+                return zhi.toFixed(1)
+            }
+        },
         methods: {
             //下载带企业微信考勤数据的工时统计模板
             downloadCheckInExcel() {
@@ -1224,7 +1247,6 @@
             },
             //添加工时
             addNewWorktime(index, item) {
-                console.log(item)
                 if(item.worktimeList == null ) {
                     item.worktimeList = []
                 }
@@ -2374,7 +2396,6 @@
 
             // 打开日报填写
             fillInReport(i, isBatch) {
-                console.log(i, 123)
                 if(i != 1) {
                     this.falsss = false 
                 } else {
@@ -2515,6 +2536,7 @@
                 this.diasZho = true
                 this.getCurrentWeek()
             },
+            // 自动选择时间点的事件
             zhoTimes(item, i, ims, event) {
                 var iss = i
                 if(item.time == null) {
@@ -2537,7 +2559,38 @@
                     }
                     zhi.he = he + 'h'
                 }
-                
+            },
+            // 自动选择事件长度的事件
+            zhoXuan(item, i) {
+                var iss = i
+                if(item.time == null) {
+                    return
+                } else {
+                    var zhi = this.zhoData[iss]
+                    var he = 0
+                    for(var i in zhi) {
+                        if(i != 'zhoDataTime' && i != 'he' && zhi[i].workingTime && zhi[i].workingTime.length > 0) {
+                            he += +zhi[i].workingTime
+                        }
+                    }
+                    zhi.he = he + 'h'
+                }
+            },
+            // 按时间比例
+            addBli(item, i) {
+                var iss = i
+                if(item.time == null) {
+                    return
+                } else {
+                    var zhi = this.zhoData[iss]
+                    var he = 0
+                    for(var i in zhi) {
+                        if(i != 'zhoDataTime' && i != 'he' && zhi[i].workingTime && zhi[i].workingTime.length > 0) {
+                            he += +zhi[i].workingTime
+                        }
+                    }
+                    zhi.he = he.toFixed(1) + 'h'
+                }
             },
             zhoRqis() {
                 this.zhoData = []
@@ -2555,6 +2608,8 @@
                             obj[xinzhi] = {}
                             obj[xinzhi].time = ''
                             obj[xinzhi].con = ''
+                            obj[xinzhi].progress = 0
+                            obj[xinzhi].workingTime = 0
                         }
                         arrst.push(obj)
                     }
@@ -2579,78 +2634,190 @@
             zhoAdd() {
                 var zhi = this.zhoData
                 var ll = 0
-                for(var i in zhi) {
-                    this.dateAr = []
-                    var alp = []
-                    var zhis = zhi[i]
-                    for(var j in zhis) {
-                        if(j != 'zhoDataTime' && j != 'he' && zhis[j].time != null && zhis[j].time != 'null' && zhis[j].time != '') {
-                            let objs = {}
-                            objs.s = zhis[j].time[0]
-                            objs.e = zhis[j].time[1]
-                            alp.push(objs)
-                        } 
-                    }
-                    this.dateAr = alp
-                    console.log(this.dateAr, i)
-                    if(this.dateAr.length > 0) {
-                        let trus = this.fns()
-                        ll += 1
-                        if(!trus) {
-                            this.$message({
-                                message: '填写的时间段重叠',
-                                type: 'error'
-                            })
-                            return false
+                if(this.reportTimeType.type == 2) {
+                    for(var i in zhi) {
+                        this.dateAr = []
+                        var alp = []
+                        var zhis = zhi[i]
+                        for(var j in zhis) {
+                            if(j != 'zhoDataTime' && j != 'he' && zhis[j].time != null && zhis[j].time != 'null' && zhis[j].time != '') {
+                                let objs = {}
+                                objs.s = zhis[j].time[0]
+                                objs.e = zhis[j].time[1]
+                                alp.push(objs)
+                            } 
                         }
-                    } else {
-                        if(ll == 0) {
-                            this.$message({
-                                message: '请填写时间',
-                                type: 'error'
-                            })
-                            return false
+                        this.dateAr = alp
+                        if(this.dateAr.length > 0) {
+                            let trus = this.fns()
+                            ll += 1
+                            if(!trus) {
+                                this.$message({
+                                    message: '填写的时间段重叠',
+                                    type: 'error'
+                                })
+                                return false
+                            }
+                        }
+                           
+                    }
+                     if(ll == 0) {
+                        this.$message({
+                            message: '请填写时间',
+                            type: 'error'
+                        })
+                        return false
+                    }
+                } else if(this.reportTimeType.type == 1){
+                    for(var i in zhi) {
+                        var zhis = zhi[i]
+                        for(var j in zhis) {
+                            if(j != 'zhoDataTime' && j != 'he' && zhis[j].workingTime != null && zhis[j].workingTime != 'null' && zhis[j].workingTime != '') {
+                                ll += 1
+                            } 
                         }
                     }
+                    if(ll == 0) {
+                        this.$message({
+                            message: '请选择时间',
+                            type: 'error'
+                        })
+                        return false
+                    }
                 }
-                var submits = []
+                    var submits = []
                     let formData = new FormData();
-                for (var i in this.zhoData) {
-                    var zhoD = this.zhoData[i]
-                    var flgs = false
-                    for(var j in zhoD) {     
-                        if(j != 'zhoDataTime' && j != 'he' && zhoD[j].time && zhoD[j].time.length > 0 && zhoD[j].time != null && zhoD[j].time != 'null') {
-                            flgs = true
-                            formData.append("degreeId", "-1");
-                            formData.append("id", '-1');
-                            for(var s in this.projectList) {
-                                if(j == this.projectList[s].projectName) {
-                                    formData.append("projectId", this.projectList[s].id);
+                    if(this.reportTimeType.multiWorktime == 1){
+                        for (var i in this.zhoData) {
+                            var zhoD = this.zhoData[i]
+                            var flgs = false
+                            for(var j in zhoD) {     
+                                if(j != 'zhoDataTime' && j != 'he' && zhoD[j].time && zhoD[j].time.length > 0 && zhoD[j].time != null && zhoD[j].time != 'null') {
+                                    flgs = true
+                                    formData.append("degreeId", "-1");
+                                    formData.append("id", '-1');
+                                    for(var s in this.projectList) {
+                                        if(j == this.projectList[s].projectName) {
+                                            formData.append("projectId", this.projectList[s].id);
+                                        }
+                                    }
+                                    formData.append("subProjectId", '0');
+                                    formData.append("taskId", 0);
+                                    formData.append("reportTimeType", this.reportTimeType.type);
+                                    formData.append("endTime", '');
+                                    formData.append("startTime", '');
+                                    formData.append("multiWorktime", this.reportTimeType.multiWorktime);
+                                    var lix = []
+                                    var objjs = {}
+                                    objjs.startTime = zhoD[j].time[0]
+                                    objjs.endTime = zhoD[j].time[1]
+                                    objjs.content = zhoD[j].con
+                                    lix.push(objjs)
+                                    var zhiZhi = JSON.stringify(lix)
+                                    zhiZhi = zhiZhi.replace(/,/g,"@");
+                                    formData.append("content", zhiZhi)
+                                    formData.append("isOvertime", 0)
+                                    formData.append("professionProgress", "[]")
+                                    formData.append("stage", "");
+                                    formData.append("createDate",zhoD.zhoDataTime)
+
                                 }
                             }
-                            formData.append("subProjectId", '0');
-                            formData.append("taskId", 0);
-                            formData.append("reportTimeType", 2);
-                            formData.append("endTime", '');
-                            formData.append("startTime", '');
-                            formData.append("multiWorktime", 1);
-                            var lix = []
-                            var objjs = {}
-                            objjs.startTime = zhoD[j].time[0]
-                            objjs.endTime = zhoD[j].time[1]
-                            objjs.content = zhoD[j].con
-                            lix.push(objjs)
-                            var zhiZhi = JSON.stringify(lix)
-                            zhiZhi = zhiZhi.replace(/,/g,"@");
-                            formData.append("content", zhiZhi)
-                            formData.append("isOvertime", 0)
-                            formData.append("professionProgress", "[]")
-                            formData.append("stage", "");
-                            formData.append("createDate",zhoD.zhoDataTime)
+                        }
+                    } else {
+                        for (var i in this.zhoData) {
+                            var zhoD = this.zhoData[i]
+                            var flgs = false
+                            if(this.reportTimeType.type == 2) {
+                                for(var j in zhoD) {     
+                                    if(j != 'zhoDataTime' && j != 'he' && zhoD[j].time && zhoD[j].time.length > 0 && zhoD[j].time != null && zhoD[j].time != 'null') {
+                                        flgs = true
+                                        formData.append("degreeId", "-1");
+                                        formData.append("id", '-1');
+                                        for(var s in this.projectList) {
+                                            if(j == this.projectList[s].projectName) {
+                                                formData.append("projectId", this.projectList[s].id);
+                                            }
+                                        }
+                                        formData.append("subProjectId", '0');
+                                        formData.append("taskId", 0);
+                                        formData.append("reportTimeType", this.reportTimeType.type);
+                                        formData.append("endTime", zhoD[j].time[1]);
+                                        formData.append("startTime", zhoD[j].time[0]);
+                                        formData.append("multiWorktime", this.reportTimeType.multiWorktime);
+                                        formData.append("content", zhoD[j].con)
+                                        formData.append("isOvertime", 0)
+                                        formData.append("professionProgress", "[]")
+                                        formData.append("stage", "");
+                                        formData.append("createDate",zhoD.zhoDataTime)
+
+                                    }
+                                }
+                            } else {
+                                for(var j in zhoD) {     
+                                    if(j != 'zhoDataTime' && j != 'he' && zhoD[j].workingTime && zhoD[j].workingTime.length > 0 && zhoD[j].workingTime > 0 && zhoD[j].workingTime != null && zhoD[j].workingTime != 'null') {
+                                        flgs = true
+                                        formData.append("degreeId", "-1");
+                                        formData.append("id", '-1');
+                                        for(var s in this.projectList) {
+                                            if(j == this.projectList[s].projectName) {
+                                                formData.append("projectId", this.projectList[s].id);
+                                            }
+                                        }
+                                        formData.append("subProjectId", '0');
+                                        formData.append("taskId", 0);
+                                        formData.append("reportTimeType", this.reportTimeType.type);
+                                        if(this.reportTimeType.type == 1) {
+                                            formData.append("workingTime", zhoD[j].workingTime);
+                                        } else if(this.reportTimeType.type == 2) {
+                                            formData.append("endTime", zhoD[j].time[1]);
+                                            formData.append("startTime", zhoD[j].time[0]);
+                                        } else if(this.reportTimeType.type == 3) {
+                                            formData.append("progress", zhoD[j].progress);
+                                            formData.append("workingTime", zhoD[j].workingTime);
+                                        }
+                                        formData.append("multiWorktime", this.reportTimeType.multiWorktime);
+                                        formData.append("content", zhoD[j].con)
+                                        formData.append("isOvertime", 0)
+                                        formData.append("professionProgress", "[]")
+                                        formData.append("stage", "");
+                                        formData.append("createDate",zhoD.zhoDataTime)
 
+                                    }
+                                }
+                            }
                         }
-                    }
-                }
+                    } 
+                    // else {
+                    //     for (var i in this.zhoData) {
+                    //         var zhoD = this.zhoData[i]
+                    //         var flgs = false
+                    //         for(var j in zhoD) {     
+                    //             if(j != 'zhoDataTime' && j != 'he' && zhoD[j].workingTime && zhoD[j].workingTime.length > 0 && zhoD[j].workingTime > 0 && zhoD[j].workingTime != null && zhoD[j].workingTime != 'null') {
+                    //                 flgs = true
+                    //                 formData.append("degreeId", "-1");
+                    //                 formData.append("id", '-1');
+                    //                 for(var s in this.projectList) {
+                    //                     if(j == this.projectList[s].projectName) {
+                    //                         formData.append("projectId", this.projectList[s].id);
+                    //                     }
+                    //                 }
+                    //                 formData.append("subProjectId", '0');
+                    //                 formData.append("taskId", 0);
+                    //                 formData.append("reportTimeType", this.reportTimeType.type);
+                    //                 formData.append("progress", zhoD[j].progress);
+                    //                 formData.append("workingTime", zhoD[j].workingTime);
+                    //                 formData.append("content", zhoD[j].con);
+                    //                 formData.append("multiWorktime", this.reportTimeType.multiWorktime);
+                    //                 formData.append("isOvertime", 0)
+                    //                 formData.append("professionProgress", "[]")
+                    //                 formData.append("stage", "");
+                    //                 formData.append("createDate",zhoD.zhoDataTime)
+
+                    //             }
+                    //         }
+                    //     }
+                    // }
                     this.http.uploadFile( this.port.report.editPort, formData,
                         res => {
                             this.listLoading = false;
@@ -3362,5 +3529,6 @@
     .zhoFel {
         display: flex;
         justify-content: space-between;
+        align-items: center;
     }
 </style>