Kaynağa Gözat

调整日报的type == 3的情况

Lijy 2 hafta önce
ebeveyn
işleme
22ea489a53

+ 29 - 8
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -412,7 +412,7 @@
                         <div v-if="isBatch!=0" style="display: inline-block;margin-left:10px">{{jsDay}} {{$t('time.day')}}</div>
                         <span v-if="reportTimeType.type == 3 && user.company.companyName != mingyiName" style="margin-left:10px;">{{isBatch==0? $t('other.total'):$t('weekDay.daily')}}{{$t('time.duration')}}:</span>
                         <el-input-number :disabled="(!canEdit || user.timeType.lockWorktime) && !isWeekend" v-if="reportTimeType.type == 3&& user.company.companyName != mingyiName" style="margin-left:5px;" @change="changeAllTime"
-                            v-model="reportTimeType.allday" :precision="1" :step="0.5" :max="yonghuUser.maxReportTime || 12" :min="0.5"></el-input-number>
+                            v-model="workForm.totalDuration" :precision="1" :step="0.5" :max="yonghuUser.maxReportTime || 12" :min="0.5"></el-input-number>
                         <span v-if="reportTimeType.type == 3 && user.company.companyName != mingyiName">{{$t('time.hour')}}</span>
                         <!-- <span v-if="isBatch && user.company.companyName != mingyiName">, {{$t('other.fillInTheTotal')}} {{jsTime.toFixed(1)}} {{$t('time.hour')}}</span> -->
                         <span v-if="isBatch && user.company.companyName != mingyiName">, {{$t('other.fillInTheTotal')}} <el-input v-model="jsTime" @change="onBatchTimeChange" style="width:80px;"/> {{$t('time.hour')}}</span>
@@ -729,7 +729,7 @@
                         <el-form-item v-if="reportTimeType.type == 3" :label="$t('lable.percentageOfTime')" :prop="'domains.' + index + '.'+timeFields[reportTimeType.type]"
                             :rules="{ required: true, message: $t('defaultText.pleaseSetTheTimeRatio'), trigger: 'blur' }">
                             <div style="width:400px;">
-                                <el-col span="14"><el-slider :disabled="!domain.canEdit" v-model="domain.progress" :min="0" :show-tooltip="false" :step="5" style="width:280px;" @input="domain.workingTime = (reportTimeType.allday*domain.progress/100).toFixed(1)" @change="seleChn(0)" show-input="true" input-size="small"></el-slider></el-col>
+                                <el-col span="14"><el-slider :disabled="!domain.canEdit" v-model="domain.progress" :min="0" :show-tooltip="false" :step="5" style="width:280px;" @input="domain.workingTime = (workForm.totalDuration*domain.progress/100).toFixed(1)" @change="seleChn(0)" show-input="true" input-size="small"></el-slider></el-col>
                                 <el-col :span="isBatch?6:10"><span style="margin-left:10px;float:right;"><span style="margin-right:10px;">{{domain.progress}}%</span><span v-if="isBatch == 0">{{domain.workingTime}}{{$t('time.hour')}}</span></span></el-col>
                             </div>
                             <div class="overtime" v-if="user.timeType.fillOvertime || isWeekend"><el-checkbox :disabled="!domain.canEdit" v-model="domain.isOvertime">{{$t('other.WorkOvertime')}}</el-checkbox>
@@ -969,7 +969,12 @@
 
                     </div>
                     <span id="workFormsItemBottom"></span>
-                    <el-link v-if="showAddMore" type="primary" :underline="false" @click="addDomain(reportTimeType.type)" style="margin-left:40px;">{{$t('other.addMore')}}</el-link>
+                    <template v-if="yonghuUser.type != 3">
+                        <el-link v-if="showAddMore" type="primary" :underline="false" @click="addDomain(reportTimeType.type)" style="margin-left:40px;">{{$t('other.addMore')}}</el-link>
+                    </template>
+                    <template v-if="yonghuUser.type == 3">
+                        <el-link v-if="canEdit" type="primary" :underline="false" @click="addDomain(reportTimeType.type)" style="margin-left:40px;">{{$t('other.addMore')}}</el-link>
+                    </template>
                 </el-form>
             </div>
             <span slot="footer" class="dialog-footer">
