import{a5 as P,b as U,r as N,ah as h,o as x,y as I,q as n,v as R,p as s,P as f,x as g,n as a,aj as B,s as j,ay as q,j as M,k as T,l as F,m as K,bv as O,D as A}from"./index.8d733f79.js";import{E as G}from"./el-input-number.60463ef8.js";import{c as H}from"./components.b31a8293.js";import"./index.28f6da25.js";const J={class:"dialog-footer"},Q=P({name:"componentLib"}),te=Object.assign(Q,{emits:["confirm"],setup(W,{expose:V,emit:E}){const{t:S}=U(),{proxy:r}=A(),c=N(!1),o=h({name:"",pageNo:1,pageSize:10}),i=h({total:0,tableData:[],columns:[{prop:"name",label:"componentName"},{label:"componentNum",type:"action"}]}),m=N([]),$=e=>{console.log("\u56DE\u663E\u6570\u636E",e),c.value=!0,b(),q(()=>{v(e)})};async function _(){const e=await H(o);i.total=e.data.total,i.tableData=e.data.records,i.tableData.forEach(t=>{t.total=1}),console.log("selectList.value-------",m.value),m.value.length&&m.value.forEach(t=>{const u=i.tableData.find(p=>p.name===t.name);u&&(u.total=t.total,r.$refs.tableRef.selectedRow(t,!1),r.$refs.tableRef.selectedRow(u,!0))})}const v=e=>{r.$refs.tableRef.clearSelection(),e!=null&&e.length&&e.forEach(t=>{t.name=t.baseName,t.identifier=t.identifier.split("_")[0],r.$refs.tableRef.selectedRow(t,!0)})},b=()=>{o.name="",o.pageNo=1,_()},D=e=>{console.log("selection--------",e),m.value=e},C=()=>{if(!m.value.length){r.$modal.msgError(S("componentP"));return}m.value.forEach(e=>{e.baseName=e.name}),E("confirm",m.value),y()};function y(){c.value=!1}return V({showModal:$}),(e,t)=>{const u=M,p=T,d=F,k=K,w=G,L=O;return x(),I(L,{title:e.$t("componentLib"),modelValue:a(c),"onUpdate:modelValue":t[3]||(t[3]=l=>j(c)?c.value=l:null),style:{width:"calc(50%)"},class:"componentLib_dialog","align-center":!0},{footer:n(()=>[R("div",J,[s(d,{onClick:y},{default:n(()=>[f(g(e.$t("cancel")),1)]),_:1}),s(d,{type:"primary",onClick:C},{default:n(()=>[f(g(e.$t("confirm")),1)]),_:1})])]),default:n(()=>[s(k,{model:a(o),inline:!0},{default:n(()=>[s(p,{label:e.$t("componentName"),prop:"name"},{default:n(()=>[s(u,{modelValue:a(o).name,"onUpdate:modelValue":t[0]||(t[0]=l=>a(o).name=l),placeholder:e.$t("componentNameP"),maxlength:"20",style:{width:"236px"}},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s(p,null,{default:n(()=>[s(d,{type:"primary",onClick:_},{default:n(()=>[f(g(e.$t("query")),1)]),_:1}),s(d,{onClick:b},{default:n(()=>[f(g(e.$t("reset")),1)]),_:1})]),_:1})]),_:1},8,["model"]),s(a(B),{style:{height:"calc(100% - 50px)"},ref:"tableRef",selection:"",rowKey:"identifier",columns:a(i).columns,tableData:a(i).tableData,total:a(i).total,pageNum:a(o).pageNo,"onUpdate:pageNum":t[1]||(t[1]=l=>a(o).pageNo=l),pageSize:a(o).pageSize,"onUpdate:pageSize":t[2]||(t[2]=l=>a(o).pageSize=l),onPagination:_,onChangeSelection:D},{action:n(({scope:l})=>[s(w,{modelValue:l.row.total,"onUpdate:modelValue":z=>l.row.total=z,precision:0,max:20,min:1,controls:!1},null,8,["modelValue","onUpdate:modelValue"])]),_:1},8,["columns","tableData","total","pageNum","pageSize"])]),_:1},8,["title","modelValue"])}}});export{te as default};
