lizhenhao 2 лет назад
Родитель
Сommit
542f59c7d2

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

@@ -94,4 +94,18 @@ export default class ProjectReportService {
       responseType: 'blob'
     })
   }
+  getAuditNodeByReportId (id) {
+    return request({
+      url: '/cwProjectReport/getAuditNodeByReportId',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+  getSignatureTypeById (id, signatureType) {
+    return request({
+      url: '/cwProjectReport/getSignatureTypeById',
+      method: 'get',
+      params: {id: id, signatureType: signatureType}
+    })
+  }
 }

+ 24 - 2
src/views/common/UpLoadComponentV2.1.vue

@@ -14,6 +14,7 @@
                :file-list="fileList">
       <el-button type="info" size="mini" :slot="auth==='view'&&uploadFlag===false?'tip':'trigger'" @click="clickHandel" :disabled="auth==='view'&&uploadFlag===false">点击上传</el-button>
     </el-upload>
+    <el-button v-if="showSign" type="info" size="mini" style="float: right;" @click="clickSign">签章</el-button>
     <div style="height: calc(100% - 80px);margin-top: 10px">
       <!-- 进度条 -->
       <el-progress style="margin-left: 5em" v-if="progressFlag" :percentage="loadProgress"></el-progress>
@@ -136,7 +137,8 @@
         showDivider: true,
         fileType: '',
         sealType: '',
-        remarks: ''
+        remarks: '',
+        showSign: false
       }
     },
     watch: {
@@ -347,8 +349,20 @@
        * @param showDivider  ‘附件‘Divider是否展示
        *    注:值为空时,默认值为true
        *    showDivider=false时 ‘附件‘Divider隐藏
+       * @param showSign ‘签章’按钮 是否展示
+       *    注:值为空时,默认值为false 不展示
+       *    showSign=audit的时候 ‘签章’按钮展示
        */
-      async newUpload (auth, fileList, directory, maxValue, dividerName, uploadFlag, delFlag, showDivider) {
+      async newUpload (auth, fileList, directory, maxValue, dividerName, uploadFlag, delFlag, showDivider, showSign) {
+        if (this.commonJS.isEmpty(showSign)) {
+          this.showSign = false
+        } else {
+          if (showSign === 'audit') {
+            this.showSign = true
+          } else {
+            this.showSign = false
+          }
+        }
         await this.fileLoadingFalse()
         if (this.commonJS.isEmpty(dividerName)) {
           this.dividerName = '附件'
@@ -683,6 +697,14 @@
             scope.row.sealType = ''
           }
         }
+      },
+      // 点击签章按钮事件
+      clickSign () {
+        this.$emit('clickSign')
+      },
+      // 隐藏签章按钮
+      hideSign () {
+        this.showSign = false
       }
     }
   }

+ 160 - 181
src/views/modules/cw/reportManagement/ReportManagementSignatureForm.vue

@@ -232,7 +232,7 @@
         <!--        </el-tab-pane>-->
         <el-tab-pane label="附件" name="archiveFile">
           <!--        附件-->
-          <UpLoadComponent ref="archiveFile"></UpLoadComponent>
+          <UpLoadComponent ref="archiveFile" @clickSign="clickSign"></UpLoadComponent>
         </el-tab-pane>
 
 
@@ -314,7 +314,8 @@
         keyWatch: '',
         activeName: 'archiveFile',
         tableKey: '',
-        tableKeyClient: '1'
+        tableKeyClient: '1',
+        interVal: ''
       }
     },
     projectRecordsService: null,
@@ -325,6 +326,10 @@
       this.projectRecordsService = new ProjectRecordsService()
       this.projectReportService = new ProjectReportService()
     },
