姜玉琦 2024-07-14 22:25:50 +08:00
commit e75f470937
4 changed files with 55 additions and 18 deletions

View File

@ -100,7 +100,6 @@ class RedNodeModel extends RectNodeModel {
return style; return style;
} }
handleContextMenu(ev) { handleContextMenu(ev) {
debugger;
} }
} }
class RedNode extends RectNode { class RedNode extends RectNode {
@ -165,6 +164,7 @@ class RedNode extends RectNode {
getShape() { getShape() {
const { text, x, y, width, height, radius } = this.props.model; const { text, x, y, width, height, radius } = this.props.model;
const style = this.props.model.getNodeStyle(); 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 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)=>{ let subType = (this.props.model.properties?.data?.oper_sub_type_name||"").split("").filter(t=>t.length>0).map((t,idx)=>{
return h("text",{ return h("text",{
@ -240,6 +240,7 @@ class RedNode extends RectNode {
y: y - height / 2, y: y - height / 2,
width, width,
height, height,
fill:fillColor,
rx: radius, rx: radius,
ry: radius, ry: radius,
}), }),

View File

@ -65,7 +65,7 @@ const config = {
style: themeApprove, style: themeApprove,
plugins: [AiNodeExtension, Menu] plugins: [AiNodeExtension, Menu]
}; };
const showFlow=(o)=>{ const showFlow=(o)=>{
info.opers=o.operator_list; info.opers=o.operator_list;
info.edges=o.operator_edges; info.edges=o.operator_edges;
info.nodes=o.operator_nodes.map(it=>{ info.nodes=o.operator_nodes.map(it=>{

View File

@ -93,7 +93,6 @@ const initEvent=(lf)=>{
}); });
} }
const doEdit=(n)=>{ const doEdit=(n)=>{
debugger
} }
const doUpdateState=()=>{ const doUpdateState=()=>{
//nodePanel.value.updateNode(lf.value.getGraphData()); //nodePanel.value.updateNode(lf.value.getGraphData());

View File

@ -51,11 +51,11 @@ const dragNode = (it, t) => {
} }
props.lf.dnd.startDrag({ props.lf.dnd.startDrag({
type: 'ai-node', type: 'ai-node',
text: it.text, text: it.text,
fill: color,
properties: { properties: {
fill: color,
node: it.id, node: it.id,
data:it data: it
} }
}) })
} }
@ -84,26 +84,25 @@ const list2 = reactive([
const updateNode = (nodes) => { const updateNode = (nodes) => {
let nds = nodes.nodes.map(d => d.properties.node); let nds = nodes.nodes.map(d => d.properties.node);
if(info.all){ if (info.all) {
info.all.forEach(d => { info.all.forEach(d => {
d.show = nds.indexOf(d.id) == -1 d.show = nds.indexOf(d.id) == -1
}); });
} }
} }
const doEdit=(nd)=>{ const doEdit = (nd) => {
debugger let tmps = info.all.filter(d => d.id == nd.id);
let tmps=info.all.filter(d=>d.id==nd.id); if (tmps.length > 0) {
if(tmps.length>0){ tmps[0].inputs = nd.inputs;
tmps[0].inputs=nd.inputs; tmps[0].outputs = nd.outputs;
tmps[0].outputs=nd.outputs; tmps[0].process = nd.process;
tmps[0].process=nd.process;
} }
} }
defineExpose({ defineExpose({
updateNode, updateNode,
doEdit, doEdit,
}) })
const initData = () => { const initData = () => {
@ -111,10 +110,48 @@ const initData = () => {
let tmps = (d.data?.data?.operator_list || []).map(it => { let tmps = (d.data?.data?.operator_list || []).map(it => {
it.show = true; it.show = true;
it.text = it.operator_name; 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; return it;
}); });
info.all=tmps; info.all = tmps;
info.list1 = tmps.filter(d => d.oper_main_type == "pre_process"); info.list1 = tmps.filter(d => d.oper_main_type == "pre_process");
info.list2 = tmps.filter(d => d.oper_main_type == "post_process"); info.list2 = tmps.filter(d => d.oper_main_type == "post_process");
info.list3 = tmps.filter(d => d.oper_main_type == "data_source"); info.list3 = tmps.filter(d => d.oper_main_type == "data_source");