Parcourir la source

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

zhouyy il y a 4 mois
Parent
commit
bf7eceda15

Fichier diff supprimé car celui-ci est trop grand
+ 31 - 10
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue


+ 3 - 3
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/list.vue

@@ -1,11 +1,11 @@
 <template>
   <div class="projectReportReview">
-    <!-- <template v-if="user.timeType.weeklyChargeFilter != 1"> -->
+    <template v-if="user.timeType.weeklyChargeFilter != 1">
         <dailyReportReview />
-    <!-- </template>
+    </template>
     <template>
         <weeklyReportReview />
-    </template> -->
+    </template>
   </div>
 </template>
 

+ 138 - 15
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/weeklyReportReview.vue

@@ -43,7 +43,7 @@
                           </el-option>
                       </el-select>
                   </el-form-item>
-                      <el-form-item :label="$t('weekDay.date')">
+                      <el-form-item :label="$t('weekDay.date')" v-if="false">
                           <el-date-picker
                               v-model="dataTime"
                               type="daterange"
@@ -55,8 +55,8 @@
                       </el-form-item>
 
                       <el-form-item   style="margin-left:20px;">
-                          <el-button @click="batchApprove(true)" style="margin-left:10px;" :loading="batchApproveLoading" :disabled="multipleSelection.length==0" size="mini">{{ $t('Batchthrough') }}</el-button>
-                          <el-button @click="batchApprove(false)"   :disabled="multipleSelection.length==0" size="mini">{{ $t('Batchrejected') }}</el-button>
+                          <el-button @click="batchCallThrough()" style="margin-left:10px;" :loading="batchApproveLoading" :disabled="multipleSelection.length==0" size="mini">{{ $t('Batchthrough') }}</el-button>
+                          <el-button @click="batchRejection()"   :disabled="multipleSelection.length==0" size="mini">{{ $t('Batchrejected') }}</el-button>
                       </el-form-item>
                       <el-form-item style="margin-left:20px;">
                       <el-link type="primary" @click="recordList(),recordDialogVisible = true,pageIndexList = 1,pageSizeList = 20">{{ $t('Auditrecords') }}</el-link>
@@ -70,11 +70,12 @@
       
       <!--列表-->
       <div class="reviewTable" ref="reviewTable">
-        <el-table :data="list" style="width: 100%">
+        <el-table :data="list" style="width: 100%" @selection-change="weeklyReportRowSelect">
+          <el-table-column type="selection" width="55"></el-table-column>
           <el-table-column type="expand">
             <template slot-scope="props">
               <div style="padding: 10px 30px">
-                <el-table :data="props.row.dataList" style="width: 100%" border @selection-change="(e) => weeklyReportItemSelect(e, props.row)">
+                <el-table :data="props.row.dataList" style="width: 100%" border @selection-change="(e) => weeklyReportItemSelect(e, props.row)" :span-method="({rowIndex, columnIndex}) => mergeCellsRow({ rowIndex, columnIndex, dataLength: props.row.dataList.length, columnLength: props.row.dataList.length })">
                   <el-table-column type="selection" width="55"></el-table-column>
                   <el-table-column label="日期" prop="userName">
                     <template slot-scope="scope">
@@ -91,8 +92,8 @@
                     </el-table-column>
                   </template>
                   <el-table-column label="操作" fixed="right" width="220">
-                    <el-button type="success" size="small" :disabled="props.row.selectItem.length <= 0">通过</el-button>
-                    <el-button type="danger" size="small" :disabled="props.row.selectItem.length <= 0">驳回</el-button>
+                    <el-button type="success" size="small" :disabled="props.row.selectItem.length <= 0" @click="rowMeans(props.row)">通过</el-button>
+                    <el-button type="danger" size="small" :disabled="props.row.selectItem.length <= 0" @click="rowRejection(props.row)">驳回</el-button>
                   </el-table-column>
                 </el-table>
               </div>
@@ -398,6 +399,7 @@
                   reason: ''
               },
               undoBathFormLoading: false,
+              tableSelectRow: []
           };
       },
       filters: {
@@ -768,8 +770,122 @@
               return tablePush;
           },
           weeklyReportItemSelect(val, row) {
-            console.log(val, row)
+            const { itemIndex } = row
+            const selectItemVal = val.map(item => item.weekDayTxt)
+            this.list[itemIndex].selectItem = selectItemVal
           },
