浏览代码

二级复核驳回时选择生成报告号

lizhenhao 2 年之前
父节点
当前提交
880310a03a

+ 14 - 0
src/api/cw/reportManagement/ReportReviewService.js

@@ -36,4 +36,18 @@ export default class ReportReviewService {
       params: {procInsId: id}
     })
   }
+  getHaveReportNo (id) {
+    return request({
+      url: '/projectReport/review/getHaveReportNo',
+      method: 'get',
+      params: {reportId: id}
+    })
+  }
+  saveReportNo (id) {
+    return request({
+      url: '/projectReport/review/saveReportNo',
+      method: 'get',
+      params: {reportId: id}
+    })
+  }
 }

+ 51 - 27
src/views/modules/cw/reportManagement/reportReview/ReportReviewForm.vue

@@ -616,6 +616,7 @@
   import ProjectReportService from '@/api/cw/reportManagement/ProjectReportService'
   import EnterpriseSearchService from '@/api/cw/common/EnterpriseSearchService'
   import UserService from '@/api/sys/UserService'
+  import CommonApi from '@/api/cw/common/CommonApi'
   export default {
     props: {
       businessId: {
@@ -714,6 +715,7 @@
     ProjectReportService: null,
     enterpriseSearchService: null,
     userService: null,
+    commonApi: null,
     created () {
       this.enterpriseSearchService = new EnterpriseSearchService()
       // this.projectReportService = new ProjectReportService()
@@ -721,6 +723,7 @@
       this.reportReviewService = new ReportReviewService()
       this.projectReportService = new ProjectReportService()
       this.userService = new UserService()
+      this.commonApi = new CommonApi()
     },
     computed: {
       bus: {
@@ -1059,33 +1062,31 @@
               throw new Error()
             } else {
               if (type === 'reject') {
-                // 驳回
-                let param
-                // this.userService.is().then(({data}) => {
-                //   if (data) {
-                //     this.inputForm.reviewStatus = '2'
-                //     // param = {status: '4', id: this.inputForm.id}
-                //   } else {
-                //     this.inputForm.reviewStatus = '4'
-                //   }
-                // })
-                this.inputForm.reviewStatus = '4'
-                // 列表处理
-                this.inputForm.details = []
-                this.inputForm.detailFor1010.forEach(item => { this.inputForm.details.push(item) })
-                this.inputForm.detailFor1020.forEach(item => { this.inputForm.details.push(item) })
-                this.inputForm.detailFor1030.forEach(item => { this.inputForm.details.push(item) })
-                param = {reviewStatus: this.inputForm.reviewStatus,
-                  id: this.inputForm.id,
-                  needUpdate2: this.inputForm.needUpdate2,
-                  needUpdate3: this.inputForm.needUpdate3,
-                  remark2: this.inputForm.remark2,
-                  remark3: this.inputForm.remark3,
-                  details: this.inputForm.details
-                }
-                this.reportReviewService.updateReviewStatysByReportId(param).then(() => {
-                  this.loading = false
-                  callback()
+                this.reportReviewService.queryByReportId(this.inputForm.id).then((review) => {
+                  this.commonApi.getTaskNameByProcInsId(review.data.procInsId).then(({data}) => {
+                    if (data === '二级复核') { // 二级复核 进入下面操作,不是二级复核 直接驳回
+                      this.reportReviewService.getHaveReportNo(this.inputForm.id).then((haveReportNo) => { // 根据报告id查询是否已经生成报告文号
+                        console.log(haveReportNo)
+                        if (haveReportNo.data === '1' || haveReportNo.data === 1) { // 返回值为 ’1‘,已生成报告文号,直接驳回
+                          this.rejectOn(callback)
+                        } else { // 返回值为 ’0‘,未生成报告文号,询问是否需要生成报告文号?是 则生成后驳回,否 则直接驳回
+                          this.$confirm(`是否需要生成报告文号?`, '提示', {
+                            confirmButtonText: '确定',
+                            cancelButtonText: '取消',
+                            type: 'warning'
+                          }).then(() => { // 是  则生成报告文号后驳回
+                            this.reportReviewService.saveReportNo(this.inputForm.id).then(() => {
+                              this.rejectOn(callback)
+                            })
+                          }).catch(() => { // 否  则直接驳回
+                            this.rejectOn(callback)
+                          })
+                        }
+                      })
+                    } else {
+                      this.rejectOn(callback)
+                    }
+                  })
                 })
               }
               if (type === 'reback') {
@@ -1112,6 +1113,29 @@
           })
         }
       },
+      // 这个方法是这个之前这个页面的驳回方法,现在粘出来复用
+      rejectOn (callback) {
+        // 驳回
+        let param
+        this.inputForm.reviewStatus = '4'
+        // 列表处理
+        this.inputForm.details = []
+        this.inputForm.detailFor1010.forEach(item => { this.inputForm.details.push(item) })
+        this.inputForm.detailFor1020.forEach(item => { this.inputForm.details.push(item) })
+        this.inputForm.detailFor1030.forEach(item => { this.inputForm.details.push(item) })
+        param = {reviewStatus: this.inputForm.reviewStatus,
+          id: this.inputForm.id,
+          needUpdate2: this.inputForm.needUpdate2,
+          needUpdate3: this.inputForm.needUpdate3,
+          remark2: this.inputForm.remark2,
+          remark3: this.inputForm.remark3,
+          details: this.inputForm.details
+        }
+        this.reportReviewService.updateReviewStatysByReportId(param).then(() => {
+          this.loading = false
+          callback()
+        })
+      },
       close () {
         this.inputForm = {
           id: '',