Browse Source

工作流

zhengnaiwen_citu 7 tháng trước cách đây
mục cha
commit
8c5d81241a
2 tập tin đã thay đổi với 27 bổ sung47 xóa
  1. 5 0
      src/api/system.js
  2. 22 47
      src/views/system/workflow/workflowApproved.vue

+ 5 - 0
src/api/system.js

@@ -174,6 +174,11 @@ export function getOrganizationAtlasPostName (params) {
   return http.post('/digitizationData/employee/postName/atlas', params)
 }
 
+// 全机构机构树状
+export function getOrganizationAtlasAll (params) {
+  return http.post('/digitizationData/employee/organization/tree/all', params)
+}
+
 // 组织结构 导入
 export function importOrganization (params) {
   return http.upload('/organization/upload', params)

+ 22 - 47
src/views/system/workflow/workflowApproved.vue

@@ -23,8 +23,13 @@
                 :ref="`cascader_${index}`"
                 placeholder="请选择处理方"
                 :show-all-levels="false"
-                :props="item.handleType === '0' ? personOptions : organizationProp"
-                :options="item.handleType === '0' ? personOrganizationTree : postOrganizationTree"
+                :options="options[item.handleType]"
+                :props="{
+                  emitPath: false,
+                  value: 'id',
+                  label: 'title',
+                  children: 'child'
+                }"
                 @change="onChangeCascader(item, `cascader_${index}`)"
               ></el-cascader>
             </el-form-item>
@@ -48,22 +53,13 @@ import {
   saveWorkflow
 } from '@/api/workflow'
 import {
-  getOrganizationAtlasEmployee,
-  getOrganizationAtlasPostName
+  getOrganizationAtlasAll
 } from '@/api/system'
 import { mapGetters } from 'vuex'
 import { cloneDeep } from 'lodash'
 export default {
   name: 'workflowApproved',
   data () {
-    const defaultOptions = {
-      lazy: true,
-      emitPath: false,
-      value: 'organizationNo',
-      label: 'organizationName',
-      children: 'child'
-    }
-    const _this = this
     return {
       key: 0,
       formValues: {
@@ -77,18 +73,7 @@ export default {
         ]
       },
       item: {},
-      personOptions: {
-        ...defaultOptions,
-        async lazyLoad (node, resolve) {
-          _this.onSearch(node, resolve, getOrganizationAtlasEmployee)
-        }
-      },
-      organizationProp: {
-        ...defaultOptions,
-        async lazyLoad (node, resolve) {
-          _this.onSearch(node, resolve, getOrganizationAtlasPostName)
-        }
-      }
+      options: []
     }
   },
   computed: {
@@ -101,8 +86,10 @@ export default {
     }
   },
   methods: {
-    open (item) {
+    async open (item) {
       this.item = item
+      this.$refs.dialog.open()
+      this.loading = true
       if (item.workFlowTmplateItems.length > 0) {
         this.formValues.items = item.workFlowTmplateItems.map((e, index) => {
           return {
@@ -114,7 +101,16 @@ export default {
         })
       }
       this.key = item.workFlowTmplateItems.length + 1
-      this.$refs.dialog.open()
+      try {
+        const { data: person } = await getOrganizationAtlasAll({ type: 0 })
+        this.options.push(person)
+        const { data: post } = await getOrganizationAtlasAll({ type: 1 })
+        this.options.push(post)
+      } catch (error) {
+        this.$message.error(error)
+      } finally {
+        this.loading = false
+      }
     },
     onAdd () {
       this.key++
@@ -147,27 +143,6 @@ export default {
     onChange (item) {
       item.handleValue = null
     },
-    async onSearch (node, resolve, api) {
-      const nodeData = node.data
-      if (!nodeData.hasChildren) {
-        return resolve()
-      }
-      try {
-        const { data } = await api({
-          organizationNo: node.value
-        })
-        resolve(data.nodes.map(e => {
-          return {
-            organizationNo: e.id,
-            organizationName: e.text,
-            leaf: true
-          }
-        }))
-      } catch (error) {
-        resolve()
-        this.$message.error(error)
-      }
-    },
     // 提交参数格式化
     onChangeCascader (item, ref) {
       if (item.handleType === '0') {