var v=(f,s,r)=>new Promise((p,u)=>{var d=e=>{try{c(r.next(e))}catch(t){u(t)}},l=e=>{try{c(r.throw(e))}catch(t){u(t)}},c=e=>e.done?p(e.value):Promise.resolve(e.value).then(d,l);c((r=r.apply(f,s)).next())});import{_ as w}from"./Write.vue_vue_type_script_setup_true_lang-DcpgUq-K.js";import{_ as C}from"./ContentDetailWrap.vue_vue_type_script_setup_true_lang-BT6PDDaO.js";import{c as x}from"./index-OziN21LA.js";import{l as b,aB as E,aI as R,r as _,ai as D,m as $,M as N,O as m,U as y,S as B,u as i}from"./vue-chunks-l-AyUCfi.js";import{q as T,r as h,t as I}from"./index-DfIQY6vp.js";import{u as S}from"./useEventBus-yN5ROQx3.js";import"./useForm-DFfbRY9m.js";import"./element-plus-C2aeItNs.js";import"./wang-editor-D6T5hJzu.js";import"./tsxHelper-BLTo71S4.js";import"./useValidator-dY8qp_qX.js";import"./message.vue_vue_type_script_setup_true_lang-C0R52Rsd.js";import"./customUrlApi.vue_vue_type_script_setup_true_lang-DlxLchgk.js";const P=b({__name:"operate",props:{type:{type:String,default:"add"},id:{type:Number,default:0}},setup(f){const s=f,{emit:r}=S(),{push:p,go:u}=E();R();const{t:d}=x(),l=_(null);v(this,null,function*(){if(s.type=="add")return;const a=yield T(s.id);a&&(l.value=a,l.value.api=a.api.id)});const e=_(),t=_(!1),k=()=>v(this,null,function*(){const a=i(e),o=yield a==null?void 0:a.submit();if(o){t.value=!0;let n=null;s.type=="edit"?n=yield h(o).catch(()=>{}).finally(()=>{t.value=!1}):n=yield I(o).catch(()=>{}).finally(()=>{t.value=!1}),n&&(r("getList",s.type),p("/vip/callbackEvent"))}});return(a,o)=>{const n=D("BaseButton");return $(),N(i(C),{title:i(d)("exampleDemo.edit"),onBack:o[1]||(o[1]=g=>i(p)("/example/example-page"))},{header:m(()=>[y(n,{onClick:o[0]||(o[0]=g=>i(u)(-1))},{default:m(()=>[B(" 返回 ")]),_:1}),y(n,{type:"primary",loading:t.value,onClick:k},{default:m(()=>[B(" 保存 ")]),_:1},8,["loading"])]),default:m(()=>[y(w,{ref_key:"writeRef",ref:e,"current-row":l.value},null,8,["current-row"])]),_:1},8,["title"])}}});export{P as default};
