import{V as O,a2 as z,aL as E,a as J,aA as q}from"./index.17037962789732.js";import"./index.1703796278973303.js";import"./index.170379627897317.js";import"./index.1703796278973304.js";import"./index.1703796278973302.js";import{b as T,c as G}from"./collector.1703796278973.js";import{d as H,k as i,p as R,m as k,o as K,x as F,z as S,b as C,a as I,t as Q,u,M,c as j,D as W,A as X,G as Y,H as Z}from"./vue.1703796278973.js";import{_ as $}from"./_plugin-vue_export-helper.1703796278973.js";import"./index.17037962789733.js";import"./dayjs.min.1703796278973.js";import"./isArray.1703796278973.js";import"./editor.api.1703796278973.js";import"./preload-helper.1703796278973.js";import"./monaco.contribution.1703796278973.js";import"./system.1703796278973.js";import"./comm.1703796278973.js";import"./index.170379627897332.js";import"./index.170379627897315.js";import"./index.170379627897333.js";import"./index.170379627897334.js";import"./default.1703796278973.js";import"./permission.1703796278973.js";import"./consts.1703796278973.js";import"./404.1703796278973.js";const ee=p=>(Y("data-v-06613a5e"),p=p(),Z(),p),te={class:"tree-content"},ae={class:"tree-header"},se=ee(()=>S("div",null,"数据源",-1)),ce=H({__name:"Tree",props:{data:{type:Array,default:()=>[]},unSelectKeys:{type:String,default:""}},emits:["change"],setup(p,{emit:B}){var D;const m=p,b=(D=m.data)==null?void 0:D.channelId,d=i([]),v=i([]),h=i(!1),l=i(!1),f=i(),o=i(),N=t=>new Promise(async s=>{var r;if(t!=null&&t.children&&((r=t.children)!=null&&r.length)||!(t!=null&&t.folder)){s();return}const e=await T({id:b,nodeId:t.key});if(e.status===200){const a=e.result.map(c=>({...c,key:c.id,title:c.name,disabled:c==null?void 0:c.folder,isLeaf:!(c!=null&&c.folder)}));o.value=x(O(o.value),t.key,[...a])}s()}),y=t=>t.filter(e=>l&&!v.value.includes(e.id)||!l).map(e=>{var r;return e.children&&((r=e.children)!=null&&r.length)?{...e,children:y(e.children)}:e}),P=(t,s)=>{var n,_,w,L,A;const e={...s.node},r=[],a=r.length?r[r.length-1]:void 0;if(r.map(g=>g==null?void 0:g.id).includes(e.id))return;const c={features:{value:a?(n=a==null?void 0:a.features)==null?void 0:n.value:((e==null?void 0:e.features)||[]).includes("changedOnly"),check:!0},id:(e==null?void 0:e.id)||"",name:(e==null?void 0:e.name)||"",accessModes:{value:a?(_=a==null?void 0:a.accessModes)==null?void 0:_.value:(e==null?void 0:e.accessModes)||[],check:!0},configuration:{...e==null?void 0:e.configuration,interval:{value:a?(L=(w=a==null?void 0:a.configuration)==null?void 0:w.interval)==null?void 0:L.value:((A=e==null?void 0:e.configuration)==null?void 0:A.interval)||3e3,check:!0},nodeId:e==null?void 0:e.id}};B("change",c,s.checked)},x=(t,s,e)=>t.map(a=>{var c;return a.key===s?{...a,children:e}:a!=null&&a.children&&((c=a==null?void 0:a.children)!=null&&c.length)?{...a,children:x(a.children,s,e)}:a}),U=async()=>{var s;h.value=!0;const t=await G({paging:!1,terms:[{terms:[{column:"collectorId",value:(s=m.data)==null?void 0:s.id}]}]});t.status===200&&(v.value=t.result.map(e=>e.pointKey)),V(),h.value=!1};R(()=>{U()});const V=async()=>{h.value=!0;const t=await T({id:b});o.value=t.result.map(s=>({...s,key:s.id,title:s.name,disabled:(s==null?void 0:s.folder)||!1})),h.value=!1};return k(()=>l.value,t=>{f.value=t?y(o.value):o.value},{deep:!0}),k(()=>o.value,t=>{f.value=l.value?y(t):t},{deep:!0}),k(()=>m.unSelectKeys,t=>{d.value=d.value.filter(s=>s!==t)},{deep:!0}),(t,s)=>{const e=z,r=E,a=J,c=q;return K(),F("div",te,[S("div",ae,[se,C(e,{checked:u(l),"onUpdate:checked":s[0]||(s[0]=n=>M(l)?l.value=n:null)},{default:I(()=>[Q("隐藏已有节点")]),_:1},8,["checked"])]),C(c,{spinning:u(h)},{default:I(()=>[u(f)?(K(),j(r,{key:0,"load-data":N,"tree-data":u(f),checkedKeys:u(d),"onUpdate:checkedKeys":s[1]||(s[1]=n=>M(d)?d.value=n:null),selectedKeys:t.selectedKeys,selectable:!1,checkable:"",onCheck:P,height:600},{title:I(({name:n,key:_})=>[S("span",{class:W([u(v).includes(_)?"tree-selected":"tree-title"])},X(n),3)]),_:1},8,["tree-data","checkedKeys","selectedKeys"])):(K(),j(a,{key:1,style:{"margin-top":"22%"}}))]),_:1},8,["spinning"])])}}});const Ae=$(ce,[["__scopeId","data-v-06613a5e"]]);export{Ae as default};
