Pārlūkot izejas kodu

合同列表页流程id动态获取

user5 2 gadi atpakaļ
vecāks
revīzija
f98f2ce079

+ 20 - 9
src/views/modules/sys/workContract/WorkContractList.vue

@@ -171,6 +171,7 @@
   import WorkContractService from '@/api/sys/WorkContractService'
   import SelectUserTree from '@/views/modules/utils/treeUserSelect'
   import TaskService from '@/api/flowable/TaskService'
+  import ProcessService from '@/api/flowable/ProcessService'
   import pick from 'lodash.pick'
   export default {
     data () {
@@ -193,14 +194,18 @@
           pageSize: 10,
           orders: []
         },
+        processDefinitionId: '',
+        procDefKey: '',
         loading: false
       }
     },
     workContractService: null,
     taskService: null,
+    processService: null,
     created () {
       this.workContractService = new WorkContractService()
       this.taskService = new TaskService()
+      this.processService = new ProcessService()
     },
     components: {
       InputNumber,
@@ -232,6 +237,12 @@
           this.tablePage.total = data.total
           this.loading = false
         })
+        this.processService.getByName('合同登记新建').then(({data}) => {
+          if (!this.commonJS.isEmpty(data.id)) {
+            this.processDefinitionId = data.id
+            this.procDefKey = data.key
+          }
+        })
       },
       // 当前页
       currentChangeHandle ({currentPage, pageSize}) {
@@ -310,13 +321,13 @@
         // 读取流程表单
         let tabTitle = `发起流程【合同登记新建】`
         let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [合同登记新建]`
-        this.taskService.getTaskDef({ procDefId: 'Process_1662628133027:6:582ad0be-3329-11ed-bee1-b40ede887c28',
+        this.taskService.getTaskDef({ procDefId: this.processDefinitionId,
           status: 'startAndHold'}).then((data) => {
             this.$router.push({
               path: '/flowable/task/TaskForm',
               query: {
-                procDefId: 'Process_1662628133027:6:582ad0be-3329-11ed-bee1-b40ede887c28',
-                procDefKey: 'Process_1662628133027',
+                procDefId: this.processDefinitionId,
+                procDefKey: this.procDefKey,
                 status: 'startAndHold',
                 title: tabTitle,
                 formType: data.data.formType,
@@ -331,15 +342,15 @@
         // 读取流程表单
         let tabTitle = `发起流程【合同登记新建】`
         let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [合同登记新建]`
-        this.taskService.getTaskDef({ procDefId: 'Process_1662628133027:6:582ad0be-3329-11ed-bee1-b40ede887c28',
+        this.taskService.getTaskDef({ procDefId: this.processDefinitionId,
           businessId: row.id,
           businessTable: 'work_contract_info',
           status: 'startAndHold'}).then((data) => {
             this.$router.push({
               path: '/flowable/task/TaskForm',
               query: {
-                procDefId: 'Process_1662628133027:6:582ad0be-3329-11ed-bee1-b40ede887c28',
-                procDefKey: 'Process_1662628133027',
+                procDefId: this.processDefinitionId,
+                procDefKey: this.procDefKey,
                 status: 'startAndHold',
                 title: tabTitle,
                 formType: data.data.formType,
@@ -355,7 +366,7 @@
         // 读取流程表单
         let tabTitle = `发起流程【合同登记新建】`
         let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [合同登记新建]`
-        this.taskService.getTaskDef({ procDefId: 'Process_1662628133027:6:582ad0be-3329-11ed-bee1-b40ede887c28',
+        this.taskService.getTaskDef({ procDefId: this.processDefinitionId,
           businessId: row.id,
           businessTable: 'work_contract_info',
           taskId: row.procInsId,
@@ -363,8 +374,8 @@
             this.$router.push({
               path: '/flowable/task/TaskForm',
               query: {
-                procDefId: 'Process_1662628133027:6:582ad0be-3329-11ed-bee1-b40ede887c28',
-                procDefKey: 'Process_1662628133027',
+                procDefId: this.processDefinitionId,
+                procDefKey: this.procDefKey,
                 status: 'reback',
                 title: tabTitle,
                 formType: data.data.formType,