import{I as v}from"./IndexPagePro-904e4e7b.js";import _ from"./MatchActivityForm-6c5afc4b.js";import{c as y,u as F}from"./activity-c9a7a2d3.js";import{u as g}from"./useFormEdit-3c660b22.js";import{d as B,u as E,p as r,a as A,z as C,m as D,k as x,e as l,a4 as c,D as b,ag as h}from"./index-deffec86.js";import"./mathActivityRule-2ac4f44b.js";import"./eleValidate-d202cccf.js";import"./Cascader-11493146.js";import"./common-8a6acaa7.js";import"./plan-2fedc155.js";import"./index-48cc2485.js";import"./map-4f55c240.js";import"./tagManage-2aab0a1e.js";import"./tabs-96386b59.js";const $=B({__name:"add",setup(k){const{closeCurrent:s}=g(),m=E(),o=r({plan_id:"",name:"",area_level:"",type_tag_ids:"",tag_group_id_list:[],is_community_sport:1,lat:"",lng:"",area_ids:[],province:"",city:"",county:"",company_area_community_id:"",address:"",street:""}),u=r(""),e=r(!1),p=()=>{s()},d=async i=>{e.value=!0;try{let t=y,a="\u65B0\u589E\u6210\u529F";u.value&&(i.activity=u.value,t=F,a="\u66F4\u65B0\u6210\u529F");let n=await t(i);n.code==200&&(b({type:"success",message:`${a}!`}),u.value||(u.value=n.data.activity_id),f()),e.value=!1}catch(t){console.error(t),e.value=!1}},f=()=>{h.confirm("\u8D5B\u4E8B\u6D3B\u52A8\u57FA\u7840\u4FE1\u606F\u6DFB\u52A0\u5B8C\u6210\uFF0C\u8DF3\u8F6C\u7EE7\u7EED\u5B8C\u6210\u8BE6\u60C5\uFF1F","\u63D0\u793A",{confirmButtonText:"\u786E\u8BA4",cancelButtonText:"\u53D6\u6D88",type:"warning"}).then(()=>{m.push({name:"matchActivityEdit",query:{activity_id:u.value}})}).catch(()=>{s()})};return(i,t)=>(A(),C(v,null,{default:D(()=>[x(_,{ref:"matchActivityFormRef",value:l(o),"onUpdate:value":t[0]||(t[0]=a=>c(o)?o.value=a:null),loading:l(e),"onUpdate:loading":t[1]||(t[1]=a=>c(e)?e.value=a:null),onCancel:p,onSubmit:d},null,8,["value","loading"])]),_:1}))}});export{$ as default};
