保存、预览流程
This commit is contained in:
@ -40,8 +40,7 @@
|
||||
|
||||
<script setup name="ElementBaseInfo">
|
||||
import { nextTick, onBeforeUnmount, toRefs } from "vue";
|
||||
import useBpmnStore from "@/store/modules/bpmn";
|
||||
const bpmnStore = useBpmnStore();
|
||||
let bpmnElement;
|
||||
const props = defineProps({
|
||||
businessObject: Object,
|
||||
type: String,
|
||||
@ -55,7 +54,7 @@ const data = reactive({
|
||||
elementBaseInfo: {},
|
||||
bpmnElement: undefined,
|
||||
});
|
||||
const { elementBaseInfo, bpmnElement } = toRefs(data);
|
||||
const { elementBaseInfo } = toRefs(data);
|
||||
watch(
|
||||
businessObject,
|
||||
(val) => {
|
||||
@ -69,24 +68,24 @@ watch(
|
||||
);
|
||||
|
||||
function resetBaseInfo() {
|
||||
bpmnElement.value = window?.bpmnInstances?.bpmnElement;
|
||||
bpmnElement = window?.bpmnInstances?.bpmnElement;
|
||||
elementBaseInfo.value = JSON.parse(
|
||||
JSON.stringify(bpmnElement.value.businessObject)
|
||||
JSON.stringify(bpmnElement.businessObject)
|
||||
);
|
||||
}
|
||||
function updateBaseInfo(key) {
|
||||
const attrObj = Object.create(null);
|
||||
attrObj[key] = elementBaseInfo.value[key];
|
||||
if (key === "id") {
|
||||
window.bpmnInstances.modeling.updateProperties(bpmnElement.value, {
|
||||
window.bpmnInstances.modeling.updateProperties(bpmnElement, {
|
||||
id: elementBaseInfo.value[key],
|
||||
di: { id: `${elementBaseInfo.value[key]}_di` },
|
||||
});
|
||||
} else {
|
||||
window.bpmnInstances.modeling.updateProperties(bpmnElement.value, attrObj);
|
||||
window.bpmnInstances.modeling.updateProperties(bpmnElement, attrObj);
|
||||
}
|
||||
}
|
||||
onBeforeUnmount(() => {
|
||||
bpmnElement.value = null;
|
||||
bpmnElement = null;
|
||||
});
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user