chore: 更新外置表单模版

saber
ssc 4 years ago
parent 4fc9e5b356
commit d6ae3bde34
  1. 54
      src/views/plugin/workflow/mixins/ex-form.js
  2. 12
      src/views/plugin/workflow/process/external/Leave/start.vue
  3. 12
      src/views/plugin/workflow/process/external/template/start.vue

@ -139,33 +139,39 @@ export default {
* 发起流程 * 发起流程
* @param form {"processId": "流程定义id", ...表单自定义字段变量} * @param form {"processId": "流程定义id", ...表单自定义字段变量}
*/ */
handleStartProcess() { handleStartProcess(isExForm = false) {
this.loading = true return new Promise((resolve) => {
this.$refs.form.validate((valid, done, msg) => { this.loading = true
let form = this.deepClone(this.form) this.$refs.form.validate((valid, done, msg) => {
if (this.$refs.examineForm && this.$refs.examineForm.examineForm) { let form = this.deepClone(this.form)
const { copyUser, assignee } = this.$refs.examineForm.examineForm if (this.$refs.examineForm && this.$refs.examineForm.examineForm) {
form = { ...form, copyUser, assignee } const { copyUser, assignee } = this.$refs.examineForm.examineForm
} form = { ...form, copyUser, assignee }
if (valid) { }
startProcess(form).then(() => { if (valid) {
this.$message.success("发起成功") startProcess(form).then(() => {
this.handleCloseTag('/plugin/workflow/process/send') if (isExForm === true) {
done() resolve(done)
this.loading = false } else {
}).catch(() => { this.$message.success("发起成功")
this.handleCloseTag('/plugin/workflow/process/send')
done()
this.loading = false
}
}).catch(() => {
done()
this.loading = false
})
} else {
done() done()
this.loading = false this.loading = false
}) if (msg) {
} else { const key = Object.keys(msg)[0]
done() const rules = msg[key]
this.loading = 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(' | '))
} }
} })
}) })
}, },
/** /**

@ -35,10 +35,7 @@
<el-button type="primary" <el-button type="primary"
size="medium" size="medium"
v-loading="loading" v-loading="loading"
@click="() => { @click="handleSubmit">发起</el-button>
loading = true;
$refs.form.submit()
}">发起</el-button>
<el-button v-if="permission.wf_process_draft" <el-button v-if="permission.wf_process_draft"
type="success" type="success"
size="medium" size="medium"
@ -225,14 +222,13 @@ export default {
this.waiting = false this.waiting = false
}) })
}, },
handleSubmit(form, done) { handleSubmit() {
this.handleStartProcess(form).then(() => { this.handleStartProcess(true).then(done => {
this.$message.success("发起成功") this.$message.success("发起成功")
done()
this.handleCloseTag('/plugin/workflow/process/send') this.handleCloseTag('/plugin/workflow/process/send')
done()
}).catch(() => { }).catch(() => {
this.loading = false this.loading = false
done()
}) })
}, },
} }

@ -29,10 +29,7 @@
<el-button type="primary" <el-button type="primary"
size="medium" size="medium"
v-loading="loading" v-loading="loading"
@click="() => { @click="handleSubmit">发起</el-button>
loading = true;
$refs.form.submit()
}">发起</el-button>
<el-button v-if="permission.wf_process_draft" <el-button v-if="permission.wf_process_draft"
type="success" type="success"
size="medium" size="medium"
@ -101,14 +98,13 @@ export default {
this.waiting = false this.waiting = false
}) })
}, },
handleSubmit(form, done) { handleSubmit() {
this.handleStartProcess(form).then(() => { this.handleStartProcess(true).then(done => {
this.$message.success("发起成功") this.$message.success("发起成功")
done()
this.handleCloseTag('/plugin/workflow/process/send') this.handleCloseTag('/plugin/workflow/process/send')
done()
}).catch(() => { }).catch(() => {
this.loading = false this.loading = false
done()
}) })
}, },
} }

Loading…
Cancel
Save