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-1Q1fX013.js";import{_ as x}from"./ContentDetailWrap.vue_vue_type_script_setup_true_lang-BT6PDDaO.js";import{c as C}from"./index-OziN21LA.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-l-AyUCfi.js";import{j as K,k as N,l as T}from"./index-Cl3s0rC0.js";import{u as I}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";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};
