import{c as e,r as a,o as t,q as s,n as r,v as o,x as l,e as d,B as i,z as m,y as u,C as c,D as n,G as p,ab as f,a9 as _}from"./base-lib.js?v=1761009159";import{B as j}from"./index400.js?v=1761009159";import{aP as y,hD as h,b,_ as x}from"./utils-lib.js?v=1761009159";import{k as D}from"./useController4.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./validator.js?v=1761009159";import"./index106.js?v=1761009159";import"./column.js?v=1761009159";import"./useController5.js?v=1761009159";import"./site.js?v=1761009159";import"./useStore4.js?v=1761009159";import"./useController6.js?v=1761009159";import"./useMethod5.js?v=1761009159";const v={class:"p-2rem"},C={class:"flex items-center"},k={key:0,class:"text-tertiary mt-[8px] ml-10rem"},w=x(e({__name:"index",props:{compData:{default:()=>{}}},emits:["close"],setup(e,{expose:x,emit:w}){const T=b(),Y=e,{rowData:g,siteType:q}=Y.compData,E=!!Array.isArray(g),{refreshSiteTable:M}=y(),S=w,V=a(),A=t({edate:g.edate||""}),B={},z=e=>e.getTime()<Date.now()-864e5,G=()=>{A.edate="",H(),O()},H=()=>{const e=document.querySelector(".date .el-input__inner");e&&(e.value="永久"),null==e||e.blur()},I=e=>{e||H()},O=async e=>{try{if(E){let e=[],a=[];g.forEach(a=>{e.push(a.id)});const t=await h({edate:A.edate?A.edate:"0000-00-00",sites_id:e});Object.keys(t.error).forEach(e=>{a.push({name:e,status:!1})}),await t.success.forEach(e=>{a.push({name:e,status:!0})}),D({title:"批量设置到期时间",resultTitle:"设置到期时间",resultData:a}),M(),S("close")}else{let e=T.load("正在设置到期时间，请稍后...");const a=await h({id:g.id,edate:A.edate?A.edate:"0000-00-00"});a.data.status?(T.request(a),M()):T.error(a.data.msg),e.close(),S("close")}}catch(a){}};return x({onConfirm:O}),s(()=>{"0000-00-00"===g.edate&&(A.edate="",r(()=>{H()}))}),(e,a)=>{const t=j,s=p,r=f,y=_;return o(),l("div",v,[d(y,{ref_key:"formRef",ref:V,model:u(A),rules:B},{default:i(()=>[d(r,{label:"到期时间",prop:"edate"},{default:i(()=>[m("div",C,[d(t,{modelValue:u(A).edate,"onUpdate:modelValue":a[0]||(a[0]=e=>u(A).edate=e),"value-format":"YYYY-MM-DD","disabled-date":z,class:"date",onChange:I,type:"date",placeholder:"选择日期"},null,8,["modelValue"]),d(s,{type:"default",class:"!ml-[.4rem]",onClick:G},{default:i(()=>a[1]||(a[1]=[c(" 设为永久 ",-1)])),_:1,__:[1]})])]),_:1})]),_:1},8,["model"]),u(A).edate?(o(),l("div",k,"* 到期当天24点后过期")):n("",!0)])}}}),[["__scopeId","data-v-0cf3bc99"]]);export{w as default};
