import{l as e,t as a,z as s,x as l}from"./utils-lib.js?v=20260328163632";import{k as t,aI as i,r,o as u,V as c,_ as o,a3 as d,X as n,Y as m,O as p,j as v,Z as h,N as f,W as k,L as b,F as g}from"./base-lib.js?v=20260328163632";import{u as x}from"./store.js?v=20260328163632";import{G as L}from"./database.js?v=20260328163632";import{N as y,au as _,m as j}from"./naive-ui.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";const w={class:"border-1px border-solid border-[var(--border-color-25)] p-16px w-[220px] max-h-[200px] overflow-auto"},D={key:1,class:"text-light-50 text-[12px]"},I=t({__name:"index",props:{compData:{default:()=>({keyList:[],sid:0})}},setup(t,{expose:I}){const N=t,{isRefreshList:q}=x(),O=i(N.compData,"keyList"),U=i(N.compData,"sid"),W=r(!0),z=r(!0),A=e=>{H.value.checkedList=e,W.value=e.length===O.value.length,z.value=e.length>0&&e.length<O.value.length},C=e=>{W.value=e,z.value=!1,H.value.checkedList=e?O.value.map((e=>e.name)):[]},F=r({formAttrs:{labelWidth:"100px"},formItems:[{label:e("选择数据库"),ruleKey:"checkedList",rules:{required:!0,message:e("最少选择一项"),type:"array",trigger:"change"},children:[{type:"custom",key:"checkedList"}]}]}),[G,H,J]=a(F);return I({onConfirm:async a=>{await J.value.validate(),await s({icon:"warning-filled",title:e("提示"),content:e("此操作将清空选中的数据库，是否继续？")});const t=JSON.stringify(O.value.filter((e=>H.value.checkedList.includes(e.name))).map((e=>e.id)));await l({loading:e("正在清空数据库，请稍后..."),request:L({dbIndexs:t,sid:U.value}),message:!0,success:e=>{e.status&&(q.value=!0)}}),a()}}),u((()=>{H.value.checkedList=O.value.map((e=>e.value))})),(a,s)=>{const l=y,t=_,i=j;return c(),o(m(G),{class:"p-20px"},{checkedList:d((()=>[n("div",w,[m(O).length?(c(),o(t,{key:0,vertical:""},{default:d((()=>[p(l,{checked:m(W),"onUpdate:checked":[s[0]||(s[0]=e=>f(W)?W.value=e:null),C]},{default:d((()=>[v(h(m(e)("全选")),1)])),_:1},8,["checked"]),p(i,{value:m(H).checkedList,"onUpdate:value":[s[1]||(s[1]=e=>m(H).checkedList=e),A]},{default:d((()=>[p(t,{vertical:""},{default:d((()=>[(c(!0),k(g,null,b(m(O),((e,a)=>(c(),o(l,{class:"w-full !mr-0",label:e.label,value:e.value,key:e.value},null,8,["label","value"])))),128))])),_:1})])),_:1},8,["value"])])),_:1})):(c(),k("span",D,h(m(e)("暂无数据")),1))])])),_:1})}}});export{I as default};
