Преглед изворни кода

客户、项目流程修改

lizhenhao пре 2 година
родитељ
комит
36be2a2157

+ 8 - 5
src/views/modules/cw/invoice/InvoiceList.vue

@@ -237,7 +237,7 @@
               <el-button v-if="hasPermission('cw_finance:invoice:edit')&&scope.row.status === '5'&&scope.row.receivablesStatus !== '1'" type="text"   size="small" @click="isReceivables(scope.row)">确认收款</el-button>
               <el-button v-if="hasPermission('cw_finance:invoice:edit')&&scope.row.status === '5'||scope.row.status === '7'||scope.row.status === '8'" type="text"  size="small" @click="invoiceInvalidPush(scope.row)">作废</el-button>
               <el-button v-if="hasPermission('cw_finance:invoice:edit')&&scope.row.status === '6'" type="text"  size="small" @click="invoiceInvalidReBack(scope.row)">作废撤回</el-button>
-              <el-button v-if="hasPermission('cw_finance:invoice:edit')&&scope.row.status === '1'||scope.row.status === '3'||scope.row.status === '4'" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
+              <el-button v-if="hasPermission('cw_finance:invoice:edit')&&scope.row.status === '1'||scope.row.status === '3'" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
             </template>
           </vxe-column>
         </vxe-table>
