|
|
|
|
@ -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(() => { |
|
|
|
|
}) |
|
|
|
|
|