import{K as T,d as I,L as D,n as O,o,c as v,a as c,b as a,w as l,E as A,r as d,k as i,q as u,g as b,M as F,N as H,O as J,x as p,t as k,j as B,D as P,G as Q,_ as W}from"./index-DIl-pxgT.js";function X(f){return T.get("/metadata/tree",{params:{source_id:f}})}function Y(f){return T.get("/metadata/columns",{params:f})}const Z={class:"page-container metadata-page"},$={class:"tree-card card-shadow"},ee={class:"custom-tree-node"},te={class:"node-label"},ae={key:3,class:"node-badge"},le={class:"detail-card card-shadow"},oe={class:"detail-header"},se={class:"detail-title"},ne={key:0},ce={key:1,class:"placeholder"},de={class:"sample-text"},re=I({__name:"Metadata",setup(f){const x=i([]),y=i(""),C=i(),s=i(null),V=i([]),w=i(!1),h=i("");D(y,e=>{var t;(t=C.value)==null||t.filter(e)});function E(e,t){return e?t.name.toLowerCase().includes(e.toLowerCase()):!0}async function K(){try{const e=await X();x.value=e||[]}catch(e){A.error((e==null?void 0:e.message)||"加载失败")}}async function q(e){e.type==="table"&&(s.value=e,await z(e.id))}async function z(e){w.value=!0;try{const t=await Y({table_id:e,keyword:h.value||void 0,page:1,page_size:500});V.value=t.data||[]}finally{w.value=!1}}return D(h,()=>{s.value&&z(s.value.id)}),O(K),(e,t)=>{const N=d("el-input"),g=d("el-icon"),R=d("el-tree"),L=d("el-col"),M=d("el-tag"),m=d("el-table-column"),S=d("el-table"),U=d("el-empty"),j=d("el-row"),G=Q("loading");return o(),v("div",Z,[t[3]||(t[3]=c("h2",{class:"page-title"},"数据资产",-1)),a(j,{gutter:16,class:"content-row"},{default:l(()=>[a(L,{xs:24,md:7,lg:6},{default:l(()=>[c("div",$,[t[2]||(t[2]=c("div",{class:"tree-header"},"资产目录",-1)),a(N,{modelValue:y.value,"onUpdate:modelValue":t[0]||(t[0]=_=>y.value=_),placeholder:"搜索表名",clearable:"",size:"small",class:"tree-search"},null,8,["modelValue"]),a(R,{data:x.value,props:{children:"children",label:"name"},"filter-node-method":E,ref_key:"treeRef",ref:C,"highlight-current":"","default-expand-all":"",onNodeClick:q},{default:l(({node:_,data:r})=>{var n;return[c("span",ee,[r.type==="source"?(o(),u(g,{key:0,size:"14"},{default:l(()=>[a(b(F))]),_:1})):r.type==="database"?(o(),u(g,{key:1,size:"14"},{default:l(()=>[a(b(H))]),_:1})):(o(),u(g,{key:2,size:"14"},{default:l(()=>[a(b(J))]),_:1})),c("span",te,p(_.label),1),r.type==="table"&&((n=r.meta)!=null&&n.column_count)?(o(),v("span",ae,p(r.meta.column_count),1)):k("",!0)])]}),_:1},8,["data"])])]),_:1}),a(L,{xs:24,md:17,lg:18},{default:l(()=>{var _,r;return[c("div",le,[c("div",oe,[c("div",se,[s.value?(o(),v("span",ne,p(s.value.name),1)):(o(),v("span",ce,"请从左侧选择数据表")),(r=(_=s.value)==null?void 0:_.meta)!=null&&r.row_count?(o(),u(M,{key:2,size:"small",type:"info"},{default:l(()=>[B(" 约 "+p(s.value.meta.row_count.toLocaleString())+" 行 ",1)]),_:1})):k("",!0)]),s.value?(o(),u(N,{key:0,modelValue:h.value,"onUpdate:modelValue":t[1]||(t[1]=n=>h.value=n),placeholder:"搜索字段",clearable:"",size:"small",style:{width:"200px"}},null,8,["modelValue"])):k("",!0)]),s.value?P((o(),u(S,{key:0,data:V.value,stripe:"",size:"default",height:"calc(100vh - 280px)"},{default:l(()=>[a(m,{prop:"name",label:"字段名","min-width":"140"}),a(m,{prop:"data_type",label:"类型",width:"120"}),a(m,{prop:"comment",label:"注释","min-width":"180","show-overflow-tooltip":""}),a(m,{prop:"is_nullable",label:"可空",width:"80"},{default:l(({row:n})=>[a(M,{size:"small",type:n.is_nullable?"info":"success"},{default:l(()=>[B(p(n.is_nullable?"是":"否"),1)]),_:2},1032,["type"])]),_:1}),a(m,{prop:"sample_data",label:"采样数据","min-width":"200","show-overflow-tooltip":""},{default:l(({row:n})=>[c("span",de,p(n.sample_data),1)]),_:1})]),_:1},8,["data"])),[[G,w.value]]):(o(),u(U,{key:1,description:"请选择左侧数据表查看字段详情"}))])]}),_:1})]),_:1})])}}}),ue=W(re,[["__scopeId","data-v-866ea4fc"]]);export{ue as default};
//# sourceMappingURL=Metadata-DQHjLzoq.js.map