@@ -513,6 +513,7 @@
             this.$router.push({
               path: '/flowable/task/TaskForm',
               query: {
+                ...pick(data.data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
                 procDefId: this.processDefinitionId,
                 procDefKey: this.procDefKey,
                 status: 'startAndHold',
@@ -542,6 +543,7 @@
             this.$router.push({
               path: '/flowable/task/TaskForm',
               query: {
+                ...pick(data.data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
                 procDefId: this.processDefinitionId,
                 procDefKey: this.procDefKey,
                 title: title,
@@ -572,6 +574,7 @@
             this.$router.push({
               path: '/flowable/task/TaskForm',
               query: {
+                ...pick(data.data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
                 procDefId: this.processDefinitionInvalidId,
                 procDefKey: this.procDefInvalidKey,
                 title: title,
@@ -600,13 +603,13 @@
               this.$router.push({
                 path: '/flowable/task/TaskFormDetail',
                 query: {
+                  ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
                   isShow: 'false',
                   readOnly: true,
                   title: '发票申请' + '流程详情',
                   formTitle: '发票申请' + '流程详情',
                   businessId: row.id,
-                  status: 'reback',
-                  ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'title', 'businessId')
+                  status: 'reback'
                 }
               })
             })
@@ -622,13 +625,13 @@
           this.$router.push({
             path: '/flowable/task/TaskFormDetail',
             query: {
+              ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
               isShow: 'false',
               readOnly: true,
               title: '发票作废' + '流程详情',
               formTitle: '发票作废' + '流程详情',
               businessId: row.financeInvoiceInvalidDTO.id,
-              status: 'reback',
-              ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'title', 'businessId')
+              status: 'reback'
             }
           })
         })

+ 9 - 5
src/views/modules/cw/projectRecords/ProjectRecordsList.vue

@@ -105,8 +105,8 @@
               <el-button v-if="hasPermission('cwProjectRecords:edit')&&scope.row.createBy.id === $store.state.user.id&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4')" type="text"  size="small" @click="push(scope.row)">修改</el-button>
               <el-button v-else-if="hasPermission('cwProjectRecords:edit')&&isAdmin&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4'||scope.row.status==='5')" type="text"  size="small" @click="edit(scope.row.id)">修改</el-button>
               <el-button v-if="hasPermission('cwProjectRecords:edit')&&scope.row.createBy.id === $store.state.user.id&&scope.row.status==='2'" type="text"  size="small" @click="reback(scope.row)">撤回</el-button>
-              <el-button v-if="hasPermission('cwProjectRecords:del')&&scope.row.createBy.id === $store.state.user.id&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4')" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
-              <el-button v-else-if="hasPermission('cwProjectRecords:del')&&isAdmin&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4'||scope.row.status==='5')" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
+              <el-button v-if="hasPermission('cwProjectRecords:del')&&scope.row.createBy.id === $store.state.user.id&&(scope.row.status==='1'||scope.row.status==='3')" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
+              <el-button v-else-if="hasPermission('cwProjectRecords:del')&&isAdmin&&(scope.row.status==='1'||scope.row.status==='3' ||scope.row.status==='5')" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
             </template>
           </vxe-column>
         </vxe-table>
@@ -282,6 +282,7 @@
             this.$router.push({
               path: '/flowable/task/TaskForm',
               query: {
+                ...pick(data.data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
                 procDefId: this.processDefinitionAuditId,
                 procDefKey: this.procDefAuditKey,
                 status: 'startAndHold',
@@ -302,8 +303,10 @@
         let title = `发起流程【项目登记】`
         let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了[项目登记]`
         let status = 'startAndHold'
-        if (row.status === '3' || row.status === '4') {
+        if (row.status === '3') {
           status = 'startAndClose'
+        } else if (row.status === '4') {
+          status = 'reapplyFlag'
         }
         this.taskService.getTaskDef({ procDefId: this.processDefinitionAuditId,
           businessId: row.id,
@@ -311,6 +314,7 @@
             this.$router.push({
               path: '/flowable/task/TaskForm',
               query: {
+                ...pick(data.data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
                 procDefId: this.processDefinitionAuditId,
                 procDefKey: this.procDefAuditKey,
                 title: title,
@@ -337,13 +341,13 @@
             this.$router.push({
               path: '/flowable/task/TaskFormDetail',
               query: {
+                ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
                 isShow: 'false',
                 readOnly: true,
                 title: '项目登记' + '流程详情',
                 formTitle: '项目登记' + '流程详情',
                 businessId: row.id,
-                status: 'reback',
-                ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'title', 'businessId')
+                status: 'reback'
               }
             })
           })

+ 48 - 23
src/views/modules/cw/projectRecords/ProjectRecordsTaskForm.vue

@@ -2,7 +2,6 @@
   <div>
     <el-row>
       <el-col :span="24">
-
         <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="formReadOnly"
                      label-width="135px" @submit.native.prevent>
           <el-divider v-if="commonJS.isNotEmpty(inputForm.contractId) && formReadOnly" content-position="left">
@@ -544,6 +543,16 @@
           }
         })
       },
+      reapplyForm (callback) {
+        this.projectRecordsService.queryById(this.inputForm.id).then(({data}) => {
+          if (data.status !== '4') { // 审核状态不是“驳回”,就弹出提示
+            this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+            throw new Error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+          } else {
+            this.doSubmit('reapply', callback)
+          }
+        })
+      },
       // 表单提交
       doSubmit (status, callback) {
         if (status === 'save') {
@@ -578,6 +587,8 @@
           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'
+        } else if (status === 'reapply') {
+          this.inputForm.status = '2'
         }
         this.$refs['inputForm'].validate((valid) => {
           if (valid) {
@@ -606,30 +617,44 @@
           }
         })
       },
-      async updateStatusById (type) {
-        if (type === 'reject' || type === 'reback') {
-          if (await this.$refs.uploadComponent.checkProgress()) {
-            this.loading = false
-            throw new Error()
-          }
-          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)
+      async updateStatusById (type, callback) {
+        if (await this.$refs.uploadComponent.checkProgress()) {
+          this.loading = false
+          throw new Error()
+        } else {
+          if (type === 'reject' || type === 'reback') {
+            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)
+                }
               }
-              if (type === 'reback') {
-                // 撤回
-                let param = {status: '3', id: this.inputForm.id}
-                this.projectRecordsService.updateStatusById(param)
+            })
+          } else if (type === 'hold') {
+            this.projectRecordsService.queryById(this.inputForm.id).then(({data}) => {
+              if (data.status !== '4') { // status的值不等于“驳回”就弹出提示
+                this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+                throw new Error()
+              } else {
+                // 终止
+                let param = {status: '1', id: this.inputForm.id}
+                this.projectRecordsService.updateStatusById(param).then(() => {
+                  callback()
+                })
               }
-            }
-          })
+            })
+          }
         }
       },
       close () {

+ 6 - 4
src/views/modules/cw/projectReportArchive/ProjectReportArchiveList.vue

@@ -148,8 +148,8 @@
               <el-button v-if="hasPermission('cwProjectReportArchive:edit')&&scope.row.createBy.id === $store.state.user.id&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4')" type="text"  size="small" @click="push(scope.row)">修改</el-button>
               <el-button v-else-if="hasPermission('cwProjectReportArchive:edit')&&isAdmin&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4'||scope.row.status==='5')" type="text"  size="small" @click="edit(scope.row.id)">修改</el-button>
               <el-button v-if="hasPermission('cwProjectReportArchive:edit')&&scope.row.createBy.id === $store.state.user.id&&scope.row.status==='2'" type="text"  size="small" @click="reback(scope.row)">撤回</el-button>
-              <el-button v-if="hasPermission('cwProjectReportArchive:del')&&scope.row.createBy.id === $store.state.user.id&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4')" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
-              <el-button v-else-if="hasPermission('cwProjectReportArchive:del')&&isAdmin&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4'||scope.row.status==='5')" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
+              <el-button v-if="hasPermission('cwProjectReportArchive:del')&&scope.row.createBy.id === $store.state.user.id&&(scope.row.status==='1'||scope.row.status==='3')" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
+              <el-button v-else-if="hasPermission('cwProjectReportArchive:del')&&isAdmin&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='5')" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
             </template>
           </vxe-column>
         </vxe-table>
@@ -335,6 +335,7 @@
             this.$router.push({
               path: '/flowable/task/TaskForm',
               query: {
+                ...pick(data.data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
                 procDefId: this.processDefinitionAuditId,
                 procDefKey: this.procDefAuditKey,
                 status: 'startAndHold',
@@ -364,6 +365,7 @@
             this.$router.push({
               path: '/flowable/task/TaskForm',
               query: {
+                ...pick(data.data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
                 procDefId: this.processDefinitionAuditId,
                 procDefKey: this.procDefAuditKey,
                 title: title,
@@ -390,13 +392,13 @@
             this.$router.push({
               path: '/flowable/task/TaskFormDetail',
               query: {
+                ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
                 isShow: 'false',
                 readOnly: true,
                 title: '项目报告归档' + '流程详情',
                 formTitle: '项目报告归档' + '流程详情',
                 businessId: row.id,
-                status: 'reback',
-                ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'title', 'businessId')
+                status: 'reback'
               }
             })
           })

+ 42 - 31
src/views/modules/cw/workClientInfo/WorkClientList.vue

@@ -161,8 +161,8 @@
               <el-button v-if="hasPermission('cw_work_client:info:edit')&&scope.row.createBy.id === $store.state.user.id&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4')" type="text"  size="small" @click="push(scope.row)">修改</el-button>
               <el-button v-else-if="hasPermission('cw_work_client:info:edit')&&isAdmin&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4'||scope.row.status==='5')" type="text"  size="small" @click="edit(scope.row.id)">修改</el-button>
               <el-button v-if="hasPermission('cw_work_client:info:edit')&&scope.row.createBy.id === $store.state.user.id&&scope.row.status==='2'" type="text"  size="small" @click="reback(scope.row)">撤回</el-button>
-              <el-button v-if="hasPermission('cw_work_client:info:del')&&scope.row.createBy.id === $store.state.user.id&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4')" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
-              <el-button v-else-if="hasPermission('cw_work_client:info:del')&&isAdmin&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='4'||scope.row.status==='5')" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
+              <el-button v-if="hasPermission('cw_work_client:info:del')&&scope.row.createBy.id === $store.state.user.id&&(scope.row.status==='1'||scope.row.status==='3')" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
+              <el-button v-else-if="hasPermission('cw_work_client:info:del')&&isAdmin&&(scope.row.status==='1'||scope.row.status==='3'||scope.row.status==='5')" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>
             </template>
           </vxe-column>
         </vxe-table>
@@ -334,6 +334,7 @@
             this.$router.push({
               path: '/flowable/task/TaskForm',
               query: {
+                ...pick(data.data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
                 procDefId: this.processDefinitionAuditId,
                 procDefKey: this.procDefAuditKey,
                 status: 'startAndHold',
@@ -350,33 +351,43 @@
       },
       // 发起客户登记
       push (row) {
-        // 读取流程表单
-        let title = `发起流程【客户登记】`
-        let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了[客户登记]`
-        let status = 'startAndHold'
-        if (row.status === '3' || row.status === '4') {
-          status = 'startAndClose'
-        }
-        this.taskService.getTaskDef({ procDefId: this.processDefinitionAuditId,
-          businessId: row.id,
-          businessTable: 'cw_work_client_base'}).then((data) => {
-            this.$router.push({
-              path: '/flowable/task/TaskForm',
-              query: {
-                procDefId: this.processDefinitionAuditId,
-                procDefKey: this.procDefAuditKey,
-                title: title,
-                formType: data.data.formType,
-                formUrl: data.data.formUrl,
-                formTitle: processTitle,
-                businessTable: 'cw_work_client_base',
-                businessId: row.id,
-                isShow: 'false',
-                status: status,
-                routePath: '/cw/workClientInfo/WorkClientList'
-              }
-            })
-          })
+        this.workClientService.queryById(row.id).then(({data}) => {
+          if (data.status !== row.status) { // status的值不等于“审核中”,就弹出提示
+            this.$message.error('数据已发生改变或不存在,请刷新数据')
+            this.refreshList()
+          } else {
+            // 读取流程表单
+            let title = `发起流程【客户登记】`
+            let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了[客户登记]`
+            let status = 'startAndHold'
+            if (row.status === '3') {
+              status = 'startAndClose'
+            } else if (row.status === '4') {
+              status = 'reapplyFlag'
+            }
+            this.taskService.getTaskDef({ procDefId: this.processDefinitionAuditId,
+              businessId: row.id,
+              businessTable: 'cw_work_client_base'}).then((data) => {
+                this.$router.push({
+                  path: '/flowable/task/TaskForm',
+                  query: {
+                    ...pick(data.data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
+                    procDefId: this.processDefinitionAuditId,
+                    procDefKey: this.procDefAuditKey,
+                    title: title,
+                    formType: data.data.formType,
+                    formUrl: data.data.formUrl,
+                    formTitle: processTitle,
+                    businessTable: 'cw_work_client_base',
+                    businessId: row.id,
+                    isShow: 'false',
+                    status: status,
+                    routePath: '/cw/workClientInfo/WorkClientList'
+                  }
+                })
+              })
+          }
+        })
       },
       // 查看客户登记流程结果
       detail (row) {
@@ -389,13 +400,13 @@
             this.$router.push({
               path: '/flowable/task/TaskFormDetail',
               query: {
+                ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
                 isShow: 'false',
                 readOnly: true,
                 title: '客户登记' + '流程详情',
                 formTitle: '客户登记' + '流程详情',
                 businessId: row.id,
-                status: 'reback',
-                ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'title', 'businessId')
+                status: 'reback'
               }
             })
           })

+ 54 - 23
src/views/modules/cw/workClientInfo/WorkClientTaskForm.vue

@@ -1043,11 +1043,26 @@
           this.doSubmit('start', callback)
         }
       },
+      reapplyForm (callback) {
+        this.workClientService.queryById(this.inputForm.id).then(({data}) => {
+          if (data.status !== '4') { // 审核状态不是“驳回”,就弹出提示
+            this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+            throw new Error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+          } else {
+            if (this.commonJS.isEmpty(this.inputForm.cwWorkClientContactDTOList)) {
+              this.$message.error('“客户联系人”信息中至少有一条数据')
+              throw new Error('“客户联系人”信息中至少有一条数据')
+            } else {
+              this.doSubmit('reapply', callback)
+            }
+          }
+        })
+      },
       async agreeForm (callback) {
         await this.workClientService.queryById(this.inputForm.id).then(({data}) => {
           if (data.status !== '2') { // 审核状态不是“待审核”,就弹出提示
             this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
-            throw new Error()
+            throw new Error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
           } else {
             this.doSubmit('agree', callback)
           }
@@ -1080,6 +1095,8 @@
           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'
+        } else if (status === 'reapply') {
+          this.inputForm.status = '2'
         }
         this.$refs['inputForm'].validate((valid) => {
           if (valid) {
@@ -1104,30 +1121,44 @@
           }
         })
       },
-      async updateStatusById (type) {
-        if (type === 'reject' || type === 'reback') {
-          if (await this.$refs.uploadComponent.checkProgress()) {
-            this.loading = false
-            throw new Error()
-          }
-          await this.workClientService.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.workClientService.updateStatusById(param)
+      updateStatusById (type, callback) {
+        if (this.$refs.uploadComponent.checkProgress()) {
+          this.loading = false
+          throw new Error()
+        } else {
+          if (type === 'reject' || type === 'reback') {
+            this.workClientService.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.workClientService.updateStatusById(param)
+                }
+                if (type === 'reback') {
+                  // 撤回
+                  let param = {status: '3', id: this.inputForm.id}
+                  this.workClientService.updateStatusById(param)
+                }
               }
-              if (type === 'reback') {
-                // 撤回
-                let param = {status: '3', id: this.inputForm.id}
-                this.workClientService.updateStatusById(param)
+            })
+          } else if (type === 'hold') {
+            this.workClientService.queryById(this.inputForm.id).then(({data}) => {
+              if (data.status !== '4') { // status的值不等于“驳回”就弹出提示
+                this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+                throw new Error()
+              } else {
+                // 终止
+                let param = {status: '1', id: this.inputForm.id}
+                this.workClientService.updateStatusById(param).then(() => {
+                  callback()
+                })
               }
-            }
-          })
+            })
+          }
         }
       },
       close () {

+ 108 - 27
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"></component>
+      <component id="printForm" :status="status" :formReadOnly="formReadOnly" v-if="formType === '2'" :class="formReadOnly?'readonly':''" ref="form" :businessId="businessId" :is="form" @disableButton="disableButton"></component>
 
       <PreviewForm  id="printForm"   v-if="formType !== '2'"  :processDefinitionId="procDefId" :edit="true" :taskFormData="taskFormData" ref="form"/>
     </el-tab-pane>
@@ -164,11 +164,9 @@
       if (this.status === 'start') {  // 送审
         this.buttons = [{code: '_flow_start', name: '启动', isHide: '0'}]
       } else if (this.status === 'startAndClose') { // 送审、关闭
-        if (this.statusFlag === '4') {
-          this.buttons = [{code: '_flow_reapply', name: '重新申请', isHide: '0'}, {code: '_flow_stop', name: '流程终止', isHide: '0'}, {code: '_flow_close', name: '关闭', isHide: '0'}]
-        } else {
-          this.buttons = [{code: '_flow_start', name: '送审', isHide: '0'}, {code: '_flow_close', name: '关闭', isHide: '0'}]
-        }
+        this.buttons = [{code: '_flow_start', name: '送审', isHide: '0'}, {code: '_flow_close', name: '关闭', isHide: '0'}]
+      } else if (this.status === 'reapplyFlag') { // 重新申请、流程终止、关闭
+        this.buttons = [{code: '_flow_reapply', name: '重新申请', isHide: '0'}, {code: '_flow_stop', name: '流程终止', isHide: '0'}, {code: '_flow_close', name: '关闭', isHide: '0'}]
       } else if (this.status === 'startAndHold') {  // 送审、暂存、关闭
         this.buttons = [{code: '_flow_start', name: '送审', isHide: '0'}, {code: '_flow_save', name: '暂存', isHide: '0'}, {code: '_flow_close', name: '关闭', isHide: '0'}]
       } else if (this.status === 'startAndCloseFiled') { // 送审、关闭
@@ -365,6 +363,90 @@
           })
         }
       },
+      // 重新申请
+      reapply (vars) {
+        vars = {...vars, agree: true}
+        if (this.formType === '2') { // 外置表单
+          let param = {
+            num: this.$route.query.num,
+            taskId: this.taskId,
+            taskDefKey: this.taskDefKey,
+            procInsId: this.procInsId,
+            procDefId: this.procDefId,
+            vars: vars,
+            comment: this.auditForm,
+            assignee: this.auditForm.assignee,
+            cope: {
+              userIds: this.auditForm.userIds,
+              procDefId: this.procDefId,
+              procInsId: '',
+              procDefName: '',
+              procInsName: this.title,
+              taskName: ''
+            }
+          }
+          this.$refs.form.reapplyForm((businessTable, businessId, inputForm) => {
+            vars = {...vars, ...inputForm}
+            this.taskService.audit({
+              taskId: this.taskId,
+              taskDefKey: this.taskDefKey,
+              procInsId: this.procInsId,
+              procDefId: this.procDefId,
+              vars: vars,
+              comment: this.auditForm,
+              assignee: this.auditForm.assignee
+            }).then(({data}) => {
+              this.$message.success('提交成功')
+              this.changeBusiness()
+              this.$refs.form.close()
+              // 我的通知
+              let createDate = ''
+              this.myNotice(data, this.procDefId, this.title, vars.userName, createDate)
+              this.$store.dispatch('tagsView/delView', {fullPath: this.$route.fullPath})
+              // this.$router.push('/flowable/task/TodoList')
+              // this.cc(data)
+              if (this.$route.query.routePath) {
+                this.$router.push(this.$route.query.routePath)
+              } else {
+                var num = this.$route.query.num
+                if (num === '2') {
+                  this.$router.push('/sys/dashboard/workBench/Pending')
+                  this.cc(data)
+                } else if (num === '3') {
+                  this.$router.push('/sys/dashboard/workBench/PendingList')
+                  this.cc(data)
+                } else {
+                  this.$router.push('/flowable/task/TodoList')
+                  this.cc(data)
+                }
+              }
+            })
+          }, param)
+        } else { // 动态表单
+          this.$refs.form.submitTaskFormData(vars, this.procInsId, this.taskId, this.auditForm.assignee, this.auditForm, (data) => {
+            this.changeBusiness()
+            this.$refs.form.close()
+            this.$store.dispatch('tagsView/delView', {fullPath: this.$route.fullPath})
+            // this.$router.push('/flowable/task/TodoList')
+            // this.cc(data)
+            if (this.$route.query.routePath) {
+              this.$router.push(this.$route.query.routePath)
+            } else {
+              var num = this.$route.query.num
+              if (num === '2') {
+                this.$router.push('/sys/dashboard/workBench/Pending')
+                this.cc(data)
+              } else if (num === '3') {
+                this.$router.push('/sys/dashboard/workBench/PendingList')
+                this.cc(data)
+              } else {
+                this.$router.push('/flowable/task/TodoList')
+                this.cc(data)
+              }
+            }
+          })
+        }
+      },
       // 驳回
       reject (vars) {
         this.$confirm(`确定驳回流程吗?`, '提示', {
@@ -512,28 +594,27 @@
           cancelButtonText: '取消',
           type: 'warning'
         }).then(() => {
-          this.processService.stop(this.procInsId, this.auditForm.message).then(({data}) => {
-            // 将数据状态更改为暂存状态
-            this.$refs.form.updateStatusById('hold', (businessTable, businessId, inputForm) => {
-              this.auditForm.candidateUserList = inputForm.assignee
-            })
-
-            this.$message.success(data)
-            if (this.$route.query.routePath) {
-              this.$router.push(this.$route.query.routePath)
-            } else {
-              var num = this.$route.query.num
-              if (num === '2') {
-                this.$router.push('/sys/dashboard/workBench/Pending')
-                this.cc(data)
-              } else if (num === '3') {
-                this.$router.push('/sys/dashboard/workBench/PendingList')
-                this.cc(data)
+          // 将数据状态更改为暂存状态
+          this.$refs.form.updateStatusById('hold', () => {
+            // this.auditForm.candidateUserList = inputForm.assignee
+            this.processService.stop(this.procInsId, this.auditForm.message).then(({data}) => {
+              this.$message.success(data)
+              if (this.$route.query.routePath) {
+                this.$router.push(this.$route.query.routePath)
               } else {
-                this.$router.push('/flowable/task/TodoList')
-                this.cc(data)
+                var num = this.$route.query.num
+                if (num === '2') {
+                  this.$router.push('/sys/dashboard/workBench/Pending')
+                  this.cc(data)
+                } else if (num === '3') {
+                  this.$router.push('/sys/dashboard/workBench/PendingList')
+                  this.cc(data)
+                } else {
+                  this.$router.push('/flowable/task/TodoList')
+                  this.cc(data)
+                }
               }
-            }
+            })
           })
         })
       },
@@ -698,7 +779,7 @@
             this.print()
             break
           case '_flow_reapply':// 重新申请
-            this.agree()
+            this.reapply()
             break
           case '_flow_close':// 关闭
             this.close()