import{h as F,C as k,I as D,J as N,B as S,D as q}from"./element-plus-z3MwpXC9.js";import{P as U}from"./index-CdmO5-Ss.js";import{f}from"./index-DXEGVToZ.js";import{d as I,s as b,Z as v,o as w,c as L,V as a,M as l,S as m,a as g,u as t,T as i,L as M,R as O}from"./@vue-TMcuEboY.js";const h={class:"export-data"},j={class:"flex"},Z=I({__name:"index",props:{params:{type:Object,default:()=>({})},pageSize:{type:Number,default:25},fetchFun:{type:Function,required:!0}},setup(z){const c=b(),u=z,x=b(),o=v({page_type:0,page_start:1,page_end:200,file_name:""}),E={page_start:[{required:!0,message:"请输入起始页码"},{type:"number",message:"页码必须是整数"},{validator:(r,e,n)=>{if(e<=0)return n(new Error("页码必须大于0"));n()}}],page_end:[{required:!0,message:"请输入结束页码"},{type:"number",message:"页码必须是整数"},{validator:(r,e,n)=>{if(e<=0)return n(new Error("页码必须大于0"));n()}}]},d=v({count:0,sum_page:0,page_size:0,max_page:0,all_max_size:0}),y=async()=>{const r=await u.fetchFun({...u.params,page_size:u.pageSize,export:1});Object.assign(d,r),o.file_name=r.file_name,o.page_end=r.page_end,o.page_start=r.page_start},R=async()=>{var r,e;await((r=c.value)==null?void 0:r.validate()),f.loading("正在导出中...");try{await u.fetchFun({...u.params,...o,page_size:u.pageSize,export:2}),(e=x.value)==null||e.close(),f.closeLoading()}catch{f.closeLoading()}};return y(),(r,e)=>{const n=F,p=k,V=D,B=N,_=S,C=q;return w(),L("div",h,[a(U,{ref_key:"popupRef",ref:x,title:"导出设置",width:"500px","confirm-button-text":"确认导出",onConfirm:R,async:!0,onOpen:y},{trigger:l(()=>[a(n,null,{default:l(()=>e[4]||(e[4]=[m("导出")])),_:1})]),default:l(()=>[g("div",null,[a(C,{ref_key:"formRef",ref:c,model:t(o),"label-width":"120px",rules:E},{default:l(()=>[a(p,{label:"数据量："},{default:l(()=>[m(" 预计导出"+i(t(d).count)+"条数据， 共"+i(t(d).sum_page)+"页，每页"+i(t(d).page_size)+"条数据 ",1)]),_:1}),a(p,{label:"导出限制："},{default:l(()=>[m(" 每次导出最大允许"+i(t(d).max_page)+"页，共"+i(t(d).all_max_size)+"条数据 ",1)]),_:1}),a(p,{prop:"page_type",label:"导出范围：",required:""},{default:l(()=>[a(B,{modelValue:t(o).page_type,"onUpdate:modelValue":e[0]||(e[0]=s=>t(o).page_type=s)},{default:l(()=>[a(V,{value:0},{default:l(()=>e[5]||(e[5]=[m("全部导出")])),_:1}),a(V,{value:1},{default:l(()=>e[6]||(e[6]=[m("分页导出")])),_:1})]),_:1},8,["modelValue"])]),_:1}),t(o).page_type==1?(w(),M(p,{key:0,label:"分页范围："},{default:l(()=>[g("div",j,[a(p,{prop:"page_start"},{default:l(()=>[a(_,{style:{width:"140px"},modelValue:t(o).page_start,"onUpdate:modelValue":e[1]||(e[1]=s=>t(o).page_start=s),modelModifiers:{number:!0},placeholder:""},null,8,["modelValue"])]),_:1}),e[7]||(e[7]=g("span",{class:"flex-none ml-2 mr-2"},"页，至",-1)),a(p,{prop:"page_end"},{default:l(()=>[a(_,{style:{width:"140px"},modelValue:t(o).page_end,"onUpdate:modelValue":e[2]||(e[2]=s=>t(o).page_end=s),modelModifiers:{number:!0},placeholder:""},null,8,["modelValue"])]),_:1})])]),_:1})):O("",!0),a(p,{label:"导出文件名称：",prop:"file_name"},{default:l(()=>[a(_,{modelValue:t(o).file_name,"onUpdate:modelValue":e[3]||(e[3]=s=>t(o).file_name=s),placeholder:"请输入导出文件名称"},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])])]),_:1},512)])}}});export{Z as _};
