import{l as E,p as F}from"./index-BTglIPU2.js?v=1773287522785";import{ab as P,g as $,at as R}from"./naive-ui--dJnpVcV.js?v=1773287522785";import{k as B,r as l,c as V,$ as f,Z as b,_ as u,aa as d,S as a,a0 as c,R as I,F as q}from"./vue-core-DJjvd5ZC.js?v=1773287522785";const W={class:"w-400px p-20px"},Z={class:"mb-12px text-14px"},j=B({__name:"progress",props:{data:{}},emits:["close"],setup(v,{emit:S}){const C=v,{title:_,data:s,api:x,callback:o}=C.data,y=S,p=l(0),n=l(0),r=V(()=>s.length);return(async()=>{for(let t=0;t<s.length;t++)try{if(x){const i=await x(s[t]);s[t].batchStatus="success",s[t].reqMsg=$(i,"message.result","Success"),n.value+=1,n.value===r.value?p.value=100:p.value=Math.round(n.value/r.value*100)}}catch(i){s[t].batchStatus="error",s[t].reqMsg=$(i,"message.result","")}o==null||o(s),y("close")})(),(t,i)=>{const M=P;return f(),b("div",W,[u("div",Z,[u("span",null,d(t.$t("Component.Batch.index_3",a(_))),1),u("span",null,d(a(n))+"/"+d(a(r)),1)]),c(M,{type:"line",status:"success",percentage:a(p),height:24,"border-radius":4,"fill-border-radius":0,processing:!0,"show-indicator":!1,"indicator-placement":"inside"},null,8,["percentage"])])}}}),A={class:"p-24px"},G={class:"flex items-center mb-24px"},H={class:"flex-1 ml-12px text-14px leading-22px"},J={class:"flex-1 ml-12px text-14px leading-22px"},Q=B({__name:"index",props:{data:{}},emits:["setConfirm"],setup(v,{expose:S,emit:C}){const _=v,{title:s,desc:x,data:o,columns:y,api:p,done:n}=_.data,r=C,{t:h}=I(),t=l([]),i=l([...y,{key:"batchStatus",title:h("Public.Table.Result"),align:"right",width:200,render:e=>e.batchStatus==="success"?c("span",{class:"text-primary"},[e.reqMsg]):e.batchStatus==="error"?c("span",{class:"text-error"},[e.reqMsg]):c("span",{class:"text-warning"},[h("Public.Status.Wait")])}]),M=()=>{t.value=o.map(m=>({batchStatus:"wait",...m}));const{status:e}=_.data;e==="done"&&w(o)},D=l(!1),N=l(""),w=e=>{const m=e.filter(k=>k.batchStatus==="success").length,g=e.length-m;N.value=h("Component.Confirm.index_3",[s,e.length,m,g]),D.value=!0,r("setConfirm",{text:"Done",disabled:!1}),n==null||n(e)},T=()=>{r("setConfirm",{disabled:!0}),F({title:s,hideClose:!0,data:{title:s,api:p,data:t.value,callback:w},component:j})},z=({hide:e})=>(D.value?e():T(),!1);return M(),S({onConfirm:z}),(e,m)=>{const g=E,k=R;return f(),b("div",A,[u("div",G,[a(D)?(f(),b(q,{key:1},[c(g,{name:"base-success",size:"40",class:"text-primary"}),u("div",J,d(a(N)),1)],64)):(f(),b(q,{key:0},[c(g,{name:"base-warning",size:"40",class:"text-warning"}),u("div",H,d(a(x)),1)],64))]),c(k,{"max-height":182,data:a(t),columns:a(i)},null,8,["data","columns"])])}}});export{Q as _,j as a};
