|
@@ -243,7 +243,7 @@
|
|
|
<template >
|
|
|
<div>
|
|
|
<span>用时占比</span>
|
|
|
- <van-slider :disabled="!item.canEdit" :min="5" :step="5" style="width:120px;display:inline-block;margin-left:50px;" v-model="item.progress" :value="100" @change="item.workingTime = (reportTimeType.allday*item.progress/100).toFixed(1)" >
|
|
|
+ <van-slider :disabled="!item.canEdit" :min="5" :step="5" style="width:120px;display:inline-block;margin-left:50px;" v-model="item.progress" :value="100" @change="item.workingTime = (reportTimeType.allday*item.progress/100).toFixed(1), setTotalReportHours()" >
|
|
|
<template #button>
|
|
|
<div class="custom-button">{{ item.progress }}%</div>
|
|
|
</template>
|
|
@@ -485,48 +485,50 @@ import timetoolVue from '../timetool/timetool.vue';
|
|
|
list: [],
|
|
|
searchList: []
|
|
|
},
|
|
|
- vacationTime: {}
|
|
|
+ vacationTime: {},
|
|
|
+ totalReportHours: 0
|
|
|
};
|
|
|
},
|
|
|
|
|
|
created() {
|
|
|
|
|
|
},
|
|
|
+ watch: {},
|
|
|
computed: {
|
|
|
- totalReportHours(){
|
|
|
- let domains = this.form.domains
|
|
|
- let hours = 0
|
|
|
- for(let i in domains){
|
|
|
- if(domains[i].projectId){
|
|
|
- // hours += parseFloat(domains[i].workingTime)
|
|
|
- if(this.reportTimeType.multiWorktime == 1){
|
|
|
- for(let m in domains[i].worktimeList){
|
|
|
- if(domains[i].worktimeList[m].startTime && domains[i].worktimeList[m].endTime){
|
|
|
- hours += this.getHour(domains[i].worktimeList[m].startTime, domains[i].worktimeList[m].endTime)
|
|
|
- }
|
|
|
- }
|
|
|
- }else{
|
|
|
- if(this.user.timeType.type == 2){
|
|
|
- if(domains[i].startTime && domains[i].endTime){
|
|
|
- let selectionTime = this.getHour(domains[i].startTime, domains[i].endTime)
|
|
|
- let subtractedData = 0
|
|
|
- let arr = JSON.parse(JSON.stringify(this.vacationTime))
|
|
|
- arr.unshift({s: domains[i].startTime, e: domains[i].endTime})
|
|
|
- for(var j in arr) {
|
|
|
- subtractedData += +this.timeOverlap(j, arr)
|
|
|
- }
|
|
|
- console.log(selectionTime, subtractedData)
|
|
|
- hours += +selectionTime - +subtractedData
|
|
|
- console.log(hours)
|
|
|
- }
|
|
|
- } else {
|
|
|
- hours += domains[i].workingTime ? parseFloat(domains[i].workingTime) : 0
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return hours.toFixed(2)
|
|
|
- },
|
|
|
+ // totalReportHours(){
|
|
|
+ // let domains = this.form.domains
|
|
|
+ // let hours = 0
|
|
|
+ // for(let i in domains){
|
|
|
+ // if(domains[i].projectId){
|
|
|
+ // // hours += parseFloat(domains[i].workingTime)
|
|
|
+ // if(this.reportTimeType.multiWorktime == 1){
|
|
|
+ // for(let m in domains[i].worktimeList){
|
|
|
+ // if(domains[i].worktimeList[m].startTime && domains[i].worktimeList[m].endTime){
|
|
|
+ // hours += this.getHour(domains[i].worktimeList[m].startTime, domains[i].worktimeList[m].endTime)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }else{
|
|
|
+ // if(this.user.timeType.type == 2){
|
|
|
+ // if(domains[i].startTime && domains[i].endTime){
|
|
|
+ // let selectionTime = this.getHour(domains[i].startTime, domains[i].endTime)
|
|
|
+ // let subtractedData = 0
|
|
|
+ // let arr = JSON.parse(JSON.stringify(this.vacationTime))
|
|
|
+ // arr.unshift({s: domains[i].startTime, e: domains[i].endTime})
|
|
|
+ // for(var j in arr) {
|
|
|
+ // subtractedData += +this.timeOverlap(j, arr)
|
|
|
+ // }
|
|
|
+ // console.log(selectionTime, subtractedData)
|
|
|
+ // hours += +selectionTime - +subtractedData
|
|
|
+ // console.log(hours)
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // hours += domains[i].workingTime ? parseFloat(domains[i].workingTime) : 0
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // return hours.toFixed(2)
|
|
|
+ // },
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
@@ -979,7 +981,45 @@ import timetoolVue from '../timetool/timetool.vue';
|
|
|
item.endTime = this.endTime;
|
|
|
this.showEndTime = false;
|
|
|
}
|
|
|
+ this.setTotalReportHours()
|
|
|
},
|
|
|
+
|
|
|
+ setTotalReportHours(){
|
|
|
+ let domains = this.form.domains
|
|
|
+ let hours = 0
|
|
|
+ for(let i in domains){
|
|
|
+ // if(domains[i].projectId){
|
|
|
+ // hours += parseFloat(domains[i].workingTime)
|
|
|
+ if(this.reportTimeType.multiWorktime == 1){
|
|
|
+ for(let m in domains[i].worktimeList){
|
|
|
+ if(domains[i].worktimeList[m].startTime && domains[i].worktimeList[m].endTime){
|
|
|
+ hours += this.getHour(domains[i].worktimeList[m].startTime, domains[i].worktimeList[m].endTime)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(this.user.timeType.type == 2){
|
|
|
+ if(domains[i].startTime && domains[i].endTime){
|
|
|
+ let selectionTime = this.getHour(domains[i].startTime, domains[i].endTime)
|
|
|
+ let subtractedData = 0
|
|
|
+ let arr = JSON.parse(JSON.stringify(this.vacationTime))
|
|
|
+ arr.unshift({s: domains[i].startTime, e: domains[i].endTime})
|
|
|
+ for(var j in arr) {
|
|
|
+ subtractedData += +this.timeOverlap(j, arr)
|
|
|
+ }
|
|
|
+ console.log(selectionTime, subtractedData)
|
|
|
+ hours += +selectionTime - +subtractedData
|
|
|
+ console.log(hours)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ hours += domains[i].workingTime ? parseFloat(domains[i].workingTime) : 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ // return hours.toFixed(2)
|
|
|
+ this.totalReportHours = hours.toFixed(2)
|
|
|
+ },
|
|
|
+
|
|
|
filter(type, options) {
|
|
|
if (type === 'minute') {
|
|
|
return options.filter(option => option % 30 === 0);
|
|
@@ -1019,7 +1059,8 @@ import timetoolVue from '../timetool/timetool.vue';
|
|
|
this.form.domains[this.clickTimeIndex].overtimeHours = allhour - this.user.timeType.allday
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ this.setTotalReportHours()
|
|
|
},
|
|
|
clickTimePicker(i,item) {
|
|
|
if (!item.canEdit) {
|
|
@@ -1258,7 +1299,11 @@ import timetoolVue from '../timetool/timetool.vue';
|
|
|
}
|
|
|
}
|
|
|
this.form.domains = array;
|
|
|
+ // console.log('执行One')
|
|
|
+ this.setTotalReportHours()
|
|
|
} else {
|
|
|
+ // console.log('执行TWO')
|
|
|
+ this.totalReportHours = 0
|
|
|
this.canCancel = false;
|
|
|
this.canEdit = true;
|
|
|
var shuzhi = this.user.timeType.allday + ''
|
|
@@ -1294,6 +1339,8 @@ import timetoolVue from '../timetool/timetool.vue';
|
|
|
this.form.domains[0].basecostName = this.report.timeBasecostList[0].name;
|
|
|
}
|
|
|
this.canEdit = true;
|
|
|
+
|
|
|
+ this.setTotalReportHours()
|
|
|
}
|
|
|
} else {
|
|
|
this.$toast.clear();
|