import{c as Q}from"./base-ea2d5d04-1782729249161v=1.0.0.js";import{u as X}from"./useTable-cf8e962b-1782729249161v=1.0.0.js";import{u as Y}from"./useSelection-d7df50be-1782729249161v=1.0.0.js";import{y as $,c as y,r as d,h as ee,al as l,z as te,I as ae,J as n,R as s,u as a,B as S,P as oe,O as F,k as ne,n as le}from"./vendor-1e24e3ad-1782729249161v=1.0.0.js";import{_ as se}from"./index-b309bf9f-1782729249161v=1.0.0.js";import"./notData-926f7286-1782729249161v=1.0.0.js";import"./eleVendor-5008d1ec-1782729249161v=1.0.0.js";const ie={class:"selected-list"},ue={class:"left"},re=$({__name:"ApplyUnitSelectDialog",props:{visible:{type:Boolean,default:!1},title:{default:"\u9009\u62E9\u62A5\u540D\u5355\u4F4D\u9650\u5236"},eventTypeId:{default:""},selectedIds:{default:()=>[]}},emits:["update:visible","submit"],setup(x,{emit:D}){const i=x,g=D,p=y({get:()=>i.visible,set:e=>g("update:visible",e)}),o=new Map,m=d(0),P=y(()=>{m.value;const e=C.value.filter(t=>!o.has(t.id)).length;return o.size+e}),u=()=>{h.value.forEach(e=>{o.delete(e.id)}),C.value.forEach(e=>{o.set(e.id,e)}),m.value++},k=()=>{var e;o.clear(),(e=i.selectedIds)!=null&&e.length&&i.selectedIds.forEach(t=>{o.set(t,{id:t,name:""})}),m.value++},{selectedList:C,selectionChange:z}=Y("id"),f=d(null),T=d([{prop:"name",label:"\u540D\u79F0",search:{el:"input",placeholder:"\u8BF7\u8F93\u5165\u5355\u4F4D\u540D\u79F0"}}]),E=d([{prop:"checkbox",label:"\u9009\u62E9",type:"selection",width:50,fixed:"left"},{type:"index",label:"\u5E8F\u53F7",width:70,fixed:"left"},{label:"\u5355\u4F4D\u540D\u79F0",prop:"name"}]),w=()=>{le(()=>{if(!f.value)return;const e=f.value.element;!e||h.value.forEach(t=>{o.has(t.id)&&e.toggleRowSelection(t,!0)})})},B=e=>(e.eventTypeId=i.eventTypeId,e),I=e=>(w(),e),{tableData:h,pageable:r,searchParam:b,handleSizeChange:U,handleCurrentChange:V,getTableList:A,search:R,reset:H,loading:Z}=X(Q,I,B),L=()=>{u(),R()},N=()=>{u(),H()},W=e=>{u(),U(e)},q=e=>{u(),V(e)};ee(p,async e=>{e&&(k(),b.value={},await A())});const _=()=>{g("update:visible",!1)},J=()=>{u();const e=[];o.forEach(t=>{e.push({id:t.id,name:t.name})}),g("submit",e),_()};return(e,t)=>{const M=l("HZSearchForm"),O=l("HZProTable"),j=l("el-pagination"),G=l("HZPageLayout"),v=l("el-button"),K=l("el-dialog");return te(),ae(K,{modelValue:a(p),"onUpdate:modelValue":t[2]||(t[2]=c=>ne(p)?p.value=c:null),width:"700px",title:i.title,"before-close":_},{default:n(()=>[s(G,{isCard:!1},{searchForm:n(()=>[s(M,{"search-param":a(b),columns:a(T),search:L,reset:N,searchCol:3},null,8,["search-param","columns"])]),pagination:n(()=>[S("div",ie,[S("div",ue,"\u5DF2\u9009\u62E9\uFF1A"+oe(a(P))+"\u6761",1),s(j,{"current-page":a(r).page,"onUpdate:currentPage":t[0]||(t[0]=c=>a(r).page=c),"page-size":a(r).size,"onUpdate:pageSize":t[1]||(t[1]=c=>a(r).size=c),"page-sizes":[10,20,50,100],background:"",layout:"total, sizes, prev, pager, next",total:a(r).count,onSizeChange:W,onCurrentChange:q},null,8,["current-page","page-size","total"])])]),default:n(()=>[s(O,{columns:a(E),data:a(h),loading:a(Z),showColSet:!1,isFlex:!1,"row-key":"id","max-height":600,ref_key:"tableRef",ref:f,onSelectionChange:a(z)},null,8,["columns","data","loading","onSelectionChange"])]),_:1})]),footer:n(()=>[s(v,{onClick:_},{default:n(()=>t[3]||(t[3]=[F("\u53D6\u6D88",-1)])),_:1,__:[3]}),s(v,{type:"primary",onClick:J},{default:n(()=>t[4]||(t[4]=[F("\u786E\u5B9A",-1)])),_:1,__:[4]})]),_:1},8,["modelValue","title"])}}});const _e=se(re,[["__scopeId","data-v-1c9a78f4"]]);export{_e as default};
