Browse Source

调整按周填报审核人的显示

Lijy 1 year ago
parent
commit
54a3d23691

+ 24 - 4
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/weeklyCustomization.vue

@@ -17,7 +17,8 @@
                     <el-table-column label="项目" width="220">
                         <template slot-scope="scope">
                             <el-select v-model="scope.row.projectId" size="small" placeholder="请选择项目" clearable
-                                @change="changeProject(scope.row.projectId, scope.$index)" :disabled="scope.row.state == 1 || scope.row.state == 0 || !scope.row.canFill">
+                                @change="changeProject(scope.row.projectId, scope.$index)"
+                                :disabled="scope.row.state == 1 || scope.row.state == 0 || !scope.row.canFill">
                                 <el-option v-for="item in projectList" :key="item.id" :label="item.projectName"
                                     :value="item.id">
                                 </el-option>
@@ -38,7 +39,8 @@
                     <el-table-column prop="content" label="工作内容" width="300">
                         <template slot-scope="scope">
                             <el-input size="small" type="textarea" :rows="2" v-model="scope.row.content"
-                                :disabled="scope.row.state == 1 || scope.row.state == 0 || !scope.row.canFill" resize="none"></el-input>
+                                :disabled="scope.row.state == 1 || scope.row.state == 0 || !scope.row.canFill"
+                                resize="none"></el-input>
                         </template>
                     </el-table-column>
                     <el-table-column prop="workingTime" label="时间(小时)" width="160">
@@ -253,11 +255,29 @@ export default {
                 this.nowTime = this.dayjs(this.nowTime).add(time, 'day').format('YYYY-MM-DD')
             }
             let { data } = await this.getData('/report/getWeeklyFillReportData', { targetDate: this.nowTime })
+            console.log(JSON.parse(JSON.stringify(data)), '<===== 处理之前的')
+            data.dateList.forEach(dateItem => {
+                const reportList = dateItem.reportList;
+                reportList.forEach(report => {
+                    const { state, taskGroups } = report;
+                    console.log(state, taskGroups);
+                    if(state != 1 && state != 0 && taskGroups && taskGroups.length > 0) {
+                        console.log('执行');
+                        report.projectAuditorId = taskGroups[0].inchargerId;
+                        report.projectAuditorName = taskGroups[0].inchargerName;
+                    }
+                    if(state == 1 && state == 0 && taskGroups && taskGroups.length > 0) {
+                        taskGroups[0].inchargerId = report.projectAuditorId;
+                        taskGroups[0].inchargerName = report.projectAuditorName;
+                    }
+                });
+            });
+            console.log(data, '<===== 处理之后的')
             const { dateList, projectList, sumTimeList, cardTimeList } = data;
             const weekTableData = dateList.flatMap(date => {
                 const { weekDayTxt, date: dateTime, reportList, canFill } = date;
-                const reports = reportList.map(report => ({ ...report, weekDayTxt, dateTime, canFill}));
-                return reports.length > 0 ? reports : [{ weekDayTxt, dateTime, canFill}];
+                const reports = reportList.map(report => ({ ...report, weekDayTxt, dateTime, canFill }));
+                return reports.length > 0 ? reports : [{ weekDayTxt, dateTime, canFill }];
             });
             let sumSet = new Set();
             weekTableData.forEach(obj => {