vue-wiring-diagram 1.1.17 → 1.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -739,4 +739,4 @@ usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`),{initialZIndex:s,curr
|
|
|
739
739
|
font-size: 12px;
|
|
740
740
|
background: 0 0;
|
|
741
741
|
}
|
|
742
|
-
`;var Mj=function(n,e,t,s){var r=arguments.length,i=r<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,t):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,s);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(i=(r<3?o(i):r>3?o(e,t,i):o(e,t))||i);return r>3&&i&&Object.defineProperty(e,t,i),i};class gi extends be{get targetScroller(){return this.options.target.getPlugin("scroller")}get targetGraph(){return this.options.target}get targetModel(){return this.targetGraph.model}constructor(e={}){super(),this.name="stencil",Wr(this.name,Oj),this.graphs={},this.groups={},this.options=Object.assign(Object.assign({},gi.defaultOptions),e),this.init()}init(){this.dnd=new Ts(this.options),this.onSearch=vp(this.onSearch,200),this.initContainer(),this.initSearch(),this.initContent(),this.initGroups(),this.setTitle(),this.startListening()}load(e,t){return Array.isArray(e)?this.loadGroup(e,t):this.options.groups&&Object.keys(this.options.groups).forEach(s=>{e[s]&&this.loadGroup(e[s],s)}),this}unload(e,t){return Array.isArray(e)?this.loadGroup(e,t,!0):this.options.groups&&Object.keys(this.options.groups).forEach(s=>{e[s]&&this.loadGroup(e[s],s,!0)}),this}toggleGroup(e){return this.isGroupCollapsed(e)?this.expandGroup(e):this.collapseGroup(e),this}collapseGroup(e){if(this.isGroupCollapsable(e)){const t=this.groups[e];t&&!this.isGroupCollapsed(e)&&(this.trigger("group:collapse",{name:e}),J(t,"collapsed"))}return this}expandGroup(e){if(this.isGroupCollapsable(e)){const t=this.groups[e];t&&this.isGroupCollapsed(e)&&(this.trigger("group:expand",{name:e}),Re(t,"collapsed"))}return this}isGroupCollapsable(e){const t=this.groups[e];return Pn(t,"collapsable")}isGroupCollapsed(e){const t=this.groups[e];return t&&Pn(t,"collapsed")}collapseGroups(){return Object.keys(this.groups).forEach(e=>this.collapseGroup(e)),this}expandGroups(){return Object.keys(this.groups).forEach(e=>this.expandGroup(e)),this}resizeGroup(e,t){const s=this.graphs[e];return s&&s.resize(t.width,t.height),this}addGroup(e){const t=Array.isArray(e)?e:[e];this.options.groups?this.options.groups.push(...t):this.options.groups=t,t.forEach(s=>this.initGroup(s))}removeGroup(e){const t=Array.isArray(e)?e:[e];this.options.groups&&(this.options.groups=this.options.groups.filter(s=>!t.includes(s.name)),t.forEach(s=>{const r=this.graphs[s];this.unregisterGraphEvents(r),r.dispose(),delete this.graphs[s];const i=this.groups[s];Gt(i),delete this.groups[s]}))}initContainer(){this.container=document.createElement("div"),J(this.container,this.prefixClassName(Mt.base)),fe(this.container,"data-not-found-text",this.options.notFoundText||"No matches found")}initContent(){this.content=document.createElement("div"),J(this.content,this.prefixClassName(Mt.content)),bs(this.content,this.container)}initSearch(){this.options.search&&(J(this.container,"searchable"),Rt(this.container,this.renderSearch()))}initGroup(e){const t=this.options.stencilGraphOptions||{},s=document.createElement("div");J(s,this.prefixClassName(Mt.group)),fe(s,"data-name",e.name),(e.collapsable==null&&this.options.collapsable||e.collapsable!==!1)&&J(s,"collapsable"),pn(s,"collapsed",e.collapsed===!0);const r=document.createElement("h3");J(r,this.prefixClassName(Mt.groupTitle)),r.innerHTML=e.title||e.name;const i=document.createElement("div");J(i,this.prefixClassName(Mt.groupContent));const o=e.graphOptions,a=new $(Object.assign(Object.assign(Object.assign({},t),o),{container:document.createElement("div"),model:t.model||new et,width:e.graphWidth||this.options.stencilGraphWidth,height:e.graphHeight||this.options.stencilGraphHeight,interacting:!1,preventDefaultBlankAction:!1}));this.registerGraphEvents(a),Rt(i,a.container),Rt(s,[r,i]),bs(s,this.content),this.groups[e.name]=s,this.graphs[e.name]=a}initGroups(){if(this.clearGroups(),this.setCollapsableState(),this.options.groups&&this.options.groups.length)this.options.groups.forEach(e=>{this.initGroup(e)});else{const e=this.options.stencilGraphOptions||{},t=new $(Object.assign(Object.assign({},e),{container:document.createElement("div"),model:e.model||new et,width:this.options.stencilGraphWidth,height:this.options.stencilGraphHeight,interacting:!1,preventDefaultBlankAction:!1}));Rt(this.content,t.container),this.graphs[Co.defaultGroupName]=t}}setCollapsableState(){this.options.collapsable=this.options.collapsable&&this.options.groups&&this.options.groups.some(e=>e.collapsable!==!1),this.options.collapsable?(J(this.container,"collapsable"),this.options.groups&&this.options.groups.every(t=>t.collapsed||t.collapsable===!1)?J(this.container,"collapsed"):Re(this.container,"collapsed")):Re(this.container,"collapsable")}setTitle(){const e=document.createElement("div");J(e,this.prefixClassName(Mt.title)),e.innerHTML=this.options.title,bs(e,this.container)}renderSearch(){const e=document.createElement("div");J(e,this.prefixClassName(Mt.search));const t=document.createElement("input");return fe(t,{type:"search",placeholder:this.options.placeholder||"Search"}),J(t,this.prefixClassName(Mt.searchText)),Rt(e,t),e}startListening(){const e=this.prefixClassName(Mt.title),t=this.prefixClassName(Mt.searchText),s=this.prefixClassName(Mt.groupTitle);this.delegateEvents({[`click .${e}`]:"onTitleClick",[`touchstart .${e}`]:"onTitleClick",[`click .${s}`]:"onGroupTitleClick",[`touchstart .${s}`]:"onGroupTitleClick",[`input .${t}`]:"onSearch",[`focusin .${t}`]:"onSearchFocusIn",[`focusout .${t}`]:"onSearchFocusOut"})}stopListening(){this.undelegateEvents()}registerGraphEvents(e){e.on("cell:mousedown",this.onDragStart,this)}unregisterGraphEvents(e){e.off("cell:mousedown",this.onDragStart,this)}loadGroup(e,t,s){const r=this.getModel(t);if(r){const c=e.map(u=>He.isNode(u)?u:He.create(u));s===!0?r.removeCells(c):r.resetCells(c)}const i=this.getGroup(t);let o=this.options.stencilGraphHeight;i&&i.graphHeight!=null&&(o=i.graphHeight);const a=i&&i.layout||this.options.layout;if(a&&r&&ne(a,this,r,i),!o){const c=this.getGraph(t);c.fitToContent({minWidth:c.options.width,gridHeight:1,padding:i&&i.graphPadding||this.options.stencilGraphPadding||10})}return this}onDragStart(e){const{e:t,node:s}=e,r=this.getGroupByNode(s);r&&r.nodeMovable===!1||this.dnd.start(s,t)}filter(e,t){const s=Object.keys(this.graphs).reduce((r,i)=>{const o=this.graphs[i],a=i===Co.defaultGroupName?null:i,c=o.model.getNodes().filter(h=>{let p=!1;typeof t=="function"?p=ne(t,this,h,e,a,this):typeof t=="boolean"?p=t:p=this.isCellMatched(h,e,t,e.toLowerCase()!==e);const g=o.renderer.findViewByCell(h);return g&&pn(g.container,"unmatched",!p),p}),u=c.length>0,d=this.options,f=new et;return f.resetCells(c),d.layout&&ne(d.layout,this,f,this.getGroup(i)),this.groups[i]&&pn(this.groups[i],"unmatched",!u),o.fitToContent({gridWidth:1,gridHeight:1,padding:d.stencilGraphPadding||10}),r||u},!1);pn(this.container,"not-found",!s)}isCellMatched(e,t,s,r){return t&&s?Object.keys(s).some(i=>{if(i==="*"||e.shape===i){const o=s[i];return typeof o=="boolean"?o:(Array.isArray(o)?o:[o]).some(c=>{let u=e.getPropByPath(c);return u!=null?(u=`${u}`,r||(u=u.toLowerCase()),u.indexOf(t)>=0):!1})}return!1}):!0}onSearch(e){this.filter(e.target.value,this.options.search)}onSearchFocusIn(){J(this.container,"is-focused")}onSearchFocusOut(){Re(this.container,"is-focused")}onTitleClick(){this.options.collapsable&&(pn(this.container,"collapsed"),Pn(this.container,"collapsed")?this.collapseGroups():this.expandGroups())}onGroupTitleClick(e){const t=e.target.closest(`.${this.prefixClassName(Mt.group)}`);t&&this.toggleGroup(fe(t,"data-name")||"");const s=Object.keys(this.groups).every(r=>{const i=this.getGroup(r),o=this.groups[r];return i&&i.collapsable===!1||Pn(o,"collapsed")});pn(this.container,"collapsed",s)}getModel(e){const t=this.getGraph(e);return t?t.model:null}getGraph(e){return this.graphs[e||Co.defaultGroupName]}getGroup(e){const t=this.options.groups;return e!=null&&t&&t.length?t.find(s=>s.name===e):null}getGroupByNode(e){const t=this.options.groups;return t?t.find(s=>{const r=this.getModel(s.name);return r?r.has(e.id):!1}):null}clearGroups(){Object.keys(this.graphs).forEach(e=>{const t=this.graphs[e];this.unregisterGraphEvents(t),t.dispose()}),Object.keys(this.groups).forEach(e=>{const t=this.groups[e];Gt(t)}),this.graphs={},this.groups={}}onRemove(){this.clearGroups(),this.dnd.remove(),this.stopListening(),this.undelegateDocumentEvents()}dispose(){this.remove(),Yr(this.name)}}Mj([be.dispose()],gi.prototype,"dispose",null),function(n){n.defaultOptions=Object.assign({stencilGraphWidth:200,stencilGraphHeight:800,title:"Stencil",collapsable:!1,placeholder:"Search",notFoundText:"No matches found",layout(e,t){const s={columnWidth:this.options.stencilGraphWidth/2-10,columns:2,rowHeight:80,resizeToFit:!1,dx:10,dy:10};Ej(e,Object.assign(Object.assign(Object.assign({},s),this.options.layoutOptions),t?t.layoutOptions:{}))}},Ts.defaults)}(gi||(gi={}));var Mt;(function(n){n.base="widget-stencil",n.title=`${n.base}-title`,n.search=`${n.base}-search`,n.searchText=`${n.search}-text`,n.content=`${n.base}-content`,n.group=`${n.base}-group`,n.groupTitle=`${n.group}-title`,n.groupContent=`${n.group}-content`})(Mt||(Mt={}));var Co;(function(n){n.defaultGroupName="__default__"})(Co||(Co={})),$.prototype.toSVG=function(n,e){const t=this.getPlugin("export");t&&t.toSVG(n,e)},$.prototype.toPNG=function(n,e){const t=this.getPlugin("export");t&&t.toPNG(n,e)},$.prototype.toJPEG=function(n,e){const t=this.getPlugin("export");t&&t.toJPEG(n,e)},$.prototype.exportPNG=function(n,e){const t=this.getPlugin("export");t&&t.exportPNG(n,e)},$.prototype.exportJPEG=function(n,e){const t=this.getPlugin("export");t&&t.exportJPEG(n,e)},$.prototype.exportSVG=function(n,e){const t=this.getPlugin("export");t&&t.exportSVG(n,e)};var Pj=function(n,e,t,s){var r=arguments.length,i=r<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,t):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,s);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(i=(r<3?o(i):r>3?o(e,t,i):o(e,t))||i);return r>3&&i&&Object.defineProperty(e,t,i),i};class g0 extends ke{constructor(){super(),this.name="export"}get view(){return this.graph.view}init(e){this.graph=e}exportPNG(e="chart",t={}){this.toPNG(s=>{Ks.downloadDataUri(s,e)},t)}exportJPEG(e="chart",t={}){this.toPNG(s=>{Ks.downloadDataUri(s,e)},t)}exportSVG(e="chart",t={}){this.toSVG(s=>{Ks.downloadDataUri(Ks.svgToDataUrl(s),e)},t)}toSVG(e,t={}){this.notify("before:export",t);const s=this.view.svg,r=oe.create(s).clone();let i=r.node;const o=r.findOne(`.${this.view.prefixClassName("graph-svg-stage")}`),a=t.viewBox||this.graph.graphToLocal(this.graph.getContentBBox()),c=t.preserveDimensions;if(c){const f=typeof c=="boolean"?a:c;r.attr({width:f.width,height:f.height})}if(r.removeAttribute("style").attr("viewBox",[a.x,a.y,a.width,a.height].join(" ")),o.removeAttribute("transform"),t.copyStyles!==!1){const f=s.ownerDocument,h=Array.from(s.querySelectorAll("*")),p=Array.from(i.querySelectorAll("*")),g=f.styleSheets.length,m=[];for(let w=g-1;w>=0;w-=1)m[w]=f.styleSheets[w],f.styleSheets[w].disabled=!0;const y={};h.forEach((w,x)=>{const v=window.getComputedStyle(w,null),C={};Object.keys(v).forEach(E=>{C[E]=v.getPropertyValue(E)}),y[x]=C}),g!==f.styleSheets.length&&m.forEach((w,x)=>{f.styleSheets[x]=w});for(let w=0;w<g;w+=1)f.styleSheets[w].disabled=!1;const b={};h.forEach((w,x)=>{const v=window.getComputedStyle(w,null),C=y[x],E={};Object.keys(v).forEach(S=>{!Lc(S)&&v.getPropertyValue(S)!==C[S]&&(E[S]=v.getPropertyValue(S))}),b[x]=E}),p.forEach((w,x)=>{Xe(w,b[x])})}const u=t.stylesheet;if(typeof u=="string"){const f=s.ownerDocument.implementation.createDocument(null,"xml",null).createCDATASection(u);r.prepend(oe.create("style",{type:"text/css"},[f]))}const d=()=>{const f=t.beforeSerialize;if(typeof f=="function"){const p=ne(f,this.graph,i);p instanceof SVGSVGElement&&(i=p)}const h=new XMLSerializer().serializeToString(i).replace(/ /g," ");this.notify("after:export",t),e(h)};if(t.serializeImages){const f=r.find("image").map(h=>new Promise(p=>{const g=h.attr("xlink:href")||h.attr("href");Ks.imageToDataUri(g,(m,y)=>{!m&&y&&h.attr("xlink:href",y),p()})}));Promise.all(f).then(d)}else d()}toDataURL(e,t){let s=t.viewBox||this.graph.getContentBBox();const r=gs(t.padding);t.width&&t.height&&(r.left+r.right>=t.width&&(r.left=r.right=0),r.top+r.bottom>=t.height&&(r.top=r.bottom=0));const i=new U(-r.left,-r.top,r.left+r.right,r.top+r.bottom);if(t.width&&t.height){const d=s.width+r.left+r.right,f=s.height+r.top+r.bottom;i.scale(d/t.width,f/t.height)}s=U.create(s).moveAndExpand(i);const o=typeof t.width=="number"&&typeof t.height=="number"?{width:t.width,height:t.height}:s;let a=t.ratio?parseFloat(t.ratio):1;(!Number.isFinite(a)||a===0)&&(a=1);const c={width:Math.max(Math.round(o.width*a),1),height:Math.max(Math.round(o.height*a),1)};{const d=document.createElement("canvas"),f=d.getContext("2d");d.width=c.width,d.height=c.height;const h=c.width-1,p=c.height-1;f.fillStyle="rgb(1,1,1)",f.fillRect(h,p,1,1);const g=f.getImageData(h,p,1,1).data;if(g[0]!==1||g[1]!==1||g[2]!==1)throw new Error("size exceeded")}const u=new Image;u.onload=()=>{const d=document.createElement("canvas");d.width=c.width,d.height=c.height;const f=d.getContext("2d");f.fillStyle=t.backgroundColor||"white",f.fillRect(0,0,c.width,c.height);try{f.drawImage(u,0,0,c.width,c.height);const h=d.toDataURL(t.type,t.quality);e(h)}catch{}},this.toSVG(d=>{u.src=`data:image/svg+xml,${encodeURIComponent(d)}`},Object.assign(Object.assign({},t),{viewBox:s,serializeImages:!0,preserveDimensions:Object.assign({},c)}))}toPNG(e,t={}){this.toDataURL(e,Object.assign(Object.assign({},t),{type:"image/png"}))}toJPEG(e,t={}){this.toDataURL(e,Object.assign(Object.assign({},t),{type:"image/jpeg"}))}notify(e,t){this.trigger(e,t),this.graph.trigger(e,t)}dispose(){this.off()}}Pj([ke.dispose()],g0.prototype,"dispose",null);const Nj={class:"control-box"},Aj=Dt({__name:"index",props:{payload:Object},setup(n){const e=n,t=l.ref("3"),s=l.ref([]),r=()=>{s.value=JSON.parse(JSON.stringify(e.payload.getPorts().map(u=>({id:u.id,attrs:u.attrs,args:{x:Number(u.args.x.replace("%","")),y:Number(u.args.y.replace("%",""))}}))))},i=()=>{const u=Du;u.attrs.text.text=`${e.payload.getPorts().length+1}`,u.args.x="50%",u.args.y="50%",e.payload.addPorts([{group:"ports",...u}]),r()},o=()=>{$r("#drawing-board",!0)},a=(u,d,f)=>{e.payload.portProp(u,"args/"+d,f+"%"),r()},c=u=>{e.payload.removePort(u),r()};return l.onMounted(()=>{r()}),(u,d)=>{const f=l.resolveComponent("el-button"),h=l.resolveComponent("el-table-column"),p=l.resolveComponent("el-slider"),g=l.resolveComponent("el-icon"),m=l.resolveComponent("el-table"),y=l.resolveComponent("el-collapse-item"),b=l.resolveComponent("el-collapse");return l.openBlock(),l.createElementBlock("div",Nj,[l.createVNode(b,{modelValue:t.value,"onUpdate:modelValue":d[0]||(d[0]=w=>t.value=w),accordion:""},{default:l.withCtx(()=>[l.createVNode(y,{title:"连接桩设置",name:"3"},{default:l.withCtx(()=>[l.createVNode(f,{type:"primary",onClick:i,size:"small"},{default:l.withCtx(()=>d[1]||(d[1]=[l.createTextVNode("添加连接桩")])),_:1}),l.createVNode(f,{type:"primary",onClick:o,size:"small"},{default:l.withCtx(()=>d[2]||(d[2]=[l.createTextVNode("显示连接桩")])),_:1}),l.createVNode(m,{data:s.value,border:"",size:"small",style:{"margin-top":"10px"}},{default:l.withCtx(()=>[l.createVNode(h,{label:"ID",width:"50",align:"center"},{default:l.withCtx(({row:w})=>[l.createTextVNode(l.toDisplayString(w.attrs.text.text),1)]),_:1}),l.createVNode(h,{label:"x",width:"100",align:"center"},{default:l.withCtx(({row:w})=>[l.createVNode(p,{modelValue:w.args.x,"onUpdate:modelValue":x=>w.args.x=x,min:0,max:100,step:1,onInput:x=>a(w.id,"x",x)},null,8,["modelValue","onUpdate:modelValue","onInput"])]),_:1}),l.createVNode(h,{label:"y",width:"100",align:"center"},{default:l.withCtx(({row:w})=>[l.createVNode(p,{modelValue:w.args.y,"onUpdate:modelValue":x=>w.args.y=x,min:0,max:100,step:1,onInput:x=>a(w.id,"y",x)},null,8,["modelValue","onUpdate:modelValue","onInput"])]),_:1}),l.createVNode(h,{label:"操作",width:"70",align:"center"},{default:l.withCtx(({row:w})=>[l.createVNode(f,{type:"danger",size:"small",onClick:x=>c(w.id)},{default:l.withCtx(()=>[l.createVNode(g,null,{default:l.withCtx(()=>[l.createVNode(l.unref(Jm))]),_:1})]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])]),_:1})]),_:1},8,["modelValue"])])}}},[["__scopeId","data-v-b280098c"]]),m0=[{shape:"rect",width:60,height:5,attrs:{body:{fill:"#ffffff",stroke:"#ffffff",strokeWidth:0}},data:{type:"base-shape"}},{shape:"rect",width:60,height:20,attrs:{body:{fill:"#ffffff",stroke:"#ffffff",strokeWidth:1}},data:{type:"base-shape",label:"母线"}},{shape:"circle",width:40,height:40,attrs:{body:{fill:"#ffffff",stroke:"#ffffff",strokeWidth:1}},data:{type:"base-shape"}},{shape:"ellipse",width:60,height:40,attrs:{body:{fill:"#ffffff",stroke:"#ffffff"}},data:{type:"base-shape"}}],y0={groups:{ports:{position:"absolute",args:{x:0,y:0},attrs:{circle:{magnet:!0,stroke:"#8f8f8f",r:4}},label:{position:"top"}}}},_j={style:{width:"100%",height:"100%",position:"relative"}},Tj={key:0,class:"spinner"},_d=Object.assign({name:"wiring-diagram-preview"},{__name:"index",props:{id:{type:String,default:""},background:{type:Object,default:()=>({})},grid:{type:Object,default:()=>({})},data:{type:Object,default:()=>({})}},setup(n){const e=n,t=l.ref(),s=()=>{window.__x6_instances__=[];const C=document.getElementById("preview-container");t.value=new $({container:C,autoResize:!0,panning:!0,mousewheel:!0,connecting:{router:"orth",connectionPoint:{name:"anchor"},anchor:"center"},interacting:{nodeMovable:!1,magnetConnectable:!1,edgeMovable:!1,edgeLabelMovable:!1,arrowheadMovable:!1,vertexMovable:!1,vertexAddable:!1,vertexDeletable:!1}}),window.__x6_instances__.push(C),t.value.on("blank:dblclick",()=>{h()}),t.value.on("render:done",()=>{$r("#preview-container",!1),w()})},r=async()=>{let C,E,S;if(e.id){const O=await Wm(e.id);C=(O==null?void 0:O.background)||qa,E=(O==null?void 0:O.grid)||Xa,S=(O==null?void 0:O.data)||{cells:[]}}else C=e.background,E={},S=e.data;t.value.drawBackground(C),t.value.drawGrid(E),t.value.fromJSON(S),d()},i=l.ref(null),o=l.ref([]),a=l.ref([]),c=l.ref(!1),u=l.ref(!1),d=()=>{o.value=t.value.getCells().filter(C=>{var E,S,O;return((E=C==null?void 0:C.data)==null?void 0:E.type)==="text"||((S=C==null?void 0:C.data)==null?void 0:S.type)==="pipe"||((O=C==null?void 0:C.data)==null?void 0:O.type)==="arrow"}),o.value.forEach(C=>{var E,S;(S=(E=C==null?void 0:C.data)==null?void 0:E.fields)!=null&&S.length&&a.value.push({id:C==null?void 0:C.id,fields:C==null?void 0:C.data.fields})}),h()},f=l.ref(!0),h=async()=>{if(u.value=!0,!a.value.length){u.value=!1;return}if(!f.value){Ye.warning("数据正在更新中,请稍后再试");return}i.value&&clearInterval(i.value),f.value=!1,console.log("字段数据",a.value),await p(a.value),!c.value&&(i.value=setTimeout(()=>{h()},1e4))},p=async(C,E=0)=>{let S=5;if(!c.value)if(C.length>E*S){const O=C.slice(E*S,E*S+S);console.log("批次:",E,"数据:",O),E++,g(await oD(O)),await p(C,E)}else u.value=!1,f.value=!0},g=C=>{C==null||C.forEach(E=>{var O,A,V;const S=t.value.getCellById(E.id);S.data.type==="text"&&(S.label=m(S.data.content,E.fields)),S.data.type==="pipe"&&(console.log("管道详情",S,(O=E.fields)==null?void 0:O[0].value),y(S,(A=E.fields)==null?void 0:A[0].value)),S.data.type==="arrow"&&b(S,(V=E.fields)==null?void 0:V[0].value)})},m=(C,E)=>{let S=0;return C.replace(Nl,()=>{const O=E.find(A=>A.index===S);return S++,O?O.value:d0})},y=(C,E)=>{if(!C.data.isCondition)return!1;for(let S=0;S<C.data.condition.length;S++)if(Number(E)>C.data.condition[S].min&&Number(E)<=C.data.condition[S].max)return C.attr("line2/style/animation",u0(C.data.condition[S].direction)),!1},b=(C,E)=>{if(console.log(C,E),!C.data.isCondition)return!1;for(let S=0;S<C.data.condition.length;S++)if(Number(E)>C.data.condition[S].min&&Number(E)<=C.data.condition[S].max)return C.attr("arrow/style/animation",C.data.condition[S].animation===or?"flashing 2s infinite linear":""),C.attr("arrow/d",C.data.condition[S].direction===pi?Ka:qm),C.attr("arrow/display",C.data.condition[S].display),!1},w=()=>{t.value.zoomToFit({maxScale:1.4,padding:20})},x=l.shallowRef(),v=()=>{new ResizeObserver(()=>{w()}).observe(x.value)};return l.onMounted(()=>{c.value=!1,s(),r(),v()}),l.onUnmounted(()=>{c.value=!0,clearInterval(i.value)}),(C,E)=>(l.openBlock(),l.createElementBlock("div",_j,[l.createElementVNode("div",{id:"preview-container",ref_key:"previewRef",ref:x,onDblclick:w},null,544),u.value?(l.openBlock(),l.createElementBlock("div",Tj,E[0]||(E[0]=[l.createElementVNode("div",{class:"spinner1"},null,-1)]))):l.createCommentVNode("",!0)]))}}),kj={class:"form-container"},Vj={class:"footer"},Dj=Dt({__name:"group-form",props:{payload:{type:Object,default:()=>({})}},emits:["close"],setup(n,{emit:e}){const t=n,s=e,r=l.reactive({groupName:"",sort:1,isShow:1}),i=l.reactive({groupName:[{required:!0,message:"请输入分组名称",trigger:"blur"},{min:1,max:20,message:"长度在 1 到 20 个字符",trigger:"blur"}],sort:[{required:!0,message:"请输入排序",trigger:"blur"},{type:"number",message:"排序必须为数字值"}],isShow:[{required:!0,message:"请选择是否显示",trigger:"change"}]}),o=l.ref(),a=()=>{console.log(r),o.value.validate(u=>{if(u)r.id?Ya("/custom/updateGroup",r).then(d=>{d!=null&&d.isOk?(Ye.success("保存成功"),s("close",!0)):Ye.error((d==null?void 0:d.msg)||"保存失败")}):Ya("/custom/saveGroup",r).then(d=>{d!=null&&d.isOk?(Ye.success("保存成功"),s("close",!0)):Ye.error((d==null?void 0:d.msg)||"保存失败")});else return!1})},c=()=>{s("close",!1)};return l.onMounted(()=>{var u;(u=t.payload)!=null&&u.id&&(r.id=t.payload.id,r.groupName=t.payload.groupName,r.sort=t.payload.sort,r.isShow=t.payload.isShow)}),(u,d)=>{const f=l.resolveComponent("el-input"),h=l.resolveComponent("el-form-item"),p=l.resolveComponent("el-input-number"),g=l.resolveComponent("el-switch"),m=l.resolveComponent("el-button"),y=l.resolveComponent("el-form");return l.openBlock(),l.createElementBlock("div",kj,[l.createVNode(y,{ref_key:"form",ref:o,model:r,rules:i,"label-width":"90px","label-suffix":":"},{default:l.withCtx(()=>[l.createVNode(h,{label:"分组名称",prop:"groupName"},{default:l.withCtx(()=>[l.createVNode(f,{modelValue:r.groupName,"onUpdate:modelValue":d[0]||(d[0]=b=>r.groupName=b),placeholder:"请输入分组名称",clearable:""},null,8,["modelValue"])]),_:1}),l.createVNode(h,{label:"排序",prop:"sort"},{default:l.withCtx(()=>[l.createVNode(p,{modelValue:r.sort,"onUpdate:modelValue":d[1]||(d[1]=b=>r.sort=b),min:0,max:999,step:1,"controls-position":"right"},null,8,["modelValue"])]),_:1}),l.createVNode(h,{label:"是否显示",prop:"isShow"},{default:l.withCtx(()=>[l.createVNode(g,{modelValue:r.isShow,"onUpdate:modelValue":d[2]||(d[2]=b=>r.isShow=b),"active-value":1,"inactive-value":0,"active-color":"#13ce66","inactive-color":"#ff4949"},null,8,["modelValue"])]),_:1}),l.createElementVNode("div",Vj,[l.createVNode(m,{type:"primary",onClick:a},{default:l.withCtx(()=>d[3]||(d[3]=[l.createTextVNode("保存")])),_:1}),l.createVNode(m,{onClick:c},{default:l.withCtx(()=>d[4]||(d[4]=[l.createTextVNode("取消")])),_:1})])]),_:1},8,["model","rules"])])}}},[["__scopeId","data-v-807a2ed3"]]),Rj={class:"form-container"},Lj={class:"footer"},Ij=Dt({__name:"image-form",props:{payload:{type:Object,default:()=>({})}},emits:["close"],setup(n,{emit:e}){const t=e,s=n,r=l.shallowRef(null),i=l.reactive({groupId:"",id:"",imageName:"",sort:0,isShow:1,imageUrl:""}),o={imageName:[{required:!0,message:"请输入图片名称",trigger:"blur"},{min:1,max:20,message:"长度在 1 到 20 个字符",trigger:"blur"}],sort:[{required:!0,message:"请输入排序",trigger:"blur"},{type:"number",message:"排序必须为数字值"}]},a=l.ref(""),c=f=>{if(f.raw.type.indexOf("image")===-1){Ye.error("请上传图片格式的文件");return}const h=new FormData;h.append("file",f.raw),iD("/file/fileUpload",h).then(p=>{p!=null&&p.isOk?xe.isSunOs?(a.value=p==null?void 0:p.data,i.imageUrl=p==null?void 0:p.data):(a.value=Yn.defaults.baseURL+"/upload/"+(p==null?void 0:p.data),i.imageUrl=p==null?void 0:p.data):Ye.error((p==null?void 0:p.msg)||"上传失败")})},u=()=>{console.log(i),r.value.validate(f=>{if(f)Ya("/custom/savePicture",i).then(h=>{h!=null&&h.isOk?(Ye.success("保存成功"),t("close",!0)):Ye.error((h==null?void 0:h.msg)||"保存失败")});else return!1})},d=()=>{t("close",!1)};return l.onMounted(()=>{var f;(f=s.payload)!=null&&f.id&&(i.id=s.payload.id,i.imageName=s.payload.imageName,i.sort=s.payload.sort,i.isShow=s.payload.isShow,i.imageUrl=xe.isSunOs?s.payload.imageUrl:Ad(s.payload.imageUrl),a.value=i.imageUrl),i.groupId=s.payload.groupId}),(f,h)=>{const p=l.resolveComponent("el-input"),g=l.resolveComponent("el-form-item"),m=l.resolveComponent("el-input-number"),y=l.resolveComponent("el-switch"),b=l.resolveComponent("el-image"),w=l.resolveComponent("el-icon"),x=l.resolveComponent("el-upload"),v=l.resolveComponent("el-button"),C=l.resolveComponent("el-form");return l.openBlock(),l.createElementBlock("div",Rj,[l.createVNode(C,{ref_key:"form",ref:r,model:i,rules:o,"label-width":"90px","label-suffix":":"},{default:l.withCtx(()=>[l.createVNode(g,{label:"图片名称",prop:"imageName"},{default:l.withCtx(()=>[l.createVNode(p,{modelValue:i.imageName,"onUpdate:modelValue":h[0]||(h[0]=E=>i.imageName=E),placeholder:"请输入图片名称"},null,8,["modelValue"])]),_:1}),l.createVNode(g,{label:"排序",prop:"sort"},{default:l.withCtx(()=>[l.createVNode(m,{modelValue:i.sort,"onUpdate:modelValue":h[1]||(h[1]=E=>i.sort=E),min:0,max:999,step:1,"controls-position":"right"},null,8,["modelValue"])]),_:1}),l.createVNode(g,{label:"是否显示",prop:"isShow"},{default:l.withCtx(()=>[l.createVNode(y,{modelValue:i.isShow,"onUpdate:modelValue":h[2]||(h[2]=E=>i.isShow=E),"active-value":1,"inactive-value":0,"active-color":"#13ce66","inactive-color":"#ff4949"},null,8,["modelValue"])]),_:1}),l.createVNode(g,{label:"上传",prop:"image"},{default:l.withCtx(()=>[l.createVNode(x,{action:"","list-type":"picture",class:"avatar-uploader","show-file-list":!1,"on-change":c,"auto-upload":!1},{default:l.withCtx(()=>[a.value?(l.openBlock(),l.createBlock(b,{key:0,src:a.value,fit:"cover",style:{width:"64px",height:"64px"}},null,8,["src"])):(l.openBlock(),l.createBlock(w,{key:1,class:"avatar-uploader-icon"},{default:l.withCtx(()=>[l.createVNode(l.unref(bD))]),_:1}))]),_:1})]),_:1}),l.createElementVNode("div",Lj,[l.createVNode(v,{type:"primary",onClick:u},{default:l.withCtx(()=>h[3]||(h[3]=[l.createTextVNode("保存")])),_:1}),l.createVNode(v,{onClick:d},{default:l.withCtx(()=>h[4]||(h[4]=[l.createTextVNode("取消")])),_:1})])]),_:1},8,["model"])])}}},[["__scopeId","data-v-8f1bae4f"]]),Bj={class:"form-container"},jj={style:{padding:"0 10px",display:"flex","flex-direction":"column",gap:"5px","align-items":"flex-start"}},$j=["src"],zj=Dt({__name:"image-management",setup(n){const e=l.reactive({items:[]}),t=()=>{Js("/custom/groupList").then(h=>{e.items=h.data})},s=l.reactive({show:!1,title:"新增图片分组",payload:null}),r=()=>{s.show=!0,s.title="新增图片分组",s.payload=null},i=h=>{s.show=!0,s.title="编辑图片分组",s.payload={id:h.id,groupName:h.groupName,sort:h.sort,isShow:h.isShow}},o=h=>{(xe.isSunOs?Js:Gm)("/custom/removeGroup/"+h).then(g=>{g.code===200?(Ye.success("删除成功"),t()):Ye.error(g.msg||"删除失败")})},a=l.reactive({show:!1,title:"新增图片",payload:null}),c=h=>{a.show=!0,a.title="新增图片",a.payload={groupId:h}},u=h=>{a.show=!0,a.title="编辑图片",a.payload={id:h.id,groupId:h.groupId,imageName:h.imageName,sort:h.sort,isShow:h.isShow,imageUrl:h.imageUrl}},d=h=>{(xe.isSunOs?Js:Gm)("/custom/removePicture/"+h).then(g=>{g.code===200?(Ye.success("删除成功"),t()):Ye.error(g.msg||"删除失败")})},f=h=>{s.show=!1,a.show=!1,h&&t()};return l.onMounted(()=>{t()}),(h,p)=>{const g=l.resolveComponent("el-button"),m=l.resolveComponent("el-table-column"),y=l.resolveComponent("el-table"),b=l.resolveComponent("el-dialog");return l.openBlock(),l.createElementBlock("div",Bj,[l.createVNode(g,{type:"primary",onClick:r,size:"small"},{default:l.withCtx(()=>p[2]||(p[2]=[l.createTextVNode("新增图片分组")])),_:1}),l.createVNode(y,{data:e.items,border:"",height:"500"},{default:l.withCtx(()=>[l.createVNode(m,{type:"expand"},{default:l.withCtx(w=>[l.createElementVNode("div",jj,[l.createVNode(g,{type:"primary",size:"small",onClick:x=>c(w.row.id)},{default:l.withCtx(()=>p[3]||(p[3]=[l.createTextVNode("新增图片")])),_:2},1032,["onClick"]),l.createVNode(y,{data:w.row.pictureList,border:"",size:"small"},{default:l.withCtx(()=>[l.createVNode(m,{label:"名称",prop:"imageName",align:"center"}),l.createVNode(m,{label:"图片",prop:"imageUrl",align:"center"},{default:l.withCtx(x=>[l.createElementVNode("img",{src:l.unref(xe.isSunOs)?x.row.imageUrl:l.unref(Ad)(x.row.imageUrl),alt:"",style:{width:"64px",height:"64px"}},null,8,$j)]),_:1}),l.createVNode(m,{label:"排序",prop:"sort",align:"center"}),l.createVNode(m,{label:"是否显示",prop:"isShow",align:"center"},{default:l.withCtx(x=>[l.createTextVNode(l.toDisplayString(x.row.isShow===1?"是":"否"),1)]),_:1}),l.createVNode(m,{label:"操作",align:"center"},{default:l.withCtx(x=>[l.createVNode(g,{type:"primary",size:"small",onClick:v=>u(x.row)},{default:l.withCtx(()=>p[4]||(p[4]=[l.createTextVNode("编辑 ")])),_:2},1032,["onClick"]),l.createVNode(g,{type:"danger",size:"small",onClick:v=>d(x.row.id)},{default:l.withCtx(()=>p[5]||(p[5]=[l.createTextVNode("删除 ")])),_:2},1032,["onClick"])]),_:1})]),_:2},1032,["data"])])]),_:1}),l.createVNode(m,{label:"分组名称",prop:"groupName",align:"center"}),l.createVNode(m,{label:"排序",prop:"sort",align:"center"}),l.createVNode(m,{label:"是否显示",prop:"isShow",align:"center"},{default:l.withCtx(w=>[l.createTextVNode(l.toDisplayString(w.row.isShow===1?"是":"否"),1)]),_:1}),l.createVNode(m,{label:"操作",align:"center"},{default:l.withCtx(w=>[l.createVNode(g,{type:"primary",size:"small",onClick:x=>i(w.row)},{default:l.withCtx(()=>p[6]||(p[6]=[l.createTextVNode("编辑")])),_:2},1032,["onClick"]),l.createVNode(g,{type:"danger",size:"small",onClick:x=>o(w.row.id)},{default:l.withCtx(()=>p[7]||(p[7]=[l.createTextVNode("删除")])),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"]),l.createVNode(b,{modelValue:s.show,"onUpdate:modelValue":p[0]||(p[0]=w=>s.show=w),title:s.title,width:"300","close-on-click-modal":!1,"close-on-press-escape":!1},{default:l.withCtx(()=>[s.show?(l.openBlock(),l.createBlock(Dj,{key:0,payload:s.payload,onClose:f},null,8,["payload"])):l.createCommentVNode("",!0)]),_:1},8,["modelValue","title"]),l.createVNode(b,{modelValue:a.show,"onUpdate:modelValue":p[1]||(p[1]=w=>a.show=w),title:a.title,width:"300","close-on-click-modal":!1,"close-on-press-escape":!1},{default:l.withCtx(()=>[a.show?(l.openBlock(),l.createBlock(Ij,{key:0,payload:a.payload,onClose:f},null,8,["payload"])):l.createCommentVNode("",!0)]),_:1},8,["modelValue","title"])])}}},[["__scopeId","data-v-721437e3"]]),Fj={class:"page-container"},Uj={class:"tool-bar"},Hj={class:"action"},Gj={class:"el-dropdown-link"},Wj={class:"action",style:{"margin-right":"50px"}},Yj={class:"board"},qj={class:"drawing-board-box"},Xj={id:"controls"},Jj={key:0,class:"controls-label"},Kj={style:{width:"100%",height:"100%",background:"black"}},b0=Dt(Object.assign({name:"editor"},{__name:"index",props:{id:{type:String,default:""},itemId:{type:String,default:""}},emits:["getJson"],setup(n,{emit:e}){const t=n,s=l.ref(),r=l.reactive({label:"",component:l.shallowRef(null)}),i=l.ref(null),o=l.ref(null),a=()=>{window.__x6_instances__=[];const I=document.getElementById("drawing-board");s.value=new $({container:I,autoResize:!0,panning:!0,mousewheel:!0,connecting:{snap:!0,allowEdge:!0,highlight:!0,router:"orth",connectionPoint:{name:"anchor"},anchor:"center",createEdge(){return s.value.createEdge({inherit:"edge",...Qe,data:{type:c0()},zIndex:0})}}}),window.__x6_instances__.push(s.value),s.value.use(L3()),s.value.use(I3()),s.value.use(B3()),s.value.use(j3()),s.value.use(z3()),s.value.use(F3()),s.value.bindKey(["delete","backspace"],()=>{U3(s.value)}),s.value.bindKey(["ctrl+c","cmd + c"],()=>{H3(s.value)}),s.value.bindKey(["ctrl+v","cmd + v"],()=>{G3(s.value)}),s.value.bindKey(["ctrl+z","cmd + z"],()=>{W3(s.value)}),s.value.bindKey(["ctrl+y","cmd + y"],()=>{Y3(s.value)});let B=null;s.value.on("edge:click",({cell:N})=>{o.value=N,r.component=p0,r.label="线段属性",i.value=Nd()}),s.value.on("edge:mouseenter",({cell:N})=>{clearTimeout(B),N.toFront(),q3(N)}),s.value.on("edge:mouseleave",({cell:N})=>{B=setTimeout(()=>{N.toBack(),N.removeTools()},300)}),s.value.on("node:mouseenter",()=>{$r("#drawing-board",!0)}),s.value.on("node:mouseleave",()=>{$r("#drawing-board",!1)}),s.value.use(new g0),s.value.on("blank:click",({e:N,x:P,y:k})=>{o.value=s,r.component=dD,r.label="画布属性",i.value=Nd()}),s.value.on("cell:click",({cell:N})=>{var P,k;if(o.value=N,i.value=Nd(),((P=N.data)==null?void 0:P.type)==="text"){r.component=h0,r.label="文本属性";return}if(((k=N.data)==null?void 0:k.type)==="base-shape"){r.component=h0,r.label="基础图形属性";return}if((N==null?void 0:N.shape)==="edge"){r.component=p0,r.label="连线属性";return}if((N==null?void 0:N.shape)==="image"){r.component=Aj,r.label="图片属性";return}r.component=null,r.label=null}),s.value.on("render:done",()=>{$r("#drawing-board",!1),g()})},c=l.ref(),u=()=>{c.value=new gi({target:s.value,...aD,groups:[{name:"基础组件",graphPadding:30}],search(N,P){var k;return((k=N.label)==null?void 0:k.indexOf(P))!==-1},placeholder:"搜索",notFoundText:"未找到匹配项",getDragNode:N=>{const P=N.clone({keepId:!0});return P.label!=="文本"&&(P.label=""),P}});const I=s.value.createNode({...lD}),B=m0.map(N=>(N.ports=y0,s.value.createNode(N)));c.value.load([I,...B],"基础组件"),Js("/custom/groupList").then(N=>{const P=(N==null?void 0:N.data)||[];P==null||P.forEach(k=>{c.value.addGroup({name:k==null?void 0:k.groupName,graphPadding:30});const j=k==null?void 0:k.pictureList.map(H=>{const K={shape:"image",imageUrl:xe.isSunOs?H==null?void 0:H.imageUrl:Ad(H==null?void 0:H.imageUrl),ports:y0,width:64,height:64,label:H.imageName};return s.value.createNode(K)});c.value.load(j,k==null?void 0:k.groupName),document.getElementById("stencil").appendChild(c.value.container)})}).finally(()=>{setTimeout(()=>{const N=c.value.container,P=N.querySelectorAll(".x6-node"),k=m0.length;N.addEventListener("mouseenter",j,!0),N.addEventListener("mouseleave",H,!0),P.forEach((K,R)=>{const _=R>k,z=K.querySelector("text");_&&z&&(Object.assign(z.style,{display:"none",fontSize:"12px",fill:"#ffffff"}),z.setAttribute("x","0%"),z.setAttribute("y","40"),K.style.position="relative",K.style.cursor="pointer")});function j(K){const R=K.target.closest(".x6-node");if(R){const _=Array.from(P).indexOf(R),z=R.querySelector("text");_>k&&z&&(z.style.display="block")}}function H(K){const R=K.target.closest(".x6-node");if(R){const _=Array.from(P).indexOf(R),z=R.querySelector("text");_>k&&z&&(z.style.display="none")}}return()=>{N.removeEventListener("mouseenter",j,!0),N.removeEventListener("mouseleave",H,!0)}},200)})},d=I=>{switch(I){case"snapLine":s.value.isSnaplineEnabled()?(s.value.disableSnapline(),Ye.warning("关闭对齐线")):(s.value.enableSnapline(),Ye.success("开启对齐线"));break;case"select":s.value.isSelectionEnabled()?(s.value.disableSelection(),Ye.warning("关闭框选")):(s.value.enableSelection(),Ye.success("开启框选"));break;case"drawLine":p();break;case"adaptive":g();break;case"shortcuts":y();break;case"image":w();break;case"clear":x();break;case"export":v();break}},f=l.ref(!1),h=l.ref(null),p=()=>{f.value=!0;const I=new Date;s.value.startBatch(I),s.value.disablePanning(),s.value.once("blank:mousedown",({e:B,x:N,y:P})=>{f.value&&(h.value=s.value.addEdge({source:{x:N,y:P},target:{x:N,y:P},...Qe,data:{type:c0(),isConnector:!1},zIndex:0}))}),s.value.on("blank:mousemove",({e:B,x:N,y:P})=>{f.value&&h.value.setTarget({x:N,y:P})}),s.value.on("blank:mouseup",({e:B,x:N,y:P})=>{f.value=!1,s.value.enablePanning(),s.value.stopBatch(I)})},g=()=>{s.value.zoomToFit({maxScale:1,padding:20})},m=l.reactive({show:!1}),y=()=>{m.show=!0},b=l.reactive({show:!1}),w=()=>{b.show=!0},x=()=>{s.value.clearCells(),s.value.drawBackground(qa),s.value.drawGrid(Xa),Ye.success("清空成功")},v=()=>{const I=W().format("YYYYMMDDHHmmss");s.value.exportPNG(I,{padding:10,quality:1,backgroundColor:s.value.options.background.color})},C=e,E=l.reactive({show:!1,background:null,grid:null,data:null}),S=()=>{E.background=s.value.options.background,E.grid=s.value.options.grid,E.data=s.value.toJSON(),E.show=!0},O=()=>{E.show=!1},A=()=>{C("getJson",{background:s.value.options.background,grid:s.value.options.grid,data:s.value.toJSON()})},V=async()=>{if(!t.id){s.value.drawBackground(qa),s.value.drawGrid(Xa),s.value.fromJSON({cells:[]});return}const I=await Wm(t.id);s.value.drawBackground((I==null?void 0:I.background)||qa),s.value.drawGrid((I==null?void 0:I.grid)||Xa),s.value.fromJSON((I==null?void 0:I.data)||{cells:[]})},T=l.shallowRef(null),D=()=>{new ResizeObserver(()=>{g()}).observe(T.value)};return l.onMounted(()=>{a(),u(),V(),D()}),(I,B)=>{const N=l.resolveComponent("el-icon"),P=l.resolveComponent("el-button"),k=l.resolveComponent("el-dropdown-item"),j=l.resolveComponent("el-dropdown-menu"),H=l.resolveComponent("el-dropdown"),K=l.resolveComponent("el-scrollbar"),R=l.resolveComponent("el-dialog"),_=l.resolveComponent("el-drawer");return l.openBlock(),l.createElementBlock("div",Fj,[l.createElementVNode("div",Uj,[l.createElementVNode("div",Hj,[l.createVNode(H,{onCommand:d},{dropdown:l.withCtx(()=>[l.createVNode(j,null,{default:l.withCtx(()=>[l.createVNode(k,{command:"snapLine"},{default:l.withCtx(()=>B[4]||(B[4]=[l.createTextVNode("对齐线")])),_:1}),l.createVNode(k,{command:"select"},{default:l.withCtx(()=>B[5]||(B[5]=[l.createTextVNode("框选")])),_:1}),l.createVNode(k,{command:"drawLine"},{default:l.withCtx(()=>B[6]||(B[6]=[l.createTextVNode("绘制直线")])),_:1}),l.createVNode(k,{command:"adaptive"},{default:l.withCtx(()=>B[7]||(B[7]=[l.createTextVNode("视图自适应")])),_:1}),l.createVNode(k,{command:"shortcuts"},{default:l.withCtx(()=>B[8]||(B[8]=[l.createTextVNode("查看快捷键")])),_:1}),l.createVNode(k,{command:"image"},{default:l.withCtx(()=>B[9]||(B[9]=[l.createTextVNode("图片管理")])),_:1}),l.createVNode(k,{command:"clear"},{default:l.withCtx(()=>B[10]||(B[10]=[l.createTextVNode("清空画布")])),_:1}),l.createVNode(k,{command:"export"},{default:l.withCtx(()=>B[11]||(B[11]=[l.createTextVNode("导出成图片")])),_:1})]),_:1})]),default:l.withCtx(()=>[l.createElementVNode("span",Gj,[l.createVNode(P,{size:"small",text:""},{default:l.withCtx(()=>[B[3]||(B[3]=l.createTextVNode("工具 ")),l.createVNode(N,null,{default:l.withCtx(()=>[l.createVNode(l.unref(fD))]),_:1})]),_:1})])]),_:1})]),l.createElementVNode("div",Wj,[l.createVNode(l.unref(Jg),{content:"预览",placement:"bottom"},{default:l.withCtx(()=>[l.createVNode(P,{size:"small",icon:l.unref(xD),onClick:S},null,8,["icon"])]),_:1}),l.createVNode(l.unref(Jg),{content:"保存",placement:"bottom"},{default:l.withCtx(()=>[l.createVNode(P,{size:"small",icon:l.unref(mD),onClick:A},null,8,["icon"])]),_:1})])]),l.createElementVNode("div",Yj,[B[12]||(B[12]=l.createElementVNode("div",{id:"stencil"},null,-1)),l.createElementVNode("div",qj,[l.createElementVNode("div",{id:"drawing-board",ref_key:"drawBoard",ref:T},null,512)]),l.createElementVNode("div",Xj,[r.label?(l.openBlock(),l.createElementBlock("div",Jj,l.toDisplayString(r.label),1)):l.createCommentVNode("",!0),l.createVNode(K,null,{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(r.component),{graph:s.value,payload:o.value,key:i.value,itemId:t.itemId},null,8,["graph","payload","itemId"]))]),_:1})])]),l.createVNode(R,{modelValue:m.show,"onUpdate:modelValue":B[0]||(B[0]=z=>m.show=z),width:"400px",title:"快捷键","close-on-click-modal":!1,"close-on-press-escape":!1},{default:l.withCtx(()=>[l.createVNode(vj)]),_:1},8,["modelValue"]),l.createVNode(R,{modelValue:b.show,"onUpdate:modelValue":B[1]||(B[1]=z=>b.show=z),width:"800px",title:"图片管理","close-on-click-modal":!1,"close-on-press-escape":!1},{default:l.withCtx(()=>[l.createVNode(zj)]),_:1},8,["modelValue"]),l.createVNode(_,{class:"no-border-drawer",modelValue:E.show,"onUpdate:modelValue":B[2]||(B[2]=z=>E.show=z),onClose:O,title:"预览",direction:"ttb",size:"100%"},{default:l.withCtx(()=>[l.createElementVNode("div",Kj,[E.show?(l.openBlock(),l.createBlock(_d,{key:0,background:E.background,grid:E.grid,data:E.data},null,8,["background","grid","data"])):l.createCommentVNode("",!0)])]),_:1},8,["modelValue"])])}}}),[["__scopeId","data-v-f7388854"]]),Zj=[b0,_d],w0=n=>{Zj.forEach(e=>{n.component(e.name,e)})};typeof window<"u"&&window.Vue&&w0(window.Vue),xe.isSunOs=!1;const Qj=n=>{xe.isSunOs=n},e$={install:w0};xe.WiringDiagramEditor=b0,xe.WiringDiagramPreview=_d,xe.default=e$,xe.setBaseURL=sD,xe.setIsSunOs=Qj,xe.setToken=rD,Object.defineProperties(xe,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
742
|
+
`;var Mj=function(n,e,t,s){var r=arguments.length,i=r<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,t):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,s);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(i=(r<3?o(i):r>3?o(e,t,i):o(e,t))||i);return r>3&&i&&Object.defineProperty(e,t,i),i};class gi extends be{get targetScroller(){return this.options.target.getPlugin("scroller")}get targetGraph(){return this.options.target}get targetModel(){return this.targetGraph.model}constructor(e={}){super(),this.name="stencil",Wr(this.name,Oj),this.graphs={},this.groups={},this.options=Object.assign(Object.assign({},gi.defaultOptions),e),this.init()}init(){this.dnd=new Ts(this.options),this.onSearch=vp(this.onSearch,200),this.initContainer(),this.initSearch(),this.initContent(),this.initGroups(),this.setTitle(),this.startListening()}load(e,t){return Array.isArray(e)?this.loadGroup(e,t):this.options.groups&&Object.keys(this.options.groups).forEach(s=>{e[s]&&this.loadGroup(e[s],s)}),this}unload(e,t){return Array.isArray(e)?this.loadGroup(e,t,!0):this.options.groups&&Object.keys(this.options.groups).forEach(s=>{e[s]&&this.loadGroup(e[s],s,!0)}),this}toggleGroup(e){return this.isGroupCollapsed(e)?this.expandGroup(e):this.collapseGroup(e),this}collapseGroup(e){if(this.isGroupCollapsable(e)){const t=this.groups[e];t&&!this.isGroupCollapsed(e)&&(this.trigger("group:collapse",{name:e}),J(t,"collapsed"))}return this}expandGroup(e){if(this.isGroupCollapsable(e)){const t=this.groups[e];t&&this.isGroupCollapsed(e)&&(this.trigger("group:expand",{name:e}),Re(t,"collapsed"))}return this}isGroupCollapsable(e){const t=this.groups[e];return Pn(t,"collapsable")}isGroupCollapsed(e){const t=this.groups[e];return t&&Pn(t,"collapsed")}collapseGroups(){return Object.keys(this.groups).forEach(e=>this.collapseGroup(e)),this}expandGroups(){return Object.keys(this.groups).forEach(e=>this.expandGroup(e)),this}resizeGroup(e,t){const s=this.graphs[e];return s&&s.resize(t.width,t.height),this}addGroup(e){const t=Array.isArray(e)?e:[e];this.options.groups?this.options.groups.push(...t):this.options.groups=t,t.forEach(s=>this.initGroup(s))}removeGroup(e){const t=Array.isArray(e)?e:[e];this.options.groups&&(this.options.groups=this.options.groups.filter(s=>!t.includes(s.name)),t.forEach(s=>{const r=this.graphs[s];this.unregisterGraphEvents(r),r.dispose(),delete this.graphs[s];const i=this.groups[s];Gt(i),delete this.groups[s]}))}initContainer(){this.container=document.createElement("div"),J(this.container,this.prefixClassName(Mt.base)),fe(this.container,"data-not-found-text",this.options.notFoundText||"No matches found")}initContent(){this.content=document.createElement("div"),J(this.content,this.prefixClassName(Mt.content)),bs(this.content,this.container)}initSearch(){this.options.search&&(J(this.container,"searchable"),Rt(this.container,this.renderSearch()))}initGroup(e){const t=this.options.stencilGraphOptions||{},s=document.createElement("div");J(s,this.prefixClassName(Mt.group)),fe(s,"data-name",e.name),(e.collapsable==null&&this.options.collapsable||e.collapsable!==!1)&&J(s,"collapsable"),pn(s,"collapsed",e.collapsed===!0);const r=document.createElement("h3");J(r,this.prefixClassName(Mt.groupTitle)),r.innerHTML=e.title||e.name;const i=document.createElement("div");J(i,this.prefixClassName(Mt.groupContent));const o=e.graphOptions,a=new $(Object.assign(Object.assign(Object.assign({},t),o),{container:document.createElement("div"),model:t.model||new et,width:e.graphWidth||this.options.stencilGraphWidth,height:e.graphHeight||this.options.stencilGraphHeight,interacting:!1,preventDefaultBlankAction:!1}));this.registerGraphEvents(a),Rt(i,a.container),Rt(s,[r,i]),bs(s,this.content),this.groups[e.name]=s,this.graphs[e.name]=a}initGroups(){if(this.clearGroups(),this.setCollapsableState(),this.options.groups&&this.options.groups.length)this.options.groups.forEach(e=>{this.initGroup(e)});else{const e=this.options.stencilGraphOptions||{},t=new $(Object.assign(Object.assign({},e),{container:document.createElement("div"),model:e.model||new et,width:this.options.stencilGraphWidth,height:this.options.stencilGraphHeight,interacting:!1,preventDefaultBlankAction:!1}));Rt(this.content,t.container),this.graphs[Co.defaultGroupName]=t}}setCollapsableState(){this.options.collapsable=this.options.collapsable&&this.options.groups&&this.options.groups.some(e=>e.collapsable!==!1),this.options.collapsable?(J(this.container,"collapsable"),this.options.groups&&this.options.groups.every(t=>t.collapsed||t.collapsable===!1)?J(this.container,"collapsed"):Re(this.container,"collapsed")):Re(this.container,"collapsable")}setTitle(){const e=document.createElement("div");J(e,this.prefixClassName(Mt.title)),e.innerHTML=this.options.title,bs(e,this.container)}renderSearch(){const e=document.createElement("div");J(e,this.prefixClassName(Mt.search));const t=document.createElement("input");return fe(t,{type:"search",placeholder:this.options.placeholder||"Search"}),J(t,this.prefixClassName(Mt.searchText)),Rt(e,t),e}startListening(){const e=this.prefixClassName(Mt.title),t=this.prefixClassName(Mt.searchText),s=this.prefixClassName(Mt.groupTitle);this.delegateEvents({[`click .${e}`]:"onTitleClick",[`touchstart .${e}`]:"onTitleClick",[`click .${s}`]:"onGroupTitleClick",[`touchstart .${s}`]:"onGroupTitleClick",[`input .${t}`]:"onSearch",[`focusin .${t}`]:"onSearchFocusIn",[`focusout .${t}`]:"onSearchFocusOut"})}stopListening(){this.undelegateEvents()}registerGraphEvents(e){e.on("cell:mousedown",this.onDragStart,this)}unregisterGraphEvents(e){e.off("cell:mousedown",this.onDragStart,this)}loadGroup(e,t,s){const r=this.getModel(t);if(r){const c=e.map(u=>He.isNode(u)?u:He.create(u));s===!0?r.removeCells(c):r.resetCells(c)}const i=this.getGroup(t);let o=this.options.stencilGraphHeight;i&&i.graphHeight!=null&&(o=i.graphHeight);const a=i&&i.layout||this.options.layout;if(a&&r&&ne(a,this,r,i),!o){const c=this.getGraph(t);c.fitToContent({minWidth:c.options.width,gridHeight:1,padding:i&&i.graphPadding||this.options.stencilGraphPadding||10})}return this}onDragStart(e){const{e:t,node:s}=e,r=this.getGroupByNode(s);r&&r.nodeMovable===!1||this.dnd.start(s,t)}filter(e,t){const s=Object.keys(this.graphs).reduce((r,i)=>{const o=this.graphs[i],a=i===Co.defaultGroupName?null:i,c=o.model.getNodes().filter(h=>{let p=!1;typeof t=="function"?p=ne(t,this,h,e,a,this):typeof t=="boolean"?p=t:p=this.isCellMatched(h,e,t,e.toLowerCase()!==e);const g=o.renderer.findViewByCell(h);return g&&pn(g.container,"unmatched",!p),p}),u=c.length>0,d=this.options,f=new et;return f.resetCells(c),d.layout&&ne(d.layout,this,f,this.getGroup(i)),this.groups[i]&&pn(this.groups[i],"unmatched",!u),o.fitToContent({gridWidth:1,gridHeight:1,padding:d.stencilGraphPadding||10}),r||u},!1);pn(this.container,"not-found",!s)}isCellMatched(e,t,s,r){return t&&s?Object.keys(s).some(i=>{if(i==="*"||e.shape===i){const o=s[i];return typeof o=="boolean"?o:(Array.isArray(o)?o:[o]).some(c=>{let u=e.getPropByPath(c);return u!=null?(u=`${u}`,r||(u=u.toLowerCase()),u.indexOf(t)>=0):!1})}return!1}):!0}onSearch(e){this.filter(e.target.value,this.options.search)}onSearchFocusIn(){J(this.container,"is-focused")}onSearchFocusOut(){Re(this.container,"is-focused")}onTitleClick(){this.options.collapsable&&(pn(this.container,"collapsed"),Pn(this.container,"collapsed")?this.collapseGroups():this.expandGroups())}onGroupTitleClick(e){const t=e.target.closest(`.${this.prefixClassName(Mt.group)}`);t&&this.toggleGroup(fe(t,"data-name")||"");const s=Object.keys(this.groups).every(r=>{const i=this.getGroup(r),o=this.groups[r];return i&&i.collapsable===!1||Pn(o,"collapsed")});pn(this.container,"collapsed",s)}getModel(e){const t=this.getGraph(e);return t?t.model:null}getGraph(e){return this.graphs[e||Co.defaultGroupName]}getGroup(e){const t=this.options.groups;return e!=null&&t&&t.length?t.find(s=>s.name===e):null}getGroupByNode(e){const t=this.options.groups;return t?t.find(s=>{const r=this.getModel(s.name);return r?r.has(e.id):!1}):null}clearGroups(){Object.keys(this.graphs).forEach(e=>{const t=this.graphs[e];this.unregisterGraphEvents(t),t.dispose()}),Object.keys(this.groups).forEach(e=>{const t=this.groups[e];Gt(t)}),this.graphs={},this.groups={}}onRemove(){this.clearGroups(),this.dnd.remove(),this.stopListening(),this.undelegateDocumentEvents()}dispose(){this.remove(),Yr(this.name)}}Mj([be.dispose()],gi.prototype,"dispose",null),function(n){n.defaultOptions=Object.assign({stencilGraphWidth:200,stencilGraphHeight:800,title:"Stencil",collapsable:!1,placeholder:"Search",notFoundText:"No matches found",layout(e,t){const s={columnWidth:this.options.stencilGraphWidth/2-10,columns:2,rowHeight:80,resizeToFit:!1,dx:10,dy:10};Ej(e,Object.assign(Object.assign(Object.assign({},s),this.options.layoutOptions),t?t.layoutOptions:{}))}},Ts.defaults)}(gi||(gi={}));var Mt;(function(n){n.base="widget-stencil",n.title=`${n.base}-title`,n.search=`${n.base}-search`,n.searchText=`${n.search}-text`,n.content=`${n.base}-content`,n.group=`${n.base}-group`,n.groupTitle=`${n.group}-title`,n.groupContent=`${n.group}-content`})(Mt||(Mt={}));var Co;(function(n){n.defaultGroupName="__default__"})(Co||(Co={})),$.prototype.toSVG=function(n,e){const t=this.getPlugin("export");t&&t.toSVG(n,e)},$.prototype.toPNG=function(n,e){const t=this.getPlugin("export");t&&t.toPNG(n,e)},$.prototype.toJPEG=function(n,e){const t=this.getPlugin("export");t&&t.toJPEG(n,e)},$.prototype.exportPNG=function(n,e){const t=this.getPlugin("export");t&&t.exportPNG(n,e)},$.prototype.exportJPEG=function(n,e){const t=this.getPlugin("export");t&&t.exportJPEG(n,e)},$.prototype.exportSVG=function(n,e){const t=this.getPlugin("export");t&&t.exportSVG(n,e)};var Pj=function(n,e,t,s){var r=arguments.length,i=r<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,t):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,s);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(i=(r<3?o(i):r>3?o(e,t,i):o(e,t))||i);return r>3&&i&&Object.defineProperty(e,t,i),i};class g0 extends ke{constructor(){super(),this.name="export"}get view(){return this.graph.view}init(e){this.graph=e}exportPNG(e="chart",t={}){this.toPNG(s=>{Ks.downloadDataUri(s,e)},t)}exportJPEG(e="chart",t={}){this.toPNG(s=>{Ks.downloadDataUri(s,e)},t)}exportSVG(e="chart",t={}){this.toSVG(s=>{Ks.downloadDataUri(Ks.svgToDataUrl(s),e)},t)}toSVG(e,t={}){this.notify("before:export",t);const s=this.view.svg,r=oe.create(s).clone();let i=r.node;const o=r.findOne(`.${this.view.prefixClassName("graph-svg-stage")}`),a=t.viewBox||this.graph.graphToLocal(this.graph.getContentBBox()),c=t.preserveDimensions;if(c){const f=typeof c=="boolean"?a:c;r.attr({width:f.width,height:f.height})}if(r.removeAttribute("style").attr("viewBox",[a.x,a.y,a.width,a.height].join(" ")),o.removeAttribute("transform"),t.copyStyles!==!1){const f=s.ownerDocument,h=Array.from(s.querySelectorAll("*")),p=Array.from(i.querySelectorAll("*")),g=f.styleSheets.length,m=[];for(let w=g-1;w>=0;w-=1)m[w]=f.styleSheets[w],f.styleSheets[w].disabled=!0;const y={};h.forEach((w,x)=>{const v=window.getComputedStyle(w,null),C={};Object.keys(v).forEach(E=>{C[E]=v.getPropertyValue(E)}),y[x]=C}),g!==f.styleSheets.length&&m.forEach((w,x)=>{f.styleSheets[x]=w});for(let w=0;w<g;w+=1)f.styleSheets[w].disabled=!1;const b={};h.forEach((w,x)=>{const v=window.getComputedStyle(w,null),C=y[x],E={};Object.keys(v).forEach(S=>{!Lc(S)&&v.getPropertyValue(S)!==C[S]&&(E[S]=v.getPropertyValue(S))}),b[x]=E}),p.forEach((w,x)=>{Xe(w,b[x])})}const u=t.stylesheet;if(typeof u=="string"){const f=s.ownerDocument.implementation.createDocument(null,"xml",null).createCDATASection(u);r.prepend(oe.create("style",{type:"text/css"},[f]))}const d=()=>{const f=t.beforeSerialize;if(typeof f=="function"){const p=ne(f,this.graph,i);p instanceof SVGSVGElement&&(i=p)}const h=new XMLSerializer().serializeToString(i).replace(/ /g," ");this.notify("after:export",t),e(h)};if(t.serializeImages){const f=r.find("image").map(h=>new Promise(p=>{const g=h.attr("xlink:href")||h.attr("href");Ks.imageToDataUri(g,(m,y)=>{!m&&y&&h.attr("xlink:href",y),p()})}));Promise.all(f).then(d)}else d()}toDataURL(e,t){let s=t.viewBox||this.graph.getContentBBox();const r=gs(t.padding);t.width&&t.height&&(r.left+r.right>=t.width&&(r.left=r.right=0),r.top+r.bottom>=t.height&&(r.top=r.bottom=0));const i=new U(-r.left,-r.top,r.left+r.right,r.top+r.bottom);if(t.width&&t.height){const d=s.width+r.left+r.right,f=s.height+r.top+r.bottom;i.scale(d/t.width,f/t.height)}s=U.create(s).moveAndExpand(i);const o=typeof t.width=="number"&&typeof t.height=="number"?{width:t.width,height:t.height}:s;let a=t.ratio?parseFloat(t.ratio):1;(!Number.isFinite(a)||a===0)&&(a=1);const c={width:Math.max(Math.round(o.width*a),1),height:Math.max(Math.round(o.height*a),1)};{const d=document.createElement("canvas"),f=d.getContext("2d");d.width=c.width,d.height=c.height;const h=c.width-1,p=c.height-1;f.fillStyle="rgb(1,1,1)",f.fillRect(h,p,1,1);const g=f.getImageData(h,p,1,1).data;if(g[0]!==1||g[1]!==1||g[2]!==1)throw new Error("size exceeded")}const u=new Image;u.onload=()=>{const d=document.createElement("canvas");d.width=c.width,d.height=c.height;const f=d.getContext("2d");f.fillStyle=t.backgroundColor||"white",f.fillRect(0,0,c.width,c.height);try{f.drawImage(u,0,0,c.width,c.height);const h=d.toDataURL(t.type,t.quality);e(h)}catch{}},this.toSVG(d=>{u.src=`data:image/svg+xml,${encodeURIComponent(d)}`},Object.assign(Object.assign({},t),{viewBox:s,serializeImages:!0,preserveDimensions:Object.assign({},c)}))}toPNG(e,t={}){this.toDataURL(e,Object.assign(Object.assign({},t),{type:"image/png"}))}toJPEG(e,t={}){this.toDataURL(e,Object.assign(Object.assign({},t),{type:"image/jpeg"}))}notify(e,t){this.trigger(e,t),this.graph.trigger(e,t)}dispose(){this.off()}}Pj([ke.dispose()],g0.prototype,"dispose",null);const Nj={class:"control-box"},Aj=Dt({__name:"index",props:{payload:Object},setup(n){const e=n,t=l.ref("3"),s=l.ref([]),r=()=>{s.value=JSON.parse(JSON.stringify(e.payload.getPorts().map(u=>({id:u.id,attrs:u.attrs,args:{x:Number(u.args.x.replace("%","")),y:Number(u.args.y.replace("%",""))}}))))},i=()=>{const u=Du;u.attrs.text.text=`${e.payload.getPorts().length+1}`,u.args.x="50%",u.args.y="50%",e.payload.addPorts([{group:"ports",...u}]),r()},o=()=>{$r("#drawing-board",!0)},a=(u,d,f)=>{e.payload.portProp(u,"args/"+d,f+"%"),r()},c=u=>{e.payload.removePort(u),r()};return l.onMounted(()=>{r()}),(u,d)=>{const f=l.resolveComponent("el-button"),h=l.resolveComponent("el-table-column"),p=l.resolveComponent("el-slider"),g=l.resolveComponent("el-icon"),m=l.resolveComponent("el-table"),y=l.resolveComponent("el-collapse-item"),b=l.resolveComponent("el-collapse");return l.openBlock(),l.createElementBlock("div",Nj,[l.createVNode(b,{modelValue:t.value,"onUpdate:modelValue":d[0]||(d[0]=w=>t.value=w),accordion:""},{default:l.withCtx(()=>[l.createVNode(y,{title:"连接桩设置",name:"3"},{default:l.withCtx(()=>[l.createVNode(f,{type:"primary",onClick:i,size:"small"},{default:l.withCtx(()=>d[1]||(d[1]=[l.createTextVNode("添加连接桩")])),_:1}),l.createVNode(f,{type:"primary",onClick:o,size:"small"},{default:l.withCtx(()=>d[2]||(d[2]=[l.createTextVNode("显示连接桩")])),_:1}),l.createVNode(m,{data:s.value,border:"",size:"small",style:{"margin-top":"10px"}},{default:l.withCtx(()=>[l.createVNode(h,{label:"ID",width:"50",align:"center"},{default:l.withCtx(({row:w})=>[l.createTextVNode(l.toDisplayString(w.attrs.text.text),1)]),_:1}),l.createVNode(h,{label:"x",width:"100",align:"center"},{default:l.withCtx(({row:w})=>[l.createVNode(p,{modelValue:w.args.x,"onUpdate:modelValue":x=>w.args.x=x,min:0,max:100,step:1,onInput:x=>a(w.id,"x",x)},null,8,["modelValue","onUpdate:modelValue","onInput"])]),_:1}),l.createVNode(h,{label:"y",width:"100",align:"center"},{default:l.withCtx(({row:w})=>[l.createVNode(p,{modelValue:w.args.y,"onUpdate:modelValue":x=>w.args.y=x,min:0,max:100,step:1,onInput:x=>a(w.id,"y",x)},null,8,["modelValue","onUpdate:modelValue","onInput"])]),_:1}),l.createVNode(h,{label:"操作",width:"70",align:"center"},{default:l.withCtx(({row:w})=>[l.createVNode(f,{type:"danger",size:"small",onClick:x=>c(w.id)},{default:l.withCtx(()=>[l.createVNode(g,null,{default:l.withCtx(()=>[l.createVNode(l.unref(Jm))]),_:1})]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])]),_:1})]),_:1},8,["modelValue"])])}}},[["__scopeId","data-v-b280098c"]]),m0=[{shape:"rect",width:60,height:5,attrs:{body:{fill:"#ffffff",stroke:"#ffffff",strokeWidth:0}},data:{type:"base-shape"}},{shape:"rect",width:60,height:20,attrs:{body:{fill:"#ffffff",stroke:"#ffffff",strokeWidth:1}},data:{type:"base-shape",label:"母线"}},{shape:"circle",width:40,height:40,attrs:{body:{fill:"#ffffff",stroke:"#ffffff",strokeWidth:1}},data:{type:"base-shape"}},{shape:"ellipse",width:60,height:40,attrs:{body:{fill:"#ffffff",stroke:"#ffffff"}},data:{type:"base-shape"}}],y0={groups:{ports:{position:"absolute",args:{x:0,y:0},attrs:{circle:{magnet:!0,stroke:"#8f8f8f",r:4}},label:{position:"top"}}}},_j={style:{width:"100%",height:"100%",position:"relative"}},Tj={key:0,class:"spinner"},_d=Object.assign({name:"wiring-diagram-preview"},{__name:"index",props:{id:{type:String,default:""},background:{type:Object,default:()=>({})},grid:{type:Object,default:()=>({})},data:{type:Object,default:()=>({})}},setup(n){const e=n,t=l.ref(),s=()=>{window.__x6_instances__=[];const C=document.getElementById("preview-container");t.value=new $({container:C,autoResize:!0,panning:!0,mousewheel:!0,connecting:{router:"orth",connectionPoint:{name:"anchor"},anchor:"center"},interacting:{nodeMovable:!1,magnetConnectable:!1,edgeMovable:!1,edgeLabelMovable:!1,arrowheadMovable:!1,vertexMovable:!1,vertexAddable:!1,vertexDeletable:!1}}),window.__x6_instances__.push(C),t.value.on("blank:dblclick",()=>{h()}),t.value.on("render:done",()=>{$r("#preview-container",!1),w()})},r=async()=>{let C,E,S;if(e.id){const O=await Wm(e.id);C=(O==null?void 0:O.background)||qa,E=(O==null?void 0:O.grid)||Xa,S=(O==null?void 0:O.data)||{cells:[]}}else C=e.background,E={},S=e.data;t.value.drawBackground(C),t.value.drawGrid(E),t.value.fromJSON(S),d()},i=l.ref(null),o=l.ref([]),a=l.ref([]),c=l.ref(!1),u=l.ref(!1),d=()=>{o.value=t.value.getCells().filter(C=>{var E,S,O;return((E=C==null?void 0:C.data)==null?void 0:E.type)==="text"||((S=C==null?void 0:C.data)==null?void 0:S.type)==="pipe"||((O=C==null?void 0:C.data)==null?void 0:O.type)==="arrow"}),o.value.forEach(C=>{var E,S;(S=(E=C==null?void 0:C.data)==null?void 0:E.fields)!=null&&S.length&&a.value.push({id:C==null?void 0:C.id,fields:C==null?void 0:C.data.fields})}),h()},f=l.ref(!0),h=async()=>{if(u.value=!0,!a.value.length){u.value=!1;return}if(!f.value){Ye.warning("数据正在更新中,请稍后再试");return}i.value&&clearInterval(i.value),f.value=!1,console.log("字段数据",a.value),await p(a.value),!c.value&&(i.value=setTimeout(()=>{h()},1e4))},p=async(C,E=0)=>{let S=5;if(!c.value)if(C.length>E*S){const O=C.slice(E*S,E*S+S);console.log("批次:",E,"数据:",O),E++,g(await oD(O)),await p(C,E)}else u.value=!1,f.value=!0},g=C=>{C==null||C.forEach(E=>{var O,A,V;const S=t.value.getCellById(E.id);S.data.type==="text"&&(S.label=m(S.data.content,E.fields)),S.data.type==="pipe"&&(console.log("管道详情",S,(O=E.fields)==null?void 0:O[0].value),y(S,(A=E.fields)==null?void 0:A[0].value)),S.data.type==="arrow"&&b(S,(V=E.fields)==null?void 0:V[0].value)})},m=(C,E)=>{let S=0;return C.replace(Nl,()=>{const O=E.find(A=>A.index===S);return S++,O?O.value:d0})},y=(C,E)=>{if(!C.data.isCondition)return!1;for(let S=0;S<C.data.condition.length;S++)if(Number(E)>C.data.condition[S].min&&Number(E)<=C.data.condition[S].max)return C.attr("line2/style/animation",u0(C.data.condition[S].direction)),!1},b=(C,E)=>{if(console.log(C,E),!C.data.isCondition)return!1;for(let S=0;S<C.data.condition.length;S++)if(Number(E)>C.data.condition[S].min&&Number(E)<=C.data.condition[S].max)return C.attr("arrow/style/animation",C.data.condition[S].animation===or?"flashing 2s infinite linear":""),C.attr("arrow/d",C.data.condition[S].direction===pi?Ka:qm),C.attr("arrow/display",C.data.condition[S].display),!1},w=()=>{t.value.zoomToFit({maxScale:1.4,padding:20})},x=l.shallowRef(),v=()=>{new ResizeObserver(()=>{w()}).observe(x.value)};return l.onMounted(()=>{c.value=!1,s(),r(),v()}),l.onUnmounted(()=>{c.value=!0,clearInterval(i.value)}),(C,E)=>(l.openBlock(),l.createElementBlock("div",_j,[l.createElementVNode("div",{id:"preview-container",ref_key:"previewRef",ref:x,onDblclick:w},null,544),u.value?(l.openBlock(),l.createElementBlock("div",Tj,E[0]||(E[0]=[l.createElementVNode("div",{class:"spinner1"},null,-1)]))):l.createCommentVNode("",!0)]))}}),kj={class:"form-container"},Vj={class:"footer"},Dj=Dt({__name:"group-form",props:{payload:{type:Object,default:()=>({})}},emits:["close"],setup(n,{emit:e}){const t=n,s=e,r=l.reactive({groupName:"",sort:1,isShow:1}),i=l.reactive({groupName:[{required:!0,message:"请输入分组名称",trigger:"blur"},{min:1,max:20,message:"长度在 1 到 20 个字符",trigger:"blur"}],sort:[{required:!0,message:"请输入排序",trigger:"blur"},{type:"number",message:"排序必须为数字值"}],isShow:[{required:!0,message:"请选择是否显示",trigger:"change"}]}),o=l.ref(),a=()=>{console.log(r),o.value.validate(u=>{if(u)r.id?Ya("/custom/updateGroup",r).then(d=>{d!=null&&d.isOk?(Ye.success("保存成功"),s("close",!0)):Ye.error((d==null?void 0:d.msg)||"保存失败")}):Ya("/custom/saveGroup",r).then(d=>{d!=null&&d.isOk?(Ye.success("保存成功"),s("close",!0)):Ye.error((d==null?void 0:d.msg)||"保存失败")});else return!1})},c=()=>{s("close",!1)};return l.onMounted(()=>{var u;(u=t.payload)!=null&&u.id&&(r.id=t.payload.id,r.groupName=t.payload.groupName,r.sort=t.payload.sort,r.isShow=t.payload.isShow)}),(u,d)=>{const f=l.resolveComponent("el-input"),h=l.resolveComponent("el-form-item"),p=l.resolveComponent("el-input-number"),g=l.resolveComponent("el-switch"),m=l.resolveComponent("el-button"),y=l.resolveComponent("el-form");return l.openBlock(),l.createElementBlock("div",kj,[l.createVNode(y,{ref_key:"form",ref:o,model:r,rules:i,"label-width":"90px","label-suffix":":"},{default:l.withCtx(()=>[l.createVNode(h,{label:"分组名称",prop:"groupName"},{default:l.withCtx(()=>[l.createVNode(f,{modelValue:r.groupName,"onUpdate:modelValue":d[0]||(d[0]=b=>r.groupName=b),placeholder:"请输入分组名称",clearable:""},null,8,["modelValue"])]),_:1}),l.createVNode(h,{label:"排序",prop:"sort"},{default:l.withCtx(()=>[l.createVNode(p,{modelValue:r.sort,"onUpdate:modelValue":d[1]||(d[1]=b=>r.sort=b),min:0,max:999,step:1,"controls-position":"right"},null,8,["modelValue"])]),_:1}),l.createVNode(h,{label:"是否显示",prop:"isShow"},{default:l.withCtx(()=>[l.createVNode(g,{modelValue:r.isShow,"onUpdate:modelValue":d[2]||(d[2]=b=>r.isShow=b),"active-value":1,"inactive-value":0,"active-color":"#13ce66","inactive-color":"#ff4949"},null,8,["modelValue"])]),_:1}),l.createElementVNode("div",Vj,[l.createVNode(m,{type:"primary",onClick:a},{default:l.withCtx(()=>d[3]||(d[3]=[l.createTextVNode("保存")])),_:1}),l.createVNode(m,{onClick:c},{default:l.withCtx(()=>d[4]||(d[4]=[l.createTextVNode("取消")])),_:1})])]),_:1},8,["model","rules"])])}}},[["__scopeId","data-v-807a2ed3"]]),Rj={class:"form-container"},Lj={class:"footer"},Ij=Dt({__name:"image-form",props:{payload:{type:Object,default:()=>({})}},emits:["close"],setup(n,{emit:e}){const t=e,s=n,r=l.shallowRef(null),i=l.reactive({groupId:"",id:"",imageName:"",sort:0,isShow:1,imageUrl:""}),o={imageName:[{required:!0,message:"请输入图片名称",trigger:"blur"},{min:1,max:20,message:"长度在 1 到 20 个字符",trigger:"blur"}],sort:[{required:!0,message:"请输入排序",trigger:"blur"},{type:"number",message:"排序必须为数字值"}]},a=l.ref(""),c=f=>{if(f.raw.type.indexOf("image")===-1){Ye.error("请上传图片格式的文件");return}const h=new FormData;h.append("file",f.raw),iD("/file/fileUpload",h).then(p=>{p!=null&&p.isOk?xe.isSunOs?(a.value=p==null?void 0:p.data,i.imageUrl=p==null?void 0:p.data):(a.value=Yn.defaults.baseURL+"/upload/"+(p==null?void 0:p.data),i.imageUrl=p==null?void 0:p.data):Ye.error((p==null?void 0:p.msg)||"上传失败")})},u=()=>{console.log(i),r.value.validate(f=>{if(f)Ya("/custom/savePicture",i).then(h=>{h!=null&&h.isOk?(Ye.success("保存成功"),t("close",!0)):Ye.error((h==null?void 0:h.msg)||"保存失败")});else return!1})},d=()=>{t("close",!1)};return l.onMounted(()=>{var f;(f=s.payload)!=null&&f.id&&(i.id=s.payload.id,i.imageName=s.payload.imageName,i.sort=s.payload.sort,i.isShow=s.payload.isShow,i.imageUrl=xe.isSunOs?s.payload.imageUrl:Ad(s.payload.imageUrl),a.value=i.imageUrl),i.groupId=s.payload.groupId}),(f,h)=>{const p=l.resolveComponent("el-input"),g=l.resolveComponent("el-form-item"),m=l.resolveComponent("el-input-number"),y=l.resolveComponent("el-switch"),b=l.resolveComponent("el-image"),w=l.resolveComponent("el-icon"),x=l.resolveComponent("el-upload"),v=l.resolveComponent("el-button"),C=l.resolveComponent("el-form");return l.openBlock(),l.createElementBlock("div",Rj,[l.createVNode(C,{ref_key:"form",ref:r,model:i,rules:o,"label-width":"90px","label-suffix":":"},{default:l.withCtx(()=>[l.createVNode(g,{label:"图片名称",prop:"imageName"},{default:l.withCtx(()=>[l.createVNode(p,{modelValue:i.imageName,"onUpdate:modelValue":h[0]||(h[0]=E=>i.imageName=E),placeholder:"请输入图片名称"},null,8,["modelValue"])]),_:1}),l.createVNode(g,{label:"排序",prop:"sort"},{default:l.withCtx(()=>[l.createVNode(m,{modelValue:i.sort,"onUpdate:modelValue":h[1]||(h[1]=E=>i.sort=E),min:0,max:999,step:1,"controls-position":"right"},null,8,["modelValue"])]),_:1}),l.createVNode(g,{label:"是否显示",prop:"isShow"},{default:l.withCtx(()=>[l.createVNode(y,{modelValue:i.isShow,"onUpdate:modelValue":h[2]||(h[2]=E=>i.isShow=E),"active-value":1,"inactive-value":0,"active-color":"#13ce66","inactive-color":"#ff4949"},null,8,["modelValue"])]),_:1}),l.createVNode(g,{label:"上传",prop:"image"},{default:l.withCtx(()=>[l.createVNode(x,{action:"","list-type":"picture",class:"avatar-uploader","show-file-list":!1,"on-change":c,"auto-upload":!1},{default:l.withCtx(()=>[a.value?(l.openBlock(),l.createBlock(b,{key:0,src:a.value,fit:"cover",style:{width:"64px",height:"64px"}},null,8,["src"])):(l.openBlock(),l.createBlock(w,{key:1,class:"avatar-uploader-icon"},{default:l.withCtx(()=>[l.createVNode(l.unref(bD))]),_:1}))]),_:1})]),_:1}),l.createElementVNode("div",Lj,[l.createVNode(v,{type:"primary",onClick:u},{default:l.withCtx(()=>h[3]||(h[3]=[l.createTextVNode("保存")])),_:1}),l.createVNode(v,{onClick:d},{default:l.withCtx(()=>h[4]||(h[4]=[l.createTextVNode("取消")])),_:1})])]),_:1},8,["model"])])}}},[["__scopeId","data-v-8f1bae4f"]]),Bj={class:"form-container"},jj={style:{padding:"0 10px",display:"flex","flex-direction":"column",gap:"5px","align-items":"flex-start"}},$j=["src"],zj=Dt({__name:"image-management",setup(n){const e=l.reactive({items:[]}),t=()=>{Js("/custom/groupList").then(h=>{e.items=h.data})},s=l.reactive({show:!1,title:"新增图片分组",payload:null}),r=()=>{s.show=!0,s.title="新增图片分组",s.payload=null},i=h=>{s.show=!0,s.title="编辑图片分组",s.payload={id:h.id,groupName:h.groupName,sort:h.sort,isShow:h.isShow}},o=h=>{(xe.isSunOs?Js:Gm)("/custom/removeGroup/"+h).then(g=>{g.code===200?(Ye.success("删除成功"),t()):Ye.error(g.msg||"删除失败")})},a=l.reactive({show:!1,title:"新增图片",payload:null}),c=h=>{a.show=!0,a.title="新增图片",a.payload={groupId:h}},u=h=>{a.show=!0,a.title="编辑图片",a.payload={id:h.id,groupId:h.groupId,imageName:h.imageName,sort:h.sort,isShow:h.isShow,imageUrl:h.imageUrl}},d=h=>{(xe.isSunOs?Js:Gm)("/custom/removePicture/"+h).then(g=>{g.code===200?(Ye.success("删除成功"),t()):Ye.error(g.msg||"删除失败")})},f=h=>{s.show=!1,a.show=!1,h&&t()};return l.onMounted(()=>{t()}),(h,p)=>{const g=l.resolveComponent("el-button"),m=l.resolveComponent("el-table-column"),y=l.resolveComponent("el-table"),b=l.resolveComponent("el-dialog");return l.openBlock(),l.createElementBlock("div",Bj,[l.createVNode(g,{type:"primary",onClick:r,size:"small"},{default:l.withCtx(()=>p[2]||(p[2]=[l.createTextVNode("新增图片分组")])),_:1}),l.createVNode(y,{data:e.items,border:"",height:"500"},{default:l.withCtx(()=>[l.createVNode(m,{type:"expand"},{default:l.withCtx(w=>[l.createElementVNode("div",jj,[l.createVNode(g,{type:"primary",size:"small",onClick:x=>c(w.row.id)},{default:l.withCtx(()=>p[3]||(p[3]=[l.createTextVNode("新增图片")])),_:2},1032,["onClick"]),l.createVNode(y,{data:w.row.pictureList,border:"",size:"small"},{default:l.withCtx(()=>[l.createVNode(m,{label:"名称",prop:"imageName",align:"center"}),l.createVNode(m,{label:"图片",prop:"imageUrl",align:"center"},{default:l.withCtx(x=>[l.createElementVNode("img",{src:l.unref(xe.isSunOs)?x.row.imageUrl:l.unref(Ad)(x.row.imageUrl),alt:"",style:{width:"64px",height:"64px"}},null,8,$j)]),_:1}),l.createVNode(m,{label:"排序",prop:"sort",align:"center"}),l.createVNode(m,{label:"是否显示",prop:"isShow",align:"center"},{default:l.withCtx(x=>[l.createTextVNode(l.toDisplayString(x.row.isShow===1?"是":"否"),1)]),_:1}),l.createVNode(m,{label:"操作",align:"center"},{default:l.withCtx(x=>[l.createVNode(g,{type:"primary",size:"small",onClick:v=>u(x.row)},{default:l.withCtx(()=>p[4]||(p[4]=[l.createTextVNode("编辑 ")])),_:2},1032,["onClick"]),l.createVNode(g,{type:"danger",size:"small",onClick:v=>d(x.row.id)},{default:l.withCtx(()=>p[5]||(p[5]=[l.createTextVNode("删除 ")])),_:2},1032,["onClick"])]),_:1})]),_:2},1032,["data"])])]),_:1}),l.createVNode(m,{label:"分组名称",prop:"groupName",align:"center"}),l.createVNode(m,{label:"排序",prop:"sort",align:"center"}),l.createVNode(m,{label:"是否显示",prop:"isShow",align:"center"},{default:l.withCtx(w=>[l.createTextVNode(l.toDisplayString(w.row.isShow===1?"是":"否"),1)]),_:1}),l.createVNode(m,{label:"操作",align:"center"},{default:l.withCtx(w=>[l.createVNode(g,{type:"primary",size:"small",onClick:x=>i(w.row)},{default:l.withCtx(()=>p[6]||(p[6]=[l.createTextVNode("编辑")])),_:2},1032,["onClick"]),l.createVNode(g,{type:"danger",size:"small",onClick:x=>o(w.row.id)},{default:l.withCtx(()=>p[7]||(p[7]=[l.createTextVNode("删除")])),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"]),l.createVNode(b,{modelValue:s.show,"onUpdate:modelValue":p[0]||(p[0]=w=>s.show=w),title:s.title,width:"300","close-on-click-modal":!1,"close-on-press-escape":!1},{default:l.withCtx(()=>[s.show?(l.openBlock(),l.createBlock(Dj,{key:0,payload:s.payload,onClose:f},null,8,["payload"])):l.createCommentVNode("",!0)]),_:1},8,["modelValue","title"]),l.createVNode(b,{modelValue:a.show,"onUpdate:modelValue":p[1]||(p[1]=w=>a.show=w),title:a.title,width:"300","close-on-click-modal":!1,"close-on-press-escape":!1},{default:l.withCtx(()=>[a.show?(l.openBlock(),l.createBlock(Ij,{key:0,payload:a.payload,onClose:f},null,8,["payload"])):l.createCommentVNode("",!0)]),_:1},8,["modelValue","title"])])}}},[["__scopeId","data-v-721437e3"]]),Fj={class:"page-container"},Uj={class:"tool-bar"},Hj={class:"action"},Gj={class:"el-dropdown-link"},Wj={class:"action",style:{"margin-right":"50px"}},Yj={class:"board"},qj={class:"drawing-board-box"},Xj={id:"controls"},Jj={key:0,class:"controls-label"},Kj={style:{width:"100%",height:"100%",background:"black"}},b0=Dt(Object.assign({name:"editor"},{__name:"index",props:{id:{type:String,default:""},itemId:{type:String,default:""}},emits:["getJson"],setup(n,{emit:e}){const t=n,s=l.ref(),r=l.reactive({label:"",component:l.shallowRef(null)}),i=l.ref(null),o=l.ref(null),a=()=>{window.__x6_instances__=[];const I=document.getElementById("drawing-board");s.value=new $({container:I,autoResize:!0,panning:!0,mousewheel:!0,connecting:{snap:!0,allowEdge:!0,highlight:!0,router:"orth",connectionPoint:{name:"anchor"},anchor:"center",createEdge(){return s.value.createEdge({inherit:"edge",...Qe,data:{type:c0()},zIndex:0})}}}),window.__x6_instances__.push(s.value),s.value.use(L3()),s.value.use(I3()),s.value.use(B3()),s.value.use(j3()),s.value.use(z3()),s.value.use(F3()),s.value.bindKey(["delete","backspace"],()=>{U3(s.value)}),s.value.bindKey(["ctrl+c","cmd + c"],()=>{H3(s.value)}),s.value.bindKey(["ctrl+v","cmd + v"],()=>{G3(s.value)}),s.value.bindKey(["ctrl+z","cmd + z"],()=>{W3(s.value)}),s.value.bindKey(["ctrl+y","cmd + y"],()=>{Y3(s.value)});let B=null;s.value.on("edge:click",({cell:N})=>{o.value=N,r.component=p0,r.label="线段属性",i.value=Nd()}),s.value.on("edge:mouseenter",({cell:N})=>{clearTimeout(B),N.toFront(),q3(N)}),s.value.on("edge:mouseleave",({cell:N})=>{B=setTimeout(()=>{N.toBack(),N.removeTools()},300)}),s.value.on("node:mouseenter",()=>{$r("#drawing-board",!0)}),s.value.on("node:mouseleave",()=>{$r("#drawing-board",!1)}),s.value.use(new g0),s.value.on("blank:click",({e:N,x:P,y:k})=>{o.value=s,r.component=dD,r.label="画布属性",i.value=Nd()}),s.value.on("cell:click",({cell:N})=>{var P,k;if(o.value=N,i.value=Nd(),((P=N.data)==null?void 0:P.type)==="text"){r.component=h0,r.label="文本属性";return}if(((k=N.data)==null?void 0:k.type)==="base-shape"){r.component=h0,r.label="基础图形属性";return}if((N==null?void 0:N.shape)==="edge"){r.component=p0,r.label="连线属性";return}if((N==null?void 0:N.shape)==="image"){r.component=Aj,r.label="图片属性";return}r.component=null,r.label=null}),s.value.on("render:done",()=>{$r("#drawing-board",!1),g()})},c=l.ref(),u=()=>{c.value=new gi({target:s.value,...aD,groups:[{name:"基础组件",graphPadding:30}],search(N,P){var k;return((k=N.label)==null?void 0:k.indexOf(P))!==-1},placeholder:"搜索",notFoundText:"未找到匹配项",getDragNode:N=>{const P=N.clone({keepId:!0});return P.label!=="文本"&&(P.label=""),P}});const I=s.value.createNode({...lD}),B=m0.map(N=>(N.ports=y0,s.value.createNode(N)));c.value.load([I,...B],"基础组件"),Js("/custom/groupList").then(N=>{const P=(N==null?void 0:N.data)||[];P==null||P.forEach(k=>{c.value.addGroup({name:k==null?void 0:k.groupName,graphPadding:30});const j=k==null?void 0:k.pictureList.map(H=>{const K={shape:"image",imageUrl:xe.isSunOs?H==null?void 0:H.imageUrl:Ad(H==null?void 0:H.imageUrl),ports:y0,width:64,height:64,label:H.imageName};return s.value.createNode(K)});c.value.load(j,k==null?void 0:k.groupName),document.getElementById("stencil").appendChild(c.value.container)})}).finally(()=>{setTimeout(()=>{const N=c.value.container,P=N.querySelectorAll(".x6-node"),k=m0.length;N.addEventListener("mouseenter",j,!0),N.addEventListener("mouseleave",H,!0),P.forEach((K,R)=>{const _=R>k,z=K.querySelector("text");_&&z&&(Object.assign(z.style,{display:"none",fontSize:"12px",fill:"#ffffff"}),z.setAttribute("x","0%"),z.setAttribute("y","40"),K.style.position="relative",K.style.cursor="pointer")});function j(K){const R=K.target.closest(".x6-node");if(R){const _=Array.from(P).indexOf(R),z=R.querySelector("text");_>k&&z&&(z.style.display="block")}}function H(K){const R=K.target.closest(".x6-node");if(R){const _=Array.from(P).indexOf(R),z=R.querySelector("text");_>k&&z&&(z.style.display="none")}}return()=>{N.removeEventListener("mouseenter",j,!0),N.removeEventListener("mouseleave",H,!0)}},200)})},d=I=>{switch(I){case"snapLine":s.value.isSnaplineEnabled()?(s.value.disableSnapline(),Ye.warning("关闭对齐线")):(s.value.enableSnapline(),Ye.success("开启对齐线"));break;case"select":s.value.isSelectionEnabled()?(s.value.disableSelection(),Ye.warning("关闭框选")):(s.value.enableSelection(),Ye.success("开启框选"));break;case"drawLine":p();break;case"adaptive":g();break;case"shortcuts":y();break;case"image":w();break;case"clear":x();break;case"export":v();break}},f=l.ref(!1),h=l.ref(null),p=()=>{f.value=!0;const I=new Date;s.value.startBatch(I),s.value.disablePanning(),s.value.once("blank:mousedown",({e:B,x:N,y:P})=>{f.value&&(h.value=s.value.addEdge({source:{x:N,y:P},target:{x:N,y:P},...Qe,data:{type:c0(),isConnector:!1},zIndex:0}))}),s.value.on("blank:mousemove",({e:B,x:N,y:P})=>{f.value&&h.value.setTarget({x:N,y:P})}),s.value.on("blank:mouseup",({e:B,x:N,y:P})=>{f.value=!1,s.value.enablePanning(),s.value.stopBatch(I)})},g=()=>{s.value.zoomToFit({maxScale:1,padding:20})},m=l.reactive({show:!1}),y=()=>{m.show=!0},b=l.reactive({show:!1}),w=()=>{b.show=!0},x=()=>{s.value.clearCells(),s.value.drawBackground(qa),s.value.drawGrid(Xa),Ye.success("清空成功")},v=()=>{const I=W().format("YYYYMMDDHHmmss");s.value.exportPNG(I,{padding:10,quality:1,backgroundColor:s.value.options.background.color})},C=e,E=l.reactive({show:!1,background:null,grid:null,data:null}),S=()=>{E.background=s.value.options.background,E.grid=s.value.options.grid,E.data=s.value.toJSON(),E.show=!0},O=()=>{E.show=!1},A=()=>{C("getJson",{background:s.value.options.background,grid:s.value.options.grid,data:s.value.toJSON()})},V=async()=>{if(!t.id){s.value.drawBackground(qa),s.value.drawGrid(Xa),s.value.fromJSON({cells:[]});return}const I=await Wm(t.id);s.value.drawBackground((I==null?void 0:I.background)||qa),s.value.drawGrid((I==null?void 0:I.grid)||Xa),s.value.fromJSON((I==null?void 0:I.data)||{cells:[]})},T=l.shallowRef(null),D=()=>{new ResizeObserver(()=>{g()}).observe(T.value)};return l.onMounted(()=>{a(),u(),V(),D()}),(I,B)=>{const N=l.resolveComponent("el-icon"),P=l.resolveComponent("el-button"),k=l.resolveComponent("el-dropdown-item"),j=l.resolveComponent("el-dropdown-menu"),H=l.resolveComponent("el-dropdown"),K=l.resolveComponent("el-scrollbar"),R=l.resolveComponent("el-dialog"),_=l.resolveComponent("el-drawer");return l.openBlock(),l.createElementBlock("div",Fj,[l.createElementVNode("div",Uj,[l.createElementVNode("div",Hj,[l.createVNode(H,{onCommand:d},{dropdown:l.withCtx(()=>[l.createVNode(j,null,{default:l.withCtx(()=>[l.createVNode(k,{command:"snapLine"},{default:l.withCtx(()=>B[4]||(B[4]=[l.createTextVNode("对齐线")])),_:1}),l.createVNode(k,{command:"select"},{default:l.withCtx(()=>B[5]||(B[5]=[l.createTextVNode("框选")])),_:1}),l.createVNode(k,{command:"drawLine"},{default:l.withCtx(()=>B[6]||(B[6]=[l.createTextVNode("绘制直线")])),_:1}),l.createVNode(k,{command:"adaptive"},{default:l.withCtx(()=>B[7]||(B[7]=[l.createTextVNode("视图自适应")])),_:1}),l.createVNode(k,{command:"shortcuts"},{default:l.withCtx(()=>B[8]||(B[8]=[l.createTextVNode("查看快捷键")])),_:1}),l.createVNode(k,{command:"image"},{default:l.withCtx(()=>B[9]||(B[9]=[l.createTextVNode("图片管理")])),_:1}),l.createVNode(k,{command:"clear"},{default:l.withCtx(()=>B[10]||(B[10]=[l.createTextVNode("清空画布")])),_:1}),l.createVNode(k,{command:"export"},{default:l.withCtx(()=>B[11]||(B[11]=[l.createTextVNode("导出成图片")])),_:1})]),_:1})]),default:l.withCtx(()=>[l.createElementVNode("span",Gj,[l.createVNode(P,{size:"small",text:""},{default:l.withCtx(()=>[B[3]||(B[3]=l.createTextVNode("工具 ")),l.createVNode(N,null,{default:l.withCtx(()=>[l.createVNode(l.unref(fD))]),_:1})]),_:1})])]),_:1})]),l.createElementVNode("div",Wj,[l.createVNode(l.unref(Jg),{content:"预览",placement:"bottom"},{default:l.withCtx(()=>[l.createVNode(P,{size:"small",icon:l.unref(xD),onClick:S},null,8,["icon"])]),_:1}),l.createVNode(l.unref(Jg),{content:"保存",placement:"bottom"},{default:l.withCtx(()=>[l.createVNode(P,{size:"small",icon:l.unref(mD),onClick:A},null,8,["icon"])]),_:1})])]),l.createElementVNode("div",Yj,[B[12]||(B[12]=l.createElementVNode("div",{id:"stencil"},null,-1)),l.createElementVNode("div",qj,[l.createElementVNode("div",{id:"drawing-board",ref_key:"drawBoard",ref:T},null,512)]),l.createElementVNode("div",Xj,[r.label?(l.openBlock(),l.createElementBlock("div",Jj,l.toDisplayString(r.label),1)):l.createCommentVNode("",!0),l.createVNode(K,null,{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(r.component),{graph:s.value,payload:o.value,key:i.value,itemId:t.itemId},null,8,["graph","payload","itemId"]))]),_:1})])]),l.createVNode(R,{modelValue:m.show,"onUpdate:modelValue":B[0]||(B[0]=z=>m.show=z),width:"400px",title:"快捷键","close-on-click-modal":!1,"close-on-press-escape":!1},{default:l.withCtx(()=>[l.createVNode(vj)]),_:1},8,["modelValue"]),l.createVNode(R,{modelValue:b.show,"onUpdate:modelValue":B[1]||(B[1]=z=>b.show=z),width:"800px",title:"图片管理","close-on-click-modal":!1,"close-on-press-escape":!1},{default:l.withCtx(()=>[b.show?(l.openBlock(),l.createBlock(zj,{key:0})):l.createCommentVNode("",!0)]),_:1},8,["modelValue"]),l.createVNode(_,{class:"no-border-drawer",modelValue:E.show,"onUpdate:modelValue":B[2]||(B[2]=z=>E.show=z),onClose:O,title:"预览",direction:"ttb",size:"100%"},{default:l.withCtx(()=>[l.createElementVNode("div",Kj,[E.show?(l.openBlock(),l.createBlock(_d,{key:0,background:E.background,grid:E.grid,data:E.data},null,8,["background","grid","data"])):l.createCommentVNode("",!0)])]),_:1},8,["modelValue"])])}}}),[["__scopeId","data-v-5dc3c2c6"]]),Zj=[b0,_d],w0=n=>{Zj.forEach(e=>{n.component(e.name,e)})};typeof window<"u"&&window.Vue&&w0(window.Vue),xe.isSunOs=!1;const Qj=n=>{xe.isSunOs=n},e$={install:w0};xe.WiringDiagramEditor=b0,xe.WiringDiagramPreview=_d,xe.default=e$,xe.setBaseURL=sD,xe.setIsSunOs=Qj,xe.setToken=rD,Object.defineProperties(xe,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
</el-dialog>
|
|
57
57
|
<el-dialog v-model="imageManagement.show" width="800px" title="图片管理" :close-on-click-modal="false"
|
|
58
58
|
:close-on-press-escape="false">
|
|
59
|
-
<image-management/>
|
|
59
|
+
<image-management v-if="imageManagement.show"/>
|
|
60
60
|
</el-dialog>
|
|
61
61
|
<el-drawer class="no-border-drawer" v-model="view.show" @close="closeViewBtnClick" title="预览"
|
|
62
62
|
:direction="'ttb'" size="100%">
|