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

master
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(() => {
loading.close()
// const watermarkText = this.userInfo.user_name + " " + this.userInfo.dept_name
// Watermark.set({ watermark_txt: watermarkText }) // 添加水印
Print('#printBody')
this.option = option
this.summaryOption = summaryOption
Watermark.remove() // 删除水印
}, 500)
},

@ -21,6 +21,12 @@
<el-card shadow="never">
<div id="printBody"
: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))"
v-model="form"
ref="form"
@ -111,6 +117,7 @@ export default {
option: {},
vars: [], //
submitLoading: false, // loading
summaryOption: {}, // option
}
},
methods: {
@ -132,11 +139,13 @@ export default {
const { option } = this.handleResolveOption(eval('(' + content + ')'), taskForm, 'done')
options.group.push({
label: taskName || taskKey,
collapse: allForm ? false : true,
column: option.column
})
})
this.option = options
} else if (allForm) {
this.summaryOption = options
}
if (allForm) {
const { option, vars } = this.handleResolveOption(eval('(' + allForm + ')'), taskForm, status)
option.menuBtn = false
for (let key in variables) {
@ -206,30 +215,40 @@ export default {
//
handleExamine(pass) {
this.submitLoading = true
this.$refs.form.validate((valid, done, msg) => {
if (valid) {
const variables = {}
this.vars.forEach(v => {
if (v != 'comment' && this.form[v]) variables[v] = this.form[v]
})
const { form, summaryForm } = this.$refs
if (form) {
this.$refs.form.validate((valid, done, msg) => {
if (valid) {
const variables = {}
this.vars.forEach(v => {
if (v != 'comment' && this.form[v]) variables[v] = this.form[v]
})
this.handleCompleteTask(pass, variables).then(() => {
this.$message.success("处理成功")
this.handleCloseTag('/plugin/workflow/process/todo')
}).catch(() => {
this.handleCompleteTask(pass, variables).then(() => {
this.$message.success("处理成功")
this.handleCloseTag('/plugin/workflow/process/todo')
}).catch(() => {
if (typeof done == 'function') done()
this.submitLoading = false
})
} else {
done()
this.submitLoading = false
})
} else {
done()
this.submitLoading = false
if (msg) {
const key = Object.keys(msg)[0]
const rules = msg[key]
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