import{a as P,E as Q}from"./el-form-item-BvJauXBe.js";import{d as j,h as A,o as g,a0 as V,p as n,m as t,e as l,c as J,I as O,J as Z,t as G,x as k,A as H,y as f,w as M,aF as W,q as X,aZ as Y,b2 as ee,r as m,ai as te}from"./index-XuO881sr.js";import{E as ae,a as oe}from"./el-select-BHeVexdj.js";import{E as le}from"./el-row-eghH2z0a.js";import{E as ne,a as se}from"./el-table-column-5BM1zXQ-.js";/* empty css                  */import{_ as me}from"./index-CcdWvSxw.js";import"./el-checkbox-Cxc7yQYm.js";/* empty css               */import{a as re,l as pe,i as ie}from"./index-CadRoqSq.js";const ue={class:"dialog-footer"},Ee=j({__name:"importTable",emits:["ok"],setup(de,{expose:R,emit:S}){const c=m(0),r=m(!1),v=m([]),N=m([]),{proxy:y}=A(),w=m(),C=m(),a=te({pageNum:1,pageSize:10,dataName:"",tableName:"",tableComment:""}),b=m([]),T=S,x=s=>{re().then(e=>{e.code==200&&(b.value=e.data,s?a.dataName=s:a.dataName=b.value[0],_(),r.value=!0)})},F=s=>{w.value?.toggleRowSelection(s,!1)},U=s=>{v.value=s.map(e=>e.tableName)},_=async()=>{const s=await pe(a);N.value=s.rows,c.value=s.total},i=()=>{a.pageNum=1,_()},B=()=>{C.value?.resetFields(),i()},I=async()=>{const s=v.value.join(",");if(s==""){y?.$modal.msgError("请选择要导入的表");return}const e=await ie({tables:s,dataName:a.dataName});y?.$modal.msgSuccess(e.msg),e.code===200&&(r.value=!1,T("ok"))};return R({show:x}),(s,e)=>{const h=oe,q=ae,u=Q,E=G,d=H,D=P,p=se,L=ne,z=me,K=le,$=ee;return g(),V($,{modelValue:l(r),"onUpdate:modelValue":e[6]||(e[6]=o=>Y(r)?r.value=o:null),title:"导入表",width:"1100px",top:"5vh","append-to-body":""},{footer:n(()=>[X("div",ue,[t(d,{type:"primary",onClick:I},{default:n(()=>[...e[9]||(e[9]=[f("确 定",-1)])]),_:1}),t(d,{onClick:e[5]||(e[5]=o=>r.value=!1)},{default:n(()=>[...e[10]||(e[10]=[f("取 消",-1)])]),_:1})])]),default:n(()=>[t(D,{ref_key:"queryFormRef",ref:C,model:l(a),inline:!0},{default:n(()=>[t(u,{label:"数据源",prop:"dataName"},{default:n(()=>[t(q,{modelValue:l(a).dataName,"onUpdate:modelValue":e[0]||(e[0]=o=>l(a).dataName=o),filterable:"",placeholder:"请选择/输入数据源名称"},{default:n(()=>[(g(!0),J(O,null,Z(l(b),o=>(g(),V(h,{key:o,label:o,value:o},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(u,{label:"表名称",prop:"tableName"},{default:n(()=>[t(E,{modelValue:l(a).tableName,"onUpdate:modelValue":e[1]||(e[1]=o=>l(a).tableName=o),placeholder:"请输入表名称",clearable:"",onKeyup:k(i,["enter"])},null,8,["modelValue"])]),_:1}),t(u,{label:"表描述",prop:"tableComment"},{default:n(()=>[t(E,{modelValue:l(a).tableComment,"onUpdate:modelValue":e[2]||(e[2]=o=>l(a).tableComment=o),placeholder:"请输入表描述",clearable:"",onKeyup:k(i,["enter"])},null,8,["modelValue"])]),_:1}),t(u,null,{default:n(()=>[t(d,{type:"primary",icon:"Search",onClick:i},{default:n(()=>[...e[7]||(e[7]=[f("搜索",-1)])]),_:1}),t(d,{icon:"Refresh",onClick:B},{default:n(()=>[...e[8]||(e[8]=[f("重置",-1)])]),_:1})]),_:1})]),_:1},8,["model"]),t(K,null,{default:n(()=>[t(L,{ref_key:"tableRef",ref:w,border:"",data:l(N),height:"260px",onRowClick:F,onSelectionChange:U},{default:n(()=>[t(p,{type:"selection",width:"55"}),t(p,{prop:"tableName",label:"表名称","show-overflow-tooltip":!0}),t(p,{prop:"tableComment",label:"表描述","show-overflow-tooltip":!0}),t(p,{prop:"createTime",label:"创建时间"}),t(p,{prop:"updateTime",label:"更新时间"})]),_:1},8,["data"]),M(t(z,{page:l(a).pageNum,"onUpdate:page":e[3]||(e[3]=o=>l(a).pageNum=o),limit:l(a).pageSize,"onUpdate:limit":e[4]||(e[4]=o=>l(a).pageSize=o),total:l(c),onPagination:_},null,8,["page","limit","total"]),[[W,l(c)>0]])]),_:1})]),_:1},8,["modelValue"])}}});export{Ee as _};
