import{aL as v}from"./index.17037962789732.js";import"./index.1703796278973304.js";import{c as u}from"./cascade.1703796278973.js";import{d as I,k as x,r as L,o as d,x as w,b as C,a as T,u as _,c as y,B as D}from"./vue.1703796278973.js";import{_ as S}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 b={class:"left-content"},B=I({__name:"tree",emits:["onSelect"],setup(N,{emit:f}){const h=(a,{node:e})=>{f("onSelect",{dId:e.deviceId,cId:e.channelId})},c=a=>!a.channelNumber,o=x([]);(async()=>{const a=await u.getMediaTree({paging:!1});a.success&&(o.value=a.result.sort((e,t)=>t.createTime-e.createTime).map(e=>{const t={};return t.isLeaf=c(e),{...e,...t}}))})();const p=(a,e,t)=>a.map(r=>r.id===e?{...r,children:r.children?[...r.children,...t]:t}:r.children?{...r,children:p(r.children,e,t)}:r),m=(a,e)=>new Promise(async t=>{const r=await u.queryChannelList(e);if(r.status===200){const{total:s,pageIndex:l,pageSize:n}=r.result;o.value=p(o.value,a,r.result.data.map(i=>({...i,class:i.status.value,isLeaf:c(i)}))),s>(l+1)*n&&setTimeout(()=>{m(a,{...e,pageIndex:e.pageIndex+1})},50),t(r.result)}}),g=({key:a,children:e})=>new Promise(async t=>{if(e){t();return}await m(a,{pageIndex:0,pageSize:100,terms:[{column:"deviceId",value:a}]}),t()});return(a,e)=>{const t=L("AIcon"),r=v;return d(),w("div",b,[C(r,{height:700,"show-line":{showLeafIcon:!1},"show-icon":!0,"tree-data":_(o),loadData:g,fieldNames:{title:"name",key:"id"},onSelect:h},{icon:T(({id:s,selected:l})=>[_(o).find(n=>n.id===s)?D("",!0):(d(),y(t,{key:0,type:"VideoCameraOutlined"}))]),_:1},8,["tree-data"])])}}});const $=S(B,[["__scopeId","data-v-d4b90641"]]);export{$ as default};
