var y=(c,s,r)=>new Promise((l,u)=>{var d=e=>{try{m(r.next(e))}catch(t){u(t)}},p=e=>{try{m(r.throw(e))}catch(t){u(t)}},m=e=>e.done?l(e.value):Promise.resolve(e.value).then(d,p);m((r=r.apply(c,s)).next())});import{_ as k}from"./Write.vue_vue_type_script_setup_true_lang-xw48OFpp.js";import{_ as x}from"./ContentDetailWrap.vue_vue_type_script_setup_true_lang-BkqDetGK.js";import{c as C}from"./index-D4Ne4xf-.js";import{l as E,aB as R,aI as b,r as v,ai as D,m as $,M as h,O as f,U as w,S as _,u as i}from"./vue-chunks-DyZSmvoe.js";import{j as K,k as N,l as T}from"./index-CTMAUNGp.js";import{u as I}from"./useEventBus-BjGKlZmW.js";import"./useForm-kq1sxERw.js";import"./element-plus-DNKe9-lk.js";import"./wang-editor-C7jwA1hA.js";import"./tsxHelper-DOqx_mcA.js";import"./useValidator-BN3tPovt.js";import"./message.vue_vue_type_script_setup_true_lang-Bq-3WI-Z.js";const J=E({__name:"operate",props:{type:{type:String,default:"add"},id:{type:Number,default:0}},setup(c){const s=c,{emit:r}=I(),{push:l,go:u}=R();b();const{t:d}=C(),p=v(null);y(this,null,function*(){if(s.type=="add")return;const o=yield K(s.id);o&&(p.value=o)});const e=v(),t=v(!1),g=()=>y(this,null,function*(){const o=i(e),a=yield o==null?void 0:o.submit();if(a){t.value=!0;let n=null;s.type=="edit"?n=yield N(a).catch(()=>{}).finally(()=>{t.value=!1}):n=yield T(a).catch(()=>{}).finally(()=>{t.value=!1}),n&&(r("getList",s.type),l("/wechat/keywordsEvent"))}});return(o,a)=>{const n=D("BaseButton");return $(),h(i(x),{title:i(d)("exampleDemo.edit"),onBack:a[1]||(a[1]=B=>i(l)("/example/example-page"))},{header:f(()=>[w(n,{onClick:a[0]||(a[0]=B=>i(u)(-1))},{default:f(()=>[_(" 返回 ")]),_:1}),w(n,{type:"primary",loading:t.value,onClick:g},{default:f(()=>[_(" 保存 ")]),_:1},8,["loading"])]),default:f(()=>[w(k,{ref_key:"writeRef",ref:e,"current-row":p.value},null,8,["current-row"])]),_:1},8,["title"])}}});export{J as default};
