chore: 规范不符合eslint校验规则的代码

This commit is contained in:
Siyu Kong
2023-02-21 18:29:27 +08:00
parent 2ec6978400
commit f2f564dc0c
24 changed files with 127 additions and 97 deletions

View File

@@ -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

View File

@@ -64,8 +64,9 @@ const bpmnElement = ref<any>()
const bpmnMessageRefsMap = ref<any>()
const bpmnRootElements = ref<any>()
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()
})

View File

@@ -58,6 +58,8 @@ const defaultTaskForm = ref({
const scriptTaskForm = ref<any>({})
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()
})

View File

@@ -53,6 +53,8 @@ const defaultTaskForm = ref({
const userTaskForm = ref<any>({})
// 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()
})