import R from"./BaseForm-8630d9ab-1782572373740v=1.0.0.js";import{u as L,c as E}from"./volunteerRecruitApi-a86c68c5-1782572373740v=1.0.0.js";import{u as V}from"./useFormEdit-e67d5b61-1782572373740v=1.0.0.js";import{a as _}from"./index-f6f689f9-1782572373740v=1.0.0.js";import{E as n}from"./eleVendor-48a7d3b8-1782572373740v=1.0.0.js";import{y as d,r as u,m as x,al as b,z as C,I,J as O,R as S,u as l,k as p}from"./vendor-866bb149-1782572373740v=1.0.0.js";const w=d({name:"volunteerRecruitEdit"}),U=d({...w,props:{type:{type:String,default:"volunteer"}},setup(f){const{closeCurrent:c}=V(),v=u(null),i=u({type:"",name:"",dictTypeSign:"",status:"",creatorOrganUnitType:"",serviceTimeList:[]}),m=f,a=u(!1),o=_(),y=()=>{c()},g=async s=>{a.value=!0;try{let e=L,r="\u66F4\u65B0\u6210\u529F";s.recruitType=m.type;let t=await e(s);t.code==0?(n({type:"success",message:`${r}!`}),c()):n.warning(t.msg),a.value=!1}catch{a.value=!1}},T=async s=>{let e=await E(s);if(e.code!=0){n.warning(e.msg);return}e.data.applyTime=[e.data.applyStartTime,e.data.applyEndTime],e.data.serviceTime=[e.data.serviceStartTime,e.data.serviceEndTime],e.data.serviceTimeGroupRespVOList&&e.data.serviceTimeGroupRespVOList.length>0&&(e.data.serviceTimeGroupRespVOList.forEach(r=>{r.serviceTimeRespVOList.forEach(t=>{t.times=[t.startTime,t.endTime]})}),e.data.serviceTimeList=e.data.serviceTimeGroupRespVOList),e.data.exclusionIds&&e.data.exclusionIds.length>0&&(e.data.exclusionIds=e.data.exclusionIds.split(",").map(Number)),i.value=e.data};return x(()=>{o.query.id&&(v.value=o.query.id,T(o.query.id))}),(s,e)=>{const r=b("HZPageLayout");return C(),I(r,{isBack:!0,title:l(o).meta.title},{default:O(()=>[S(R,{value:l(i),"onUpdate:value":e[0]||(e[0]=t=>p(i)?i.value=t:null),type:m.type,loading:l(a),"onUpdate:loading":e[1]||(e[1]=t=>p(a)?a.value=t:null),onCancel:y,onSubmit:g},null,8,["value","type","loading"])]),_:1},8,["title"])}}});export{U as _};
