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

View File

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

View File

@ -648,7 +648,7 @@ const initFlow = () => {
} }
}; };
const group = () => { const group = () => {
const PADDING = 200; const PADDING = 200;
lf.extension.selectionSelect.openSelectionSelect(); lf.extension.selectionSelect.openSelectionSelect();
lf.once("selection:selected", (data) => { lf.once("selection:selected", (data) => {
@ -801,6 +801,13 @@ onMounted(() => {
element.style.background = "#fff"; 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) => { const operationEdge = (arr) => {
@ -813,6 +820,7 @@ onUnmounted(() => {
emitter.off("changeNodeState"); emitter.off("changeNodeState");
emitter.off("openParamsDrawer"); emitter.off("openParamsDrawer");
emitter.off("throwAnError"); emitter.off("throwAnError");
emitter.off("deleteNode");
window.removeEventListener("beforeunload", handleBeforeUnload); window.removeEventListener("beforeunload", handleBeforeUnload);
document.removeEventListener("singleNodeExecution", singleNodeExecution); document.removeEventListener("singleNodeExecution", singleNodeExecution);

View File

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