+    deactivated () {
+      // 页面关闭(路由跳转)时清除定时器
+      clearInterval(this.interVal)
+    },
     computed: {
       bus: {
         get () {
@@ -361,43 +366,9 @@
       // UpLoadComponentDialog
     },
     methods: {
-      // seeFileInfo (index) {
-      //   if (this.commonJS.isEmpty(this.inputForm.cwProjectInfoList[index].cwFileInfoList)) {
-      //     this.inputForm.cwProjectInfoList[index].cwFileInfoList = []
-      //   }
-      //   this.$refs.upLoadComponentDialog.newUpload('view', this.inputForm.cwProjectInfoList[index].cwFileInfoList, null, null, null, null, null, false, index)
-      // },
-      // sss (index) {
-      //   if (this.commonJS.isEmpty(this.inputForm.cwProjectInfoList[index].cwFileInfoList)) {
-      //     this.inputForm.cwProjectInfoList[index].cwFileInfoList = []
-      //   }
-      //   this.$refs.upLoadComponentDialog.newUpload(null, this.inputForm.cwProjectInfoList[index].cwFileInfoList, null, null, null, null, null, false, index)
-      // },
-      // getUpload (p, index) {
-      //   p.then((list) => {
-      //     // list为返回数据
-      //     this.inputForm.cwProjectInfoList[index].cwFileInfoList = list
-      //     this.inputForm.cwProjectInfoList[index].fileNumber = list.length
-      //     this.tableKeyClient = Math.random()
-      //   })
-      // },
       getKeyWatch (keyWatch) {
         this.keyWatch = keyWatch
       },
-      // 删除
-      // del (id) {
-      //   let ids = id || this.$refs.clientTable.getCheckboxRecords().map(item => {
-      //     return item.id
-      //   }).join(',')
-      //   this.$confirm(`确定删除所选项吗?`, '提示', {
-      //     confirmButtonText: '确定',
-      //     cancelButtonText: '取消',
-      //     type: 'warning'
-      //   }).then(() => {
-      //     this.$refs.clientTable.remove(ids)
-      //     // this.inputForm.cwProjectClientInfoDTOList.splice(ids, 1)
-      //   })
-      // },
       changeSignatory1 (value) {
         if (this.inputForm.signatureAnnotator2 === value && this.commonJS.isNotEmpty(value)) {
           this.$message.warning('首次发行签字注师1和首次发行签字注师2不可以相同')
@@ -458,7 +429,10 @@
           status: '',
           status1: '',
           status2: '',
-          realCreate: ''
+          realCreate: '',
+          sid1: '',
+          sid2: '',
+          signatureContractId: ''
         }
         this.inputForm.id = id
         this.loading = false
@@ -480,21 +454,17 @@
             if (this.commonJS.isEmpty(this.inputForm.realCreate)) {
               this.inputForm.realCreate = JSON.parse(localStorage.getItem('user')).id
             }
-            if (this.formReadOnly) {
-              method = 'view'
+            if (this.commonJS.isNotEmpty(this.inputForm.signatureContractId) && this.status === 'audit') {
+              this.$refs.archiveFile.newUpload('view', data.cwFileInfoList, 'cwWorkContract', null, null, null, null, false, 'audit')
+            } else {
+              this.$refs.archiveFile.newUpload('view', data.cwFileInfoList, 'cwWorkContract', null, null, null, null, false)
             }
-            this.$refs.archiveFile.newUpload('view', data.cwFileInfoList, 'cwWorkContract', null, null, null, null, false)
             this.loading = false
+            if (this.status === 'audit') {
+              this.$emit('callBackFunc', 'hide')
+              this.jobScheduler()
+            }
           })
-          // this.projectRecordsService.queryById(this.inputForm.id).then(({data}) => {
-          //   // this.$refs.uploadComponent.clearUpload()
-          //   this.inputForm = this.recover(this.inputForm, data)
-          //   this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
-          //   if (this.commonJS.isEmpty(this.inputForm.createDate)) {
-          //     this.inputForm.createDate = this.moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
-          //   }
-          //   this.loading = false
-          // })
         })
       },
       openContractForm () {
@@ -524,148 +494,109 @@
         this.doSubmit('save', callback)
       },
       startForm (callback) {
-        this.doSubmit('start', callback)
-      },
-      async agreeForm (callback) {
-        await this.projectReportService.queryById(this.inputForm.id).then(({data}) => {
-          if (data.status !== '2') { // 审核状态不是“待审核”,就弹出提示
-            this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
-            throw new Error()
-          } else {
-            this.doSubmit('agree', callback)
+        // this.doSubmit('start', callback)
+        this.loading = true
+        this.projectReportService.saveData(this.inputForm).then(({data}) => {
+          if (this.inputForm.signatureType === '2') {
+            this.inputForm.assignee = this.inputForm.signatureAnnotator1
           }
-        })
-        // await this.projectRecordsService.queryById(this.inputForm.id).then(({data}) => {
-        //   if (this.inputForm.status !== '2') { // 审核状态不是“待审核”,就弹出提示
-        //     this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
-        //     throw new Error()
-        //   } else {
-        //     this.doSubmit('agree', callback)
-        //   }
-        // })
-      },
-      // 表单提交
-      doSubmit (status, callback) {
-        if (this.inputForm.status === '2' && this.commonJS.isEmpty(this.inputForm.opinionType)) {
-          this.$message.error('意见类型不能为空')
+          callback(data.businessTable, data.businessId, this.inputForm)
           this.loading = false
-          throw new Error('意见类型不能为空')
-        }
-        if (status === 'save') {
-          // 暂存
-          this.inputForm.status = '1'
-          this.loading = true
-          // if (this.$refs.uploadComponent.checkProgress()) {
-          //   this.loading = false
-          //   return
-          // }
-          // this.inputForm.workAttachmentDtoList = this.$refs.uploadComponent.getDataList()
-          // this.inputForm.cwFileInfoList = this.$refs.archiveFile.getDataList()
-          this.$refs.archiveFile.getDataList().then((data) => {
-            this.inputForm.cwFileInfoList = data
-          })
-          this.inputForm.createDate = this.moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
-          // 验证报告 日期报告 类型是否出具报告 意见类型 是否为空
-          // eslint-disable-next-line no-unused-expressions
-          this.projectReportService.saveForm(this.inputForm).then(({data}) => {
-            callback(data.businessTable, data.businessId, this.inputForm)
-            this.loading = false
-          }).catch(() => {
-            this.loading = false
-          })
-          // this.projectRecordsService.saveForm(this.inputForm).then(({data}) => {
-          //   callback(data.businessTable, data.businessId, this.inputForm)
-          //   this.loading = false
-          // }).catch(() => {
-          //   this.loading = false
-          // })
-          return
-        } else if (status === 'start') {
-          // 送审  待审核
-          this.inputForm.status = '2'
-        } else if (status === 'agree') {
-          // 审核同意
-          this.inputForm.agreeDate = this.moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
-          this.inputForm.agreeUserId = this.$store.state.user.id
-          this.inputForm.status = '5'
-        }
-        this.$refs['inputForm'].validate((valid) => {
-          if (valid) {
-            this.loading = true
-            if (this.commonJS.isEmpty(this.inputForm.createDate)) {
-              this.inputForm.createDate = this.moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
-            }
-            // if (this.commonJS.isEmpty(this.inputForm.reportType)) {
-            //   this.$message.error('报告类型不能为空')
-            //   this.loading = false
-            //   throw new Error('报告类型不能为空')
-            // }
-            this.$refs.archiveFile.getDataList().then((data) => {
-              this.inputForm.cwFileInfoList = data
-            })
-            // let _this = this
-            // _this.inputForm.cwFileInfoList.forEach(info => {
-            //   if (this.commonJS.isEmpty(info.fileType)) {
-            //     throw new Error('文件类型不能为空')
-            //   }
-            //   if (this.commonJS.isEmpty(info.sealType)) {
-            //     throw new Error('盖章类型不能为空')
-            //   }
-            // })
-            this.projectReportService.saveForm(this.inputForm).then(({data}) => {
-              callback(data.businessTable, data.businessId, this.inputForm)
-              this.loading = false
-            }).catch(() => {
-              this.loading = false
-            })
-          }
+          throw new Error()
+        }).catch(() => {
+          this.loading = false
+          throw new Error('流程发起失败')
         })
       },
-      async updateStatusById (type) {
-        if (type === 'reject' || type === 'reback') {
-          // if (await this.$refs.uploadComponent.checkProgress()) {
-          //   this.loading = false
-          //   throw new Error()
-          // }
-          await this.projectReportService.queryById(this.inputForm.id).then(({data}) => {
+      async agreeForm (callback) {
+        if (this.inputForm.signatureType === '1') {
+          this.projectReportService.findBySignatureId(this.inputForm.sid1).then(({data}) => {
             if (data.status !== '2') { // status的值不等于“审核中”就弹出提示
               this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
               throw new Error()
             } else {
-              if (type === 'reject') {
-                // 驳回
-                this.inputForm.status = '4'
-                let param = {status: '4', id: this.inputForm.id}
-                this.projectReportService.updateStatusById(param)
-                // this.projectRecordsService.updateStatusById(param)
-              }
-              if (type === 'reback') {
-                // 撤回
-                let param = {status: '3', id: this.inputForm.id}
-                // this.projectRecordsService.updateStatusById(param)
-                this.projectReportService.updateStatusById(param)
-              }
+              let param = {status: '5', id: this.inputForm.sid1}
+              this.projectReportService.updateSignatureStatusById(param)
+              let table = 'cw_project_report_signature'
+              callback(table, this.inputForm.sid1, this.inputForm)
+            }
+          })
+        }
+        if (this.inputForm.signatureType === '2') {
+          this.projectReportService.findBySignatureId(this.inputForm.sid2).then(({data}) => {
+            if (data.status !== this.inputForm.status2) { // status的值不等于“审核中”就弹出提示
+              this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+              throw new Error()
+            } else {
+              this.projectReportService.getAuditNodeByReportId(this.inputForm.sid2).then(({data}) => {
+                console.log('data', data)
+                if (data.signatureType === '签字注师1审核') {
+                  let param = {status: '6', id: this.inputForm.sid2}
+                  this.projectReportService.updateSignatureStatusById(param)
+                  this.inputForm.assignee = this.inputForm.signatureAnnotator2
+                  let table = 'cw_project_report_signature'
+                  callback(table, this.inputForm.sid2, this.inputForm)
+                }
+                if (data.signatureType === '签字注师2审核') {
+                  let param = {status: '7', id: this.inputForm.sid2}
+                  this.projectReportService.updateSignatureStatusById(param)
+                  callback()
+                }
+                if (data.signatureType === '签章管理人审核') {
+                  let param = {status: '5', id: this.inputForm.sid2}
+                  this.projectReportService.updateSignatureStatusById(param)
+                  callback()
+                }
+              })
             }
           })
-          // await this.projectRecordsService.queryById(this.inputForm.id).then(({data}) => {
-          //   if (data.status !== '2') { // status的值不等于“审核中”就弹出提示
-          //     this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
-          //     throw new Error()
-          //   } else {
-          //     if (type === 'reject') {
-          //       // 驳回
-          //       this.inputForm.status = '4'
-          //       let param = {status: '4', id: this.inputForm.id}
-          //       this.projectRecordsService.updateStatusById(param)
-          //     }
-          //     if (type === 'reback') {
-          //       // 撤回
-          //       let param = {status: '3', id: this.inputForm.id}
-          //       // this.projectRecordsService.updateStatusById(param)
-          //       this.projectReportService.updateStatusById(param)
-          //     }
-          //   }
-          // })
+        }
+      },
+      async updateStatusById (type) {
+        if (await this.$refs.archiveFile.checkProgress()) {
+          this.loading = false
+          throw new Error()
+        } else {
+          if (type === 'reject' || type === 'reback') {
+            if (this.inputForm.signatureType === '1') {
+              await this.projectReportService.findBySignatureId(this.inputForm.sid1).then(({data}) => {
+                if (data.status !== this.inputForm.status1) { // status的值不等于“审核中”就弹出提示
+                  this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+                  throw new Error()
+                } else {
+                  if (type === 'reject') {
+                    // 驳回
+                    let param = {status: '4', id: data.id}
+                    this.projectReportService.updateSignatureStatusById(param)
+                  }
+                  if (type === 'reback') {
+                    // 撤回
+                    let param = {status: '3', id: data.id}
+                    this.projectReportService.updateSignatureStatusById(param)
+                  }
+                }
+              })
+            }
+            if (this.inputForm.signatureType === '2') {
+              await this.projectReportService.findBySignatureId(this.inputForm.sid2).then(({data}) => {
+                if (data.status !== this.inputForm.status2) { // status的值不等于“审核中”就弹出提示
+                  this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+                  throw new Error()
+                } else {
+                  if (type === 'reject') {
+                    // 驳回
+                    let param = {status: '4', id: data.id}
+                    this.projectReportService.updateSignatureStatusById(param)
+                  }
+                  if (type === 'reback') {
+                    // 撤回
+                    let param = {status: '3', id: data.id}
+                    this.projectReportService.updateSignatureStatusById(param)
+                  }
+                }
+              })
+            }
+          }
         }
       },
       close () {
@@ -745,6 +676,54 @@
             this.tableKeyClient = Math.random()
           })
         })
+      },
+      clickSign () {
+        this.projectReportService.saveFlowableParam(this.inputForm).then(({data}) => {
+          window.open(data, '_blank')
+        })
+      },
+      jobScheduler () {
+        this.interVal = setInterval(() => {
+          console.log('正在访问签章状态...')
+          if (this.inputForm.signatureType === '1') {
+            this.projectReportService.getAuditNodeByReportId(this.inputForm.sid1).then(({data}) => {
+              if (data.success) {
+                this.projectReportService.getSignatureTypeById(this.inputForm.sid1, data.signatureType).then((sign) => {
+                  console.log('获取签章状态为' + sign.data.signatureType)
+                  if (sign.data.signatureType === '1') {
+                    console.log('签章已完成,展示‘同意’按钮')
+                    this.$emit('callBackFunc', 'show')
+                    this.$refs.archiveFile.hideSign() // 隐藏签章按钮
+                    clearInterval(this.interVal)
+                    this.showConfirm() // 提示签章操作已完成
+                  }
+                })
+              }
+            })
+          }
+          if (this.inputForm.signatureType === '2') {
+            this.projectReportService.getAuditNodeByReportId(this.inputForm.sid2).then(({data}) => {
+              if (data.success) {
+                this.projectReportService.getSignatureTypeById(this.inputForm.sid2, data.signatureType).then((sign) => {
+                  console.log('获取签章状态为' + sign.data.signatureType)
+                  if (sign.data.signatureType === '1') {
+                    console.log('签章已完成,展示‘同意’按钮')
+                    this.$emit('callBackFunc', 'show')
+                    this.$refs.archiveFile.hideSign() // 隐藏签章按钮
+                    clearInterval(this.interVal)
+                    this.showConfirm() // 提示签章操作已完成
+                  }
+                })
+              }
+            })
+          }
+        }, 1000)
+      },
+      showConfirm () {
+        this.$confirm(`签章操作已完成,请进行审核操作`, '提示', {
+          confirmButtonText: '确定',
+          type: 'warning'
+        })
       }
     }
   }

+ 40 - 1
src/views/modules/flowable/task/TaskForm.vue

@@ -4,7 +4,7 @@
 
   <el-tabs type="border-card" v-model="taskSelectedTab">
     <el-tab-pane label="表单信息" name="form-first">
-      <component id="printForm" :status="status" :formReadOnly="formReadOnly" v-if="formType === '2'" :class="formReadOnly?'readonly':''" ref="form" :businessId="businessId" :is="form" @disableButton="disableButton"></component>
+      <component id="printForm" :status="status" :formReadOnly="formReadOnly" v-if="formType === '2'" :class="formReadOnly?'readonly':''" ref="form" :businessId="businessId" :is="form" @callBackFunc="callBackFunc"></component>
 
       <PreviewForm  id="printForm"   v-if="formType !== '2'"  :processDefinitionId="procDefId" :edit="true" :taskFormData="taskFormData" ref="form"/>
     </el-tab-pane>
@@ -662,6 +662,11 @@
             }
           }
           this.$refs.form.agreeForm((businessTable, businessId, inputForm) => {
+            if (this.commonJS.isNotEmpty(inputForm)) {
+              if (this.commonJS.isNotEmpty(inputForm.assignee)) {
+                this.auditForm.assignee = inputForm.assignee
+              }
+            }
             vars = {...vars, ...inputForm}
             this.taskService.audit({
               taskId: this.taskId,
@@ -824,6 +829,40 @@
             this.noticeService.addInfo(this.inputForm)
           }
         })
+      },
+      callBackFunc (type) {
+        // 隐藏同意按钮
+        if (type === 'hide') {
+          // 读取按钮
+          this.taskDefExtensionService.queryByDefIdAndTaskId({
+            processDefId: this.procDefKey,
+            taskDefId: this.taskDefKey
+          }).then(({data}) => {
+            // console.log('buttons', data)
+            data.flowButtonList.forEach(item => {
+              if (item.code === '_flow_agree') {
+                item.isHide = '1'
+              }
+            })
+            this.buttons = data.flowButtonList
+          })
+        }
+        // 展示同意按钮
+        if (type === 'show') {
+          // 读取按钮
+          this.taskDefExtensionService.queryByDefIdAndTaskId({
+            processDefId: this.procDefKey,
+            taskDefId: this.taskDefKey
+          }).then(({data}) => {
+            // console.log('buttons', data)
+            data.flowButtonList.forEach(item => {
+              if (item.code === '_flow_agree') {
+                item.isHide = '0'
+              }
+            })
+            this.buttons = data.flowButtonList
+          })
+        }
       }
     },
     data () {