lizhenhao 2 سال پیش
والد
کامیت
0c8c30d012

+ 58 - 0
src/views/modules/cw/projectReportArchive/ProjectReportArchiveList.vue

@@ -188,6 +188,10 @@
               <el-button v-if="hasPermission('cwProjectReportArchive:edit')&&(scope.row.createBy.id === $store.state.user.id||haveProjectIds.includes(scope.row.projectId))&&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==='5'||scope.row.status==='4')" type="text"   size="small" @click="del(scope.row.id)">删除</el-button>-->
+<!--              审核-->
+              <el-button v-if="scope.row.status==='2' && checkIsAudit(scope.row)" type="text"  size="small" @click="examine(scope.row)">审核</el-button>
+<!--              被驳回后当前申请人重新调整-->
+              <el-button v-if="scope.row.createBy.id === $store.state.user.id&&scope.row.status === '4'" type="text"  size="small" @click="adjust(scope.row)">驳回调整</el-button>
             </template>
           </vxe-column>
         </vxe-table>
@@ -540,6 +544,60 @@
             console.log(err.response)
           }
         })
+      },
+      // 驳回后调整
+      adjust (row) {
+        this.projectReportArchiveService.queryById(row.id).then(({data}) => {
+          if (data.status !== '4') { // status的值不等于“驳回”,就弹出提示
+            this.$message.error('数据已发生改变或不存在,请刷新数据')
+            this.refreshList()
+          } else {
+            this.todo(row)
+          }
+        })
+      },
+      // 审核
+      examine (row) {
+        this.projectReportArchiveService.queryById(row.id).then(({data}) => {
+          if (data.status !== '2') { // status的值不等于“审核中”,就弹出提示
+            this.$message.error('数据已发生改变或不存在,请刷新数据')
+            this.refreshList()
+          } else {
+            this.todo(row)
+          }
+        })
+      },
+      // 审核或重新调整跳转
+      todo (row) {
+        let cUser = false
+        this.taskService.getTaskDefInfo({
+          taskId: row.taskId
+        }).then(({data}) => {
+          this.$router.push({
+            path: '/flowable/task/TaskForm',
+            query: {
+              ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId'),
+              isShow: false,
+              formReadOnly: true,
+              formTitle: `${data.taskName}`,
+              cUser: cUser,
+              title: `审批【${data.taskName || ''}】`,
+              routePath: '/cw/projectReportArchive/ProjectReportArchiveList'   // 数据处理后需要跳转的页面路径
+            }
+          })
+        })
+      },
+      // 查询当前登录人是否是数据的审核人
+      checkIsAudit (row) {
+        let loginUserId = this.$store.state.user.id  // 获取当前登录用户id
+        if (this.commonJS.isNotEmpty(row.auditUserIds)) {
+          for (const userId of row.auditUserIds) {
+            if (userId === loginUserId) {  // 当数据的审核人中包含当前登录人id时,返回true
+              return true
+            }
+          }
+        }
+        return false
       }
     }
   }

+ 5 - 0
src/views/modules/cw/projectReportArchive/ProjectReportArchiveTaskForm.vue

