Commit 3ce663c7a5894e193fc0c57567840ff46eca2db6
1 parent
a03f702f
bug
Showing
9 changed files
with
89 additions
and
63 deletions
yudao-ui-admin-vue3/src/components/bpmnProcessDesigner/package/designer/ProcessDesigner.vue
| @@ -7,22 +7,24 @@ | @@ -7,22 +7,24 @@ | ||
| 7 | <XButton preIcon="ep:folder-opened" title="打开文件" @click="refFile.click()" /> | 7 | <XButton preIcon="ep:folder-opened" title="打开文件" @click="refFile.click()" /> |
| 8 | <el-tooltip effect="light" placement="bottom"> | 8 | <el-tooltip effect="light" placement="bottom"> |
| 9 | <template #content> | 9 | <template #content> |
| 10 | - <XButton type="text" title="下载为XML文件" @click="downloadProcessAsXml()" /> | ||
| 11 | - <br /> | 10 | + <div style="color: #409eff"> |
| 11 | + <el-button link @click="downloadProcessAsXml()">下载为XML文件</el-button> | ||
| 12 | + <br /> | ||
| 12 | 13 | ||
| 13 | - <XButton type="text" title="下载为SVG文件" @click="downloadProcessAsSvg()" /> | ||
| 14 | - <br /> | 14 | + <el-button link @click="downloadProcessAsSvg()">下载为SVG文件</el-button> |
| 15 | + <br /> | ||
| 15 | 16 | ||
| 16 | - <XButton type="text" title="下载为BPMN文件" @click="downloadProcessAsBpmn()" /> | 17 | + <el-button link @click="downloadProcessAsBpmn()">下载为BPMN文件</el-button> |
| 18 | + </div> | ||
| 17 | </template> | 19 | </template> |
| 18 | <XButton title="下载文件" preIcon="ep:download" /> | 20 | <XButton title="下载文件" preIcon="ep:download" /> |
| 19 | </el-tooltip> | 21 | </el-tooltip> |
| 20 | <el-tooltip effect="light"> | 22 | <el-tooltip effect="light"> |
| 21 | <XButton preIcon="ep:view" title="浏览" /> | 23 | <XButton preIcon="ep:view" title="浏览" /> |
| 22 | <template #content> | 24 | <template #content> |
| 23 | - <el-button type="text" @click="previewProcessXML">预览XML</el-button> | 25 | + <el-button link @click="previewProcessXML">预览XML</el-button> |
| 24 | <br /> | 26 | <br /> |
| 25 | - <el-button type="text" @click="previewProcessJson">预览JSON</el-button> | 27 | + <el-button link @click="previewProcessJson">预览JSON</el-button> |
| 26 | </template> | 28 | </template> |
| 27 | </el-tooltip> | 29 | </el-tooltip> |
| 28 | <el-tooltip | 30 | <el-tooltip |
| @@ -594,10 +596,9 @@ const elementsAlign = (align) => { | @@ -594,10 +596,9 @@ const elementsAlign = (align) => { | ||
| 594 | const Align = bpmnModeler.get('alignElements') | 596 | const Align = bpmnModeler.get('alignElements') |
| 595 | const Selection = bpmnModeler.get('selection') | 597 | const Selection = bpmnModeler.get('selection') |
| 596 | const SelectedElements = Selection.get() | 598 | const SelectedElements = Selection.get() |
| 597 | - console.log(SelectedElements, 'SelectedElements') | ||
| 598 | if (!SelectedElements || SelectedElements.length <= 1) { | 599 | if (!SelectedElements || SelectedElements.length <= 1) { |
| 599 | ElMessage.warning('请按住 Shift 键选择多个元素对齐') | 600 | ElMessage.warning('请按住 Shift 键选择多个元素对齐') |
| 600 | - // alert('请按住 Ctrl 键选择多个元素对齐') | 601 | + // alert('请按住 Ctrl 键选择多个元素对齐 |
| 601 | return | 602 | return |
| 602 | } | 603 | } |
| 603 | ElMessageBox.confirm('自动对齐可能造成图形变形,是否继续?', '警告', { | 604 | ElMessageBox.confirm('自动对齐可能造成图形变形,是否继续?', '警告', { |
| @@ -636,7 +637,10 @@ const previewProcessJson = () => { | @@ -636,7 +637,10 @@ const previewProcessJson = () => { | ||
| 636 | } | 637 | } |
| 637 | /* ------------------------------------------------ 芋道源码 methods ------------------------------------------------------ */ | 638 | /* ------------------------------------------------ 芋道源码 methods ------------------------------------------------------ */ |
| 638 | const processSave = async () => { | 639 | const processSave = async () => { |
| 640 | + console.log(bpmnModeler, 'bpmnModelerbpmnModelerbpmnModelerbpmnModeler') | ||
| 639 | const { err, xml } = await bpmnModeler.saveXML() | 641 | const { err, xml } = await bpmnModeler.saveXML() |
| 642 | + console.log(err, 'errerrerrerrerr') | ||
| 643 | + console.log(xml, 'xmlxmlxmlxmlxml') | ||
| 640 | // 读取异常时抛出异常 | 644 | // 读取异常时抛出异常 |
| 641 | if (err) { | 645 | if (err) { |
| 642 | // this.$modal.msgError('保存模型失败,请重试!') | 646 | // this.$modal.msgError('保存模型失败,请重试!') |
yudao-ui-admin-vue3/src/components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue
yudao-ui-admin-vue3/src/components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue
| @@ -45,7 +45,7 @@ const props = defineProps({ | @@ -45,7 +45,7 @@ const props = defineProps({ | ||
| 45 | model: Object // 流程模型的数据 | 45 | model: Object // 流程模型的数据 |
| 46 | }) | 46 | }) |
| 47 | const needProps = ref({}) | 47 | const needProps = ref({}) |
| 48 | -const bpmnElement = ref() | 48 | +let bpmnElement |
| 49 | const elementBaseInfo = ref({}) | 49 | const elementBaseInfo = ref({}) |
| 50 | // 流程表单的下拉框的数据 | 50 | // 流程表单的下拉框的数据 |
| 51 | // const forms = ref([]) | 51 | // const forms = ref([]) |
| @@ -59,10 +59,10 @@ const resetBaseInfo = () => { | @@ -59,10 +59,10 @@ const resetBaseInfo = () => { | ||
| 59 | console.log(window, 'window') | 59 | console.log(window, 'window') |
| 60 | console.log(bpmnElement, 'bpmnElement') | 60 | console.log(bpmnElement, 'bpmnElement') |
| 61 | 61 | ||
| 62 | - bpmnElement.value = window?.bpmnInstances?.bpmnElement | ||
| 63 | - console.log(bpmnElement.value, 'resetBaseInfo11111111111') | ||
| 64 | - elementBaseInfo.value = bpmnElement.value.businessObject | ||
| 65 | - needProps.value['type'] = bpmnElement.value.businessObject.$type | 62 | + bpmnElement = window?.bpmnInstances?.bpmnElement |
| 63 | + console.log(bpmnElement, 'resetBaseInfo11111111111') | ||
| 64 | + elementBaseInfo.value = bpmnElement.businessObject | ||
| 65 | + needProps.value['type'] = bpmnElement.businessObject.$type | ||
| 66 | // elementBaseInfo.value['typess'] = bpmnElement.value.businessObject.$type | 66 | // elementBaseInfo.value['typess'] = bpmnElement.value.businessObject.$type |
| 67 | 67 | ||
| 68 | // elementBaseInfo.value = JSON.parse(JSON.stringify(bpmnElement.value.businessObject)) | 68 | // elementBaseInfo.value = JSON.parse(JSON.stringify(bpmnElement.value.businessObject)) |
| @@ -113,15 +113,15 @@ const updateBaseInfo = (key) => { | @@ -113,15 +113,15 @@ const updateBaseInfo = (key) => { | ||
| 113 | if (key === 'id') { | 113 | if (key === 'id') { |
| 114 | console.log('jinru') | 114 | console.log('jinru') |
| 115 | console.log(window, 'window') | 115 | console.log(window, 'window') |
| 116 | - console.log(bpmnElement.value, 'bpmnElement') | ||
| 117 | - console.log(toRaw(bpmnElement.value), 'bpmnElement') | ||
| 118 | - window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), { | 116 | + console.log(bpmnElement, 'bpmnElement') |
| 117 | + console.log(toRaw(bpmnElement), 'bpmnElement') | ||
| 118 | + window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement), { | ||
| 119 | id: elementBaseInfo.value[key], | 119 | id: elementBaseInfo.value[key], |
| 120 | di: { id: `${elementBaseInfo.value[key]}_di` } | 120 | di: { id: `${elementBaseInfo.value[key]}_di` } |
| 121 | }) | 121 | }) |
| 122 | } else { | 122 | } else { |
| 123 | console.log(attrObj, 'attrObj') | 123 | console.log(attrObj, 'attrObj') |
| 124 | - window.bpmnInstances.modeling.updateProperties(bpmnElement.value, attrObj) | 124 | + window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement), attrObj) |
| 125 | } | 125 | } |
| 126 | } | 126 | } |
| 127 | onMounted(() => { | 127 | onMounted(() => { |
| @@ -165,6 +165,6 @@ watch( | @@ -165,6 +165,6 @@ watch( | ||
| 165 | // } | 165 | // } |
| 166 | // } | 166 | // } |
| 167 | onBeforeUnmount(() => { | 167 | onBeforeUnmount(() => { |
| 168 | - bpmnElement.value = null | 168 | + bpmnElement = null |
| 169 | }) | 169 | }) |
| 170 | </script> | 170 | </script> |
yudao-ui-admin-vue3/src/components/bpmnProcessDesigner/package/penal/listeners/ElementListeners.vue
| @@ -11,13 +11,12 @@ | @@ -11,13 +11,12 @@ | ||
| 11 | /> | 11 | /> |
| 12 | <el-table-column label="操作" width="90px"> | 12 | <el-table-column label="操作" width="90px"> |
| 13 | <template #default="scope"> | 13 | <template #default="scope"> |
| 14 | - <el-button size="small" type="text" @click="openListenerForm(scope.row, scope.$index)" | 14 | + <el-button size="small" @click="openListenerForm(scope.row, scope.$index)" |
| 15 | >编辑</el-button | 15 | >编辑</el-button |
| 16 | > | 16 | > |
| 17 | <el-divider direction="vertical" /> | 17 | <el-divider direction="vertical" /> |
| 18 | <el-button | 18 | <el-button |
| 19 | size="small" | 19 | size="small" |
| 20 | - type="text" | ||
| 21 | style="color: #ff4d4f" | 20 | style="color: #ff4d4f" |
| 22 | @click="removeListener(scope.row, scope.$index)" | 21 | @click="removeListener(scope.row, scope.$index)" |
| 23 | >移除</el-button | 22 | >移除</el-button |
| @@ -395,10 +394,15 @@ const saveListenerConfig = async () => { | @@ -395,10 +394,15 @@ const saveListenerConfig = async () => { | ||
| 395 | bpmnElement.value.businessObject?.extensionElements?.values?.filter( | 394 | bpmnElement.value.businessObject?.extensionElements?.values?.filter( |
| 396 | (ex) => ex.$type !== `${prefix}:ExecutionListener` | 395 | (ex) => ex.$type !== `${prefix}:ExecutionListener` |
| 397 | ) ?? [] | 396 | ) ?? [] |
| 398 | - // updateElementExtensions( | ||
| 399 | - // bpmnElement.value, | ||
| 400 | - // otherExtensionList.value.concat(bpmnElementListeners.value) | ||
| 401 | - // ) | 397 | + console.log(bpmnElement.value.height, 'bpmnElement.value') |
| 398 | + console.log( | ||
| 399 | + otherExtensionList.value.concat(bpmnElementListeners.value), | ||
| 400 | + 'otherExtensionList.value.concat(bpmnElementListeners.value).value' | ||
| 401 | + ) | ||
| 402 | + updateElementExtensions( | ||
| 403 | + bpmnElement.value, | ||
| 404 | + otherExtensionList.value.concat(bpmnElementListeners.value) | ||
| 405 | + ) | ||
| 402 | // 4. 隐藏侧边栏 | 406 | // 4. 隐藏侧边栏 |
| 403 | listenerFormModelVisible.value = false | 407 | listenerFormModelVisible.value = false |
| 404 | listenerForm.value = {} | 408 | listenerForm.value = {} |
| @@ -407,6 +411,7 @@ const saveListenerConfig = async () => { | @@ -407,6 +411,7 @@ const saveListenerConfig = async () => { | ||
| 407 | watch( | 411 | watch( |
| 408 | () => props.id, | 412 | () => props.id, |
| 409 | (val) => { | 413 | (val) => { |
| 414 | + console.log(val, 'propsId变化') | ||
| 410 | val && | 415 | val && |
| 411 | val.length && | 416 | val.length && |
| 412 | nextTick(() => { | 417 | nextTick(() => { |
yudao-ui-admin-vue3/src/components/bpmnProcessDesigner/package/penal/other/ElementOtherConfig.vue
| @@ -25,13 +25,16 @@ const props = defineProps({ | @@ -25,13 +25,16 @@ const props = defineProps({ | ||
| 25 | const documentation = ref('') | 25 | const documentation = ref('') |
| 26 | const bpmnElement = ref() | 26 | const bpmnElement = ref() |
| 27 | const updateDocumentation = () => { | 27 | const updateDocumentation = () => { |
| 28 | - ;(bpmnElement.value && bpmnElement.value.id === props.id) || | ||
| 29 | - (bpmnElement.value = window.bpmnInstances.elementRegistry.get(props.id)) | ||
| 30 | - const documentation = window.bpmnInstances.bpmnFactory.create('bpmn:Documentation', { | 28 | + if (bpmnElement.value && bpmnElement.value.id === props.id) { |
| 29 | + bpmnElement.value = window.bpmnInstances.elementRegistry.get(props.id) | ||
| 30 | + } | ||
| 31 | + // (bpmnElement.value && bpmnElement.value.id === props.id) || | ||
| 32 | + // (bpmnElement.value = window.bpmnInstances.elementRegistry.get(props.id)) | ||
| 33 | + const documentations = window.bpmnInstances.bpmnFactory.create('bpmn:Documentation', { | ||
| 31 | text: documentation.value | 34 | text: documentation.value |
| 32 | }) | 35 | }) |
| 33 | window.bpmnInstances.modeling.updateProperties(bpmnElement.value, { | 36 | window.bpmnInstances.modeling.updateProperties(bpmnElement.value, { |
| 34 | - documentation: [documentation] | 37 | + documentation: [documentations] |
| 35 | }) | 38 | }) |
| 36 | } | 39 | } |
| 37 | onBeforeUnmount(() => { | 40 | onBeforeUnmount(() => { |
yudao-ui-admin-vue3/src/components/bpmnProcessDesigner/package/penal/properties/ElementProperties.vue
| @@ -6,12 +6,14 @@ | @@ -6,12 +6,14 @@ | ||
| 6 | <el-table-column label="属性值" prop="value" min-width="100px" show-overflow-tooltip /> | 6 | <el-table-column label="属性值" prop="value" min-width="100px" show-overflow-tooltip /> |
| 7 | <el-table-column label="操作" width="90px"> | 7 | <el-table-column label="操作" width="90px"> |
| 8 | <template #default="scope"> | 8 | <template #default="scope"> |
| 9 | - <el-button type="text" @click="openAttributesForm(scope, scope.$index)">编辑</el-button> | 9 | + <el-button type="text" @click="openAttributesForm(scope.row, scope.$index)" |
| 10 | + >编辑</el-button | ||
| 11 | + > | ||
| 10 | <el-divider direction="vertical" /> | 12 | <el-divider direction="vertical" /> |
| 11 | <el-button | 13 | <el-button |
| 12 | type="text" | 14 | type="text" |
| 13 | style="color: #ff4d4f" | 15 | style="color: #ff4d4f" |
| 14 | - @click="removeAttributes(scope, scope.$index)" | 16 | + @click="removeAttributes(scope.roww, scope.$index)" |
| 15 | >移除</el-button | 17 | >移除</el-button |
| 16 | > | 18 | > |
| 17 | </template> | 19 | </template> |
| @@ -84,10 +86,10 @@ const resetAttributesList = () => { | @@ -84,10 +86,10 @@ const resetAttributesList = () => { | ||
| 84 | otherExtensionList.value = [] // 其他扩展配置 | 86 | otherExtensionList.value = [] // 其他扩展配置 |
| 85 | bpmnElementProperties.value = | 87 | bpmnElementProperties.value = |
| 86 | bpmnElement.value.businessObject?.extensionElements?.values?.filter((ex) => { | 88 | bpmnElement.value.businessObject?.extensionElements?.values?.filter((ex) => { |
| 87 | - if (ex.$type !== `${prefix.value}:Properties`) { | 89 | + if (ex.$type !== `${prefix}:Properties`) { |
| 88 | otherExtensionList.value.push(ex) | 90 | otherExtensionList.value.push(ex) |
| 89 | } | 91 | } |
| 90 | - return ex.$type === `${prefix.value}:Properties` | 92 | + return ex.$type === `${prefix}:Properties` |
| 91 | }) ?? [] | 93 | }) ?? [] |
| 92 | 94 | ||
| 93 | // 保存所有的 扩展属性字段 | 95 | // 保存所有的 扩展属性字段 |
| @@ -116,7 +118,7 @@ const removeAttributes = (attr, index) => { | @@ -116,7 +118,7 @@ const removeAttributes = (attr, index) => { | ||
| 116 | elementPropertyList.value.splice(index, 1) | 118 | elementPropertyList.value.splice(index, 1) |
| 117 | bpmnElementPropertyList.value.splice(index, 1) | 119 | bpmnElementPropertyList.value.splice(index, 1) |
| 118 | // 新建一个属性字段的保存列表 | 120 | // 新建一个属性字段的保存列表 |
| 119 | - const propertiesObject = window.bpmnInstances.moddle.create(`${prefix.value}:Properties`, { | 121 | + const propertiesObject = window.bpmnInstances.moddle.create(`${prefix}:Properties`, { |
| 120 | values: bpmnElementPropertyList.value | 122 | values: bpmnElementPropertyList.value |
| 121 | }) | 123 | }) |
| 122 | updateElementExtensions(propertiesObject) | 124 | updateElementExtensions(propertiesObject) |
| @@ -125,8 +127,8 @@ const removeAttributes = (attr, index) => { | @@ -125,8 +127,8 @@ const removeAttributes = (attr, index) => { | ||
| 125 | .catch(() => console.info('操作取消')) | 127 | .catch(() => console.info('操作取消')) |
| 126 | } | 128 | } |
| 127 | const saveAttribute = () => { | 129 | const saveAttribute = () => { |
| 130 | + console.log(propertyForm.value, 'propertyForm.value') | ||
| 128 | const { name, value } = propertyForm.value | 131 | const { name, value } = propertyForm.value |
| 129 | - console.log(bpmnElementPropertyList.value) | ||
| 130 | if (editingPropertyIndex.value !== -1) { | 132 | if (editingPropertyIndex.value !== -1) { |
| 131 | window.bpmnInstances.modeling.updateModdleProperties( | 133 | window.bpmnInstances.modeling.updateModdleProperties( |
| 132 | bpmnElement.value, | 134 | bpmnElement.value, |
| @@ -138,12 +140,12 @@ const saveAttribute = () => { | @@ -138,12 +140,12 @@ const saveAttribute = () => { | ||
| 138 | ) | 140 | ) |
| 139 | } else { | 141 | } else { |
| 140 | // 新建属性字段 | 142 | // 新建属性字段 |
| 141 | - const newPropertyObject = window.bpmnInstances.moddle.create(`${prefix.value}:Property`, { | 143 | + const newPropertyObject = window.bpmnInstances.moddle.create(`${prefix}:Property`, { |
| 142 | name, | 144 | name, |
| 143 | value | 145 | value |
| 144 | }) | 146 | }) |
| 145 | // 新建一个属性字段的保存列表 | 147 | // 新建一个属性字段的保存列表 |
| 146 | - const propertiesObject = window.bpmnInstances.moddle.create(`${prefix.value}:Properties`, { | 148 | + const propertiesObject = window.bpmnInstances.moddle.create(`${prefix}:Properties`, { |
| 147 | values: bpmnElementPropertyList.value.concat([newPropertyObject]) | 149 | values: bpmnElementPropertyList.value.concat([newPropertyObject]) |
| 148 | }) | 150 | }) |
| 149 | updateElementExtensions(propertiesObject) | 151 | updateElementExtensions(propertiesObject) |
yudao-ui-admin-vue3/src/components/bpmnProcessDesigner/package/utils.js renamed to yudao-ui-admin-vue3/src/components/bpmnProcessDesigner/package/utils.ts
| 1 | // 创建监听器实例 | 1 | // 创建监听器实例 |
| 2 | -export function createListenerObject (options, isTask, prefix) { | 2 | +export function createListenerObject(options, isTask, prefix) { |
| 3 | const listenerObj = Object.create(null) | 3 | const listenerObj = Object.create(null) |
| 4 | listenerObj.event = options.event | 4 | listenerObj.event = options.event |
| 5 | isTask && (listenerObj.id = options.id) // 任务监听器特有的 id 字段 | 5 | isTask && (listenerObj.id = options.id) // 任务监听器特有的 id 字段 |
| 6 | switch (options.listenerType) { | 6 | switch (options.listenerType) { |
| 7 | - case "scriptListener": | 7 | + case 'scriptListener': |
| 8 | listenerObj.script = createScriptObject(options, prefix) | 8 | listenerObj.script = createScriptObject(options, prefix) |
| 9 | break | 9 | break |
| 10 | - case "expressionListener": | 10 | + case 'expressionListener': |
| 11 | listenerObj.expression = options.expression | 11 | listenerObj.expression = options.expression |
| 12 | break | 12 | break |
| 13 | - case "delegateExpressionListener": | 13 | + case 'delegateExpressionListener': |
| 14 | listenerObj.delegateExpression = options.delegateExpression | 14 | listenerObj.delegateExpression = options.delegateExpression |
| 15 | break | 15 | break |
| 16 | default: | 16 | default: |
| @@ -18,54 +18,59 @@ export function createListenerObject (options, isTask, prefix) { | @@ -18,54 +18,59 @@ export function createListenerObject (options, isTask, prefix) { | ||
| 18 | } | 18 | } |
| 19 | // 注入字段 | 19 | // 注入字段 |
| 20 | if (options.fields) { | 20 | if (options.fields) { |
| 21 | - listenerObj.fields = options.fields.map(field => { | 21 | + listenerObj.fields = options.fields.map((field) => { |
| 22 | return createFieldObject(field, prefix) | 22 | return createFieldObject(field, prefix) |
| 23 | }) | 23 | }) |
| 24 | } | 24 | } |
| 25 | // 任务监听器的 定时器 设置 | 25 | // 任务监听器的 定时器 设置 |
| 26 | - if (isTask && options.event === "timeout" && !!options.eventDefinitionType) { | ||
| 27 | - const timeDefinition = window.bpmnInstances.moddle.create("bpmn:FormalExpression", { body: options.eventTimeDefinitions }) | ||
| 28 | - const TimerEventDefinition = window.bpmnInstances.moddle.create("bpmn:TimerEventDefinition", { | 26 | + if (isTask && options.event === 'timeout' && !!options.eventDefinitionType) { |
| 27 | + const timeDefinition = window.bpmnInstances.moddle.create('bpmn:FormalExpression', { | ||
| 28 | + body: options.eventTimeDefinitions | ||
| 29 | + }) | ||
| 30 | + const TimerEventDefinition = window.bpmnInstances.moddle.create('bpmn:TimerEventDefinition', { | ||
| 29 | id: `TimerEventDefinition_${uuid(8)}`, | 31 | id: `TimerEventDefinition_${uuid(8)}`, |
| 30 | - [`time${options.eventDefinitionType.replace(/^\S/, s => s.toUpperCase())}`]: timeDefinition | 32 | + [`time${options.eventDefinitionType.replace(/^\S/, (s) => s.toUpperCase())}`]: timeDefinition |
| 31 | }) | 33 | }) |
| 32 | listenerObj.eventDefinitions = [TimerEventDefinition] | 34 | listenerObj.eventDefinitions = [TimerEventDefinition] |
| 33 | } | 35 | } |
| 34 | - return window.bpmnInstances.moddle.create(`${prefix}:${isTask ? "TaskListener" : "ExecutionListener"}`, listenerObj) | 36 | + return window.bpmnInstances.moddle.create( |
| 37 | + `${prefix}:${isTask ? 'TaskListener' : 'ExecutionListener'}`, | ||
| 38 | + listenerObj | ||
| 39 | + ) | ||
| 35 | } | 40 | } |
| 36 | 41 | ||
| 37 | // 创建 监听器的注入字段 实例 | 42 | // 创建 监听器的注入字段 实例 |
| 38 | -export function createFieldObject (option, prefix) { | 43 | +export function createFieldObject(option, prefix) { |
| 39 | const { name, fieldType, string, expression } = option | 44 | const { name, fieldType, string, expression } = option |
| 40 | - const fieldConfig = fieldType === "string" ? { name, string } : { name, expression } | 45 | + const fieldConfig = fieldType === 'string' ? { name, string } : { name, expression } |
| 41 | return window.bpmnInstances.moddle.create(`${prefix}:Field`, fieldConfig) | 46 | return window.bpmnInstances.moddle.create(`${prefix}:Field`, fieldConfig) |
| 42 | } | 47 | } |
| 43 | 48 | ||
| 44 | // 创建脚本实例 | 49 | // 创建脚本实例 |
| 45 | -export function createScriptObject (options, prefix) { | 50 | +export function createScriptObject(options, prefix) { |
| 46 | const { scriptType, scriptFormat, value, resource } = options | 51 | const { scriptType, scriptFormat, value, resource } = options |
| 47 | - const scriptConfig = scriptType === "inlineScript" ? { scriptFormat, value } : { scriptFormat, resource } | 52 | + const scriptConfig = |
| 53 | + scriptType === 'inlineScript' ? { scriptFormat, value } : { scriptFormat, resource } | ||
| 48 | return window.bpmnInstances.moddle.create(`${prefix}:Script`, scriptConfig) | 54 | return window.bpmnInstances.moddle.create(`${prefix}:Script`, scriptConfig) |
| 49 | } | 55 | } |
| 50 | 56 | ||
| 51 | // 更新元素扩展属性 | 57 | // 更新元素扩展属性 |
| 52 | -export function updateElementExtensions (element, extensionList) { | ||
| 53 | - console.log(element, 'element') | ||
| 54 | - console.log(extensionList, 'extensionList') | ||
| 55 | - const extensions = window.bpmnInstances.moddle.create("bpmn:ExtensionElements", { | 58 | +export function updateElementExtensions(element, extensionList) { |
| 59 | + const extensions = window.bpmnInstances.moddle.create('bpmn:ExtensionElements', { | ||
| 56 | values: extensionList | 60 | values: extensionList |
| 57 | }) | 61 | }) |
| 58 | - console.log(extensions, 'extensionsextensions') | ||
| 59 | - console.log(window.bpmnInstances.modeling, 'window.bpmnInstances.modeling') | 62 | + console.log(element, 'elementelementelementelement') |
| 63 | + console.log(extensions.values, 'extensionsextensionsextensions') | ||
| 60 | window.bpmnInstances.modeling.updateProperties(element, { | 64 | window.bpmnInstances.modeling.updateProperties(element, { |
| 61 | extensionElements: extensions.values | 65 | extensionElements: extensions.values |
| 62 | }) | 66 | }) |
| 67 | + console.log('ssss') | ||
| 63 | } | 68 | } |
| 64 | 69 | ||
| 65 | // 创建一个id | 70 | // 创建一个id |
| 66 | -export function uuid (length = 8, chars) { | ||
| 67 | - let result = "" | ||
| 68 | - let charsString = chars || "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" | 71 | +export function uuid(length = 8, chars) { |
| 72 | + let result = '' | ||
| 73 | + const charsString = chars || '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' | ||
| 69 | for (let i = length; i > 0; --i) { | 74 | for (let i = length; i > 0; --i) { |
| 70 | result += charsString[Math.floor(Math.random() * charsString.length)] | 75 | result += charsString[Math.floor(Math.random() * charsString.length)] |
| 71 | } | 76 | } |
yudao-ui-admin-vue3/src/types/auto-components.d.ts
| @@ -46,10 +46,12 @@ declare module '@vue/runtime-core' { | @@ -46,10 +46,12 @@ declare module '@vue/runtime-core' { | ||
| 46 | ElIcon: typeof import('element-plus/es')['ElIcon'] | 46 | ElIcon: typeof import('element-plus/es')['ElIcon'] |
| 47 | ElImageViewer: typeof import('element-plus/es')['ElImageViewer'] | 47 | ElImageViewer: typeof import('element-plus/es')['ElImageViewer'] |
| 48 | ElInput: typeof import('element-plus/es')['ElInput'] | 48 | ElInput: typeof import('element-plus/es')['ElInput'] |
| 49 | + ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] | ||
| 49 | ElLink: typeof import('element-plus/es')['ElLink'] | 50 | ElLink: typeof import('element-plus/es')['ElLink'] |
| 50 | ElOption: typeof import('element-plus/es')['ElOption'] | 51 | ElOption: typeof import('element-plus/es')['ElOption'] |
| 51 | ElPopover: typeof import('element-plus/es')['ElPopover'] | 52 | ElPopover: typeof import('element-plus/es')['ElPopover'] |
| 52 | ElRadio: typeof import('element-plus/es')['ElRadio'] | 53 | ElRadio: typeof import('element-plus/es')['ElRadio'] |
| 54 | + ElRadioButton: typeof import('element-plus/es')['ElRadioButton'] | ||
| 53 | ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] | 55 | ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] |
| 54 | ElRow: typeof import('element-plus/es')['ElRow'] | 56 | ElRow: typeof import('element-plus/es')['ElRow'] |
| 55 | ElSelect: typeof import('element-plus/es')['ElSelect'] | 57 | ElSelect: typeof import('element-plus/es')['ElSelect'] |
| @@ -60,6 +62,7 @@ declare module '@vue/runtime-core' { | @@ -60,6 +62,7 @@ declare module '@vue/runtime-core' { | ||
| 60 | ElTabs: typeof import('element-plus/es')['ElTabs'] | 62 | ElTabs: typeof import('element-plus/es')['ElTabs'] |
| 61 | ElTag: typeof import('element-plus/es')['ElTag'] | 63 | ElTag: typeof import('element-plus/es')['ElTag'] |
| 62 | ElTooltip: typeof import('element-plus/es')['ElTooltip'] | 64 | ElTooltip: typeof import('element-plus/es')['ElTooltip'] |
| 65 | + ElTree: typeof import('element-plus/es')['ElTree'] | ||
| 63 | ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect'] | 66 | ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect'] |
| 64 | ElUpload: typeof import('element-plus/es')['ElUpload'] | 67 | ElUpload: typeof import('element-plus/es')['ElUpload'] |
| 65 | Error: typeof import('./../components/Error/src/Error.vue')['default'] | 68 | Error: typeof import('./../components/Error/src/Error.vue')['default'] |
yudao-ui-admin-vue3/src/views/bpm/model/modelEditor.vue
| @@ -27,7 +27,7 @@ | @@ -27,7 +27,7 @@ | ||
| 27 | </template> | 27 | </template> |
| 28 | 28 | ||
| 29 | <script setup lang="ts"> | 29 | <script setup lang="ts"> |
| 30 | -import { ref, onMounted } from 'vue' | 30 | +import { ref, onMounted, onBeforeMount } from 'vue' |
| 31 | // import { translations } from '@/components/bpmnProcessDesigner/src/translations' | 31 | // import { translations } from '@/components/bpmnProcessDesigner/src/translations' |
| 32 | // 自定义元素选中时的弹出菜单(修改 默认任务 为 用户任务) | 32 | // 自定义元素选中时的弹出菜单(修改 默认任务 为 用户任务) |
| 33 | import CustomContentPadProvider from '@/components/bpmnProcessDesigner/package/designer/plugins/content-pad' | 33 | import CustomContentPadProvider from '@/components/bpmnProcessDesigner/package/designer/plugins/content-pad' |
| @@ -39,7 +39,7 @@ import CustomPaletteProvider from '@/components/bpmnProcessDesigner/package/desi | @@ -39,7 +39,7 @@ import CustomPaletteProvider from '@/components/bpmnProcessDesigner/package/desi | ||
| 39 | import { createModelApi, getModelApi, updateModelApi } from '@/api/bpm/model' | 39 | import { createModelApi, getModelApi, updateModelApi } from '@/api/bpm/model' |
| 40 | 40 | ||
| 41 | import { useRouter } from 'vue-router' | 41 | import { useRouter } from 'vue-router' |
| 42 | -import { onBeforeMount } from 'vue' | 42 | +import { ElMessage } from 'element-plus' |
| 43 | const router = useRouter() | 43 | const router = useRouter() |
| 44 | 44 | ||
| 45 | // 自定义侧边栏 | 45 | // 自定义侧边栏 |
| @@ -115,12 +115,15 @@ const save = (bpmnXml) => { | @@ -115,12 +115,15 @@ const save = (bpmnXml) => { | ||
| 115 | ...model.value, | 115 | ...model.value, |
| 116 | bpmnXml: bpmnXml // this.bpmnXml 只是初始化流程图,后续修改无法通过它获得 | 116 | bpmnXml: bpmnXml // this.bpmnXml 只是初始化流程图,后续修改无法通过它获得 |
| 117 | } | 117 | } |
| 118 | + console.log(data, 'data') | ||
| 118 | 119 | ||
| 119 | // 修改的提交 | 120 | // 修改的提交 |
| 120 | if (data.id) { | 121 | if (data.id) { |
| 121 | updateModelApi(data).then((response) => { | 122 | updateModelApi(data).then((response) => { |
| 122 | console.log(response, 'response') | 123 | console.log(response, 'response') |
| 123 | // this.$modal.msgSuccess("修改成功") | 124 | // this.$modal.msgSuccess("修改成功") |
| 125 | + ElMessage.success('修改成功') | ||
| 126 | + | ||
| 124 | // 跳转回去 | 127 | // 跳转回去 |
| 125 | close() | 128 | close() |
| 126 | }) | 129 | }) |
| @@ -130,6 +133,7 @@ const save = (bpmnXml) => { | @@ -130,6 +133,7 @@ const save = (bpmnXml) => { | ||
| 130 | createModelApi(data).then((response) => { | 133 | createModelApi(data).then((response) => { |
| 131 | console.log(response, 'response1') | 134 | console.log(response, 'response1') |
| 132 | // this.$modal.msgSuccess("保存成功") | 135 | // this.$modal.msgSuccess("保存成功") |
| 136 | + ElMessage.success('保存成功') | ||
| 133 | // 跳转回去 | 137 | // 跳转回去 |
| 134 | close() | 138 | close() |
| 135 | }) | 139 | }) |