import N from"./BaseForm-c1114469-1782572373740v=1.0.0.js";import{h as f,a as D,y as A,C as E,B as G}from"./index-f6f689f9-1782572373740v=1.0.0.js";import{u as R}from"./useFormEdit-e67d5b61-1782572373740v=1.0.0.js";import{u as U}from"./useSignupSetHook-6ae94102-1782572373740v=1.0.0.js";import{E as l}from"./eleVendor-48a7d3b8-1782572373740v=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-866bb149-1782572373740v=1.0.0.js";import"./UnitSetForm-4add7c19-1782572373740v=1.0.0.js";import"./AddAdminSelectDialog-e7f3997f-1782572373740v=1.0.0.js";import"./useTable-34acff72-1782572373740v=1.0.0.js";import"./notData-cef8761e-1782572373740v=1.0.0.js";import"./useSelection-ba27a2e2-1782572373740v=1.0.0.js";import"./GroupForm-bb7b818a-1782572373740v=1.0.0.js";import"./PersonalFormCom.vue_vue_type_script_setup_true_lang-35f011c9-1782572373740v=1.0.0.js";import"./useSignupTemplate-94c0c1aa-1782572373740v=1.0.0.js";import"./Imgs-ec8274aa-1782572373740v=1.0.0.js";import"./useDynamicFormHook-1d702eb2-1782572373740v=1.0.0.js";import"./UnitFormCom-b59a8c14-1782572373740v=1.0.0.js";import"./TeamFormCom.vue_vue_type_script_setup_true_lang-81341bae-1782572373740v=1.0.0.js";import"./DoubleFormCom.vue_vue_type_script_setup_true_lang-3e4db69a-1782572373740v=1.0.0.js";import"./signupTemplateApi-59fddc0d-1782572373740v=1.0.0.js";import"./eventTypeApi-155a5531-1782572373740v=1.0.0.js";import"./keepAlive-0ac97bbd-1782572373740v=1.0.0.js";import"./eventGroupAndTermApi-31c30359-1782572373740v=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};