@@ -602,6 +602,7 @@
         })
       },
       async updateStatusById (type, callback) {
+        this.loading = true
         if (this.$refs.uploadComponent.checkProgress()) {
           this.loading = false
           throw new Error()
@@ -609,6 +610,7 @@
           if (type === 'reject' || type === 'reback') {
             await this.projectReportArchiveService.queryById(this.inputForm.id).then(({data}) => {
               if (data.status !== '2') { // status的值不等于“审核中”就弹出提示
+                this.loading = false
                 this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
                 throw new Error()
               } else {
@@ -651,6 +653,7 @@
                   // 撤回
                   let param = {status: '3', id: this.inputForm.id}
                   this.projectReportArchiveService.updateStatusById(param).then(() => {
+                    this.loading = false
                     callback()
                   })
                 }
@@ -659,12 +662,14 @@
           } else if (type === 'hold') {
             this.projectReportArchiveService.queryById(this.inputForm.id).then(({data}) => {
               if (data.status !== '4') { // status的值不等于“驳回”就弹出提示
+                this.loading = false
                 this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
                 throw new Error()
               } else {
                 // 终止
                 let param = {status: '1', id: this.inputForm.id}
                 this.projectReportArchiveService.updateStatusById(param).then(() => {
+                  this.loading = false
                   callback()
                 })
               }

+ 58 - 0
src/views/modules/cw/reportCancellApply/ReportCancellApplyList.vue

@@ -129,6 +129,10 @@
               <el-button v-if="hasPermission('cwProjectReport:edit')&&scope.row.createById === $store.state.user.id&&scope.row.status==='2'" type="text"  size="small" @click="reback(scope.row)">撤回</el-button>
               <el-button v-if="hasPermission('cwProjectReport:del')&&scope.row.createById === $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('cwProjectReport: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>
+<!--              审核-->
+              <el-button v-if="scope.row.status==='2' && checkIsAudit(scope.row)" type="text"  size="small" @click="examine(scope.row)">审核</el-button>
+<!--              被驳回后当前申请人重新调整-->
+              <el-button v-if="scope.row.createById === $store.state.user.id&&scope.row.status === '4'" type="text"  size="small" @click="adjust(scope.row)">驳回调整</el-button>
             </template>
           </vxe-column>
         </vxe-table>
@@ -434,6 +438,60 @@
           //   }
           // })
         })
+      },
+      // 驳回后调整
+      adjust (row) {
+        this.reportCancellApplyService.queryById(row.id).then(({data}) => {
+          if (data.status !== '4') { // status的值不等于“驳回”,就弹出提示
+            this.$message.error('数据已发生改变或不存在,请刷新数据')
+            this.refreshList()
+          } else {
+            this.todo(row)
+          }
+        })
+      },
+      // 审核
+      examine (row) {
+        this.reportCancellApplyService.queryById(row.id).then(({data}) => {
+          if (data.status !== '2') { // status的值不等于“审核中”,就弹出提示
+            this.$message.error('数据已发生改变或不存在,请刷新数据')
+            this.refreshList()
+          } else {
+            this.todo(row)
+          }
+        })
+      },
+      // 审核或重新调整跳转
+      todo (row) {
+        let cUser = false
+        this.taskService.getTaskDefInfo({
+          taskId: row.taskId
+        }).then(({data}) => {
+          this.$router.push({
+            path: '/flowable/task/TaskForm',
+            query: {
+              ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId'),
+              isShow: false,
+              formReadOnly: true,
+              formTitle: `${data.taskName}`,
+              cUser: cUser,
+              title: `审批【${data.taskName || ''}】`,
+              routePath: '/cw/reportCancellApply/ReportCancellApplyList'   // 数据处理后需要跳转的页面路径
+            }
+          })
+        })
+      },
+      // 查询当前登录人是否是数据的审核人
+      checkIsAudit (row) {
+        let loginUserId = this.$store.state.user.id  // 获取当前登录用户id
+        if (this.commonJS.isNotEmpty(row.auditUserIds)) {
+          for (const userId of row.auditUserIds) {
+            if (userId === loginUserId) {  // 当数据的审核人中包含当前登录人id时,返回true
+              return true
+            }
+          }
+        }
+        return false
       }
     }
   }

+ 27 - 1
src/views/modules/cw/reportCancellApply/ReportCancellApplyTaskForm.vue

@@ -164,6 +164,11 @@
             })
           }
         }
+      },
+      'loading': {
+        handler (newVal) {
+          this.$emit('changeLoading', newVal)
+        }
       }
     },
     components: {
@@ -252,11 +257,22 @@
         this.doSubmit('save', callback)
       },
       startForm (callback) {
-        this.doSubmit('start', callback)
+        this.loading = true
+        this.reportCancellApplyService.queryById(this.inputForm.id).then(({data}) => {
+          if (data.status !== '0' && data.status !== '1' && data.status !== '3') { // 审核状态不是“未发起”或“暂存”或“撤回”,就弹出提示
+            this.loading = false
+            this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+            throw new Error()
+          } else {
+            this.doSubmit('start', callback)
+          }
+        })
       },
       async agreeForm (callback) {
+        this.loading = true
         await this.reportCancellApplyService.queryById(this.inputForm.id).then(({data}) => {
           if (data.status !== '2') { // 审核状态不是“待审核”,就弹出提示
+            this.loading = false
             this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
             throw new Error()
           } else {
@@ -274,8 +290,10 @@
         // })
       },
       reapplyForm (callback) {
+        this.loading = true
         this.reportCancellApplyService.queryById(this.inputForm.id).then(({data}) => {
           if (data.status !== '4') { // 审核状态不是“驳回”,就弹出提示
+            this.loading = false
             this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
             throw new Error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
           } else {
@@ -339,13 +357,17 @@
             // }).catch(() => {
             //   this.loading = false
             // })
+          } else {
+            this.loading = false
           }
         })
       },
       async updateStatusById (type, callback) {
+        this.loading = true
         if (type === 'reject' || type === 'reback') {
           await this.reportCancellApplyService.queryById(this.inputForm.id).then(({data}) => {
             if (data.status !== '2') { // status的值不等于“审核中”就弹出提示
+              this.loading = false
               this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
               throw new Error()
             } else {
@@ -354,6 +376,7 @@
                 this.inputForm.status = '4'
                 let param = {status: '4', id: this.inputForm.id}
                 this.reportCancellApplyService.updateStatusById(param).then(() => {
+                  this.loading = false
                   callback()
                 })
                 // this.projectRecordsService.updateStatusById(param)
@@ -363,6 +386,7 @@
                 let param = {status: '3', id: this.inputForm.id}
                 // this.projectRecordsService.updateStatusById(param)
                 this.reportCancellApplyService.updateStatusById(param).then(() => {
+                  this.loading = false
                   callback()
                 })
               }
@@ -391,12 +415,14 @@
         } else if (type === 'hold') {
           this.reportCancellApplyService.queryById(this.inputForm.id).then(({data}) => {
             if (data.status !== '4') { // status的值不等于“驳回”就弹出提示
+              this.loading = false
               this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
               throw new Error()
             } else {
               // 终止
               let param = {status: '1', id: this.inputForm.id}
               this.reportCancellApplyService.updateStatusById(param).then(() => {
+                this.loading = false
                 callback()
               })
             }