报错基本解决,数据绑定还有些错误

This commit is contained in:
gexinzhineng/gxzn27 2023-01-28 17:42:19 +08:00
parent 3ce663c7a5
commit b704aae49b
16 changed files with 171 additions and 132 deletions

View File

@ -1,5 +1,5 @@
<template>
<div class="process-panel__container" :style="{ width: `${width}px;` }">
<div class="process-panel__container" :style="{ width: `${width}px` }">
<el-collapse v-model="activeTab">
<el-collapse-item name="base">
<!-- class="panel-tab__title" -->

View File

@ -45,7 +45,7 @@ const props = defineProps({
model: Object //
})
const needProps = ref({})
let bpmnElement
const bpmnElement = ref()
const elementBaseInfo = ref({})
//
// const forms = ref([])
@ -57,12 +57,12 @@ const rules = reactive({
const resetBaseInfo = () => {
console.log(window, 'window')
console.log(bpmnElement, 'bpmnElement')
console.log(bpmnElement.value, 'bpmnElement')
bpmnElement = window?.bpmnInstances?.bpmnElement
console.log(bpmnElement, 'resetBaseInfo11111111111')
elementBaseInfo.value = bpmnElement.businessObject
needProps.value['type'] = bpmnElement.businessObject.$type
bpmnElement.value = window?.bpmnInstances?.bpmnElement
console.log(bpmnElement.value, 'resetBaseInfo11111111111')
elementBaseInfo.value = bpmnElement.value.businessObject
needProps.value['type'] = bpmnElement.value.businessObject.$type
// elementBaseInfo.value['typess'] = bpmnElement.value.businessObject.$type
// elementBaseInfo.value = JSON.parse(JSON.stringify(bpmnElement.value.businessObject))
@ -81,7 +81,10 @@ const handleKeyUpdate = (value) => {
// BPMN XML key id
elementBaseInfo.value['id'] = value
updateBaseInfo('id')
setTimeout(() => {
updateBaseInfo('id')
}, 100)
}
const handleNameUpdate = (value) => {
console.log(elementBaseInfo, 'elementBaseInfo')
@ -89,7 +92,10 @@ const handleNameUpdate = (value) => {
return
}
elementBaseInfo.value['name'] = value
updateBaseInfo('name')
setTimeout(() => {
updateBaseInfo('name')
}, 100)
}
// const handleDescriptionUpdate=(value)=> {
// TODO documentation
@ -113,15 +119,15 @@ const updateBaseInfo = (key) => {
if (key === 'id') {
console.log('jinru')
console.log(window, 'window')
console.log(bpmnElement, 'bpmnElement')
console.log(toRaw(bpmnElement), 'bpmnElement')
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement), {
console.log(bpmnElement.value, 'bpmnElement')
console.log(toRaw(bpmnElement.value), 'bpmnElement')
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
id: elementBaseInfo.value[key],
di: { id: `${elementBaseInfo.value[key]}_di` }
})
} else {
console.log(attrObj, 'attrObj')
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement), attrObj)
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), attrObj)
}
}
onMounted(() => {
@ -165,6 +171,6 @@ watch(
// }
// }
onBeforeUnmount(() => {
bpmnElement = null
bpmnElement.value = null
})
</script>

View File

@ -63,7 +63,7 @@
</template>
<script setup lang="ts" name="FlowCondition">
import { ref, nextTick, watch, onBeforeUnmount } from 'vue'
import { ref, nextTick, watch, onBeforeUnmount, toRaw } from 'vue'
import { ElSelect, ElForm, ElFormItem, ElInput, ElOption } from 'element-plus'
const props = defineProps({
@ -117,17 +117,17 @@ const updateFlowType = (flowType) => {
//
if (flowType === 'condition') {
flowConditionRef.value = window.bpmnInstances.moddle.create('bpmn:FormalExpression')
window.bpmnInstances.modeling.updateProperties(bpmnElement.value, {
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
conditionExpression: flowConditionRef.value
})
return
}
//
if (flowType === 'default') {
window.bpmnInstances.modeling.updateProperties(bpmnElement.value, {
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
conditionExpression: null
})
window.bpmnInstances.modeling.updateProperties(bpmnElementSource.value, {
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElementSource.value), {
default: bpmnElement.value
})
return
@ -137,11 +137,11 @@ const updateFlowType = (flowType) => {
bpmnElementSourceRef.value.default &&
bpmnElementSourceRef.value.default.id === bpmnElement.value.id
) {
window.bpmnInstances.modeling.updateProperties(bpmnElementSource.value, {
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElementSource.value), {
default: null
})
}
window.bpmnInstances.modeling.updateProperties(bpmnElement.value, {
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
conditionExpression: null
})
}
@ -164,7 +164,7 @@ const updateFlowCondition = () => {
})
}
}
window.bpmnInstances.modeling.updateProperties(bpmnElement.value, {
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
conditionExpression: condition
})
}

View File

@ -205,7 +205,7 @@
</template>
<script setup lang="ts" name="ElementForm">
import { ref, inject, watch, nextTick } from 'vue'
import { ref, inject, watch, nextTick, toRaw } from 'vue'
import {
ElDialog,
ElForm,
@ -280,10 +280,12 @@ const resetFormList = () => {
updateElementExtensions()
}
const updateElementFormKey = () => {
window.bpmnInstances.modeling.updateProperties(bpmnELement.value, { formKey: formKey.value })
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnELement.value), {
formKey: formKey.value
})
}
const updateElementBusinessKey = () => {
window.bpmnInstances.modeling.updateModdleProperties(bpmnELement.value, formData.value, {
window.bpmnInstances.modeling.updateModdleProperties(toRaw(bpmnELement.value), formData.value, {
businessKey: businessKey.value
})
}
@ -437,7 +439,7 @@ const updateElementExtensions = () => {
values: otherExtensions.value.concat(formData.value)
})
//
window.bpmnInstances.modeling.updateProperties(bpmnELement.value, {
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnELement.value), {
extensionElements: newElExtensionElements
})
}

View File

@ -249,7 +249,7 @@
</div>
</template>
<script setup lang="ts" name="ElementListeners">
import { ref, inject, watch, nextTick } from 'vue'
import { ref, inject, watch, nextTick, toRaw } from 'vue'
import {
ElMessageBox,
ElTable,
@ -288,8 +288,10 @@ const listenerFormRef = ref()
const listenerFieldFormRef = ref()
const resetListenersList = () => {
console.log(window, 'window')
bpmnElement.value = window.bpmnInstances.bpmnElement
otherExtensionList.value = []
console.log(bpmnElement.value, 'bpmnElement.value')
bpmnElementListeners.value =
bpmnElement.value.businessObject?.extensionElements?.values?.filter(
(ex) => ex.$type === `${prefix}:ExecutionListener`
@ -394,14 +396,15 @@ const saveListenerConfig = async () => {
bpmnElement.value.businessObject?.extensionElements?.values?.filter(
(ex) => ex.$type !== `${prefix}:ExecutionListener`
) ?? []
console.log(bpmnElement.value.height, 'bpmnElement.value')
console.log(bpmnElement.value, 'bpmnElement.value')
console.log(toRaw(bpmnElement.value), 'toRawtoRawtoRawtoRawtoRaw')
console.log(
otherExtensionList.value.concat(bpmnElementListeners.value),
'otherExtensionList.value.concat(bpmnElementListeners.value).value'
)
updateElementExtensions(
bpmnElement.value,
otherExtensionList.value.concat(bpmnElementListeners.value)
toRaw(bpmnElement.value),
toRaw(otherExtensionList.value.concat(bpmnElementListeners.value))
)
// 4.
listenerFormModelVisible.value = false

View File

@ -331,6 +331,10 @@ const listenerFormRef = ref()
const listenerFieldFormRef = ref()
const resetListenersList = () => {
console.log(
window.bpmnInstances.bpmnElement,
'window.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElement'
)
bpmnElement.value = window.bpmnInstances.bpmnElement
otherExtensionList.value = []
bpmnElementListeners.value =

View File

@ -1,62 +0,0 @@
// 初始化表单数据
export function initListenerForm(listener) {
let self = {
...listener
};
if (listener.script) {
self = {
...listener,
...listener.script,
scriptType: listener.script.resource ? "externalScript" : "inlineScript"
};
}
if (listener.event === "timeout" && listener.eventDefinitions) {
if (listener.eventDefinitions.length) {
let k = "";
for (let key in listener.eventDefinitions[0]) {
console.log(listener.eventDefinitions, key);
if (key.indexOf("time") !== -1) {
k = key;
self.eventDefinitionType = key.replace("time", "").toLowerCase();
}
}
console.log(k);
self.eventTimeDefinitions = listener.eventDefinitions[0][k].body;
}
}
return self;
}
export function initListenerType(listener) {
let listenerType;
if (listener.class) listenerType = "classListener";
if (listener.expression) listenerType = "expressionListener";
if (listener.delegateExpression) listenerType = "delegateExpressionListener";
if (listener.script) listenerType = "scriptListener";
return {
...JSON.parse(JSON.stringify(listener)),
...(listener.script ?? {}),
listenerType: listenerType
};
}
export const listenerType = {
classListener: "Java 类",
expressionListener: "表达式",
delegateExpressionListener: "代理表达式",
scriptListener: "脚本"
};
export const eventType = {
create: "创建",
assignment: "指派",
complete: "完成",
delete: "删除",
update: "更新",
timeout: "超时"
};
export const fieldType = {
string: "字符串",
expression: "表达式"
};

View File

@ -0,0 +1,62 @@
// 初始化表单数据
export function initListenerForm(listener) {
let self = {
...listener
}
if (listener.script) {
self = {
...listener,
...listener.script,
scriptType: listener.script.resource ? 'externalScript' : 'inlineScript'
}
}
if (listener.event === 'timeout' && listener.eventDefinitions) {
if (listener.eventDefinitions.length) {
let k = ''
for (const key in listener.eventDefinitions[0]) {
console.log(listener.eventDefinitions, key)
if (key.indexOf('time') !== -1) {
k = key
self.eventDefinitionType = key.replace('time', '').toLowerCase()
}
}
console.log(k)
self.eventTimeDefinitions = listener.eventDefinitions[0][k].body
}
}
return self
}
export function initListenerType(listener) {
let listenerType
if (listener.class) listenerType = 'classListener'
if (listener.expression) listenerType = 'expressionListener'
if (listener.delegateExpression) listenerType = 'delegateExpressionListener'
if (listener.script) listenerType = 'scriptListener'
return {
...JSON.parse(JSON.stringify(listener)),
...(listener.script ?? {}),
listenerType: listenerType
}
}
export const listenerType = {
classListener: 'Java 类',
expressionListener: '表达式',
delegateExpressionListener: '代理表达式',
scriptListener: '脚本'
}
export const eventType = {
create: '创建',
assignment: '指派',
complete: '完成',
delete: '删除',
update: '更新',
timeout: '超时'
}
export const fieldType = {
string: '字符串',
expression: '表达式'
}

View File

@ -69,7 +69,7 @@
</template>
<script setup lang="ts" name="ElementMultiInstance">
import { inject, ref, onBeforeUnmount, watch } from 'vue'
import { inject, ref, onBeforeUnmount, watch, toRaw } from 'vue'
import { ElForm, ElFormItem, ElSelect, ElOption, ElCheckbox, ElInput } from 'element-plus'
const props = defineProps({
businessObject: Object,
@ -129,7 +129,9 @@ const changeLoopCharacteristicsType = (type) => {
// this.loopInstanceForm = { ...this.defaultLoopInstanceForm }; //
//
if (type === 'Null') {
window.bpmnInstances.modeling.updateProperties(bpmnElement.value, { loopCharacteristics: null })
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
loopCharacteristics: null
})
return
}
//
@ -137,7 +139,7 @@ const changeLoopCharacteristicsType = (type) => {
const loopCharacteristicsObject = window.bpmnInstances.moddle.create(
'bpmn:StandardLoopCharacteristics'
)
window.bpmnInstances.modeling.updateProperties(bpmnElement.value, {
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
loopCharacteristics: loopCharacteristicsObject
})
multiLoopInstance.value = null
@ -155,7 +157,7 @@ const changeLoopCharacteristicsType = (type) => {
{ collection: '${coll_userList}' }
)
}
window.bpmnInstances.modeling.updateProperties(bpmnElement.value, {
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
loopCharacteristics: multiLoopInstance.value
})
}
@ -167,9 +169,13 @@ const updateLoopCardinality = (cardinality) => {
body: cardinality
})
}
window.bpmnInstances.modeling.updateModdleProperties(bpmnElement.value, multiLoopInstance.value, {
loopCardinality
})
window.bpmnInstances.modeling.updateModdleProperties(
toRaw(bpmnElement.value),
multiLoopInstance.value,
{
loopCardinality
}
)
}
//
const updateLoopCondition = (condition) => {
@ -179,9 +185,13 @@ const updateLoopCondition = (condition) => {
body: condition
})
}
window.bpmnInstances.modeling.updateModdleProperties(bpmnElement.value, multiLoopInstance.value, {
completionCondition
})
window.bpmnInstances.modeling.updateModdleProperties(
toRaw(bpmnElement.value),
multiLoopInstance.value,
{
completionCondition
}
)
}
//
const updateLoopTimeCycle = (timeCycle) => {
@ -192,16 +202,24 @@ const updateLoopTimeCycle = (timeCycle) => {
})
]
})
window.bpmnInstances.modeling.updateModdleProperties(bpmnElement.value, multiLoopInstance.value, {
extensionElements
})
window.bpmnInstances.modeling.updateModdleProperties(
toRaw(bpmnElement.value),
multiLoopInstance.value,
{
extensionElements
}
)
}
//
const updateLoopBase = () => {
window.bpmnInstances.modeling.updateModdleProperties(bpmnElement.value, multiLoopInstance.value, {
collection: loopInstanceForm.value.collection || null,
elementVariable: loopInstanceForm.value.elementVariable || null
})
window.bpmnInstances.modeling.updateModdleProperties(
toRaw(bpmnElement.value),
multiLoopInstance.value,
{
collection: loopInstanceForm.value.collection || null,
elementVariable: loopInstanceForm.value.elementVariable || null
}
)
}
//
const updateLoopAsync = (key) => {
@ -215,7 +233,7 @@ const updateLoopAsync = (key) => {
asyncAttr[key] = loopInstanceForm.value[key]
}
window.bpmnInstances.modeling.updateModdleProperties(
bpmnElement.value,
toRaw(bpmnElement.value),
multiLoopInstance.value,
asyncAttr
)

View File

@ -17,7 +17,7 @@
</template>
<script setup lang="ts" name="ElementOtherConfig">
import { ref, watch, nextTick, onBeforeUnmount } from 'vue'
import { ref, watch, nextTick, onBeforeUnmount, toRaw } from 'vue'
import { ElInput } from 'element-plus'
const props = defineProps({
id: String
@ -25,15 +25,26 @@ const props = defineProps({
const documentation = ref('')
const bpmnElement = ref()
const updateDocumentation = () => {
console.log(props, 'props')
console.log(window, 'window')
console.log(
window.bpmnInstances.elementRegistry.get(props.id),
'window.bpmnInstances.elementRegistry.get(props.id)'
)
console.log(bpmnElement.value, 'bpmnElement.value ')
if (bpmnElement.value && bpmnElement.value.id === props.id) {
bpmnElement.value = window.bpmnInstances.elementRegistry.get(props.id)
bpmnElement.value = window?.bpmnInstances.elementRegistry.get(props.id)
}
console.log(
bpmnElement.value,
'bpmnElement.value bpmnElement.value bpmnElement.value bpmnElement.value bpmnElement.value bpmnElement.value '
)
// (bpmnElement.value && bpmnElement.value.id === props.id) ||
// (bpmnElement.value = window.bpmnInstances.elementRegistry.get(props.id))
const documentations = window.bpmnInstances.bpmnFactory.create('bpmn:Documentation', {
text: documentation.value
})
window.bpmnInstances.modeling.updateProperties(bpmnElement.value, {
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
documentation: [documentations]
})
}

View File

@ -13,7 +13,7 @@
<el-button
type="text"
style="color: #ff4d4f"
@click="removeAttributes(scope.roww, scope.$index)"
@click="removeAttributes(scope.row, scope.$index)"
>移除</el-button
>
</template>
@ -52,7 +52,7 @@
</template>
<script setup lang="ts" name="ElementProperties">
import { ref, inject, nextTick, watch } from 'vue'
import { ref, inject, nextTick, watch, toRaw } from 'vue'
import {
ElMessageBox,
ElDialog,
@ -131,8 +131,8 @@ const saveAttribute = () => {
const { name, value } = propertyForm.value
if (editingPropertyIndex.value !== -1) {
window.bpmnInstances.modeling.updateModdleProperties(
bpmnElement.value,
bpmnElementPropertyList.value[editingPropertyIndex.value],
toRaw(bpmnElement.value),
toRaw(bpmnElementPropertyList.value)[toRaw(editingPropertyIndex.value)],
{
name,
value
@ -157,7 +157,7 @@ const updateElementExtensions = (properties) => {
const extensions = window.bpmnInstances.moddle.create('bpmn:ExtensionElements', {
values: otherExtensionList.value.concat([properties])
})
window.bpmnInstances.modeling.updateProperties(bpmnElement.value, {
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
extensionElements: extensions
})
}

View File

@ -50,7 +50,7 @@
</template>
<script setup lang="ts" name="ReceiveTask">
import { ref, watch, onBeforeUnmount, onMounted, nextTick } from 'vue'
import { ref, watch, onBeforeUnmount, onMounted, nextTick, toRaw } from 'vue'
import { ElMessage, ElFormItem, ElDialog, ElForm, ElSelect, ElOption } from 'element-plus'
const props = defineProps({
id: String,
@ -85,11 +85,11 @@ const createNewMessage = () => {
}
const updateTaskMessage = (messageId) => {
if (messageId === '-1') {
window.bpmnInstances.modeling.updateProperties(bpmnElement.value, {
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
messageRef: null
})
} else {
window.bpmnInstances.modeling.updateProperties(bpmnElement.value, {
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
messageRef: bpmnMessageRefsMap.value[messageId]
})
}

View File

@ -45,7 +45,7 @@
</template>
<script setup lang="ts" name="ScriptTask">
import { ref, watch, nextTick, onBeforeUnmount } from 'vue'
import { ref, watch, nextTick, onBeforeUnmount, toRaw } from 'vue'
import { ElInput, ElFormItem } from 'element-plus'
const props = defineProps({
id: String,
@ -78,7 +78,7 @@ const updateElementTask = () => {
taskAttr.resource = scriptTaskForm.value.resource || null
taskAttr.script = null
}
window.bpmnInstances.modeling.updateProperties(bpmnElement.value, taskAttr)
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), taskAttr)
}
onBeforeUnmount(() => {

View File

@ -38,7 +38,7 @@
</template>
<script setup lang="ts" name="UserTask">
import { ref, watch, nextTick, onBeforeUnmount } from 'vue'
import { ref, watch, nextTick, onBeforeUnmount, toRaw } from 'vue'
import { ElLink, ElFormItem, ElInput } from 'element-plus'
const props = defineProps({
id: String,
@ -78,7 +78,7 @@ const updateElementTask = (key) => {
} else {
taskAttr[key] = userTaskForm.value[key] || null
}
window.bpmnInstances.modeling.updateProperties(bpmnElement.value, taskAttr)
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), taskAttr)
}
watch(

View File

@ -1,3 +1,4 @@
import { toRaw } from 'vue'
// 创建监听器实例
export function createListenerObject(options, isTask, prefix) {
const listenerObj = Object.create(null)
@ -59,12 +60,9 @@ export function updateElementExtensions(element, extensionList) {
const extensions = window.bpmnInstances.moddle.create('bpmn:ExtensionElements', {
values: extensionList
})
console.log(element, 'elementelementelementelement')
console.log(extensions.values, 'extensionsextensionsextensions')
window.bpmnInstances.modeling.updateProperties(element, {
window.bpmnInstances.modeling.updateProperties(toRaw(element), {
extensionElements: extensions.values
})
console.log('ssss')
}
// 创建一个id

View File

@ -27,7 +27,7 @@
</template>
<script setup lang="ts">
import { ref, onMounted, onBeforeMount } from 'vue'
import { ref, onMounted } from 'vue'
// import { translations } from '@/components/bpmnProcessDesigner/src/translations'
//
import CustomContentPadProvider from '@/components/bpmnProcessDesigner/package/designer/plugins/content-pad'
@ -64,9 +64,6 @@ const controlForm = ref({
// })
//
const model = ref({})
onBeforeMount(() => {
// window.bpmnInstances = {}
})
onMounted(() => {
// modelId
const modelId = router.currentRoute.value.query && router.currentRoute.value.query.modelId