From afa8e58b0254eeec468624cb8a694807810fbaaf Mon Sep 17 00:00:00 2001 From: haha Date: Sun, 14 Jul 2024 22:18:12 +0800 Subject: [PATCH] update code --- src/components/flow/nodes/BaseNode.js | 3 +- src/views/connection/detailFlow.vue | 2 +- src/views/connection/editFlow.vue | 1 - src/views/connection/nodePanel.vue | 67 +++++++++++++++++++++------ 4 files changed, 55 insertions(+), 18 deletions(-) diff --git a/src/components/flow/nodes/BaseNode.js b/src/components/flow/nodes/BaseNode.js index b8cbbb2..89eddd2 100644 --- a/src/components/flow/nodes/BaseNode.js +++ b/src/components/flow/nodes/BaseNode.js @@ -100,7 +100,6 @@ class RedNodeModel extends RectNodeModel { return style; } handleContextMenu(ev) { - debugger; } } class RedNode extends RectNode { @@ -165,6 +164,7 @@ class RedNode extends RectNode { getShape() { const { text, x, y, width, height, radius } = this.props.model; const style = this.props.model.getNodeStyle(); + const fillColor=this.props.model.properties.fill||"#FFA726"; let subText=(this.props.model.properties?.data?.oper_sub_type_name||""); let subType = (this.props.model.properties?.data?.oper_sub_type_name||"").split("").filter(t=>t.length>0).map((t,idx)=>{ return h("text",{ @@ -240,6 +240,7 @@ class RedNode extends RectNode { y: y - height / 2, width, height, + fill:fillColor, rx: radius, ry: radius, }), diff --git a/src/views/connection/detailFlow.vue b/src/views/connection/detailFlow.vue index 8c12c98..97fc0da 100644 --- a/src/views/connection/detailFlow.vue +++ b/src/views/connection/detailFlow.vue @@ -65,7 +65,7 @@ const config = { style: themeApprove, plugins: [AiNodeExtension, Menu] }; -const showFlow=(o)=>{ +const showFlow=(o)=>{ info.opers=o.operator_list; info.edges=o.operator_edges; info.nodes=o.operator_nodes.map(it=>{ diff --git a/src/views/connection/editFlow.vue b/src/views/connection/editFlow.vue index 72554f6..e7cb5d2 100644 --- a/src/views/connection/editFlow.vue +++ b/src/views/connection/editFlow.vue @@ -93,7 +93,6 @@ const initEvent=(lf)=>{ }); } const doEdit=(n)=>{ - debugger } const doUpdateState=()=>{ //nodePanel.value.updateNode(lf.value.getGraphData()); diff --git a/src/views/connection/nodePanel.vue b/src/views/connection/nodePanel.vue index 1298664..88c3cea 100644 --- a/src/views/connection/nodePanel.vue +++ b/src/views/connection/nodePanel.vue @@ -51,11 +51,11 @@ const dragNode = (it, t) => { } props.lf.dnd.startDrag({ type: 'ai-node', - text: it.text, - fill: color, + text: it.text, properties: { + fill: color, node: it.id, - data:it + data: it } }) } @@ -84,26 +84,25 @@ const list2 = reactive([ const updateNode = (nodes) => { let nds = nodes.nodes.map(d => d.properties.node); - if(info.all){ + if (info.all) { info.all.forEach(d => { d.show = nds.indexOf(d.id) == -1 }); } - + } -const doEdit=(nd)=>{ - debugger - let tmps=info.all.filter(d=>d.id==nd.id); - if(tmps.length>0){ - tmps[0].inputs=nd.inputs; - tmps[0].outputs=nd.outputs; - tmps[0].process=nd.process; +const doEdit = (nd) => { + let tmps = info.all.filter(d => d.id == nd.id); + if (tmps.length > 0) { + tmps[0].inputs = nd.inputs; + tmps[0].outputs = nd.outputs; + tmps[0].process = nd.process; } } defineExpose({ updateNode, - doEdit, + doEdit, }) const initData = () => { @@ -111,10 +110,48 @@ const initData = () => { let tmps = (d.data?.data?.operator_list || []).map(it => { it.show = true; it.text = it.operator_name; - it.id = it.operator_id + it.id = it.operator_id + if (!it.parameters) { + it.parameters = { + inputs: [{ + input_id: 1, + oper_inout_data_type: "image_rgb24,image_gray8", + size_x: { + type: "int", // 代表输入是一个整数 + value: 480, // 这是具体输入的数值 + }, + size_y: { + type: "int", + value: 480, + } + },], + outputs: [{ + output_id: 1, + oper_inout_data_type: "same_as_input", // 这是固定参数,表示与输入图像格式相同 + size_x: { + type: "int", // 代表输入是一个整数 + value: 580, // 这是具体输入的数值 + }, + size_y: { + type: "int", + value: 580, + }, + scale: { + type: "float", // 代表输入是一个浮点数 + value: 1.0, // 这是具体输入的数值 + } + },], + process: { + method: { + type: "nearest/bilinear", + value: "nearest", + }, + } + } + } return it; }); - info.all=tmps; + info.all = tmps; info.list1 = tmps.filter(d => d.oper_main_type == "pre_process"); info.list2 = tmps.filter(d => d.oper_main_type == "post_process"); info.list3 = tmps.filter(d => d.oper_main_type == "data_source");