perf: 节点独立表单支持同时汇总与填写

saber
ssc 4 years ago
parent d896c833ad
commit 3e5fd5805c
  1. 14
      src/views/plugin/workflow/mixins/ex-form.js
  2. 63
      src/views/plugin/workflow/process/components/detail.vue

@ -343,12 +343,26 @@ export default {
}) })
}) })
} }
// 汇总表单打印
const summaryOption = this.deepClone(this.summaryOption)
if (this.summaryOption.group) {
this.summaryOption.group.forEach(g => {
g.collapse = false
g.column.forEach(col => {
this.handleTemporaryPrintOption(col)
})
setTimeout(() => {
g.collapse = true
})
})
}
setTimeout(() => { setTimeout(() => {
loading.close() loading.close()
// const watermarkText = this.userInfo.user_name + " " + this.userInfo.dept_name // const watermarkText = this.userInfo.user_name + " " + this.userInfo.dept_name
// Watermark.set({ watermark_txt: watermarkText }) // 添加水印 // Watermark.set({ watermark_txt: watermarkText }) // 添加水印
Print('#printBody') Print('#printBody')
this.option = option this.option = option
this.summaryOption = summaryOption
Watermark.remove() // 删除水印 Watermark.remove() // 删除水印
}, 500) }, 500)
}, },

@ -21,6 +21,12 @@
<el-card shadow="never"> <el-card shadow="never">
<div id="printBody" <div id="printBody"
:class="process.status != 'todo' ? `wf-theme-${theme}`: ''"> :class="process.status != 'todo' ? `wf-theme-${theme}`: ''">
<avue-form v-if="summaryOption && ((summaryOption.column && summaryOption.column.length > 0) || (summaryOption.group && summaryOption.group.length > 0))"
v-model="form"
ref="summaryForm"
:option="summaryOption"
:upload-preview="handleUploadPreview"
style="margin-bottom: 20px;"></avue-form>
<avue-form v-if="option && ((option.column && option.column.length > 0) || (option.group && option.group.length > 0))" <avue-form v-if="option && ((option.column && option.column.length > 0) || (option.group && option.group.length > 0))"
v-model="form" v-model="form"
ref="form" ref="form"
@ -111,6 +117,7 @@ export default {
option: {}, option: {},
vars: [], // vars: [], //
submitLoading: false, // loading submitLoading: false, // loading
summaryOption: {}, // option
} }
}, },
methods: { methods: {
@ -132,11 +139,13 @@ export default {
const { option } = this.handleResolveOption(eval('(' + content + ')'), taskForm, 'done') const { option } = this.handleResolveOption(eval('(' + content + ')'), taskForm, 'done')
options.group.push({ options.group.push({
label: taskName || taskKey, label: taskName || taskKey,
collapse: allForm ? false : true,
column: option.column column: option.column
}) })
}) })
this.option = options this.summaryOption = options
} else if (allForm) { }
if (allForm) {
const { option, vars } = this.handleResolveOption(eval('(' + allForm + ')'), taskForm, status) const { option, vars } = this.handleResolveOption(eval('(' + allForm + ')'), taskForm, status)
option.menuBtn = false option.menuBtn = false
for (let key in variables) { for (let key in variables) {
@ -206,30 +215,40 @@ export default {
// //
handleExamine(pass) { handleExamine(pass) {
this.submitLoading = true this.submitLoading = true
this.$refs.form.validate((valid, done, msg) => { const { form, summaryForm } = this.$refs
if (valid) { if (form) {
const variables = {} this.$refs.form.validate((valid, done, msg) => {
this.vars.forEach(v => { if (valid) {
if (v != 'comment' && this.form[v]) variables[v] = this.form[v] const variables = {}
}) this.vars.forEach(v => {
if (v != 'comment' && this.form[v]) variables[v] = this.form[v]
})
this.handleCompleteTask(pass, variables).then(() => { this.handleCompleteTask(pass, variables).then(() => {
this.$message.success("处理成功") this.$message.success("处理成功")
this.handleCloseTag('/plugin/workflow/process/todo') this.handleCloseTag('/plugin/workflow/process/todo')
}).catch(() => { }).catch(() => {
if (typeof done == 'function') done()
this.submitLoading = false
})
} else {
done() done()
this.submitLoading = false this.submitLoading = false
}) if (msg) {
} else { const key = Object.keys(msg)[0]
done() const rules = msg[key]
this.submitLoading = false this.$message.error(rules.map(r => r.message).join(' | '))
if (msg) { }
const key = Object.keys(msg)[0]
const rules = msg[key]
this.$message.error(rules.map(r => r.message).join(' | '))
} }
} })
}) } else if (summaryForm) {
this.handleCompleteTask(pass, {}).then(() => {
this.$message.success("处理成功")
this.handleCloseTag('/plugin/workflow/process/todo')
}).catch(() => {
this.submitLoading = false
})
} else this.$message.error('找不到需要提交的表单')
}, },
} }
} }

Loading…
Cancel
Save