|
|
|
@ -56,7 +56,15 @@ export default {
@@ -56,7 +56,15 @@ export default {
|
|
|
|
|
bpmnModeler: undefined, |
|
|
|
|
canRedo: false, |
|
|
|
|
canUndo: false, |
|
|
|
|
defaultZoom: 1 |
|
|
|
|
defaultZoom: 1, |
|
|
|
|
// todo: 目前配合微应用乾坤使用兼容,重构vue3删除 |
|
|
|
|
createMessage: this.$useMessage.createMessage, |
|
|
|
|
notification: this.$useMessage.notification, |
|
|
|
|
createConfirm: this.$useMessage.createConfirm, |
|
|
|
|
createSuccessModal: this.$useMessage.createSuccessModal, |
|
|
|
|
createErrorModal: this.$useMessage.createErrorModal, |
|
|
|
|
createWarningModal: this.$useMessage.createWarningModal, |
|
|
|
|
createInfoModal: this.$useMessage.createInfoModal |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted () { |
|
|
|
@ -106,7 +114,7 @@ export default {
@@ -106,7 +114,7 @@ export default {
|
|
|
|
|
}, |
|
|
|
|
/** 导入bpmnXml文件 */ |
|
|
|
|
importDiagram (xml) { |
|
|
|
|
this.bpmnModeler.importXML(xml).catch(() => this.$message.error('打开模型出错,请确认该模型符合Bpmn2.0规范')) |
|
|
|
|
this.bpmnModeler.importXML(xml).catch(() => this.createMessage.error('打开模型出错,请确认该模型符合Bpmn2.0规范')) |
|
|
|
|
}, |
|
|
|
|
/** 创建新的流程图 */ |
|
|
|
|
restart () { |
|
|
|
@ -248,7 +256,7 @@ export default {
@@ -248,7 +256,7 @@ export default {
|
|
|
|
|
value: bpmnElement.formReadOnly |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
if (conditionType != undefined) { |
|
|
|
|
if (conditionType !== undefined) { |
|
|
|
|
options.activityExtensionProperty.push({ |
|
|
|
|
key: 'conditionType', |
|
|
|
|
processDefId: options.process.id, |
|
|
|
@ -259,11 +267,11 @@ export default {
@@ -259,11 +267,11 @@ export default {
|
|
|
|
|
// ---------------扩展活动属性数据存储---------------- |
|
|
|
|
const values = lodash.get(extensionElements, 'values', []) |
|
|
|
|
// ------------------用户分配人--------------------- |
|
|
|
|
const assignee = values.filter(element => element.$type == 'flowable:Assignee') |
|
|
|
|
const assignee = values.filter(element => element.$type === 'flowable:Assignee') |
|
|
|
|
// ------------------常用按钮----------------------- |
|
|
|
|
const button = values.filter(element => element.$type == 'flowable:Button') |
|
|
|
|
const button = values.filter(element => element.$type === 'flowable:Button') |
|
|
|
|
// ------------------流转条件----------------------- |
|
|
|
|
const condition = values.filter(element => element.$type == 'flowable:Condition') |
|
|
|
|
const condition = values.filter(element => element.$type === 'flowable:Condition') |
|
|
|
|
if ((assignee.length + button.length + condition.length) > 0) { |
|
|
|
|
options.activityExtensionData.push({ |
|
|
|
|
activityDefId: bpmnElement.id, |
|
|
|
@ -277,19 +285,19 @@ export default {
@@ -277,19 +285,19 @@ export default {
|
|
|
|
|
const formKey = lodash.get(bpmnElement, 'formKey') |
|
|
|
|
switch (bpmnType) { |
|
|
|
|
case 'bpmn:StartEvent': |
|
|
|
|
if (validateNull(formKey) && bpmnElementParent.$type != 'bpmn:SubProcess') { |
|
|
|
|
options.validateErrorData.push(`<p>节点【${bpmnElement.name || bpmnElement.id}】没有配置表单。</p>`) |
|
|
|
|
if (validateNull(formKey) && bpmnElementParent.$type !== 'bpmn:SubProcess') { |
|
|
|
|
options.validateErrorData.push(<p>节点【${bpmnElement.name || bpmnElement.id}】没有配置表单。</p>) |
|
|
|
|
} |
|
|
|
|
break |
|
|
|
|
case 'bpmn:UserTask': |
|
|
|
|
if (!assignee.length) { |
|
|
|
|
options.validateErrorData.push(`<p>节点【${bpmnElement.name || bpmnElement.id}】没有指定办理人。</p>`) |
|
|
|
|
options.validateErrorData.push(<p>节点【${bpmnElement.name || bpmnElement.id}】没有指定办理人。</p>) |
|
|
|
|
} |
|
|
|
|
if (!button.length) { |
|
|
|
|
options.validateErrorData.push(`<p>节点【${bpmnElement.name || bpmnElement.id}】没有配置按钮。</p>`) |
|
|
|
|
options.validateErrorData.push(<p>节点【${bpmnElement.name || bpmnElement.id}】没有配置按钮。</p>) |
|
|
|
|
} |
|
|
|
|
if (validateNull(formKey)) { |
|
|
|
|
options.validateErrorData.push(`<p>节点【${bpmnElement.name || bpmnElement.id}】没有配置表单。</p>`) |
|
|
|
|
options.validateErrorData.push(<p>节点【${bpmnElement.name || bpmnElement.id}】没有配置表单。</p>) |
|
|
|
|
} |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
@ -319,7 +327,7 @@ export default {
@@ -319,7 +327,7 @@ export default {
|
|
|
|
|
return reject('检测到主体画布流程名称为空,请检查,这个为必填项!') |
|
|
|
|
} |
|
|
|
|
// 检测协助池中的一些非空校验 |
|
|
|
|
const collaboration = rootElements.find(item => item.$type == 'bpmn:Collaboration') |
|
|
|
|
const collaboration = rootElements.find(item => item.$type === 'bpmn:Collaboration') |
|
|
|
|
if (collaboration) { |
|
|
|
|
const participants = lodash.get(collaboration, 'participants', []) |
|
|
|
|
for (let i = 0; i < participants.length; ++i) { |
|
|
|
@ -327,12 +335,12 @@ export default {
@@ -327,12 +335,12 @@ export default {
|
|
|
|
|
const process = lodash.get(participant, 'processRef', {}) |
|
|
|
|
// 检测池中的泳道不能为空 |
|
|
|
|
const lanes = lodash.get(process, 'laneSets[0].lanes', []) |
|
|
|
|
if (lanes.length == 0) { |
|
|
|
|
if (lanes.length === 0) { |
|
|
|
|
return reject(`池子【${participant.name || participant.id}】没有配置泳道,请检测!`) |
|
|
|
|
} |
|
|
|
|
// 检测池中的bpmn元素不能为空 |
|
|
|
|
const flowElements = lodash.get(process, 'flowElements', []) |
|
|
|
|
if (flowElements.length == 0) { |
|
|
|
|
if (flowElements.length === 0) { |
|
|
|
|
return reject(`池子【${participant.name || participant.id}】没有配置bpmn元素,请设计bpmn流程!`) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -340,7 +348,7 @@ export default {
@@ -340,7 +348,7 @@ export default {
|
|
|
|
|
} else { |
|
|
|
|
const process = lodash.get(rootElements, '[0]', {}) |
|
|
|
|
const flowElements = lodash.get(process, 'flowElements', []) |
|
|
|
|
if (flowElements.length == 0) { |
|
|
|
|
if (flowElements.length === 0) { |
|
|
|
|
return reject(`流程【${process.name || process.id}】没有配置bpmn元素,请设计bpmn流程!`) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -351,7 +359,7 @@ export default {
@@ -351,7 +359,7 @@ export default {
|
|
|
|
|
}).then(({ rootElements, canvasProcess }) => { |
|
|
|
|
// todo:第二层处理流程模型新增 |
|
|
|
|
const processRelationIds = [] |
|
|
|
|
const collaboration = rootElements.find(item => item.$type == 'bpmn:Collaboration') |
|
|
|
|
const collaboration = rootElements.find(item => item.$type === 'bpmn:Collaboration') |
|
|
|
|
if (collaboration) { |
|
|
|
|
const participants = lodash.get(collaboration, 'participants', []) |
|
|
|
|
for (let i = 0; i < participants.length; ++i) { |
|
|
|
@ -364,7 +372,7 @@ export default {
@@ -364,7 +372,7 @@ export default {
|
|
|
|
|
processRelationIds.push(String(process.id).replaceAll(',', '')) |
|
|
|
|
} |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
if (this.modelData.id == undefined) { |
|
|
|
|
if (this.modelData.id === undefined) { |
|
|
|
|
addModel({ |
|
|
|
|
key: processRelationIds.join(), |
|
|
|
|
name: canvasProcess.name, |
|
|
|
@ -403,7 +411,7 @@ export default {
@@ -403,7 +411,7 @@ export default {
|
|
|
|
|
const activityExtensionData = [] |
|
|
|
|
let validateErrorData = [] |
|
|
|
|
// 查找并存储扩展属性跟扩展数据,方便后台拿取做对应功能需求 |
|
|
|
|
const collaboration = rootElements.find(item => item.$type == 'bpmn:Collaboration') |
|
|
|
|
const collaboration = rootElements.find(item => item.$type === 'bpmn:Collaboration') |
|
|
|
|
// 处理协助池 |
|
|
|
|
if (collaboration) { |
|
|
|
|
const participants = lodash.get(collaboration, 'participants', []) |
|
|
|
@ -420,8 +428,7 @@ export default {
@@ -420,8 +428,7 @@ export default {
|
|
|
|
|
validateErrorData: tempValidateErrorData |
|
|
|
|
}) |
|
|
|
|
if (tempValidateErrorData.length > 0) { |
|
|
|
|
validateErrorData = validateErrorData.concat( |
|
|
|
|
[`<p>池子【${participant.name || participant.id}】:</p>`], tempValidateErrorData) |
|
|
|
|
validateErrorData.push((<p>池子【${participant.name || participant.id}】:</p>), tempValidateErrorData) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 处理正常单流程 |
|
|
|
@ -438,7 +445,7 @@ export default {
@@ -438,7 +445,7 @@ export default {
|
|
|
|
|
}) |
|
|
|
|
if (tempValidateErrorData.length > 0) { |
|
|
|
|
validateErrorData = validateErrorData.concat( |
|
|
|
|
[`<p>流程【${process.name || process.id}】:</p>`], tempValidateErrorData) |
|
|
|
|
[<p>流程【${process.name || process.id}】:</p>], tempValidateErrorData) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
chain.push(validateErrorData) |
|
|
|
@ -450,17 +457,15 @@ export default {
@@ -450,17 +457,15 @@ export default {
|
|
|
|
|
return Promise.reject('保存流程模型失败!') |
|
|
|
|
}) |
|
|
|
|
}).then(results => { |
|
|
|
|
results[0].length && this.$notify({ |
|
|
|
|
title: '提示', |
|
|
|
|
message: results[0].join(''), |
|
|
|
|
type: 'warning', |
|
|
|
|
dangerouslyUseHTMLString: true |
|
|
|
|
results[0].length && this.notification['warning']({ |
|
|
|
|
message: '提示', |
|
|
|
|
description: results[0] |
|
|
|
|
}) |
|
|
|
|
this.$message.success(results[1].data || '保存流程模型成功!') |
|
|
|
|
this.createMessage.success(results[1].data || '保存流程模型成功!') |
|
|
|
|
this.$emit('refresh') |
|
|
|
|
this.loading = false |
|
|
|
|
}).catch(err => { |
|
|
|
|
this.$message.error(err) |
|
|
|
|
this.createMessage.error(err) |
|
|
|
|
this.loading = false |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|