-
-
-
- {{ previewResult }}
-
-
+
+
+
+ {{ previewResult }}
+
+
@@ -331,7 +331,7 @@ const additionalModules = computed(() => {
// 插入用户自定义扩展模块
if (Object.prototype.toString.call(props.additionalModel) == '[object Array]') {
- Modules.push(...props.additionalModel)
+ Modules.push(...(props.additionalModel as any[]))
} else {
props.additionalModel && Modules.push(props.additionalModel)
}
diff --git a/src/components/bpmnProcessDesigner/package/palette/ProcessPalette.vue b/src/components/bpmnProcessDesigner/package/palette/ProcessPalette.vue
index f5272840..38e4ba17 100644
--- a/src/components/bpmnProcessDesigner/package/palette/ProcessPalette.vue
+++ b/src/components/bpmnProcessDesigner/package/palette/ProcessPalette.vue
@@ -8,9 +8,10 @@
diff --git a/src/components/bpmnProcessDesigner/package/penal/form/ElementForm.vue b/src/components/bpmnProcessDesigner/package/penal/form/ElementForm.vue
index a1b51623..cb96a2fb 100644
--- a/src/components/bpmnProcessDesigner/package/penal/form/ElementForm.vue
+++ b/src/components/bpmnProcessDesigner/package/penal/form/ElementForm.vue
@@ -239,17 +239,18 @@ const elExtensionElements = ref()
const formData = ref()
const otherExtensions = ref()
+const bpmnInstances = () => (window as any)?.bpmnInstances
const resetFormList = () => {
- bpmnELement.value = window.bpmnInstances.bpmnElement
+ bpmnELement.value = bpmnInstances().bpmnElement
formKey.value = bpmnELement.value.businessObject.formKey
// 获取元素扩展属性 或者 创建扩展属性
elExtensionElements.value =
bpmnELement.value.businessObject.get('extensionElements') ||
- window.bpmnInstances.moddle.create('bpmn:ExtensionElements', { values: [] })
+ bpmnInstances().moddle.create('bpmn:ExtensionElements', { values: [] })
// 获取元素表单配置 或者 创建新的表单配置
formData.value =
elExtensionElements.value.values.filter((ex) => ex.$type === `${prefix}:FormData`)?.[0] ||
- window.bpmnInstances.moddle.create(`${prefix}:FormData`, { fields: [] })
+ bpmnInstances().moddle.create(`${prefix}:FormData`, { fields: [] })
// 业务标识 businessKey, 绑定在 formData 中
businessKey.value = formData.value.businessKey
@@ -266,12 +267,12 @@ const resetFormList = () => {
updateElementExtensions()
}
const updateElementFormKey = () => {
- window.bpmnInstances.modeling.updateProperties(toRaw(bpmnELement.value), {
+ bpmnInstances().modeling.updateProperties(toRaw(bpmnELement.value), {
formKey: formKey.value
})
}
const updateElementBusinessKey = () => {
- window.bpmnInstances.modeling.updateModdleProperties(toRaw(bpmnELement.value), formData.value, {
+ bpmnInstances().modeling.updateModdleProperties(toRaw(bpmnELement.value), formData.value, {
businessKey: businessKey.value
})
}
@@ -353,37 +354,37 @@ const saveFieldOption = () => {
// 保存字段配置
const saveField = () => {
const { id, type, label, defaultValue, datePattern } = formFieldForm.value
- const Field = window.bpmnInstances.moddle.create(`${prefix}:FormField`, { id, type, label })
+ const Field = bpmnInstances().moddle.create(`${prefix}:FormField`, { id, type, label })
defaultValue && (Field.defaultValue = defaultValue)
datePattern && (Field.datePattern = datePattern)
// 构建属性
if (fieldPropertiesList.value && fieldPropertiesList.value.length) {
const fieldPropertyList = fieldPropertiesList.value.map((fp) => {
- return window.bpmnInstances.moddle.create(`${prefix}:Property`, {
+ return bpmnInstances().moddle.create(`${prefix}:Property`, {
id: fp.id,
value: fp.value
})
})
- Field.properties = window.bpmnInstances.moddle.create(`${this.prefix}:Properties`, {
+ Field.properties = bpmnInstances().moddle.create(`${prefix}:Properties`, {
values: fieldPropertyList
})
}
// 构建校验规则
if (fieldConstraintsList.value && fieldConstraintsList.value.length) {
const fieldConstraintList = fieldConstraintsList.value.map((fc) => {
- return window.bpmnInstances.moddle.create(`${prefix}:Constraint`, {
+ return bpmnInstances().moddle.create(`${prefix}:Constraint`, {
name: fc.name,
config: fc.config
})
})
- Field.validation = window.bpmnInstances.moddle.create(`${prefix}:Validation`, {
+ Field.validation = bpmnInstances().moddle.create(`${prefix}:Validation`, {
constraints: fieldConstraintList
})
}
// 构建枚举值
if (fieldEnumList.value && fieldEnumList.value.length) {
Field.values = fieldEnumList.value.map((fe) => {
- return window.bpmnInstances.moddle.create(`${prefix}:Value`, { name: fe.name, id: fe.id })
+ return bpmnInstances().moddle.create(`${prefix}:Value`, { name: fe.name, id: fe.id })
})
}
// 更新数组 与 表单配置实例
@@ -421,11 +422,11 @@ const removeField = (field, index) => {
const updateElementExtensions = () => {
// 更新回扩展元素
- const newElExtensionElements = window.bpmnInstances.moddle.create(`bpmn:ExtensionElements`, {
+ const newElExtensionElements = bpmnInstances().moddle.create(`bpmn:ExtensionElements`, {
values: otherExtensions.value.concat(formData.value)
})
// 更新到元素上
- window.bpmnInstances.modeling.updateProperties(toRaw(bpmnELement.value), {
+ bpmnInstances().modeling.updateProperties(toRaw(bpmnELement.value), {
extensionElements: newElExtensionElements
})
}
diff --git a/src/components/bpmnProcessDesigner/package/penal/listeners/ElementListeners.vue b/src/components/bpmnProcessDesigner/package/penal/listeners/ElementListeners.vue
index 0c29e6ff..5c2db5af 100644
--- a/src/components/bpmnProcessDesigner/package/penal/listeners/ElementListeners.vue
+++ b/src/components/bpmnProcessDesigner/package/penal/listeners/ElementListeners.vue
@@ -266,9 +266,10 @@ const otherExtensionList = ref()
const bpmnElementListeners = ref()
const listenerFormRef = ref()
const listenerFieldFormRef = ref()
+const bpmnInstances = () => (window as any)?.bpmnInstances
const resetListenersList = () => {
- bpmnElement.value = window.bpmnInstances.bpmnElement
+ bpmnElement.value = bpmnInstances().bpmnElement
otherExtensionList.value = []
bpmnElementListeners.value =
bpmnElement.value.businessObject?.extensionElements?.values?.filter(
diff --git a/src/components/bpmnProcessDesigner/package/penal/listeners/UserTaskListeners.vue b/src/components/bpmnProcessDesigner/package/penal/listeners/UserTaskListeners.vue
index 7746ca86..e4201b52 100644
--- a/src/components/bpmnProcessDesigner/package/penal/listeners/UserTaskListeners.vue
+++ b/src/components/bpmnProcessDesigner/package/penal/listeners/UserTaskListeners.vue
@@ -313,13 +313,14 @@ const bpmnElementListeners = ref()
const otherExtensionList = ref()
const listenerFormRef = ref()
const listenerFieldFormRef = ref()
+const bpmnInstances = () => (window as any)?.bpmnInstances
const resetListenersList = () => {
console.log(
- window.bpmnInstances.bpmnElement,
+ bpmnInstances().bpmnElement,
'window.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElement'
)
- bpmnElement.value = window.bpmnInstances.bpmnElement
+ bpmnElement.value = bpmnInstances().bpmnElement
otherExtensionList.value = []
bpmnElementListeners.value =
bpmnElement.value.businessObject?.extensionElements?.values.filter(
diff --git a/src/components/bpmnProcessDesigner/package/penal/multi-instance/ElementMultiInstance.vue b/src/components/bpmnProcessDesigner/package/penal/multi-instance/ElementMultiInstance.vue
index 6d0229bb..962234d5 100644
--- a/src/components/bpmnProcessDesigner/package/penal/multi-instance/ElementMultiInstance.vue
+++ b/src/components/bpmnProcessDesigner/package/penal/multi-instance/ElementMultiInstance.vue
@@ -87,6 +87,7 @@ const defaultLoopInstanceForm = ref({
const loopInstanceForm = ref({})
const bpmnElement = ref(null)
const multiLoopInstance = ref(null)
+const bpmnInstances = () => (window as any)?.bpmnInstances
const getElementLoop = (businessObject) => {
if (!businessObject.loopCharacteristics) {
@@ -112,7 +113,7 @@ const getElementLoop = (businessObject) => {
loopCardinality: businessObject.loopCharacteristics?.loopCardinality?.body ?? ''
}
// 保留当前元素 businessObject 上的 loopCharacteristics 实例
- multiLoopInstance.value = window.bpmnInstances.bpmnElement.businessObject.loopCharacteristics
+ multiLoopInstance.value = bpmnInstances().bpmnElement.businessObject.loopCharacteristics
// 更新表单
if (
businessObject.loopCharacteristics.extensionElements &&
@@ -127,17 +128,17 @@ const changeLoopCharacteristicsType = (type) => {
// this.loopInstanceForm = { ...this.defaultLoopInstanceForm }; // 切换类型取消原表单配置
// 取消多实例配置
if (type === 'Null') {
- window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
+ bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
loopCharacteristics: null
})
return
}
// 配置循环
if (type === 'StandardLoop') {
- const loopCharacteristicsObject = window.bpmnInstances.moddle.create(
+ const loopCharacteristicsObject = bpmnInstances().moddle.create(
'bpmn:StandardLoopCharacteristics'
)
- window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
+ bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
loopCharacteristics: loopCharacteristicsObject
})
multiLoopInstance.value = null
@@ -145,17 +146,17 @@ const changeLoopCharacteristicsType = (type) => {
}
// 时序
if (type === 'SequentialMultiInstance') {
- multiLoopInstance.value = window.bpmnInstances.moddle.create(
+ multiLoopInstance.value = bpmnInstances().moddle.create(
'bpmn:MultiInstanceLoopCharacteristics',
{ isSequential: true }
)
} else {
- multiLoopInstance.value = window.bpmnInstances.moddle.create(
+ multiLoopInstance.value = bpmnInstances().moddle.create(
'bpmn:MultiInstanceLoopCharacteristics',
{ collection: '${coll_userList}' }
)
}
- window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
+ bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
loopCharacteristics: toRaw(multiLoopInstance.value)
})
}
@@ -163,11 +164,11 @@ const changeLoopCharacteristicsType = (type) => {
const updateLoopCardinality = (cardinality) => {
let loopCardinality = null
if (cardinality && cardinality.length) {
- loopCardinality = window.bpmnInstances.moddle.create('bpmn:FormalExpression', {
+ loopCardinality = bpmnInstances().moddle.create('bpmn:FormalExpression', {
body: cardinality
})
}
- window.bpmnInstances.modeling.updateModdleProperties(
+ bpmnInstances().modeling.updateModdleProperties(
toRaw(bpmnElement.value),
multiLoopInstance.value,
{
@@ -179,11 +180,11 @@ const updateLoopCardinality = (cardinality) => {
const updateLoopCondition = (condition) => {
let completionCondition = null
if (condition && condition.length) {
- completionCondition = window.bpmnInstances.moddle.create('bpmn:FormalExpression', {
+ completionCondition = bpmnInstances().moddle.create('bpmn:FormalExpression', {
body: condition
})
}
- window.bpmnInstances.modeling.updateModdleProperties(
+ bpmnInstances().modeling.updateModdleProperties(
toRaw(bpmnElement.value),
multiLoopInstance.value,
{
@@ -193,14 +194,14 @@ const updateLoopCondition = (condition) => {
}
// 重试周期
const updateLoopTimeCycle = (timeCycle) => {
- const extensionElements = window.bpmnInstances.moddle.create('bpmn:ExtensionElements', {
+ const extensionElements = bpmnInstances().moddle.create('bpmn:ExtensionElements', {
values: [
- window.bpmnInstances.moddle.create(`${prefix}:FailedJobRetryTimeCycle`, {
+ bpmnInstances().moddle.create(`${prefix}:FailedJobRetryTimeCycle`, {
body: timeCycle
})
]
})
- window.bpmnInstances.modeling.updateModdleProperties(
+ bpmnInstances().modeling.updateModdleProperties(
toRaw(bpmnElement.value),
multiLoopInstance.value,
{
@@ -210,7 +211,7 @@ const updateLoopTimeCycle = (timeCycle) => {
}
// 直接更新的基础信息
const updateLoopBase = () => {
- window.bpmnInstances.modeling.updateModdleProperties(
+ bpmnInstances().modeling.updateModdleProperties(
toRaw(bpmnElement.value),
multiLoopInstance.value,
{
@@ -230,7 +231,7 @@ const updateLoopAsync = (key) => {
} else {
asyncAttr[key] = loopInstanceForm.value[key]
}
- window.bpmnInstances.modeling.updateModdleProperties(
+ bpmnInstances().modeling.updateModdleProperties(
toRaw(bpmnElement.value),
multiLoopInstance.value,
asyncAttr
@@ -245,7 +246,7 @@ onBeforeUnmount(() => {
watch(
() => props.businessObject,
(val) => {
- bpmnElement.value = window.bpmnInstances.bpmnElement
+ bpmnElement.value = bpmnInstances().bpmnElement
getElementLoop(val)
},
{ immediate: true }
diff --git a/src/components/bpmnProcessDesigner/package/penal/other/ElementOtherConfig.vue b/src/components/bpmnProcessDesigner/package/penal/other/ElementOtherConfig.vue
index fe2d004d..2c55481c 100644
--- a/src/components/bpmnProcessDesigner/package/penal/other/ElementOtherConfig.vue
+++ b/src/components/bpmnProcessDesigner/package/penal/other/ElementOtherConfig.vue
@@ -22,13 +22,14 @@ const props = defineProps({
})
const documentation = ref('')
const bpmnElement = ref()
+const bpmnInstances = () => (window as any).bpmnInstances
const updateDocumentation = () => {
;(bpmnElement.value && bpmnElement.value.id === props.id) ||
- (bpmnElement.value = (window as any).bpmnInstances.elementRegistry.get(props.id))
- const documentations = window.bpmnInstances.bpmnFactory.create('bpmn:Documentation', {
+ (bpmnElement.value = bpmnInstances().elementRegistry.get(props.id))
+ const documentations = bpmnInstances().bpmnFactory.create('bpmn:Documentation', {
text: documentation.value
})
- window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
+ bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
documentation: [documentations]
})
}
@@ -41,7 +42,7 @@ watch(
(id) => {
if (id && id.length) {
nextTick(() => {
- const documentations = window.bpmnInstances.bpmnElement.businessObject?.documentation
+ const documentations = bpmnInstances().bpmnElement.businessObject?.documentation
documentation.value = documentations && documentations.length ? documentations[0].text : ''
})
} else {
diff --git a/src/components/bpmnProcessDesigner/package/penal/properties/ElementProperties.vue b/src/components/bpmnProcessDesigner/package/penal/properties/ElementProperties.vue
index 388c363f..f1670ffb 100644
--- a/src/components/bpmnProcessDesigner/package/penal/properties/ElementProperties.vue
+++ b/src/components/bpmnProcessDesigner/package/penal/properties/ElementProperties.vue
@@ -70,10 +70,11 @@ const otherExtensionList = ref()
const bpmnElementProperties = ref()
const bpmnElementPropertyList = ref()
const attributeFormRef = ref()
+const bpmnInstances = () => (window as any)?.bpmnInstances
const resetAttributesList = () => {
console.log(window, 'windowwindowwindowwindowwindowwindowwindow')
- bpmnElement.value = window.bpmnInstances.bpmnElement
+ bpmnElement.value = bpmnInstances().bpmnElement
otherExtensionList.value = [] // 其他扩展配置
bpmnElementProperties.value =
// bpmnElement.value.businessObject?.extensionElements?.filter((ex) => {
@@ -110,7 +111,7 @@ const removeAttributes = (attr, index) => {
elementPropertyList.value.splice(index, 1)
bpmnElementPropertyList.value.splice(index, 1)
// 新建一个属性字段的保存列表
- const propertiesObject = window.bpmnInstances.moddle.create(`${prefix}:Properties`, {
+ const propertiesObject = bpmnInstances().moddle.create(`${prefix}:Properties`, {
values: bpmnElementPropertyList.value
})
updateElementExtensions(propertiesObject)
@@ -122,7 +123,7 @@ const saveAttribute = () => {
console.log(propertyForm.value, 'propertyForm.value')
const { name, value } = propertyForm.value
if (editingPropertyIndex.value !== -1) {
- window.bpmnInstances.modeling.updateModdleProperties(
+ bpmnInstances().modeling.updateModdleProperties(
toRaw(bpmnElement.value),
toRaw(bpmnElementPropertyList.value)[toRaw(editingPropertyIndex.value)],
{
@@ -132,12 +133,12 @@ const saveAttribute = () => {
)
} else {
// 新建属性字段
- const newPropertyObject = window.bpmnInstances.moddle.create(`${prefix}:Property`, {
+ const newPropertyObject = bpmnInstances().moddle.create(`${prefix}:Property`, {
name,
value
})
// 新建一个属性字段的保存列表
- const propertiesObject = window.bpmnInstances.moddle.create(`${prefix}:Properties`, {
+ const propertiesObject = bpmnInstances().moddle.create(`${prefix}:Properties`, {
values: bpmnElementPropertyList.value.concat([newPropertyObject])
})
updateElementExtensions(propertiesObject)
@@ -146,10 +147,10 @@ const saveAttribute = () => {
resetAttributesList()
}
const updateElementExtensions = (properties) => {
- const extensions = window.bpmnInstances.moddle.create('bpmn:ExtensionElements', {
+ const extensions = bpmnInstances().moddle.create('bpmn:ExtensionElements', {
values: otherExtensionList.value.concat([properties])
})
- window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
+ bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
extensionElements: extensions
})
}
diff --git a/src/components/bpmnProcessDesigner/package/penal/signal-message/SignalAndMessage.vue b/src/components/bpmnProcessDesigner/package/penal/signal-message/SignalAndMessage.vue
index 285b3411..e2c406db 100644
--- a/src/components/bpmnProcessDesigner/package/penal/signal-message/SignalAndMessage.vue
+++ b/src/components/bpmnProcessDesigner/package/penal/signal-message/SignalAndMessage.vue
@@ -62,10 +62,11 @@ const modelConfig = computed(() => {
return { title: '创建信号', idLabel: '信号ID', nameLabel: '信号名称' }
}
})
+const bpmnInstances = () => (window as any)?.bpmnInstances
const initDataList = () => {
console.log(window, 'window')
- rootElements.value = window.bpmnInstances.modeler.getDefinitions().rootElements
+ rootElements.value = bpmnInstances().modeler.getDefinitions().rootElements
messageIdMap.value = {}
signalIdMap.value = {}
messageList.value = []
@@ -91,13 +92,13 @@ const addNewObject = () => {
if (messageIdMap.value[modelObjectForm.value.id]) {
message.error('该消息已存在,请修改id后重新保存')
}
- const messageRef = window.bpmnInstances.moddle.create('bpmn:Message', modelObjectForm.value)
+ const messageRef = bpmnInstances().moddle.create('bpmn:Message', modelObjectForm.value)
rootElements.value.push(messageRef)
} else {
if (signalIdMap.value[modelObjectForm.value.id]) {
message.error('该信号已存在,请修改id后重新保存')
}
- const signalRef = window.bpmnInstances.moddle.create('bpmn:Signal', modelObjectForm.value)
+ const signalRef = bpmnInstances().moddle.create('bpmn:Signal', modelObjectForm.value)
rootElements.value.push(signalRef)
}
modelVisible.value = false
diff --git a/src/components/bpmnProcessDesigner/package/penal/task/ElementTask.vue b/src/components/bpmnProcessDesigner/package/penal/task/ElementTask.vue
index 939116ab..23e750a1 100644
--- a/src/components/bpmnProcessDesigner/package/penal/task/ElementTask.vue
+++ b/src/components/bpmnProcessDesigner/package/penal/task/ElementTask.vue
@@ -45,11 +45,12 @@ const installedComponent = ref({
})
const bpmnElement = ref()
+const bpmnInstances = () => (window as any).bpmnInstances
const changeTaskAsync = () => {
if (!taskConfigForm.value.asyncBefore && !taskConfigForm.value.asyncAfter) {
taskConfigForm.value.exclusive = false
}
- window.bpmnInstances.modeling.updateProperties(window.bpmnInstances.bpmnElement, {
+ bpmnInstances().modeling.updateProperties(bpmnInstances().bpmnElement, {
...taskConfigForm.value
})
}
@@ -57,7 +58,7 @@ const changeTaskAsync = () => {
watch(
() => props.id,
() => {
- bpmnElement.value = window.bpmnInstances.bpmnElement
+ bpmnElement.value = bpmnInstances().bpmnElement
taskConfigForm.value.asyncBefore = bpmnElement.value?.businessObject?.asyncBefore
taskConfigForm.value.asyncAfter = bpmnElement.value?.businessObject?.asyncAfter
taskConfigForm.value.exclusive = bpmnElement.value?.businessObject?.exclusive
diff --git a/src/components/bpmnProcessDesigner/package/penal/task/task-components/ReceiveTask.vue b/src/components/bpmnProcessDesigner/package/penal/task/task-components/ReceiveTask.vue
index 57c68b19..ef2ba0b9 100644
--- a/src/components/bpmnProcessDesigner/package/penal/task/task-components/ReceiveTask.vue
+++ b/src/components/bpmnProcessDesigner/package/penal/task/task-components/ReceiveTask.vue
@@ -64,8 +64,9 @@ const bpmnElement = ref()
const bpmnMessageRefsMap = ref()
const bpmnRootElements = ref()
+const bpmnInstances = () => (window as any).bpmnInstances
const getBindMessage = () => {
- bpmnElement.value = window.bpmnInstances.bpmnElement
+ bpmnElement.value = bpmnInstances().bpmnElement
bindMessageId.value = bpmnElement.value.businessObject?.messageRef?.id || '-1'
}
const openMessageModel = () => {
@@ -77,7 +78,7 @@ const createNewMessage = () => {
message.error('该消息已存在,请修改id后重新保存')
return
}
- const newMessage = window.bpmnInstances.moddle.create('bpmn:Message', newMessageForm.value)
+ const newMessage = bpmnInstances().moddle.create('bpmn:Message', newMessageForm.value)
bpmnRootElements.value.push(newMessage)
messageMap.value[newMessageForm.value.id] = newMessageForm.value.name
bpmnMessageRefsMap.value[newMessageForm.value.id] = newMessage
@@ -85,11 +86,11 @@ const createNewMessage = () => {
}
const updateTaskMessage = (messageId) => {
if (messageId === '-1') {
- window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
+ bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
messageRef: null
})
} else {
- window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
+ bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
messageRef: bpmnMessageRefsMap.value[messageId]
})
}
@@ -97,7 +98,7 @@ const updateTaskMessage = (messageId) => {
onMounted(() => {
bpmnMessageRefsMap.value = Object.create(null)
- bpmnRootElements.value = window.bpmnInstances.modeler.getDefinitions().rootElements
+ bpmnRootElements.value = bpmnInstances().modeler.getDefinitions().rootElements
bpmnRootElements.value
.filter((el) => el.$type === 'bpmn:Message')
.forEach((m) => {
@@ -113,7 +114,7 @@ onBeforeUnmount(() => {
watch(
() => props.id,
() => {
- // bpmnElement.value = window.bpmnInstances.bpmnElement
+ // bpmnElement.value = bpmnInstances().bpmnElement
nextTick(() => {
getBindMessage()
})
diff --git a/src/components/bpmnProcessDesigner/package/penal/task/task-components/ScriptTask.vue b/src/components/bpmnProcessDesigner/package/penal/task/task-components/ScriptTask.vue
index ba3e6edf..bacdec0e 100644
--- a/src/components/bpmnProcessDesigner/package/penal/task/task-components/ScriptTask.vue
+++ b/src/components/bpmnProcessDesigner/package/penal/task/task-components/ScriptTask.vue
@@ -58,6 +58,8 @@ const defaultTaskForm = ref({
const scriptTaskForm = ref({})
const bpmnElement = ref()
+const bpmnInstances = () => (window as any)?.bpmnInstances
+
const resetTaskForm = () => {
for (let key in defaultTaskForm.value) {
let value = bpmnElement.value?.businessObject[key] || defaultTaskForm.value[key]
@@ -76,7 +78,7 @@ const updateElementTask = () => {
taskAttr.resource = scriptTaskForm.value.resource || null
taskAttr.script = null
}
- window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), taskAttr)
+ bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), taskAttr)
}
onBeforeUnmount(() => {
@@ -86,7 +88,7 @@ onBeforeUnmount(() => {
watch(
() => props.id,
() => {
- bpmnElement.value = window.bpmnInstances.bpmnElement
+ bpmnElement.value = bpmnInstances().bpmnElement
nextTick(() => {
resetTaskForm()
})
diff --git a/src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue b/src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue
index 118fa71b..725335eb 100644
--- a/src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue
+++ b/src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue
@@ -53,6 +53,8 @@ const defaultTaskForm = ref({
const userTaskForm = ref({})
// const mockData=ref([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
const bpmnElement = ref()
+const bpmnInstances = () => (window as any)?.bpmnInstances
+
const resetTaskForm = () => {
for (let key in defaultTaskForm.value) {
let value
@@ -76,13 +78,13 @@ const updateElementTask = (key) => {
} else {
taskAttr[key] = userTaskForm.value[key] || null
}
- window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), taskAttr)
+ bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), taskAttr)
}
watch(
() => props.id,
() => {
- bpmnElement.value = window.bpmnInstances.bpmnElement
+ bpmnElement.value = bpmnInstances().bpmnElement
nextTick(() => {
resetTaskForm()
})
diff --git a/src/components/bpmnProcessDesigner/package/utils.ts b/src/components/bpmnProcessDesigner/package/utils.ts
index 41f06801..bb6c5d52 100644
--- a/src/components/bpmnProcessDesigner/package/utils.ts
+++ b/src/components/bpmnProcessDesigner/package/utils.ts
@@ -1,4 +1,5 @@
import { toRaw } from 'vue'
+const bpmnInstances = () => (window as any)?.bpmnInstances
// 创建监听器实例
export function createListenerObject(options, isTask, prefix) {
const listenerObj = Object.create(null)
@@ -25,16 +26,16 @@ export function createListenerObject(options, isTask, prefix) {
}
// 任务监听器的 定时器 设置
if (isTask && options.event === 'timeout' && !!options.eventDefinitionType) {
- const timeDefinition = window.bpmnInstances.moddle.create('bpmn:FormalExpression', {
+ const timeDefinition = bpmnInstances().moddle.create('bpmn:FormalExpression', {
body: options.eventTimeDefinitions
})
- const TimerEventDefinition = window.bpmnInstances.moddle.create('bpmn:TimerEventDefinition', {
+ const TimerEventDefinition = bpmnInstances().moddle.create('bpmn:TimerEventDefinition', {
id: `TimerEventDefinition_${uuid(8)}`,
[`time${options.eventDefinitionType.replace(/^\S/, (s) => s.toUpperCase())}`]: timeDefinition
})
listenerObj.eventDefinitions = [TimerEventDefinition]
}
- return window.bpmnInstances.moddle.create(
+ return bpmnInstances().moddle.create(
`${prefix}:${isTask ? 'TaskListener' : 'ExecutionListener'}`,
listenerObj
)
@@ -44,7 +45,7 @@ export function createListenerObject(options, isTask, prefix) {
export function createFieldObject(option, prefix) {
const { name, fieldType, string, expression } = option
const fieldConfig = fieldType === 'string' ? { name, string } : { name, expression }
- return window.bpmnInstances.moddle.create(`${prefix}:Field`, fieldConfig)
+ return bpmnInstances().moddle.create(`${prefix}:Field`, fieldConfig)
}
// 创建脚本实例
@@ -52,21 +53,21 @@ export function createScriptObject(options, prefix) {
const { scriptType, scriptFormat, value, resource } = options
const scriptConfig =
scriptType === 'inlineScript' ? { scriptFormat, value } : { scriptFormat, resource }
- return window.bpmnInstances.moddle.create(`${prefix}:Script`, scriptConfig)
+ return bpmnInstances().moddle.create(`${prefix}:Script`, scriptConfig)
}
// 更新元素扩展属性
export function updateElementExtensions(element, extensionList) {
- const extensions = window.bpmnInstances.moddle.create('bpmn:ExtensionElements', {
+ const extensions = bpmnInstances().moddle.create('bpmn:ExtensionElements', {
values: extensionList
})
- window.bpmnInstances.modeling.updateProperties(toRaw(element), {
+ bpmnInstances().modeling.updateProperties(toRaw(element), {
extensionElements: extensions
})
}
// 创建一个id
-export function uuid(length = 8, chars) {
+export function uuid(length = 8, chars?) {
let result = ''
const charsString = chars || '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
for (let i = length; i > 0; --i) {
diff --git a/src/hooks/web/useCrudSchemas.ts b/src/hooks/web/useCrudSchemas.ts
index 34e655b1..543111ca 100644
--- a/src/hooks/web/useCrudSchemas.ts
+++ b/src/hooks/web/useCrudSchemas.ts
@@ -282,7 +282,7 @@ const filterDescriptionsSchema = (crudSchema: CrudSchema[]): DescriptionsSchema[
// 给options添加国际化
const filterOptions = (options: Recordable, labelField?: string) => {
- return options.map((v: Recordable) => {
+ return options?.map((v: Recordable) => {
if (labelField) {
v['labelField'] = t(v.labelField)
} else {
diff --git a/src/hooks/web/useI18n.ts b/src/hooks/web/useI18n.ts
index 8b6e7650..d1ab70fa 100644
--- a/src/hooks/web/useI18n.ts
+++ b/src/hooks/web/useI18n.ts
@@ -41,6 +41,7 @@ export const useI18n = (
const tFn: I18nGlobalTranslation = (key: string, ...arg: any[]) => {
if (!key) return ''
if (!key.includes('.') && !namespace) return key
+ //@ts-ignore
return t(getKey(namespace, key), ...(arg as I18nTranslationRestParameters))
}
return {
diff --git a/src/hooks/web/useTimeAgo.ts b/src/hooks/web/useTimeAgo.ts
index 08f5d1e6..a6da2819 100644
--- a/src/hooks/web/useTimeAgo.ts
+++ b/src/hooks/web/useTimeAgo.ts
@@ -5,6 +5,7 @@ const TIME_AGO_MESSAGE_MAP: {
'zh-CN': UseTimeAgoMessages
en: UseTimeAgoMessages
} = {
+ // @ts-ignore
'zh-CN': {
justNow: '刚刚',
past: (n) => (n.match(/\d/) ? `${n}前` : n),
@@ -17,6 +18,7 @@ const TIME_AGO_MESSAGE_MAP: {
minute: (n) => `${n} 分钟`,
second: (n) => `${n} 秒`
},
+ // @ts-ignore
en: {
justNow: 'just now',
past: (n) => (n.match(/\d/) ? `${n} ago` : n),
diff --git a/src/layout/components/TagsView/src/TagsView.vue b/src/layout/components/TagsView/src/TagsView.vue
index b3f95594..d6e9768d 100644
--- a/src/layout/components/TagsView/src/TagsView.vue
+++ b/src/layout/components/TagsView/src/TagsView.vue
@@ -409,7 +409,10 @@ watch(
{
icon: 'ep:close',
label: t('common.closeTab'),
- disabled: !!visitedViews?.length && selectedTag?.meta.affix
+ disabled: !!visitedViews?.length && selectedTag?.meta.affix,
+ command: () => {
+ closeSelectedTag(selectedTag!)
+ }
},
{
divided: true,
diff --git a/src/layout/components/ThemeSwitch/src/ThemeSwitch.vue b/src/layout/components/ThemeSwitch/src/ThemeSwitch.vue
index 1af67cf0..45243011 100644
--- a/src/layout/components/ThemeSwitch/src/ThemeSwitch.vue
+++ b/src/layout/components/ThemeSwitch/src/ThemeSwitch.vue
@@ -37,3 +37,8 @@ const themeChange = (val: boolean) => {
@change="themeChange"
/>