Selaa lähdekoodia

动态配置工作流

zhengnaiwen_citu 4 kuukautta sitten
vanhempi
commit
58848b5b05
2 muutettua tiedostoa jossa 26 lisäystä ja 11 poistoa
  1. 6 1
      src/api/system.js
  2. 20 10
      src/views/system/workflow/workflowApproved.vue

+ 6 - 1
src/api/system.js

@@ -245,5 +245,10 @@ export function fileUpload (params) {
 
 // 钻取接口
 export function drilling (params) {
-  return http.post('/drilling/detail ', params)
+  return http.post('/drilling/detail', params)
+}
+
+// 获取工作流处理对象
+export function getDictList (params) {
+  return http.get('/dict/list', params)
 }

+ 20 - 10
src/views/system/workflow/workflowApproved.vue

@@ -14,11 +14,10 @@
             >
               <el-form-item label="处理对象" :prop="`items.${index}.handleType`">
                 <el-select v-model="item.handleType" placeholder="请选择处理对象" @change="onChange(item)">
-                  <el-option label="指定人" value="0"></el-option>
-                  <el-option label="指定部室岗位" value="1"></el-option>
+                  <el-option v-for="val in items" :key="val.value" :label="val.title" :value="val.value"></el-option>
                 </el-select>
               </el-form-item>
-              <el-form-item label="处理方" :prop="`items.${index}.handleValue`" :rules="{ required: true, message: '请选择处理方', trigger: 'change' }">
+              <el-form-item v-if="item.handleType < 2" label="处理方" :prop="`items.${index}.handleValue`" :rules="{ required: item.handleType < 2, message: '请选择处理方', trigger: 'change' }">
                 <el-cascader
                   v-model="item.handleValue"
                   :ref="`cascader_${index}`"
@@ -56,7 +55,8 @@ import {
   saveWorkflow
 } from '@/api/workflow'
 import {
-  getOrganizationAtlasAll
+  getOrganizationAtlasAll,
+  getDictList
 } from '@/api/system'
 import { mapGetters } from 'vuex'
 import { cloneDeep } from 'lodash'
@@ -69,14 +69,15 @@ export default {
         items: [
           {
             key: 0,
-            handleType: '0',
+            handleType: 0,
             handleValue: null,
             handleValueData: {}
           }
         ]
       },
       item: {},
-      options: []
+      options: [],
+      items: []
     }
   },
   computed: {
@@ -93,10 +94,11 @@ export default {
       this.item = item
       this.$refs.dialog.open()
       this.loading = true
+      await this.getDict()
       this.formValues.items = item.workFlowTmplateItems.map((e, index) => {
         return {
-          handleType: e.handleType,
-          handleValue: e.handleType === '0' ? e.handleValue.userId : e.handleValue.postName,
+          handleType: +e.handleType,
+          handleValue: +e.handleType === 0 ? e.handleValue.userId : e.handleValue.postName,
           handleValueData: e.handleValue, // 回显
           key: index
         }
@@ -113,11 +115,19 @@ export default {
         this.loading = false
       }
     },
+    async getDict () {
+      try {
+        const { data } = await getDictList()
+        this.items = data.find(e => e.category === 'workFlowHandleTypeEnum')?.dictVos ?? []
+      } catch (error) {
+        this.$message.error(error)
+      }
+    },
     onAdd () {
       this.key++
       this.formValues.items.push({
         key: this.key,
-        handleType: '0',
+        handleType: 0,
         handleValue: null,
         handleValueData: {}
       })
@@ -146,7 +156,7 @@ export default {
     },
     // 提交参数格式化
     onChangeCascader (item, ref) {
-      if (item.handleType === '0') {
+      if (item.handleType === 0) {
         item.handleValueData = {
           userId: item.handleValue
         }