@@ -4988,8 +4993,11 @@
             },
             changeAllTime() {
                 //总时长发生改变,自动按比例计算
+                if(!this.workForm.totalDuration) {
+                    this.workForm.totalDuration = 0.5
+                }
                 this.workForm.domains.forEach(d=>{
-                    d.workingTime = (d.progress*this.reportTimeType.allday/100).toFixed(1);
+                    d.workingTime = (d.progress*this.workForm.totalDuration/100).toFixed(1);
                 });
                 //计算jsTime
                 if (this.workForm.createDate) {
@@ -4999,7 +5007,7 @@
                     if (days < 0) {
                         days = 0;
                     }
-                    this.jsTime = this.reportTimeType.allday * days;
+                    this.jsTime = this.workForm.totalDuration * days;
                 }
             },
 
@@ -6665,8 +6673,7 @@
                                     this.getInfoByProjectId(copyData, i, false)
                                 }
                             }
-                            this.reportCanDelete = candelete
-                            this.workForm = {
+                            let copyWorkForm = {
                                 createDate: this.workForm.createDate,
                                 domains: arr,
                                 userNames:null,
@@ -6674,8 +6681,18 @@
                                 time: list.time,
                                 showRefresh: list.showRefresh
                             }
-                        } else {
+                            if(res.data.timeType.type == 3) {
+                                const reportCalculationReportList = res.data.report || []
+                                copyWorkForm.totalDuration = reportCalculationReportList.reduce((accumulator, current) => {
+                                    const workingTime = current.workingTime || 0;
+                                    return accumulator + workingTime;
+                                }, 0);
+                            }
                             this.workForm = {
+                                ...copyWorkForm
+                            }
+                        } else {
+                            let copyWorkForm = {
                                 createDate: this.workForm.createDate,
                                 domains: [{
                                     id: null,
@@ -6698,6 +6715,10 @@
                                 time: this.report.time,
                                 showRefresh: list.showRefresh
                             }
+                            if(res.data.timeType.type == 3) {
+                                copyWorkForm.totalDuration = res.data.timeType.allday
+                            }
+                            this.workForm = copyWorkForm
                             // businessTrips 有数据的情况下
                             const businessTrips = res.data.businessTrips || []
                             this.businessTripsArray = res.data.businessTrips || []

+ 33 - 8
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/index.vue

@@ -81,7 +81,7 @@
             <van-cell title="总时长(h)" v-if="reportTimeType.type == 3">
                 <template>
                     <van-stepper :disabled="(!canEdit || user.timeType.lockWorktime == 1) && !isWeekend"
-                        v-model="reportTimeType.allday" @change="changeAllTime" min="0.5" max="12" step="0.5"
+                        v-model="form.totalDuration" @change="changeAllTime" min="0.5" :max="reportSettingsRow.maxReportTime || 12" step="0.5"
                         :decimal-length="1" />
                 </template>
             </van-cell>
@@ -524,11 +524,21 @@
 
             </div>
             <div style="text-align:center;" v-if="showAddMore">
-                <van-tag size="large"
+                <template v-if="reportSettingsRow.type != 3">
+                    <van-tag size="large"
                     style="text-align:center;margin:10px;padding:12px;margin-bottom:120px;border: 1px solid #20a0ff;"
-                    @click="addNewPro" icon="plus" color="#ffffff"><span
-                        style="color:#999;text-align:center;padding: 0 50px;"> + 新增{{ user.companyId == 781 ? '任务' : '项目' }}
-                    </span></van-tag>
+                    @click="addNewPro" icon="plus" color="#ffffff">
+                        <span style="color:#999;text-align:center;padding: 0 50px;"> + 新增{{ user.companyId == 781 ? '任务' : '项目' }}</span>
+                    </van-tag>
+                </template>
+                <template v-if="reportSettingsRow.type == 3 && canEdit">
+                    <van-tag size="large"
+                    style="text-align:center;margin:10px;padding:12px;margin-bottom:120px;border: 1px solid #20a0ff;"
+                    @click="addNewPro" icon="plus" color="#ffffff">
+                        <span style="color:#999;text-align:center;padding: 0 50px;"> + 新增{{ user.companyId == 781 ? '任务' : '项目' }}</span>
+                    </van-tag>
+                </template>
+                
                 <!-- <van-button id="btn-start-recording" @click="startRecording">录音</van-button>
                 <van-button id="btn-stop-recording" @click="stopRecording">停止</van-button>
                 <van-button id="btn-play-recording" @click="getRecording">获取文件</van-button> -->
@@ -690,6 +700,7 @@ export default {
             timeType: [],
             form: {
                 createDate: this.format(new Date(new Date()), "yyyy-MM-dd"),
+                totalDuration: 8,
                 domains: [{
                     id: null,
                     projectId: "",
@@ -752,7 +763,9 @@ export default {
             showAddMore: false,
             businessTripsArray: [],
             doYouWantToDisplayTheWorkOrder: true,
-            hideWorkingHours: false
+            hideWorkingHours: false,
+
+            reportSettingsRow: {},
         };
     },
 
@@ -1415,7 +1428,8 @@ export default {
         changeAllTime() {
             //总时长发生改变,自动按比例计算
             this.form.domains.forEach(d => {
-                d.workingTime = (d.progress * this.reportTimeType.allday / 100).toFixed(1);
+                // d.workingTime = (d.progress * this.reportTimeType.allday / 100).toFixed(1);
+                d.workingTime = (d.progress * this.form.totalDuration / 100).toFixed(1);
             });
         },
         cancel() {
@@ -1829,6 +1843,7 @@ export default {
                         this.report = res.data;
                         this.businessTripsArray = res.data.businessTrips || []
                         var t = res.data.timeType;
+                        this.reportSettingsRow = res.data.timeType
                         var timeType = [];
                         //转化时间格式
                         if (t.allday != null) {
@@ -1993,6 +2008,13 @@ export default {
                                     const { projectCode } = this.proads.find(item => item.id == list[i].projectId)
                                     this.getInfoByProjectId(projectCode, i, false)
                                 }
+                                if(res.data.timeType.type == 3) {
+                                    const reportCalculationReportList = res.data.report || []
+                                    this.form.totalDuration = reportCalculationReportList.reduce((accumulator, current) => {
+                                        const workingTime = current.workingTime || 0;
+                                        return accumulator + workingTime;
+                                    }, 0);
+                                }
                             }
                             this.form.domains = array;
                             this.setTotalReportHours()
@@ -2001,6 +2023,9 @@ export default {
                             this.canCancel = false;
                             this.canEdit = true;
                             var shuzhi = this.user.timeType.allday + ''
+                            if(res.data.timeType.type == 3) {
+                                this.form.totalDuration = this.user.timeType.allday
+                            }
                             //没有填报的可以点击提交
                             this.form.domains = [{
                                 id: null,
@@ -2825,7 +2850,7 @@ export default {
                         if(!customDegreeMultiple) { // 单选
                             formData.append("degreeId", this.form.domains[i].degreeId);
                         } else {
-                            let newDegreeId = this.form.domains[i].degreeId.split(',')
+                            let newDegreeId = Array.isArray(this.form.domains[i].degreeId) ? this.form.domains[i].degreeId : this.form.domains[i].degreeId.split(',')
                             formData.append("multiDegrId", JSON.stringify(newDegreeId).replace(/,/g, '@'))
                         }
                     } else {