import N from"./BaseForm-158e6a6c-1782729249161v=1.0.0.js";import{h as f,a as D,y as A,C as E,B as G}from"./index-b309bf9f-1782729249161v=1.0.0.js";import{u as R}from"./useFormEdit-fb8b8504-1782729249161v=1.0.0.js";import{u as U}from"./useSignupSetHook-d01c9e47-1782729249161v=1.0.0.js";import{E as l}from"./eleVendor-5008d1ec-1782729249161v=1.0.0.js";import{y as S,r as d,c,m as x,al as H,z,I as M,J as Z,R as $,u as n,k as B}from"./vendor-1e24e3ad-1782729249161v=1.0.0.js";import"./UnitSetForm-10144db7-1782729249161v=1.0.0.js";import"./AddAdminSelectDialog-c0b941f0-1782729249161v=1.0.0.js";import"./useTable-cf8e962b-1782729249161v=1.0.0.js";import"./notData-926f7286-1782729249161v=1.0.0.js";import"./useSelection-d7df50be-1782729249161v=1.0.0.js";import"./GroupForm-ebccd8c8-1782729249161v=1.0.0.js";import"./PersonalFormCom.vue_vue_type_script_setup_true_lang-9bb9c282-1782729249161v=1.0.0.js";import"./useSignupTemplate-2b906224-1782729249161v=1.0.0.js";import"./Imgs-0a9c1d5a-1782729249161v=1.0.0.js";import"./useDynamicFormHook-140c1b9e-1782729249161v=1.0.0.js";import"./UnitFormCom-36792dae-1782729249161v=1.0.0.js";import"./TeamFormCom.vue_vue_type_script_setup_true_lang-7f195220-1782729249161v=1.0.0.js";import"./DoubleFormCom.vue_vue_type_script_setup_true_lang-7cc4de51-1782729249161v=1.0.0.js";import"./signupTemplateApi-da258822-1782729249161v=1.0.0.js";import"./eventTypeApi-be275193-1782729249161v=1.0.0.js";import"./keepAlive-20a782c5-1782729249161v=1.0.0.js";import"./eventGroupAndTermApi-7b02c2ee-1782729249161v=1.0.0.js";const j=o=>f.post("/javaPpoEventactivity/asyncBiz/eventApplyConfBatchSet",o,{headers:{noLoading:!0}}),J=o=>f.post("/javaPpoEventactivity/eventApplyConf/add",o,{headers:{noLoading:!0}}),V=o=>f.put("/javaPpoEventactivity/eventApplyConf/up",o,{headers:{noLoading:!0}}),K=o=>f.get(`/javaPpoEventactivity/eventApplyConf/infoByEventTermId/${o}`,{},{headers:{noLoading:!0}}),O=S({name:"eventSettingAdd"}),Ie=S({...O,setup(o){const{closeCurrent:y}=R(),r=D(),h=d(r.query.detail==1),{baseInfoForm:v,initialForm:F,unitInitialForm:T}=U(),a=d(!1),C=c(()=>r.query.type),b=c(()=>r.query.eventId),w=c(()=>r.query.eventGroupId),m=c(()=>r.query.eventTermId),i=d(!1),g=d(null),P=()=>{y()},_=async()=>{let e=await K(m.value);if(e.code==0){i.value=!!e.data.eventApplyConfId,e.data.eventApplyUnitType===null&&(e.data.eventApplyUnitType="-1");let t=A(E(T),e.data),s=A(E(F),e.data);s.unitForm=t,v.value=s,g.value=e.data}else i.value=!1,l.warning(e.msg)};x(()=>{m.value&&_()});const L=async e=>{a.value=!0;try{e.eventTermId=m.value;let t=i.value?V:J;i.value&&(e.eventApplyConfId=g.value.eventApplyConfId);let s=i.value?"\u66F4\u65B0\u6210\u529F":"\u65B0\u589E\u6210\u529F",u=await t(e);u.code==0?(l({type:"success",message:`${s}!`}),y()):l.warning(u.msg),a.value=!1}catch{a.value=!1}},k=async e=>{a.value=!0;try{p.value=0,await j(e),I()}catch(t){l.warning(t.message)}},p=d(0),I=async()=>{let e=await G("eventApplyConfBatchSet");if(e.code==0){if(!e.data){a.value=!1;return}if(p.value=e.data.rate,e.data.asyncStatus==="run_success"||e.data.rate===100){a.value=!1,p.value=0,l({type:"success",message:"\u6279\u91CF\u8BBE\u7F6E\u6210\u529F"}),y();return}if(e.data.asyncStatus==="failed"){a.value=!1,l.warning(e.msg),p.value=0;return}e.data.asyncStatus==="init"&&setTimeout(()=>{I()},1e3)}},q=async e=>{C.value==="multiple"?k(e):L(e)};return(e,t)=>{const s=H("HZPageLayout");return z(),M(s,{isBack:!0,title:n(r).meta.title},{default:Z(()=>[$(N,{value:n(v),"onUpdate:value":t[0]||(t[0]=u=>B(v)?v.value=u:null),loading:n(a),"onUpdate:loading":t[1]||(t[1]=u=>B(a)?a.value=u:null),onCancel:P,onSubmit:q,editType:n(C),eventId:n(b),eventGroupId:n(w),eventTermId:n(m),allData:n(g),disabled:n(h),batchProgressNum:n(p)},null,8,["value","loading","editType","eventId","eventGroupId","eventTermId","allData","disabled","batchProgressNum"])]),_:1},8,["title"])}}});export{Ie as default};
