chore: 规范不符合eslint校验规则的代码
This commit is contained in:
parent
2ec6978400
commit
f2f564dc0c
@ -331,7 +331,7 @@ const additionalModules = computed(() => {
|
|||||||
|
|
||||||
// 插入用户自定义扩展模块
|
// 插入用户自定义扩展模块
|
||||||
if (Object.prototype.toString.call(props.additionalModel) == '[object Array]') {
|
if (Object.prototype.toString.call(props.additionalModel) == '[object Array]') {
|
||||||
Modules.push(...props.additionalModel)
|
Modules.push(...(props.additionalModel as any[]))
|
||||||
} else {
|
} else {
|
||||||
props.additionalModel && Modules.push(props.additionalModel)
|
props.additionalModel && Modules.push(props.additionalModel)
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,10 @@
|
|||||||
<script setup lang="ts" name="MyProcessPalette">
|
<script setup lang="ts" name="MyProcessPalette">
|
||||||
import { assign } from 'min-dash'
|
import { assign } from 'min-dash'
|
||||||
|
|
||||||
const addTask = (event, options = {}) => {
|
const bpmnInstances = () => (window as any).bpmnInstances
|
||||||
const ElementFactory = window.bpmnInstances.elementFactory
|
const addTask = (event, options: any = {}) => {
|
||||||
const create = window.bpmnInstances.modeler.get('create')
|
const ElementFactory = bpmnInstances().elementFactory
|
||||||
|
const create = bpmnInstances().modeler.get('create')
|
||||||
|
|
||||||
console.log(ElementFactory, create)
|
console.log(ElementFactory, create)
|
||||||
|
|
||||||
|
@ -109,6 +109,7 @@ const bpmnElement = ref()
|
|||||||
const timer = ref()
|
const timer = ref()
|
||||||
provide('prefix', props.prefix)
|
provide('prefix', props.prefix)
|
||||||
provide('width', props.width)
|
provide('width', props.width)
|
||||||
|
const bpmnInstances = () => (window as any)?.bpmnInstances
|
||||||
const initModels = () => {
|
const initModels = () => {
|
||||||
// console.log(props, 'props')
|
// console.log(props, 'props')
|
||||||
// console.log(props.bpmnModeler, 'sakdjjaskdsajdkasdjkadsjk')
|
// console.log(props.bpmnModeler, 'sakdjjaskdsajdkasdjkadsjk')
|
||||||
@ -121,7 +122,8 @@ const initModels = () => {
|
|||||||
}
|
}
|
||||||
if (timer.value) {
|
if (timer.value) {
|
||||||
clearTimeout(timer.value)
|
clearTimeout(timer.value)
|
||||||
window.bpmnInstances = {
|
const w = window as any
|
||||||
|
w.bpmnInstances = {
|
||||||
modeler: props.bpmnModeler,
|
modeler: props.bpmnModeler,
|
||||||
modeling: props.bpmnModeler.get('modeling'),
|
modeling: props.bpmnModeler.get('modeling'),
|
||||||
moddle: props.bpmnModeler.get('moddle'),
|
moddle: props.bpmnModeler.get('moddle'),
|
||||||
@ -134,7 +136,7 @@ const initModels = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(window.bpmnInstances, 'window.bpmnInstances')
|
console.log(bpmnInstances(), 'window.bpmnInstances')
|
||||||
getActiveElement()
|
getActiveElement()
|
||||||
// })
|
// })
|
||||||
}
|
}
|
||||||
@ -161,8 +163,8 @@ const initFormOnChanged = (element) => {
|
|||||||
let activatedElement = element
|
let activatedElement = element
|
||||||
if (!activatedElement) {
|
if (!activatedElement) {
|
||||||
activatedElement =
|
activatedElement =
|
||||||
window.bpmnInstances.elementRegistry.find((el) => el.type === 'bpmn:Process') ??
|
bpmnInstances().elementRegistry.find((el) => el.type === 'bpmn:Process') ??
|
||||||
window.bpmnInstances.elementRegistry.find((el) => el.type === 'bpmn:Collaboration')
|
bpmnInstances().elementRegistry.find((el) => el.type === 'bpmn:Collaboration')
|
||||||
}
|
}
|
||||||
if (!activatedElement) return
|
if (!activatedElement) return
|
||||||
console.log(`
|
console.log(`
|
||||||
@ -173,7 +175,7 @@ const initFormOnChanged = (element) => {
|
|||||||
----------
|
----------
|
||||||
`)
|
`)
|
||||||
console.log('businessObject: ', activatedElement.businessObject)
|
console.log('businessObject: ', activatedElement.businessObject)
|
||||||
window.bpmnInstances.bpmnElement = activatedElement
|
bpmnInstances().bpmnElement = activatedElement
|
||||||
bpmnElement.value = activatedElement
|
bpmnElement.value = activatedElement
|
||||||
elementId.value = activatedElement.id
|
elementId.value = activatedElement.id
|
||||||
elementType.value = activatedElement.type.split(':')[1] || ''
|
elementType.value = activatedElement.type.split(':')[1] || ''
|
||||||
@ -191,7 +193,8 @@ onMounted(() => {
|
|||||||
}, 100)
|
}, 100)
|
||||||
})
|
})
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
window.bpmnInstances = null
|
const w = window as any
|
||||||
|
w.bpmnInstances = null
|
||||||
console.log(props, 'props1')
|
console.log(props, 'props1')
|
||||||
console.log(props.bpmnModeler, 'props.bpmnModeler1')
|
console.log(props.bpmnModeler, 'props.bpmnModeler1')
|
||||||
})
|
})
|
||||||
|
@ -59,11 +59,12 @@ const rules = reactive({
|
|||||||
name: [{ required: true, message: '流程名称不能为空', trigger: 'blur' }]
|
name: [{ required: true, message: '流程名称不能为空', trigger: 'blur' }]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const bpmnInstances = () => (window as any)?.bpmnInstances
|
||||||
const resetBaseInfo = () => {
|
const resetBaseInfo = () => {
|
||||||
console.log(window, 'window')
|
console.log(window, 'window')
|
||||||
console.log(bpmnElement.value, 'bpmnElement')
|
console.log(bpmnElement.value, 'bpmnElement')
|
||||||
|
|
||||||
bpmnElement.value = window?.bpmnInstances?.bpmnElement
|
bpmnElement.value = bpmnInstances()?.bpmnElement
|
||||||
console.log(bpmnElement.value, 'resetBaseInfo11111111111')
|
console.log(bpmnElement.value, 'resetBaseInfo11111111111')
|
||||||
elementBaseInfo.value = bpmnElement.value.businessObject
|
elementBaseInfo.value = bpmnElement.value.businessObject
|
||||||
needProps.value['type'] = bpmnElement.value.businessObject.$type
|
needProps.value['type'] = bpmnElement.value.businessObject.$type
|
||||||
@ -125,13 +126,13 @@ const updateBaseInfo = (key) => {
|
|||||||
console.log(window, 'window')
|
console.log(window, 'window')
|
||||||
console.log(bpmnElement.value, 'bpmnElement')
|
console.log(bpmnElement.value, 'bpmnElement')
|
||||||
console.log(toRaw(bpmnElement.value), 'bpmnElement')
|
console.log(toRaw(bpmnElement.value), 'bpmnElement')
|
||||||
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||||
id: elementBaseInfo.value[key],
|
id: elementBaseInfo.value[key],
|
||||||
di: { id: `${elementBaseInfo.value[key]}_di` }
|
di: { id: `${elementBaseInfo.value[key]}_di` }
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
console.log(attrObj, 'attrObj')
|
console.log(attrObj, 'attrObj')
|
||||||
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), attrObj)
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), attrObj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -72,14 +72,15 @@ const bpmnElement = ref()
|
|||||||
const bpmnElementSource = ref()
|
const bpmnElementSource = ref()
|
||||||
const bpmnElementSourceRef = ref()
|
const bpmnElementSourceRef = ref()
|
||||||
const flowConditionRef = ref()
|
const flowConditionRef = ref()
|
||||||
|
const bpmnInstances = () => (window as any)?.bpmnInstances
|
||||||
const resetFlowCondition = () => {
|
const resetFlowCondition = () => {
|
||||||
bpmnElement.value = window.bpmnInstances.bpmnElement
|
bpmnElement.value = bpmnInstances().bpmnElement
|
||||||
bpmnElementSource.value = bpmnElement.value.source
|
bpmnElementSource.value = bpmnElement.value.source
|
||||||
bpmnElementSourceRef.value = bpmnElement.value.businessObject.sourceRef
|
bpmnElementSourceRef.value = bpmnElement.value.businessObject.sourceRef
|
||||||
if (
|
if (
|
||||||
bpmnElementSourceRef.value &&
|
bpmnElementSourceRef.value &&
|
||||||
bpmnElementSourceRef.value.default &&
|
bpmnElementSourceRef.value.default &&
|
||||||
bpmnElementSourceRef.value.default.id === this.bpmnElement.id
|
bpmnElementSourceRef.value.default.id === bpmnElement.value.id
|
||||||
) {
|
) {
|
||||||
// 默认
|
// 默认
|
||||||
flowConditionForm.value = { type: 'default' }
|
flowConditionForm.value = { type: 'default' }
|
||||||
@ -113,18 +114,18 @@ const resetFlowCondition = () => {
|
|||||||
const updateFlowType = (flowType) => {
|
const updateFlowType = (flowType) => {
|
||||||
// 正常条件类
|
// 正常条件类
|
||||||
if (flowType === 'condition') {
|
if (flowType === 'condition') {
|
||||||
flowConditionRef.value = window.bpmnInstances.moddle.create('bpmn:FormalExpression')
|
flowConditionRef.value = bpmnInstances().moddle.create('bpmn:FormalExpression')
|
||||||
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||||
conditionExpression: flowConditionRef.value
|
conditionExpression: flowConditionRef.value
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 默认路径
|
// 默认路径
|
||||||
if (flowType === 'default') {
|
if (flowType === 'default') {
|
||||||
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||||
conditionExpression: null
|
conditionExpression: null
|
||||||
})
|
})
|
||||||
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElementSource.value), {
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElementSource.value), {
|
||||||
default: bpmnElement.value
|
default: bpmnElement.value
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
@ -134,11 +135,11 @@ const updateFlowType = (flowType) => {
|
|||||||
bpmnElementSourceRef.value.default &&
|
bpmnElementSourceRef.value.default &&
|
||||||
bpmnElementSourceRef.value.default.id === bpmnElement.value.id
|
bpmnElementSourceRef.value.default.id === bpmnElement.value.id
|
||||||
) {
|
) {
|
||||||
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElementSource.value), {
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElementSource.value), {
|
||||||
default: null
|
default: null
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||||
conditionExpression: null
|
conditionExpression: null
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -146,22 +147,22 @@ const updateFlowCondition = () => {
|
|||||||
let { conditionType, scriptType, body, resource, language } = flowConditionForm.value
|
let { conditionType, scriptType, body, resource, language } = flowConditionForm.value
|
||||||
let condition
|
let condition
|
||||||
if (conditionType === 'expression') {
|
if (conditionType === 'expression') {
|
||||||
condition = window.bpmnInstances.moddle.create('bpmn:FormalExpression', { body })
|
condition = bpmnInstances().moddle.create('bpmn:FormalExpression', { body })
|
||||||
} else {
|
} else {
|
||||||
if (scriptType === 'inlineScript') {
|
if (scriptType === 'inlineScript') {
|
||||||
condition = window.bpmnInstances.moddle.create('bpmn:FormalExpression', { body, language })
|
condition = bpmnInstances().moddle.create('bpmn:FormalExpression', { body, language })
|
||||||
// this.$set(this.flowConditionForm, "resource", "");
|
// this.$set(this.flowConditionForm, "resource", "");
|
||||||
flowConditionForm.value['resource'] = ''
|
flowConditionForm.value['resource'] = ''
|
||||||
} else {
|
} else {
|
||||||
// this.$set(this.flowConditionForm, "body", "");
|
// this.$set(this.flowConditionForm, "body", "");
|
||||||
flowConditionForm.value['body'] = ''
|
flowConditionForm.value['body'] = ''
|
||||||
condition = window.bpmnInstances.moddle.create('bpmn:FormalExpression', {
|
condition = bpmnInstances().moddle.create('bpmn:FormalExpression', {
|
||||||
resource,
|
resource,
|
||||||
language
|
language
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||||
conditionExpression: condition
|
conditionExpression: condition
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -239,17 +239,18 @@ const elExtensionElements = ref()
|
|||||||
const formData = ref()
|
const formData = ref()
|
||||||
const otherExtensions = ref()
|
const otherExtensions = ref()
|
||||||
|
|
||||||
|
const bpmnInstances = () => (window as any)?.bpmnInstances
|
||||||
const resetFormList = () => {
|
const resetFormList = () => {
|
||||||
bpmnELement.value = window.bpmnInstances.bpmnElement
|
bpmnELement.value = bpmnInstances().bpmnElement
|
||||||
formKey.value = bpmnELement.value.businessObject.formKey
|
formKey.value = bpmnELement.value.businessObject.formKey
|
||||||
// 获取元素扩展属性 或者 创建扩展属性
|
// 获取元素扩展属性 或者 创建扩展属性
|
||||||
elExtensionElements.value =
|
elExtensionElements.value =
|
||||||
bpmnELement.value.businessObject.get('extensionElements') ||
|
bpmnELement.value.businessObject.get('extensionElements') ||
|
||||||
window.bpmnInstances.moddle.create('bpmn:ExtensionElements', { values: [] })
|
bpmnInstances().moddle.create('bpmn:ExtensionElements', { values: [] })
|
||||||
// 获取元素表单配置 或者 创建新的表单配置
|
// 获取元素表单配置 或者 创建新的表单配置
|
||||||
formData.value =
|
formData.value =
|
||||||
elExtensionElements.value.values.filter((ex) => ex.$type === `${prefix}:FormData`)?.[0] ||
|
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, 绑定在 formData 中
|
||||||
businessKey.value = formData.value.businessKey
|
businessKey.value = formData.value.businessKey
|
||||||
@ -266,12 +267,12 @@ const resetFormList = () => {
|
|||||||
updateElementExtensions()
|
updateElementExtensions()
|
||||||
}
|
}
|
||||||
const updateElementFormKey = () => {
|
const updateElementFormKey = () => {
|
||||||
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnELement.value), {
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnELement.value), {
|
||||||
formKey: formKey.value
|
formKey: formKey.value
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const updateElementBusinessKey = () => {
|
const updateElementBusinessKey = () => {
|
||||||
window.bpmnInstances.modeling.updateModdleProperties(toRaw(bpmnELement.value), formData.value, {
|
bpmnInstances().modeling.updateModdleProperties(toRaw(bpmnELement.value), formData.value, {
|
||||||
businessKey: businessKey.value
|
businessKey: businessKey.value
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -353,37 +354,37 @@ const saveFieldOption = () => {
|
|||||||
// 保存字段配置
|
// 保存字段配置
|
||||||
const saveField = () => {
|
const saveField = () => {
|
||||||
const { id, type, label, defaultValue, datePattern } = formFieldForm.value
|
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)
|
defaultValue && (Field.defaultValue = defaultValue)
|
||||||
datePattern && (Field.datePattern = datePattern)
|
datePattern && (Field.datePattern = datePattern)
|
||||||
// 构建属性
|
// 构建属性
|
||||||
if (fieldPropertiesList.value && fieldPropertiesList.value.length) {
|
if (fieldPropertiesList.value && fieldPropertiesList.value.length) {
|
||||||
const fieldPropertyList = fieldPropertiesList.value.map((fp) => {
|
const fieldPropertyList = fieldPropertiesList.value.map((fp) => {
|
||||||
return window.bpmnInstances.moddle.create(`${prefix}:Property`, {
|
return bpmnInstances().moddle.create(`${prefix}:Property`, {
|
||||||
id: fp.id,
|
id: fp.id,
|
||||||
value: fp.value
|
value: fp.value
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
Field.properties = window.bpmnInstances.moddle.create(`${this.prefix}:Properties`, {
|
Field.properties = bpmnInstances().moddle.create(`${prefix}:Properties`, {
|
||||||
values: fieldPropertyList
|
values: fieldPropertyList
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 构建校验规则
|
// 构建校验规则
|
||||||
if (fieldConstraintsList.value && fieldConstraintsList.value.length) {
|
if (fieldConstraintsList.value && fieldConstraintsList.value.length) {
|
||||||
const fieldConstraintList = fieldConstraintsList.value.map((fc) => {
|
const fieldConstraintList = fieldConstraintsList.value.map((fc) => {
|
||||||
return window.bpmnInstances.moddle.create(`${prefix}:Constraint`, {
|
return bpmnInstances().moddle.create(`${prefix}:Constraint`, {
|
||||||
name: fc.name,
|
name: fc.name,
|
||||||
config: fc.config
|
config: fc.config
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
Field.validation = window.bpmnInstances.moddle.create(`${prefix}:Validation`, {
|
Field.validation = bpmnInstances().moddle.create(`${prefix}:Validation`, {
|
||||||
constraints: fieldConstraintList
|
constraints: fieldConstraintList
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 构建枚举值
|
// 构建枚举值
|
||||||
if (fieldEnumList.value && fieldEnumList.value.length) {
|
if (fieldEnumList.value && fieldEnumList.value.length) {
|
||||||
Field.values = fieldEnumList.value.map((fe) => {
|
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 updateElementExtensions = () => {
|
||||||
// 更新回扩展元素
|
// 更新回扩展元素
|
||||||
const newElExtensionElements = window.bpmnInstances.moddle.create(`bpmn:ExtensionElements`, {
|
const newElExtensionElements = bpmnInstances().moddle.create(`bpmn:ExtensionElements`, {
|
||||||
values: otherExtensions.value.concat(formData.value)
|
values: otherExtensions.value.concat(formData.value)
|
||||||
})
|
})
|
||||||
// 更新到元素上
|
// 更新到元素上
|
||||||
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnELement.value), {
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnELement.value), {
|
||||||
extensionElements: newElExtensionElements
|
extensionElements: newElExtensionElements
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -266,9 +266,10 @@ const otherExtensionList = ref()
|
|||||||
const bpmnElementListeners = ref()
|
const bpmnElementListeners = ref()
|
||||||
const listenerFormRef = ref()
|
const listenerFormRef = ref()
|
||||||
const listenerFieldFormRef = ref()
|
const listenerFieldFormRef = ref()
|
||||||
|
const bpmnInstances = () => (window as any)?.bpmnInstances
|
||||||
|
|
||||||
const resetListenersList = () => {
|
const resetListenersList = () => {
|
||||||
bpmnElement.value = window.bpmnInstances.bpmnElement
|
bpmnElement.value = bpmnInstances().bpmnElement
|
||||||
otherExtensionList.value = []
|
otherExtensionList.value = []
|
||||||
bpmnElementListeners.value =
|
bpmnElementListeners.value =
|
||||||
bpmnElement.value.businessObject?.extensionElements?.values?.filter(
|
bpmnElement.value.businessObject?.extensionElements?.values?.filter(
|
||||||
|
@ -313,13 +313,14 @@ const bpmnElementListeners = ref()
|
|||||||
const otherExtensionList = ref()
|
const otherExtensionList = ref()
|
||||||
const listenerFormRef = ref()
|
const listenerFormRef = ref()
|
||||||
const listenerFieldFormRef = ref()
|
const listenerFieldFormRef = ref()
|
||||||
|
const bpmnInstances = () => (window as any)?.bpmnInstances
|
||||||
|
|
||||||
const resetListenersList = () => {
|
const resetListenersList = () => {
|
||||||
console.log(
|
console.log(
|
||||||
window.bpmnInstances.bpmnElement,
|
bpmnInstances().bpmnElement,
|
||||||
'window.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.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 = []
|
otherExtensionList.value = []
|
||||||
bpmnElementListeners.value =
|
bpmnElementListeners.value =
|
||||||
bpmnElement.value.businessObject?.extensionElements?.values.filter(
|
bpmnElement.value.businessObject?.extensionElements?.values.filter(
|
||||||
|
@ -87,6 +87,7 @@ const defaultLoopInstanceForm = ref({
|
|||||||
const loopInstanceForm = ref<any>({})
|
const loopInstanceForm = ref<any>({})
|
||||||
const bpmnElement = ref(null)
|
const bpmnElement = ref(null)
|
||||||
const multiLoopInstance = ref(null)
|
const multiLoopInstance = ref(null)
|
||||||
|
const bpmnInstances = () => (window as any)?.bpmnInstances
|
||||||
|
|
||||||
const getElementLoop = (businessObject) => {
|
const getElementLoop = (businessObject) => {
|
||||||
if (!businessObject.loopCharacteristics) {
|
if (!businessObject.loopCharacteristics) {
|
||||||
@ -112,7 +113,7 @@ const getElementLoop = (businessObject) => {
|
|||||||
loopCardinality: businessObject.loopCharacteristics?.loopCardinality?.body ?? ''
|
loopCardinality: businessObject.loopCharacteristics?.loopCardinality?.body ?? ''
|
||||||
}
|
}
|
||||||
// 保留当前元素 businessObject 上的 loopCharacteristics 实例
|
// 保留当前元素 businessObject 上的 loopCharacteristics 实例
|
||||||
multiLoopInstance.value = window.bpmnInstances.bpmnElement.businessObject.loopCharacteristics
|
multiLoopInstance.value = bpmnInstances().bpmnElement.businessObject.loopCharacteristics
|
||||||
// 更新表单
|
// 更新表单
|
||||||
if (
|
if (
|
||||||
businessObject.loopCharacteristics.extensionElements &&
|
businessObject.loopCharacteristics.extensionElements &&
|
||||||
@ -127,17 +128,17 @@ const changeLoopCharacteristicsType = (type) => {
|
|||||||
// this.loopInstanceForm = { ...this.defaultLoopInstanceForm }; // 切换类型取消原表单配置
|
// this.loopInstanceForm = { ...this.defaultLoopInstanceForm }; // 切换类型取消原表单配置
|
||||||
// 取消多实例配置
|
// 取消多实例配置
|
||||||
if (type === 'Null') {
|
if (type === 'Null') {
|
||||||
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||||
loopCharacteristics: null
|
loopCharacteristics: null
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 配置循环
|
// 配置循环
|
||||||
if (type === 'StandardLoop') {
|
if (type === 'StandardLoop') {
|
||||||
const loopCharacteristicsObject = window.bpmnInstances.moddle.create(
|
const loopCharacteristicsObject = bpmnInstances().moddle.create(
|
||||||
'bpmn:StandardLoopCharacteristics'
|
'bpmn:StandardLoopCharacteristics'
|
||||||
)
|
)
|
||||||
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||||
loopCharacteristics: loopCharacteristicsObject
|
loopCharacteristics: loopCharacteristicsObject
|
||||||
})
|
})
|
||||||
multiLoopInstance.value = null
|
multiLoopInstance.value = null
|
||||||
@ -145,17 +146,17 @@ const changeLoopCharacteristicsType = (type) => {
|
|||||||
}
|
}
|
||||||
// 时序
|
// 时序
|
||||||
if (type === 'SequentialMultiInstance') {
|
if (type === 'SequentialMultiInstance') {
|
||||||
multiLoopInstance.value = window.bpmnInstances.moddle.create(
|
multiLoopInstance.value = bpmnInstances().moddle.create(
|
||||||
'bpmn:MultiInstanceLoopCharacteristics',
|
'bpmn:MultiInstanceLoopCharacteristics',
|
||||||
{ isSequential: true }
|
{ isSequential: true }
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
multiLoopInstance.value = window.bpmnInstances.moddle.create(
|
multiLoopInstance.value = bpmnInstances().moddle.create(
|
||||||
'bpmn:MultiInstanceLoopCharacteristics',
|
'bpmn:MultiInstanceLoopCharacteristics',
|
||||||
{ collection: '${coll_userList}' }
|
{ collection: '${coll_userList}' }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||||
loopCharacteristics: toRaw(multiLoopInstance.value)
|
loopCharacteristics: toRaw(multiLoopInstance.value)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -163,11 +164,11 @@ const changeLoopCharacteristicsType = (type) => {
|
|||||||
const updateLoopCardinality = (cardinality) => {
|
const updateLoopCardinality = (cardinality) => {
|
||||||
let loopCardinality = null
|
let loopCardinality = null
|
||||||
if (cardinality && cardinality.length) {
|
if (cardinality && cardinality.length) {
|
||||||
loopCardinality = window.bpmnInstances.moddle.create('bpmn:FormalExpression', {
|
loopCardinality = bpmnInstances().moddle.create('bpmn:FormalExpression', {
|
||||||
body: cardinality
|
body: cardinality
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
window.bpmnInstances.modeling.updateModdleProperties(
|
bpmnInstances().modeling.updateModdleProperties(
|
||||||
toRaw(bpmnElement.value),
|
toRaw(bpmnElement.value),
|
||||||
multiLoopInstance.value,
|
multiLoopInstance.value,
|
||||||
{
|
{
|
||||||
@ -179,11 +180,11 @@ const updateLoopCardinality = (cardinality) => {
|
|||||||
const updateLoopCondition = (condition) => {
|
const updateLoopCondition = (condition) => {
|
||||||
let completionCondition = null
|
let completionCondition = null
|
||||||
if (condition && condition.length) {
|
if (condition && condition.length) {
|
||||||
completionCondition = window.bpmnInstances.moddle.create('bpmn:FormalExpression', {
|
completionCondition = bpmnInstances().moddle.create('bpmn:FormalExpression', {
|
||||||
body: condition
|
body: condition
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
window.bpmnInstances.modeling.updateModdleProperties(
|
bpmnInstances().modeling.updateModdleProperties(
|
||||||
toRaw(bpmnElement.value),
|
toRaw(bpmnElement.value),
|
||||||
multiLoopInstance.value,
|
multiLoopInstance.value,
|
||||||
{
|
{
|
||||||
@ -193,14 +194,14 @@ const updateLoopCondition = (condition) => {
|
|||||||
}
|
}
|
||||||
// 重试周期
|
// 重试周期
|
||||||
const updateLoopTimeCycle = (timeCycle) => {
|
const updateLoopTimeCycle = (timeCycle) => {
|
||||||
const extensionElements = window.bpmnInstances.moddle.create('bpmn:ExtensionElements', {
|
const extensionElements = bpmnInstances().moddle.create('bpmn:ExtensionElements', {
|
||||||
values: [
|
values: [
|
||||||
window.bpmnInstances.moddle.create(`${prefix}:FailedJobRetryTimeCycle`, {
|
bpmnInstances().moddle.create(`${prefix}:FailedJobRetryTimeCycle`, {
|
||||||
body: timeCycle
|
body: timeCycle
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
window.bpmnInstances.modeling.updateModdleProperties(
|
bpmnInstances().modeling.updateModdleProperties(
|
||||||
toRaw(bpmnElement.value),
|
toRaw(bpmnElement.value),
|
||||||
multiLoopInstance.value,
|
multiLoopInstance.value,
|
||||||
{
|
{
|
||||||
@ -210,7 +211,7 @@ const updateLoopTimeCycle = (timeCycle) => {
|
|||||||
}
|
}
|
||||||
// 直接更新的基础信息
|
// 直接更新的基础信息
|
||||||
const updateLoopBase = () => {
|
const updateLoopBase = () => {
|
||||||
window.bpmnInstances.modeling.updateModdleProperties(
|
bpmnInstances().modeling.updateModdleProperties(
|
||||||
toRaw(bpmnElement.value),
|
toRaw(bpmnElement.value),
|
||||||
multiLoopInstance.value,
|
multiLoopInstance.value,
|
||||||
{
|
{
|
||||||
@ -230,7 +231,7 @@ const updateLoopAsync = (key) => {
|
|||||||
} else {
|
} else {
|
||||||
asyncAttr[key] = loopInstanceForm.value[key]
|
asyncAttr[key] = loopInstanceForm.value[key]
|
||||||
}
|
}
|
||||||
window.bpmnInstances.modeling.updateModdleProperties(
|
bpmnInstances().modeling.updateModdleProperties(
|
||||||
toRaw(bpmnElement.value),
|
toRaw(bpmnElement.value),
|
||||||
multiLoopInstance.value,
|
multiLoopInstance.value,
|
||||||
asyncAttr
|
asyncAttr
|
||||||
@ -245,7 +246,7 @@ onBeforeUnmount(() => {
|
|||||||
watch(
|
watch(
|
||||||
() => props.businessObject,
|
() => props.businessObject,
|
||||||
(val) => {
|
(val) => {
|
||||||
bpmnElement.value = window.bpmnInstances.bpmnElement
|
bpmnElement.value = bpmnInstances().bpmnElement
|
||||||
getElementLoop(val)
|
getElementLoop(val)
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
|
@ -22,13 +22,14 @@ const props = defineProps({
|
|||||||
})
|
})
|
||||||
const documentation = ref('')
|
const documentation = ref('')
|
||||||
const bpmnElement = ref()
|
const bpmnElement = ref()
|
||||||
|
const bpmnInstances = () => (window as any).bpmnInstances
|
||||||
const updateDocumentation = () => {
|
const updateDocumentation = () => {
|
||||||
;(bpmnElement.value && bpmnElement.value.id === props.id) ||
|
;(bpmnElement.value && bpmnElement.value.id === props.id) ||
|
||||||
(bpmnElement.value = (window as any).bpmnInstances.elementRegistry.get(props.id))
|
(bpmnElement.value = bpmnInstances().elementRegistry.get(props.id))
|
||||||
const documentations = window.bpmnInstances.bpmnFactory.create('bpmn:Documentation', {
|
const documentations = bpmnInstances().bpmnFactory.create('bpmn:Documentation', {
|
||||||
text: documentation.value
|
text: documentation.value
|
||||||
})
|
})
|
||||||
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||||
documentation: [documentations]
|
documentation: [documentations]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -41,7 +42,7 @@ watch(
|
|||||||
(id) => {
|
(id) => {
|
||||||
if (id && id.length) {
|
if (id && id.length) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
const documentations = window.bpmnInstances.bpmnElement.businessObject?.documentation
|
const documentations = bpmnInstances().bpmnElement.businessObject?.documentation
|
||||||
documentation.value = documentations && documentations.length ? documentations[0].text : ''
|
documentation.value = documentations && documentations.length ? documentations[0].text : ''
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
@ -70,10 +70,11 @@ const otherExtensionList = ref()
|
|||||||
const bpmnElementProperties = ref()
|
const bpmnElementProperties = ref()
|
||||||
const bpmnElementPropertyList = ref()
|
const bpmnElementPropertyList = ref()
|
||||||
const attributeFormRef = ref()
|
const attributeFormRef = ref()
|
||||||
|
const bpmnInstances = () => (window as any)?.bpmnInstances
|
||||||
|
|
||||||
const resetAttributesList = () => {
|
const resetAttributesList = () => {
|
||||||
console.log(window, 'windowwindowwindowwindowwindowwindowwindow')
|
console.log(window, 'windowwindowwindowwindowwindowwindowwindow')
|
||||||
bpmnElement.value = window.bpmnInstances.bpmnElement
|
bpmnElement.value = bpmnInstances().bpmnElement
|
||||||
otherExtensionList.value = [] // 其他扩展配置
|
otherExtensionList.value = [] // 其他扩展配置
|
||||||
bpmnElementProperties.value =
|
bpmnElementProperties.value =
|
||||||
// bpmnElement.value.businessObject?.extensionElements?.filter((ex) => {
|
// bpmnElement.value.businessObject?.extensionElements?.filter((ex) => {
|
||||||
@ -110,7 +111,7 @@ const removeAttributes = (attr, index) => {
|
|||||||
elementPropertyList.value.splice(index, 1)
|
elementPropertyList.value.splice(index, 1)
|
||||||
bpmnElementPropertyList.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
|
values: bpmnElementPropertyList.value
|
||||||
})
|
})
|
||||||
updateElementExtensions(propertiesObject)
|
updateElementExtensions(propertiesObject)
|
||||||
@ -122,7 +123,7 @@ const saveAttribute = () => {
|
|||||||
console.log(propertyForm.value, 'propertyForm.value')
|
console.log(propertyForm.value, 'propertyForm.value')
|
||||||
const { name, value } = propertyForm.value
|
const { name, value } = propertyForm.value
|
||||||
if (editingPropertyIndex.value !== -1) {
|
if (editingPropertyIndex.value !== -1) {
|
||||||
window.bpmnInstances.modeling.updateModdleProperties(
|
bpmnInstances().modeling.updateModdleProperties(
|
||||||
toRaw(bpmnElement.value),
|
toRaw(bpmnElement.value),
|
||||||
toRaw(bpmnElementPropertyList.value)[toRaw(editingPropertyIndex.value)],
|
toRaw(bpmnElementPropertyList.value)[toRaw(editingPropertyIndex.value)],
|
||||||
{
|
{
|
||||||
@ -132,12 +133,12 @@ const saveAttribute = () => {
|
|||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
// 新建属性字段
|
// 新建属性字段
|
||||||
const newPropertyObject = window.bpmnInstances.moddle.create(`${prefix}:Property`, {
|
const newPropertyObject = bpmnInstances().moddle.create(`${prefix}:Property`, {
|
||||||
name,
|
name,
|
||||||
value
|
value
|
||||||
})
|
})
|
||||||
// 新建一个属性字段的保存列表
|
// 新建一个属性字段的保存列表
|
||||||
const propertiesObject = window.bpmnInstances.moddle.create(`${prefix}:Properties`, {
|
const propertiesObject = bpmnInstances().moddle.create(`${prefix}:Properties`, {
|
||||||
values: bpmnElementPropertyList.value.concat([newPropertyObject])
|
values: bpmnElementPropertyList.value.concat([newPropertyObject])
|
||||||
})
|
})
|
||||||
updateElementExtensions(propertiesObject)
|
updateElementExtensions(propertiesObject)
|
||||||
@ -146,10 +147,10 @@ const saveAttribute = () => {
|
|||||||
resetAttributesList()
|
resetAttributesList()
|
||||||
}
|
}
|
||||||
const updateElementExtensions = (properties) => {
|
const updateElementExtensions = (properties) => {
|
||||||
const extensions = window.bpmnInstances.moddle.create('bpmn:ExtensionElements', {
|
const extensions = bpmnInstances().moddle.create('bpmn:ExtensionElements', {
|
||||||
values: otherExtensionList.value.concat([properties])
|
values: otherExtensionList.value.concat([properties])
|
||||||
})
|
})
|
||||||
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||||
extensionElements: extensions
|
extensionElements: extensions
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -62,10 +62,11 @@ const modelConfig = computed(() => {
|
|||||||
return { title: '创建信号', idLabel: '信号ID', nameLabel: '信号名称' }
|
return { title: '创建信号', idLabel: '信号ID', nameLabel: '信号名称' }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
const bpmnInstances = () => (window as any)?.bpmnInstances
|
||||||
|
|
||||||
const initDataList = () => {
|
const initDataList = () => {
|
||||||
console.log(window, 'window')
|
console.log(window, 'window')
|
||||||
rootElements.value = window.bpmnInstances.modeler.getDefinitions().rootElements
|
rootElements.value = bpmnInstances().modeler.getDefinitions().rootElements
|
||||||
messageIdMap.value = {}
|
messageIdMap.value = {}
|
||||||
signalIdMap.value = {}
|
signalIdMap.value = {}
|
||||||
messageList.value = []
|
messageList.value = []
|
||||||
@ -91,13 +92,13 @@ const addNewObject = () => {
|
|||||||
if (messageIdMap.value[modelObjectForm.value.id]) {
|
if (messageIdMap.value[modelObjectForm.value.id]) {
|
||||||
message.error('该消息已存在,请修改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)
|
rootElements.value.push(messageRef)
|
||||||
} else {
|
} else {
|
||||||
if (signalIdMap.value[modelObjectForm.value.id]) {
|
if (signalIdMap.value[modelObjectForm.value.id]) {
|
||||||
message.error('该信号已存在,请修改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)
|
rootElements.value.push(signalRef)
|
||||||
}
|
}
|
||||||
modelVisible.value = false
|
modelVisible.value = false
|
||||||
|
@ -45,11 +45,12 @@ const installedComponent = ref({
|
|||||||
})
|
})
|
||||||
const bpmnElement = ref()
|
const bpmnElement = ref()
|
||||||
|
|
||||||
|
const bpmnInstances = () => (window as any).bpmnInstances
|
||||||
const changeTaskAsync = () => {
|
const changeTaskAsync = () => {
|
||||||
if (!taskConfigForm.value.asyncBefore && !taskConfigForm.value.asyncAfter) {
|
if (!taskConfigForm.value.asyncBefore && !taskConfigForm.value.asyncAfter) {
|
||||||
taskConfigForm.value.exclusive = false
|
taskConfigForm.value.exclusive = false
|
||||||
}
|
}
|
||||||
window.bpmnInstances.modeling.updateProperties(window.bpmnInstances.bpmnElement, {
|
bpmnInstances().modeling.updateProperties(bpmnInstances().bpmnElement, {
|
||||||
...taskConfigForm.value
|
...taskConfigForm.value
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -57,7 +58,7 @@ const changeTaskAsync = () => {
|
|||||||
watch(
|
watch(
|
||||||
() => props.id,
|
() => props.id,
|
||||||
() => {
|
() => {
|
||||||
bpmnElement.value = window.bpmnInstances.bpmnElement
|
bpmnElement.value = bpmnInstances().bpmnElement
|
||||||
taskConfigForm.value.asyncBefore = bpmnElement.value?.businessObject?.asyncBefore
|
taskConfigForm.value.asyncBefore = bpmnElement.value?.businessObject?.asyncBefore
|
||||||
taskConfigForm.value.asyncAfter = bpmnElement.value?.businessObject?.asyncAfter
|
taskConfigForm.value.asyncAfter = bpmnElement.value?.businessObject?.asyncAfter
|
||||||
taskConfigForm.value.exclusive = bpmnElement.value?.businessObject?.exclusive
|
taskConfigForm.value.exclusive = bpmnElement.value?.businessObject?.exclusive
|
||||||
|
@ -64,8 +64,9 @@ const bpmnElement = ref<any>()
|
|||||||
const bpmnMessageRefsMap = ref<any>()
|
const bpmnMessageRefsMap = ref<any>()
|
||||||
const bpmnRootElements = ref<any>()
|
const bpmnRootElements = ref<any>()
|
||||||
|
|
||||||
|
const bpmnInstances = () => (window as any).bpmnInstances
|
||||||
const getBindMessage = () => {
|
const getBindMessage = () => {
|
||||||
bpmnElement.value = window.bpmnInstances.bpmnElement
|
bpmnElement.value = bpmnInstances().bpmnElement
|
||||||
bindMessageId.value = bpmnElement.value.businessObject?.messageRef?.id || '-1'
|
bindMessageId.value = bpmnElement.value.businessObject?.messageRef?.id || '-1'
|
||||||
}
|
}
|
||||||
const openMessageModel = () => {
|
const openMessageModel = () => {
|
||||||
@ -77,7 +78,7 @@ const createNewMessage = () => {
|
|||||||
message.error('该消息已存在,请修改id后重新保存')
|
message.error('该消息已存在,请修改id后重新保存')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const newMessage = window.bpmnInstances.moddle.create('bpmn:Message', newMessageForm.value)
|
const newMessage = bpmnInstances().moddle.create('bpmn:Message', newMessageForm.value)
|
||||||
bpmnRootElements.value.push(newMessage)
|
bpmnRootElements.value.push(newMessage)
|
||||||
messageMap.value[newMessageForm.value.id] = newMessageForm.value.name
|
messageMap.value[newMessageForm.value.id] = newMessageForm.value.name
|
||||||
bpmnMessageRefsMap.value[newMessageForm.value.id] = newMessage
|
bpmnMessageRefsMap.value[newMessageForm.value.id] = newMessage
|
||||||
@ -85,11 +86,11 @@ const createNewMessage = () => {
|
|||||||
}
|
}
|
||||||
const updateTaskMessage = (messageId) => {
|
const updateTaskMessage = (messageId) => {
|
||||||
if (messageId === '-1') {
|
if (messageId === '-1') {
|
||||||
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||||
messageRef: null
|
messageRef: null
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), {
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||||
messageRef: bpmnMessageRefsMap.value[messageId]
|
messageRef: bpmnMessageRefsMap.value[messageId]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -97,7 +98,7 @@ const updateTaskMessage = (messageId) => {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
bpmnMessageRefsMap.value = Object.create(null)
|
bpmnMessageRefsMap.value = Object.create(null)
|
||||||
bpmnRootElements.value = window.bpmnInstances.modeler.getDefinitions().rootElements
|
bpmnRootElements.value = bpmnInstances().modeler.getDefinitions().rootElements
|
||||||
bpmnRootElements.value
|
bpmnRootElements.value
|
||||||
.filter((el) => el.$type === 'bpmn:Message')
|
.filter((el) => el.$type === 'bpmn:Message')
|
||||||
.forEach((m) => {
|
.forEach((m) => {
|
||||||
@ -113,7 +114,7 @@ onBeforeUnmount(() => {
|
|||||||
watch(
|
watch(
|
||||||
() => props.id,
|
() => props.id,
|
||||||
() => {
|
() => {
|
||||||
// bpmnElement.value = window.bpmnInstances.bpmnElement
|
// bpmnElement.value = bpmnInstances().bpmnElement
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
getBindMessage()
|
getBindMessage()
|
||||||
})
|
})
|
||||||
|
@ -58,6 +58,8 @@ const defaultTaskForm = ref({
|
|||||||
const scriptTaskForm = ref<any>({})
|
const scriptTaskForm = ref<any>({})
|
||||||
const bpmnElement = ref()
|
const bpmnElement = ref()
|
||||||
|
|
||||||
|
const bpmnInstances = () => (window as any)?.bpmnInstances
|
||||||
|
|
||||||
const resetTaskForm = () => {
|
const resetTaskForm = () => {
|
||||||
for (let key in defaultTaskForm.value) {
|
for (let key in defaultTaskForm.value) {
|
||||||
let value = bpmnElement.value?.businessObject[key] || defaultTaskForm.value[key]
|
let value = bpmnElement.value?.businessObject[key] || defaultTaskForm.value[key]
|
||||||
@ -76,7 +78,7 @@ const updateElementTask = () => {
|
|||||||
taskAttr.resource = scriptTaskForm.value.resource || null
|
taskAttr.resource = scriptTaskForm.value.resource || null
|
||||||
taskAttr.script = null
|
taskAttr.script = null
|
||||||
}
|
}
|
||||||
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), taskAttr)
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), taskAttr)
|
||||||
}
|
}
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
@ -86,7 +88,7 @@ onBeforeUnmount(() => {
|
|||||||
watch(
|
watch(
|
||||||
() => props.id,
|
() => props.id,
|
||||||
() => {
|
() => {
|
||||||
bpmnElement.value = window.bpmnInstances.bpmnElement
|
bpmnElement.value = bpmnInstances().bpmnElement
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
resetTaskForm()
|
resetTaskForm()
|
||||||
})
|
})
|
||||||
|
@ -53,6 +53,8 @@ const defaultTaskForm = ref({
|
|||||||
const userTaskForm = ref<any>({})
|
const userTaskForm = ref<any>({})
|
||||||
// const mockData=ref([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
|
// const mockData=ref([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
|
||||||
const bpmnElement = ref()
|
const bpmnElement = ref()
|
||||||
|
const bpmnInstances = () => (window as any)?.bpmnInstances
|
||||||
|
|
||||||
const resetTaskForm = () => {
|
const resetTaskForm = () => {
|
||||||
for (let key in defaultTaskForm.value) {
|
for (let key in defaultTaskForm.value) {
|
||||||
let value
|
let value
|
||||||
@ -76,13 +78,13 @@ const updateElementTask = (key) => {
|
|||||||
} else {
|
} else {
|
||||||
taskAttr[key] = userTaskForm.value[key] || null
|
taskAttr[key] = userTaskForm.value[key] || null
|
||||||
}
|
}
|
||||||
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), taskAttr)
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), taskAttr)
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.id,
|
() => props.id,
|
||||||
() => {
|
() => {
|
||||||
bpmnElement.value = window.bpmnInstances.bpmnElement
|
bpmnElement.value = bpmnInstances().bpmnElement
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
resetTaskForm()
|
resetTaskForm()
|
||||||
})
|
})
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { toRaw } from 'vue'
|
import { toRaw } from 'vue'
|
||||||
|
const bpmnInstances = () => (window as any)?.bpmnInstances
|
||||||
// 创建监听器实例
|
// 创建监听器实例
|
||||||
export function createListenerObject(options, isTask, prefix) {
|
export function createListenerObject(options, isTask, prefix) {
|
||||||
const listenerObj = Object.create(null)
|
const listenerObj = Object.create(null)
|
||||||
@ -25,16 +26,16 @@ export function createListenerObject(options, isTask, prefix) {
|
|||||||
}
|
}
|
||||||
// 任务监听器的 定时器 设置
|
// 任务监听器的 定时器 设置
|
||||||
if (isTask && options.event === 'timeout' && !!options.eventDefinitionType) {
|
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
|
body: options.eventTimeDefinitions
|
||||||
})
|
})
|
||||||
const TimerEventDefinition = window.bpmnInstances.moddle.create('bpmn:TimerEventDefinition', {
|
const TimerEventDefinition = bpmnInstances().moddle.create('bpmn:TimerEventDefinition', {
|
||||||
id: `TimerEventDefinition_${uuid(8)}`,
|
id: `TimerEventDefinition_${uuid(8)}`,
|
||||||
[`time${options.eventDefinitionType.replace(/^\S/, (s) => s.toUpperCase())}`]: timeDefinition
|
[`time${options.eventDefinitionType.replace(/^\S/, (s) => s.toUpperCase())}`]: timeDefinition
|
||||||
})
|
})
|
||||||
listenerObj.eventDefinitions = [TimerEventDefinition]
|
listenerObj.eventDefinitions = [TimerEventDefinition]
|
||||||
}
|
}
|
||||||
return window.bpmnInstances.moddle.create(
|
return bpmnInstances().moddle.create(
|
||||||
`${prefix}:${isTask ? 'TaskListener' : 'ExecutionListener'}`,
|
`${prefix}:${isTask ? 'TaskListener' : 'ExecutionListener'}`,
|
||||||
listenerObj
|
listenerObj
|
||||||
)
|
)
|
||||||
@ -44,7 +45,7 @@ export function createListenerObject(options, isTask, prefix) {
|
|||||||
export function createFieldObject(option, prefix) {
|
export function createFieldObject(option, prefix) {
|
||||||
const { name, fieldType, string, expression } = option
|
const { name, fieldType, string, expression } = option
|
||||||
const fieldConfig = fieldType === 'string' ? { name, string } : { name, expression }
|
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 { scriptType, scriptFormat, value, resource } = options
|
||||||
const scriptConfig =
|
const scriptConfig =
|
||||||
scriptType === 'inlineScript' ? { scriptFormat, value } : { scriptFormat, resource }
|
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) {
|
export function updateElementExtensions(element, extensionList) {
|
||||||
const extensions = window.bpmnInstances.moddle.create('bpmn:ExtensionElements', {
|
const extensions = bpmnInstances().moddle.create('bpmn:ExtensionElements', {
|
||||||
values: extensionList
|
values: extensionList
|
||||||
})
|
})
|
||||||
window.bpmnInstances.modeling.updateProperties(toRaw(element), {
|
bpmnInstances().modeling.updateProperties(toRaw(element), {
|
||||||
extensionElements: extensions
|
extensionElements: extensions
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建一个id
|
// 创建一个id
|
||||||
export function uuid(length = 8, chars) {
|
export function uuid(length = 8, chars?) {
|
||||||
let result = ''
|
let result = ''
|
||||||
const charsString = chars || '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
const charsString = chars || '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
for (let i = length; i > 0; --i) {
|
for (let i = length; i > 0; --i) {
|
||||||
|
@ -41,6 +41,7 @@ export const useI18n = (
|
|||||||
const tFn: I18nGlobalTranslation = (key: string, ...arg: any[]) => {
|
const tFn: I18nGlobalTranslation = (key: string, ...arg: any[]) => {
|
||||||
if (!key) return ''
|
if (!key) return ''
|
||||||
if (!key.includes('.') && !namespace) return key
|
if (!key.includes('.') && !namespace) return key
|
||||||
|
//@ts-ignore
|
||||||
return t(getKey(namespace, key), ...(arg as I18nTranslationRestParameters))
|
return t(getKey(namespace, key), ...(arg as I18nTranslationRestParameters))
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
@ -5,6 +5,7 @@ const TIME_AGO_MESSAGE_MAP: {
|
|||||||
'zh-CN': UseTimeAgoMessages
|
'zh-CN': UseTimeAgoMessages
|
||||||
en: UseTimeAgoMessages
|
en: UseTimeAgoMessages
|
||||||
} = {
|
} = {
|
||||||
|
// @ts-ignore
|
||||||
'zh-CN': {
|
'zh-CN': {
|
||||||
justNow: '刚刚',
|
justNow: '刚刚',
|
||||||
past: (n) => (n.match(/\d/) ? `${n}前` : n),
|
past: (n) => (n.match(/\d/) ? `${n}前` : n),
|
||||||
@ -17,6 +18,7 @@ const TIME_AGO_MESSAGE_MAP: {
|
|||||||
minute: (n) => `${n} 分钟`,
|
minute: (n) => `${n} 分钟`,
|
||||||
second: (n) => `${n} 秒`
|
second: (n) => `${n} 秒`
|
||||||
},
|
},
|
||||||
|
// @ts-ignore
|
||||||
en: {
|
en: {
|
||||||
justNow: 'just now',
|
justNow: 'just now',
|
||||||
past: (n) => (n.match(/\d/) ? `${n} ago` : n),
|
past: (n) => (n.match(/\d/) ? `${n} ago` : n),
|
||||||
|
6
src/types/auto-components.d.ts
vendored
6
src/types/auto-components.d.ts
vendored
@ -21,6 +21,7 @@ declare module '@vue/runtime-core' {
|
|||||||
DictTag: typeof import('./../components/DictTag/src/DictTag.vue')['default']
|
DictTag: typeof import('./../components/DictTag/src/DictTag.vue')['default']
|
||||||
Echart: typeof import('./../components/Echart/src/Echart.vue')['default']
|
Echart: typeof import('./../components/Echart/src/Echart.vue')['default']
|
||||||
Editor: typeof import('./../components/Editor/src/Editor.vue')['default']
|
Editor: typeof import('./../components/Editor/src/Editor.vue')['default']
|
||||||
|
ElAvatar: typeof import('element-plus/es')['ElAvatar']
|
||||||
ElBadge: typeof import('element-plus/es')['ElBadge']
|
ElBadge: typeof import('element-plus/es')['ElBadge']
|
||||||
ElButton: typeof import('element-plus/es')['ElButton']
|
ElButton: typeof import('element-plus/es')['ElButton']
|
||||||
ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
|
ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
|
||||||
@ -49,6 +50,7 @@ declare module '@vue/runtime-core' {
|
|||||||
ElForm: typeof import('element-plus/es')['ElForm']
|
ElForm: typeof import('element-plus/es')['ElForm']
|
||||||
ElFormItem: typeof import('element-plus/es')['ElFormItem']
|
ElFormItem: typeof import('element-plus/es')['ElFormItem']
|
||||||
ElIcon: typeof import('element-plus/es')['ElIcon']
|
ElIcon: typeof import('element-plus/es')['ElIcon']
|
||||||
|
ElImage: typeof import('element-plus/es')['ElImage']
|
||||||
ElImageViewer: typeof import('element-plus/es')['ElImageViewer']
|
ElImageViewer: typeof import('element-plus/es')['ElImageViewer']
|
||||||
ElInput: typeof import('element-plus/es')['ElInput']
|
ElInput: typeof import('element-plus/es')['ElInput']
|
||||||
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
|
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
|
||||||
@ -63,13 +65,15 @@ declare module '@vue/runtime-core' {
|
|||||||
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
|
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
|
||||||
ElSelect: typeof import('element-plus/es')['ElSelect']
|
ElSelect: typeof import('element-plus/es')['ElSelect']
|
||||||
ElSkeleton: typeof import('element-plus/es')['ElSkeleton']
|
ElSkeleton: typeof import('element-plus/es')['ElSkeleton']
|
||||||
|
ElSpace: typeof import('element-plus/es')['ElSpace']
|
||||||
ElSwitch: typeof import('element-plus/es')['ElSwitch']
|
ElSwitch: typeof import('element-plus/es')['ElSwitch']
|
||||||
ElTable: typeof import('element-plus/es')['ElTable']
|
ElTable: typeof import('element-plus/es')['ElTable']
|
||||||
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
||||||
ElTableV2: typeof import('element-plus/es')['ElTableV2']
|
|
||||||
ElTabPane: typeof import('element-plus/es')['ElTabPane']
|
ElTabPane: typeof import('element-plus/es')['ElTabPane']
|
||||||
ElTabs: typeof import('element-plus/es')['ElTabs']
|
ElTabs: typeof import('element-plus/es')['ElTabs']
|
||||||
ElTag: typeof import('element-plus/es')['ElTag']
|
ElTag: typeof import('element-plus/es')['ElTag']
|
||||||
|
ElTimeline: typeof import('element-plus/es')['ElTimeline']
|
||||||
|
ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
|
||||||
ElTooltip: typeof import('element-plus/es')['ElTooltip']
|
ElTooltip: typeof import('element-plus/es')['ElTooltip']
|
||||||
ElTransfer: typeof import('element-plus/es')['ElTransfer']
|
ElTransfer: typeof import('element-plus/es')['ElTransfer']
|
||||||
ElTree: typeof import('element-plus/es')['ElTree']
|
ElTree: typeof import('element-plus/es')['ElTree']
|
||||||
|
5
src/types/auto-imports.d.ts
vendored
5
src/types/auto-imports.d.ts
vendored
@ -1,4 +1,7 @@
|
|||||||
// Generated by 'unplugin-auto-import'
|
/* eslint-disable */
|
||||||
|
/* prettier-ignore */
|
||||||
|
// @ts-nocheck
|
||||||
|
// Generated by unplugin-auto-import
|
||||||
export {}
|
export {}
|
||||||
declare global {
|
declare global {
|
||||||
const DICT_TYPE: typeof import('@/utils/dict')['DICT_TYPE']
|
const DICT_TYPE: typeof import('@/utils/dict')['DICT_TYPE']
|
||||||
|
@ -108,7 +108,7 @@ const initModeler = (item) => {
|
|||||||
|
|
||||||
const save = (bpmnXml) => {
|
const save = (bpmnXml) => {
|
||||||
const data: ModelVO = {
|
const data: ModelVO = {
|
||||||
...model.value,
|
...(model.value ?? ({} as ModelVO)),
|
||||||
bpmnXml: bpmnXml // bpmnXml 只是初始化流程图,后续修改无法通过它获得
|
bpmnXml: bpmnXml // bpmnXml 只是初始化流程图,后续修改无法通过它获得
|
||||||
}
|
}
|
||||||
console.log(data, 'data')
|
console.log(data, 'data')
|
||||||
|
@ -406,7 +406,7 @@ const getDetail = () => {
|
|||||||
nextTick().then(() => {
|
nextTick().then(() => {
|
||||||
fApi.value?.btn.show(false)
|
fApi.value?.btn.show(false)
|
||||||
fApi.value?.resetBtn.show(false)
|
fApi.value?.resetBtn.show(false)
|
||||||
fApi.value?.disabled(true)
|
fApi.value?.btn.disabled(true)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ const [registerTable, { reload, getCheckboxRecords }] = useXTable({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const handleUpdateList = async () => {
|
const handleUpdateList = async () => {
|
||||||
const list = getCheckboxRecords()
|
const list = getCheckboxRecords() as any as any[]
|
||||||
if (list.length === 0) {
|
if (list.length === 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user