import{t as e,l as a,x as t}from"./utils-lib.js?v=20260328163632";import{o as s}from"./useMethod4.js?v=20260328163632";import{u as l}from"./store4.js?v=20260328163632";import{P as o}from"./site.js?v=20260328163632";import{k as r,r as i,c as m,V as d,W as u,O as n,Y as p}from"./base-lib.js?v=20260328163632";import{p as c}from"./naive-ui.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";const v={class:"p-20px"},f=r({__name:"index",props:{compData:{default:()=>{}}},emits:["close"],setup(r,{expose:f,emit:y}){const b=r,{rowData:x,siteType:h}=b.compData,j=!!Array.isArray(x),{isRefreshList:k}=l(),w=y,D=i(""),_=e=>e<Date.now()-864e5,g=()=>{P.value.edate="",D.value="",W(w("close"))},C=e=>{D.value=e},T=m((()=>({label:a("到期时间"),attrs:{feedbackClass:"!min-h-0",labelStyle:"min-width: 100px"},children:[{type:"custom",key:"edate",render:()=>n(c,{"formatted-value":P.value.edate,"onUpdate:formatted-value":[e=>P.value.edate=e,C],"value-format":"yyyy-MM-dd",placeholder:D.value?a("选择日期"):a("永久"),"is-date-disabled":_,type:"date",class:"!w-230px date",clearable:!0},null)},{type:"button",key:"permanent",attrs:{buttonText:a("设为永久"),type:"default",class:"!ml-[4px]",onClick:g}}]}))),A=i({label:" ",attrs:{feedbackClass:"!min-h-0"},children:[{type:"custom",key:"tips",render:()=>n("div",{class:"text-[--text-color-19] mt-[8px] "},[a("到期时间当天的24点之后自动停止该网站")])}]}),M=i({formAttrs:{labelWidth:"auto"},formItems:[]}),H=m((()=>(M.value.formItems=[T.value,A.value],M.value))),[I,P,S]=e(H),W=async e=>{var l;let r=0;if(P.value.edate&&(r=new Date(P.value.edate),r.setHours(23,59,59),r=(r.getTime()/1e3).toFixed(0)),j){let t=[];await Promise.all(x.map((async e=>{const a=await o({siteid:e.id,endtime:r||0});t.push({name:e.name,status:a.status,msg:a.msg})}))),s({title:a("批量设置到期时间"),resultTitle:a("设置到期时间"),resultData:t}),k.value=!0,null==(l=b.compData)||l.clearSelection(),e()}else t({loading:a("正在设置到期时间, 请稍后..."),request:o({siteid:x.id,endtime:r||0}),message:!0,success:a=>{a.status&&(k.value=!0,e())}})};return"0000-00-00"===x.edate||0==x.edate?D.value="":(P.value.edate=x.edate,D.value=x.edate),f({onConfirm:W}),(e,a)=>(d(),u("div",v,[n(p(I))]))}});export{f as default};
