var b=Object.defineProperty,D=Object.defineProperties;var R=Object.getOwnPropertyDescriptors;var B=Object.getOwnPropertySymbols;var $=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable;var N=(a,e,t)=>e in a?b(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,y=(a,e)=>{for(var t in e||(e={}))$.call(e,t)&&N(a,t,e[t]);if(B)for(var t of B(e))h.call(e,t)&&N(a,t,e[t]);return a},_=(a,e)=>D(a,R(e));var C=(a,e,t)=>new Promise((u,f)=>{var v=n=>{try{c(t.next(n))}catch(r){f(r)}},i=n=>{try{c(t.throw(n))}catch(r){f(r)}},c=n=>n.done?u(n.value):Promise.resolve(n.value).then(v,i);c((t=t.apply(a,e)).next())});import{_ as T}from"./Write.vue_vue_type_script_setup_true_lang-CR2MKoDc.js";import{_ as S}from"./ContentDetailWrap.vue_vue_type_script_setup_true_lang-BT6PDDaO.js";import{c as V}from"./index-OziN21LA.js";import{l as E,aB as I,r as g,ai as L,m as M,M as O,O as d,U as w,S as x,u as p}from"./vue-chunks-l-AyUCfi.js";import{c as U,e as j,f as q}from"./index-ChFzlt9y.js";import{u as z}from"./useEventBus-yN5ROQx3.js";import{o as A}from"./element-plus-C2aeItNs.js";import"./useForm-DFfbRY9m.js";import"./wang-editor-D6T5hJzu.js";import"./tsxHelper-BLTo71S4.js";import"./useValidator-dY8qp_qX.js";import"./selectFriend.vue_vue_type_script_setup_true_lang-B_XN1vat.js";import"./index-Cl3s0rC0.js";import"./selectRoom.vue_vue_type_script_setup_true_lang-CqEi0UST.js";import"./customUrlApi.vue_vue_type_script_setup_true_lang-DlxLchgk.js";import"./index-DfIQY6vp.js";import"./addCron.vue_vue_type_script_setup_true_lang-DVx_-IMc.js";import"./Dialog.vue_vue_type_style_index_0_lang-DTUY8bxL.js";const me=E({__name:"operate",props:{type:{type:String,default:"add"},id:{type:Number,default:0}},setup(a){const e=a,{emit:t}=z(),{push:u,go:f}=I(),{t:v}=V(),i=g(null);C(this,null,function*(){if(e.type=="add")return;const o=yield U(e.id);o&&(i.value=o,i.value.api=o.api.id,o.type!="contact"?i.value.roomNames=o.names||[]:i.value.friendNames=o.names||[])});const n=g(),r=g(!1),k=()=>C(this,null,function*(){const o=p(n),s=yield o==null?void 0:o.submit();if(s){r.value=!0;let m=null,l=s.roomNames;s.type=="contact"&&(l=s.friendNames),e.type=="edit"?m=yield j(A(_(y({},s),{names:l}),["friendNames","roomNames"])).catch(()=>{}).finally(()=>{r.value=!1}):m=yield q(_(y({},s),{names:l})).catch(()=>{}).finally(()=>{r.value=!1}),m&&(t("getList",e.type),u("/schedule/customContent"))}});return(o,s)=>{const m=L("BaseButton");return M(),O(p(S),{title:p(v)("exampleDemo.edit"),onBack:s[1]||(s[1]=l=>p(u)("/example/example-page"))},{header:d(()=>[w(m,{onClick:s[0]||(s[0]=l=>p(f)(-1))},{default:d(()=>[x(" 返回 ")]),_:1}),w(m,{type:"primary",loading:r.value,onClick:k},{default:d(()=>[x(" 保存 ")]),_:1},8,["loading"])]),default:d(()=>[w(T,{ref_key:"writeRef",ref:n,"current-row":i.value},null,8,["current-row"])]),_:1},8,["title"])}}});export{me as default};
