|
42 | 42 | import i18n from '@/module/i18n' |
43 | 43 | import disabledState from '@/module/mixin/disabledState' |
44 | 44 | import mListBox from './_source/listBox' |
| 45 | + import { mapActions, mapState } from 'vuex' |
45 | 46 |
|
46 | 47 | export default { |
47 | 48 | name: 'sub_process', |
|
57 | 58 | props: { |
58 | 59 | backfillItem: Object |
59 | 60 | }, |
| 61 | + computed: { |
| 62 | + ...mapState('dag', ['processListS']) |
| 63 | + }, |
60 | 64 | methods: { |
| 65 | + ...mapActions('dag', ['getProcessList']), |
61 | 66 | /** |
62 | 67 | * Node unified authentication parameters |
63 | 68 | */ |
|
82 | 87 | */ |
83 | 88 | _handleName (id) { |
84 | 89 | return _.filter(this.processDefinitionList, v => id === v.id)[0].name |
| 90 | + }, |
| 91 | + /** |
| 92 | + * Get all processDefinition list |
| 93 | + */ |
| 94 | + getAllProcessDefinitions () { |
| 95 | + if (!this.processListS || this.processListS.length === 0) { |
| 96 | + return this.getProcessList() |
| 97 | + } |
| 98 | + return Promise.resolve(this.processListS) |
85 | 99 | } |
86 | 100 | }, |
87 | 101 | watch: { |
|
92 | 106 | } |
93 | 107 | }, |
94 | 108 | created () { |
95 | | - let processListS = _.cloneDeep(this.store.state.dag.processListS) |
96 | 109 | let code = null |
97 | 110 | if (this.router.history.current.name === 'projects-instance-details') { |
98 | 111 | code = this.router.history.current.query.code || null |
99 | 112 | } else { |
100 | 113 | code = this.router.history.current.params.code || null |
101 | 114 | } |
102 | | - this.processDefinitionList = processListS.map(v => { |
103 | | - return { |
104 | | - id: v.processDefinition.id, |
105 | | - code: v.processDefinition.code, |
106 | | - name: v.processDefinition.name, |
107 | | - disabled: false |
| 115 | + this.getAllProcessDefinitions().then((processListS) => { |
| 116 | + this.processDefinitionList = processListS.map(def => { |
| 117 | + return { |
| 118 | + id: def.id, |
| 119 | + code: def.code, |
| 120 | + name: def.name, |
| 121 | + disabled: false |
| 122 | + } |
| 123 | + }).filter(a => (a.code + '') !== code) |
| 124 | + let o = this.backfillItem |
| 125 | + // Non-null objects represent backfill |
| 126 | + if (!_.isEmpty(o)) { |
| 127 | + this.wdiCurr = o.params.processDefinitionId |
| 128 | + } else { |
| 129 | + if (this.processDefinitionList.length) { |
| 130 | + this.wdiCurr = this.processDefinitionList[0].id |
| 131 | + this.$emit('on-set-process-name', this._handleName(this.wdiCurr)) |
| 132 | + } |
108 | 133 | } |
109 | | - }).filter(a => (a.code + '') !== code) |
110 | | -
|
111 | | - let o = this.backfillItem |
112 | | - // Non-null objects represent backfill |
113 | | - if (!_.isEmpty(o)) { |
114 | | - this.wdiCurr = o.params.processDefinitionId |
115 | | - } else { |
116 | | - if (this.processDefinitionList.length) { |
117 | | - this.wdiCurr = this.processDefinitionList[0].id |
118 | | - this.$emit('on-set-process-name', this._handleName(this.wdiCurr)) |
119 | | - } |
120 | | - } |
| 134 | + }) |
121 | 135 | }, |
122 | 136 | mounted () { |
123 | 137 | }, |
|
0 commit comments