diff --git a/src/views/plugin/workflow/mixins/draft.js b/src/views/plugin/workflow/mixins/draft.js index 0e33b37..a7fda9d 100644 --- a/src/views/plugin/workflow/mixins/draft.js +++ b/src/views/plugin/workflow/mixins/draft.js @@ -2,20 +2,24 @@ import { getDetail, submit } from '@/api/plugin/workflow/draft' export default { methods: { - initDraft(processDefId) { - return new Promise((resolve) => { - getDetail({ processDefId, platform: 'pc' }).then(res => { + initDraft({ processDefId, taskId }) { + return new Promise((resolve, reject) => { + getDetail({ processDefId, taskId, platform: 'pc' }).then(res => { const { data } = res.data if (data && data.variables && Object.keys(data.variables).length > 0) resolve(data.variables) + else reject() + }).catch((e) => { + reject(e) }) }) }, - handleDraft(processDefId, formKey, variables) { + handleDraft({ processDefId, taskId, formKey, variables }) { this.$confirm('保存至草稿箱并关闭?', '提示', { type: 'warning' }).then(() => { - submit({ processDefId, formKey, variables: JSON.stringify(variables), platform: 'pc' }).then(() => { - this.handleCloseTag('/plugin/workflow/process/start') + submit({ processDefId, taskId, formKey, variables: JSON.stringify(variables), platform: 'pc' }).then(() => { + if (!taskId) this.handleCloseTag('/plugin/workflow/process/start') + else this.handleCloseTag('/plugin/workflow/process/todo') }) }).catch(() => { }) diff --git a/src/views/plugin/workflow/process/components/button.vue b/src/views/plugin/workflow/process/components/button.vue index 7f02dc5..4ccfe85 100644 --- a/src/views/plugin/workflow/process/components/button.vue +++ b/src/views/plugin/workflow/process/components/button.vue @@ -5,6 +5,10 @@ :style="{width: isCollapse? 'calc(100% - 80px)': 'calc(100% - 260px)' }" id="avue-view">