+          weeklyReportRowSelect(val) {
+            this.multipleSelection = val
+          },
+          rowMeans(val) {
+            const row = this.list[val.itemIndex]
+            const { daySummaryList, selectItem } = row
+            const newList = daySummaryList.filter(item => selectItem.includes(item.weekDayTxt))
+            const mergedProjectList = newList.map(item => item.projectList).reduce((acc, curr) => acc.concat(curr), []);
+            const idList = mergedProjectList.map(item => item.id)
+            this.callThrough(idList.join(','))
+          },
+          batchCallThrough() {
+            const val = this.multipleSelection
+            const dataList = val.flatMap(item => 
+                item.daySummaryList.flatMap(daySummary => 
+                    daySummary.projectList
+                )
+            );
+            const ids = dataList.map(item => item.id)
+            this.callThrough(ids.join(','))
+          },
+          callThrough(ids) {
+            this.http.post(`/report/approve`, { reportIds: ids },
+            res => {
+                if (res.code == "ok") {
+                    this.$message({
+                        message: '操作成功',
+                        type: "success"
+                    });
+                    this.getList()
+                } else {
+                    this.$message({
+                        message: res.msg,
+                        type: "error"
+                    });
+                }
+            },
+            error => {
+                this.$message({
+                    message: error,
+                    type: "error"
+                });
+            });
+          },
+          rowRejection(val) {
+            const row = this.list[val.itemIndex]
+            const { daySummaryList, selectItem } = row
+            const newList = daySummaryList.filter(item => selectItem.includes(item.weekDayTxt))
+            console.log(newList, '<==== newList')
+            const mergedProjectList = newList.map(item => item.projectList).reduce((acc, curr) => acc.concat(curr), []);
+            const idList = mergedProjectList.map(item => item.id)
+            const text = newList.map(item => item.weekDayTxt)
+            this.$prompt(`确定驳回【${text.join(',')}】这些日报吗?`, '', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+                inputPattern: /^(?!\s*$).+/,
+                inputErrorMessage: '请输入驳回原因',
+                inputPlaceholder: '请输入驳回原因'
+            }).then(({ value }) => {
+                this.rejectionReport(idList.join(','), value)
+            })
+          },
+          batchRejection() {
+            const val = this.multipleSelection
+            const dataList = val.flatMap(item => 
+                item.daySummaryList.flatMap(daySummary => 
+                    daySummary.projectList
+                )
+            );
+            const ids = dataList.map(item => item.id)
+            this.$prompt(`确定驳回选中的这些日报吗?`, '', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+                inputPattern: /^(?!\s*$).+/,
+                inputErrorMessage: '请输入驳回原因',
+                inputPlaceholder: '请输入驳回原因'
+            }).then(({ value }) => {
+                this.rejectionReport(ids.join(','), value)
+            })
+          },
+          rejectionReport(ids, reason) {
+            this.http.post(`/report/batchDenyReport`, { ids, reason },
+            res => {
+                if (res.code == "ok") {
+                    this.$message({
+                        message: '操作成功',
+                        type: "success"
+                    });
+                    this.getList()
+                } else {
+                    this.$message({
+                        message: res.msg,
+                        type: "error"
+                    });
+                }
+            },
+            error => {
+                this.$message({
+                    message: error,
+                    type: "error"
+                });
+            });
+          },
+        mergeCellsRow({ rowIndex, columnIndex, dataLength, columnLength }) {
+            if (columnIndex === (+(columnLength || 0) + 2)) {
+                if (rowIndex === 0) {
+                    return [dataLength, 1];  // 合并最后一列的所有行
+                }
+                return [0, 0];  // 不显示其他行
+            }
+            return [1, 1]; // 其他列不合并
+        },
           //获取待审核的数据列表
           getList(e) {
               this.listLoading = true;
@@ -800,15 +916,21 @@
               res => {
                   this.listLoading = false;
                   if (res.code == "ok") {
-                      // for (let entry of res.data) {
-                      //     let reviewerNames = (entry.data || []).map(item => item.projectAuditorName);
-                      //     let uniqueReviewerNames = [...new Set(reviewerNames)];
-                      //     entry.reviewerNames = uniqueReviewerNames;
-                      // }
-                      const newList = res.data.map(item => {
+                      if(!res.data) {
+                        this.listBackup = []
+                        this.list = []
+                        let total = 0
+                        this.reviewTableObj = {
+                          reviewTableTotal: total,
+                          reviewTableIndex: 1,
+                          reviewTableSize: this.reviewTableObj.reviewTableSize
+                        }
+                        return
+                      }
+                      const newList = (res.data || []).map((item, index) => {
                         const daySummaryList = (item.daySummaryList || []).filter(item => (item.projectList || []).length > 0)
                         const dataList = daySummaryList.map(item => {
-                          const projectList = item.projectList.reduce((acc, curr) => {
+                          const projectList = (item.projectList || []).reduce((acc, curr) => {
                             acc[curr.project] = curr;
                             return acc;
                           }, {});
@@ -827,6 +949,7 @@
                           daySummaryList,
                           projectNameList,
                           dataList,
+                          itemIndex:index,
                           selectItem: []
                         }
                       })