zn-admin-vue3-wcs/src/components/bpmnProcessDesigner/package/penal/task/ElementTask.vue

79 lines
2.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="panel-tab__content">
<el-form size="small" label-width="90px">
<!-- add by 芋艿由于异步延续暂时用不到所以这里 display none -->
<el-form-item label="异步延续" style="display: none">
<el-checkbox
v-model="taskConfigForm.asyncBefore"
label="异步前"
value="异步前"
@change="changeTaskAsync"
/>
<el-checkbox
v-model="taskConfigForm.asyncAfter"
label="异步后"
value="异步后"
@change="changeTaskAsync"
/>
<el-checkbox
v-model="taskConfigForm.exclusive"
v-if="taskConfigForm.asyncAfter || taskConfigForm.asyncBefore"
label="排除"
value="排除"
@change="changeTaskAsync"
/>
</el-form-item>
<component :is="witchTaskComponent" v-bind="$props" />
</el-form>
</div>
</template>
<script lang="ts" setup>
import { installedComponent } from './data'
defineOptions({ name: 'ElementTaskConfig' })
const props = defineProps({
id: String,
type: String
})
const taskConfigForm = ref({
asyncAfter: false,
asyncBefore: false,
exclusive: false
})
const witchTaskComponent = ref()
const bpmnElement = ref()
const bpmnInstances = () => (window as any).bpmnInstances
const changeTaskAsync = () => {
if (!taskConfigForm.value.asyncBefore && !taskConfigForm.value.asyncAfter) {
taskConfigForm.value.exclusive = false
}
bpmnInstances().modeling.updateProperties(bpmnInstances().bpmnElement, {
...taskConfigForm.value
})
}
watch(
() => props.id,
() => {
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
},
{ immediate: true }
)
watch(
() => props.type,
() => {
if (props.type) {
witchTaskComponent.value = installedComponent[props.type].componet
}
},
{ immediate: true }
)
</script>