import{J as d,K as b,at as _,a6 as S,o as c,N as u,a as n,W as k,X as z,ah as D,Y as A}from"./vendor-Cv2dYodt.js";import{_ as F}from"./index-D5nbxFF0.js";const M={class:"system-graph"},W={class:"system-list"},C=["src","alt"],T={class:"system-item-label"},x={__name:"index",setup(B){const g=d(null);let a=null;const r=d({nodes:[],edges:[]}),l=()=>{if(!a||a.get("destroyed"))return;a.changeSize(900,800)},p=()=>({width:900,height:800,autoFit:"view",animate:!0,animateCfg:{duration:1e3,easing:"easeInOutQuad"},modes:{default:["drag-canvas","zoom-canvas","drag-node","click-select"]},defaultNode:{draggable:!0,labelCfg:{style:{fontSize:16,fill:"#000"}}},node:{style:e=>{const t=e.cluster==="submodule";return{labelPlacement:t?"bottom":"center",labelText:w=>w.label,stroke:t?"#1890ff":"#5F95FF",lineWidth:t?1:2,fill:"#fff",shadowColor:t?"#e8e8e8":"#d9d9d9",shadowBlur:t?5:10,radius:t?15:30,fontSize:t?12:16,fontWeight:t?400:500,opacity:t?.8:1}},palette:{type:"group",field:"cluster",color:{"nodeType-0":"#1890ff","nodeType-1":"#52c41a","nodeType-2":"#722ed1",submodule:"#40a9ff"}},state:{hover:{stroke:"#40a9ff",lineWidth:e=>e.cluster==="submodule"?2:3,shadowColor:"#1890ff",shadowBlur:e=>e.cluster==="submodule"?8:15,opacity:1},selected:{stroke:"#1890ff",lineWidth:e=>e.cluster==="submodule"?2:3,shadowColor:"#1890ff",shadowBlur:e=>e.cluster==="submodule"?8:15}}},edge:{style:e=>{const t=e.cluster==="submodule";return{stroke:t?"#40a9ff":"#91d5ff",lineWidth:t?1:2,endArrow:t?!1:{path:"M 0,0 L 12,6 L 12,-6 Z",fill:"#91d5ff"},radius:t?10:20,opacity:t?.5:.8,lineDash:t?[2,2]:null}},palette:{type:"group",field:"cluster",color:{"edgeType-0":"#1890ff","edgeType-1":"#52c41a","edgeType-2":"#722ed1",submodule:"#40a9ff"}},state:{hover:{stroke:"#1890ff",lineWidth:e=>e.cluster==="submodule"?1.5:3,opacity:1}}},plugins:[{type:"legend",nodeField:"cluster",position:"bottom"},{key:"hull-0",type:"hull",members:[]},{key:"hull-1",type:"hull",members:[]}]}),i=d([]),m=s=>({ERP:"/src/assets/arrow_arrow01.png",MES:"/src/assets/arrow_arrow02.png",PLM:"/src/assets/arrow_arrow03.png",QMS:"/src/assets/arrow_arrow04.png",PMS:"/src/assets/arrow_arrow05.png",WMS:"/src/assets/arrow_arrow16.png"})[s]||"/src/assets/svg/setting.svg",y=s=>Object.entries(s).map(([o,e])=>({id:o,name:o,color:e.color,modules:e.modules,connections:e.connections})),f=async()=>{try{const o=await(await fetch("https://aiapi.raycos.com.cn/api/agents/system-integration/")).json();r.value={nodes:o.data.nodes,edges:o.data.edges},i.value=y(o.data.systems),console.log("转换后的系统列表:",i.value),a&&(a.changeData(r.value),a.render())}catch(s){console.error("获取数据失败:",s)}},h={enter:{style:{opacity:0,size:0},animate:{size:{value:30,duration:1e3,easing:"easeInOutQuad"},opacity:{value:1,duration:1e3,easing:"easeInOutQuad"}}}},v={enter:{style:{opacity:0,lineWidth:0},animate:{opacity:{value:1,duration:1e3,delay:800,easing:"easeInOutQuad"},lineWidth:{value:2,duration:1e3,delay:800,easing:"easeInOutQuad"}}}};return b(async()=>{try{await f(),a=new _({...p(),container:g.value,data:r.value,autoFit:"view",behaviors:["drag-canvas","zoom-canvas","drag-element"],layout:{type:"gForce",preventOverlap:!0,nodeStrength:-100,edgeStrength:.1,nodeSize:30,nodeSpacing:100,linkDistance:200,gravity:1,maxIteration:1e3,minMovement:.1,damping:.9,maxSpeed:1e3,center:[400,300]},node:{...h,style:{labelPlacement:"center",labelText:s=>s.label,stroke:"#61DDAA",lineWidth:1,labelFontSize:6},labelCfg:{style:{fontSize:16,fill:"#000"}},palette:{type:"group",field:"cluster",color:["#61DDAA","#65789B"]}},edge:{...v,style:{endArrow:!0},palette:{type:"group",field:"cluster",color:["#61DDAA","#65789B"]}},plugins:[{type:"legend",nodeField:"cluster",position:"bottom"},{key:"hull-0",type:"hull",members:[]},{key:"hull-1",type:"hull",members:[]}],layout:{type:"d3-force",collide:{strength:.5}}}),a.render(),window.addEventListener("resize",l)}catch(s){console.error("Failed to fetch graph data:",s)}a.on("node:click",s=>{const{item:o}=s,e=o.getModel();console.log("Clicked node:",e)}),window.addEventListener("resize",l)}),S(()=>{window.removeEventListener("resize",l),a&&a.destroy()}),(s,o)=>(c(),u("div",M,[n("div",W,[(c(!0),u(k,null,z(i.value,e=>(c(),u("div",{class:"system-item",key:e.id,style:D({backgroundColor:e.color||"#f0f0f0"})},[n("img",{src:m(e.name),alt:e.name,class:"system-icon"},null,8,C),n("div",T,A(e.name),1)],4))),128))]),n("div",{id:"container",ref_key:"container",ref:g},null,512)]))}},O=F(x,[["__scopeId","data-v-63c2fb07"]]);export{O as S};
