fix: 删除节点移除错误

This commit is contained in:
zhanghao 2026-04-17 15:07:36 +08:00
parent 9d3ed51349
commit 57d2686738
4 changed files with 26 additions and 33 deletions

View File

@ -42,19 +42,6 @@
</el-icon>
</el-button>
</el-tooltip>
<!-- <el-tooltip
class="box-item"
effect="dark"
:content="zoomState ? '缩小' : '放大'"
placement="top"
>
<el-button v-if="showZoom" circle @click="zoom">
<el-icon>
<ZoomOut v-if="zoomState" />
<ZoomIn v-else />
</el-icon>
</el-button>
</el-tooltip> -->
<el-tooltip
class="box-item"
effect="dark"
@ -71,10 +58,11 @@
</div>
</template>
<script setup lang="js">
import { ref } from 'vue'
import { EditPen, Select, CloseBold, Delete, ZoomOut, ZoomIn, VideoPlay } from '@element-plus/icons-vue'
import { onUnmounted, ref } from 'vue'
import { EditPen, Select, CloseBold, Delete, VideoPlay } from '@element-plus/icons-vue'
import { ElMessageBox } from 'element-plus'
import { computed } from 'vue'
import { emitter } from "@/utils/eventBus";
const props = defineProps({
icon: {
@ -101,17 +89,9 @@ const props = defineProps({
type: String,
default: ''
},
showZoom: {
type: Boolean,
default: true
},
zoomState: {
type: Boolean,
default: false
}
})
const emits = defineEmits(['zoom', 'setNodeName'])
const emits = defineEmits(['setNodeName'])
const showTextTitle = ref(true)
const nodeName = ref(props.nodeProperties.name || props.nodeName)
@ -145,13 +125,10 @@ const deleteNode = () => {
})
}
lf.deleteNode(props.nodeId);
emitter.emit('deleteNode', props.nodeId);
})
}
const zoom = () => {
emits('zoom', !props.zoomState)
}
const execute = () => {
const myEvent = new CustomEvent('singleNodeExecution', {
bubbles: false, // false
@ -173,6 +150,10 @@ const handleInputKeydown = (e) => {
const imageUrl = () => {
return new URL(props.icon, import.meta.url).href;
}
onUnmounted(() => {
emitter.off("deleteNode");
})
</script>
<style lang="scss" scoped>
.title__container {

View File

@ -1023,7 +1023,7 @@
@visible-change="
(visible) => visibleChange(visible, index, property.quote)
"
@change="(value) => cascaderChange(value, index)"
@change="(value) => cascaderChange(value, index, 'sdAgentConfig')"
/>
</el-form-item>
</el-form-item>
@ -1130,7 +1130,7 @@
@visible-change="
(visible) => visibleChange(visible, index, property.quote)
"
@change="(value) => cascaderChange(value, index)"
@change="(value) => cascaderChange(value, index, 'sdAgentTts')"
/>
</el-form-item>
</el-form-item>
@ -1440,6 +1440,12 @@ const cascaderChange = (value, index, type = 'default') => {
if (type === 'default') {
formData.nodeParams[index].quote = value;
formData.nodeParams[index].quoteType = selectedOptions[0].data.type;
}else if (type === 'sdAgentConfig') {
sdAgentNodeData.value.config[index].quote = value;
sdAgentNodeData.value.config[index].quoteType = selectedOptions[0].data.type;
} else if (type === 'sdAgentTts') {
sdAgentNodeData.value.tts[index].quote = value;
sdAgentNodeData.value.tts[index].quoteType = selectedOptions[0].data.type;
} else {
httpNodeData.value.body.formData[index].quote = value;
httpNodeData.value.body.formData[index].quoteType = selectedOptions[0].data.type;

View File

@ -801,6 +801,13 @@ onMounted(() => {
element.style.background = "#fff";
}
});
emitter.on("deleteNode", (nodeId) => {
const index = nodeErrorList.value.findIndex((item) => item === nodeId);
if (index !== -1) {
nodeErrorList.value.splice(index, 1);
}
})
});
const operationEdge = (arr) => {
@ -813,6 +820,7 @@ onUnmounted(() => {
emitter.off("changeNodeState");
emitter.off("openParamsDrawer");
emitter.off("throwAnError");
emitter.off("deleteNode");
window.removeEventListener("beforeunload", handleBeforeUnload);
document.removeEventListener("singleNodeExecution", singleNodeExecution);

View File

@ -26,8 +26,6 @@
:nodeName="props.properties.name"
:nodeType="props.properties.nodeType || 'NONE'"
:nodeDesc="props.properties.desc"
:zoom-state="nodeZoom"
@zoom="zoom"
@setNodeName="setNodeName"
/>
</div>