diff --git a/src/views/plugin/workflow/design/index.vue b/src/views/plugin/workflow/design/index.vue index 2c408c7..0f60ee0 100644 --- a/src/views/plugin/workflow/design/index.vue +++ b/src/views/plugin/workflow/design/index.vue @@ -198,10 +198,6 @@ export default { label: '表单', prop: 'formKey', type: 'select', - dicUrl: '/api/blade-workflow/design/form/list?size=-1&status=1', - dicFormatter: (data) => { - return data.data.records - }, props: { label: 'name', value: 'formKey' @@ -302,6 +298,7 @@ export default { this.getButtonList() // this.getUserList() this.getUserListV2() + this.getFormList() }, methods: { handleNextStep() { @@ -319,11 +316,9 @@ export default { exFormKey, column }) } else if (formType == 3) { // 独立表单 - this.$axios.get('/api/blade-workflow/design/form/list?size=-1&status=1').then(res => { - this.$set(this.step2.option, 'indepForm', { - mode: 'indep', - list: res.data.data.records - }) + this.$set(this.step2.option, 'indepForm', { + mode: 'indep', + list: this.formList }) } this.step++ @@ -332,6 +327,28 @@ export default { }) break; case 1: + if (this.step1.form.formType == 3) { // 节点独立表单 + const registry = this.$refs.bpmn2.getElementRegistry().getAll() + let errorList = [] + registry.forEach(ele => { + this.validateIndepFormOption(ele, errorList) + }) + if (errorList.length > 0) { + errorList = new Set(errorList) + let message = '' + errorList.forEach(err => { + const { businessObject } = err + const { id, name } = businessObject + message += `

${name || id} 节点未正确配置表单

` + }) + this.$message({ + type: 'error', + dangerouslyUseHTMLString: true, + message + }) + return + } + } this.$refs.bpmn2.getData('xml').then(data => { this.$set(this.step2.option, 'xml', data) this.$set(this.step3.option, 'xml', data) @@ -396,6 +413,23 @@ export default { }) } }, + validateIndepFormOption(element, errorList) { + const { type, businessObject, children } = element + const indepFormKey = 'flowable:IndepFormKey' + const indepFormSummary = 'flowable:IndepFormSummary' + if ('bpmn:StartEvent' == type) { + const extensionElements = businessObject.extensionElements + if (extensionElements && extensionElements.values && extensionElements.values.length > 0) { + const summary = extensionElements.values.find(v => v.$type == indepFormSummary) + if (!extensionElements.values.find(v => v.$type == indepFormKey) && (!summary || summary == '0')) errorList.push(element) + } else errorList.push(element) + } else if ('bpmn:UserTask' == type) { + const summary = businessObject['indepFormSummary'] + if (!businessObject['indepFormKey'] && (!summary || summary == '0')) errorList.push(element) + } else if ('bpmn:SubProcess' == type) { + children.forEach(ele => this.validateIndepFormOption(ele, errorList)) + } + }, getButtonList() { buttonList(1, 99, { status: 1 }).then(res => { const list = res.data.data.records.map(l => { @@ -408,6 +442,12 @@ export default { this.$set(this.step2.option, 'button', list) }) }, + getFormList() { + this.$axios.get('/api/blade-workflow/design/form/list?size=-1&status=1').then(res => { + this.formList = res.data.data.records + this.findObject(this.step1.option.group, 'formKey').dicData = this.formList + }) + }, getUserList() { const userConfig = { leftColumns: [{