feat: 审批暂存

master
ssc 2 years ago
parent 1389b909cf
commit 5f3f2344c0
  1. 16
      src/views/plugin/workflow/mixins/draft.js
  2. 4
      src/views/plugin/workflow/process/components/button.vue
  3. 18
      src/views/plugin/workflow/process/components/detail.vue
  4. 4
      src/views/plugin/workflow/process/components/form.vue
  5. 4
      src/views/plugin/workflow/process/external/Leave/start.vue
  6. 2
      src/views/plugin/workflow/process/external/template/start.vue

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

@ -5,6 +5,10 @@
:style="{width: isCollapse? 'calc(100% - 80px)': 'calc(100% - 260px)' }"
id="avue-view">
<template v-if="process.status == 'todo'">
<el-button size="medium"
type="primary"
v-loading="loading"
@click="$emit('draft')">暂存</el-button>
<el-button v-if="getButton('wf_pass')"
type="success"
size="medium"

@ -78,6 +78,7 @@
:button-list="buttonList"
:process="process"
:comment="comment"
@draft="handleDraft({ taskId: process.taskId, variables: form })"
@examine="handleExamine"
@user-select="handleUserSelect"
@print="handlePrint"
@ -102,9 +103,10 @@ import userSelect from './user-select'
import exForm from '../../mixins/ex-form'
import theme from '../../mixins/theme'
import draft from '../../mixins/draft'
export default {
mixins: [exForm, theme],
mixins: [exForm, theme, draft],
components: { userSelect, WfExamineForm, WfButton, WfFlow, WfTheme, WfFormVariable },
watch: {
'$route.params.params': {
@ -177,7 +179,19 @@ export default {
this.option = option
this.vars = vars
}
this.form = variables
if (this.permission.wf_process_draft && status == 'todo') {
// 稿
this.initDraft({ taskId }).then(data => {
this.$confirm('是否恢复之前保存的草稿?', '提示', {
}).then(() => {
this.form = { ...JSON.parse(data) }
}).catch(() => {
this.form = { ...variables }
})
}).catch(() => {
this.form = { ...variables }
})
} else this.form = { ...variables }
this.waiting = false
})
},

@ -36,7 +36,7 @@
type="success"
size="medium"
v-loading="loading"
@click="handleDraft(process.id, process.formKey, form)">存为草稿</el-button>
@click="handleDraft({ processDefId: process.id, formKey: process.formKey, variables: form })">存为草稿</el-button>
</el-row>
</avue-skeleton>
@ -123,7 +123,7 @@ export default {
if (this.permission.wf_process_draft) {
// 稿
this.initDraft(process.id).then(data => {
this.initDraft({ processDefId: process.id }).then(data => {
this.$confirm('是否恢复之前保存的草稿?', '提示', {
}).then(() => {
this.form = JSON.parse(data)

@ -40,7 +40,7 @@
type="success"
size="medium"
v-loading="loading"
@click="handleDraft(process.id, process.formKey, form)">存为草稿</el-button>
@click="handleDraft({ processDefId: process.id, formKey: process.formKey, variables: form })">存为草稿</el-button>
</el-row>
</avue-skeleton>
@ -226,7 +226,7 @@ export default {
if (this.permission.wf_process_draft) {
// 稿
this.initDraft(process.id).then(data => {
this.initDraft({ processDefId: process.id }).then(data => {
this.$confirm('是否恢复之前保存的草稿?', '提示', {
}).then(() => {
this.form = JSON.parse(data)

@ -34,7 +34,7 @@
type="success"
size="medium"
v-loading="loading"
@click="handleDraft(process.id, process.formKey, form)">存为草稿</el-button>
@click="handleDraft({ processDefId: process.id, formKey: process.formKey, variables: form })">存为草稿</el-button>
</el-row>
</avue-skeleton>

Loading…
Cancel
Save