From d6ae3bde342f05cced910f50aa0c646988655dc4 Mon Sep 17 00:00:00 2001
From: ssc <273702440@qq.com>
Date: Tue, 12 Apr 2022 17:15:00 +0800
Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E5=A4=96=E7=BD=AE?=
=?UTF-8?q?=E8=A1=A8=E5=8D=95=E6=A8=A1=E7=89=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/plugin/workflow/mixins/ex-form.js | 54 ++++++++++---------
.../workflow/process/external/Leave/start.vue | 12 ++---
.../process/external/template/start.vue | 12 ++---
3 files changed, 38 insertions(+), 40 deletions(-)
diff --git a/src/views/plugin/workflow/mixins/ex-form.js b/src/views/plugin/workflow/mixins/ex-form.js
index 2c0185a..5b3372d 100644
--- a/src/views/plugin/workflow/mixins/ex-form.js
+++ b/src/views/plugin/workflow/mixins/ex-form.js
@@ -139,33 +139,39 @@ export default {
* 发起流程
* @param form {"processId": "流程定义id", ...表单自定义字段变量}
*/
- handleStartProcess() {
- this.loading = true
- this.$refs.form.validate((valid, done, msg) => {
- let form = this.deepClone(this.form)
- if (this.$refs.examineForm && this.$refs.examineForm.examineForm) {
- const { copyUser, assignee } = this.$refs.examineForm.examineForm
- form = { ...form, copyUser, assignee }
- }
- if (valid) {
- startProcess(form).then(() => {
- this.$message.success("发起成功")
- this.handleCloseTag('/plugin/workflow/process/send')
- done()
- this.loading = false
- }).catch(() => {
+ handleStartProcess(isExForm = false) {
+ return new Promise((resolve) => {
+ this.loading = true
+ this.$refs.form.validate((valid, done, msg) => {
+ let form = this.deepClone(this.form)
+ if (this.$refs.examineForm && this.$refs.examineForm.examineForm) {
+ const { copyUser, assignee } = this.$refs.examineForm.examineForm
+ form = { ...form, copyUser, assignee }
+ }
+ if (valid) {
+ startProcess(form).then(() => {
+ if (isExForm === true) {
+ resolve(done)
+ } else {
+ this.$message.success("发起成功")
+ this.handleCloseTag('/plugin/workflow/process/send')
+ done()
+ this.loading = false
+ }
+ }).catch(() => {
+ done()
+ this.loading = false
+ })
+ } else {
done()
this.loading = false
- })
- } else {
- done()
- this.loading = 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(' | '))
+ }
}
- }
+ })
})
},
/**
diff --git a/src/views/plugin/workflow/process/external/Leave/start.vue b/src/views/plugin/workflow/process/external/Leave/start.vue
index bca3264..de4c9a1 100644
--- a/src/views/plugin/workflow/process/external/Leave/start.vue
+++ b/src/views/plugin/workflow/process/external/Leave/start.vue
@@ -35,10 +35,7 @@
{
- loading = true;
- $refs.form.submit()
- }">发起
+ @click="handleSubmit">发起
{
+ handleSubmit() {
+ this.handleStartProcess(true).then(done => {
this.$message.success("发起成功")
- done()
this.handleCloseTag('/plugin/workflow/process/send')
+ done()
}).catch(() => {
this.loading = false
- done()
})
},
}
diff --git a/src/views/plugin/workflow/process/external/template/start.vue b/src/views/plugin/workflow/process/external/template/start.vue
index cf851b7..893a349 100644
--- a/src/views/plugin/workflow/process/external/template/start.vue
+++ b/src/views/plugin/workflow/process/external/template/start.vue
@@ -29,10 +29,7 @@
{
- loading = true;
- $refs.form.submit()
- }">发起
+ @click="handleSubmit">发起
{
+ handleSubmit() {
+ this.handleStartProcess(true).then(done => {
this.$message.success("发起成功")
- done()
this.handleCloseTag('/plugin/workflow/process/send')
+ done()
}).catch(() => {
this.loading = false
- done()
})
},
}