var y=(c,s,r)=>new Promise((i,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?i(e.value):Promise.resolve(e.value).then(d,p);m((r=r.apply(c,s)).next())});import{_ as B}from"./Write.vue_vue_type_script_setup_true_lang-CQL4GgVH.js";import{_ as b}from"./ContentDetailWrap.vue_vue_type_script_setup_true_lang-BT6PDDaO.js";import{c as x}from"./index-OziN21LA.js";import{l as T,aB as C,aI as R,r as _,ai as D,m as $,M as G,O as f,U as v,S as g,u as n}from"./vue-chunks-l-AyUCfi.js";import{y as N,z as h,A 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";const J=T({__name:"operate",props:{type:{type:String,default:"add"},id:{type:Number,default:0}},setup(c){const s=c,{emit:r}=S(),{push:i,go:u}=C();R();const{t:d}=x(),p=_(null);y(this,null,function*(){if(s.type=="add")return;const o=yield N(s.id);o&&(p.value=o)});const e=_(),t=_(!1),k=()=>y(this,null,function*(){const o=n(e),a=yield o==null?void 0:o.submit();if(a){t.value=!0;let l=null;s.type=="edit"?l=yield h(a).catch(()=>{}).finally(()=>{t.value=!1}):l=yield I(a).catch(()=>{}).finally(()=>{t.value=!1}),l&&(r("getList",s.type),i("/globalTask/list"))}});return(o,a)=>{const l=D("BaseButton");return $(),G(n(b),{title:n(d)("exampleDemo.edit"),onBack:a[1]||(a[1]=w=>n(i)("/example/example-page"))},{header:f(()=>[v(l,{onClick:a[0]||(a[0]=w=>n(u)(-1))},{default:f(()=>[g(" 返回 ")]),_:1}),v(l,{type:"primary",loading:t.value,onClick:k},{default:f(()=>[g(" 保存 ")]),_:1},8,["loading"])]),default:f(()=>[v(B,{ref_key:"writeRef",ref:e,"current-row":p.value},null,8,["current-row"])]),_:1},8,["title"])}}});export{J as default};
