var h=(u,i,a)=>new Promise((c,n)=>{var m=o=>{try{t(a.next(o))}catch(r){n(r)}},p=o=>{try{t(a.throw(o))}catch(r){n(r)}},t=o=>o.done?c(o.value):Promise.resolve(o.value).then(m,p);t((a=a.apply(u,i)).next())});import{u as P,F as g}from"./useForm-DFfbRY9m.js";import{u as w}from"./useValidator-dY8qp_qX.js";import{_ as U}from"./selectFriend.vue_vue_type_script_setup_true_lang-B_XN1vat.js";import{_ as x}from"./selectRoom.vue_vue_type_script_setup_true_lang-CqEi0UST.js";import{_ as y}from"./customUrlApi.vue_vue_type_script_setup_true_lang-DlxLchgk.js";import{_ as I}from"./addCron.vue_vue_type_script_setup_true_lang-DVx_-IMc.js";import{l as F,r as R,U as s,Z as $,w as S,m as k,M as B,u as _}from"./vue-chunks-l-AyUCfi.js";const Z=F({__name:"Write",props:{currentRow:{type:Object,default:()=>null}},setup(u,{expose:i}){const{required:a,isUrl:c}=w(),n=u,m=e=>{e=="contact"?d([{field:"roomNames",path:"hidden",value:!0},{field:"friendNames",path:"hidden",value:!1}]):d([{field:"roomNames",path:"hidden",value:!1},{field:"friendNames",path:"hidden",value:!0}])},p=R([{field:"type",label:"发送对象",component:"Select",value:"contact",colProps:{span:16,push:4},componentProps:{clearable:!1,on:{change:e=>{m(e)}},options:[{value:"contact",label:"好友"},{value:"room",label:"群组"}]}},{field:"roomNames",label:"群名",colProps:{span:16,push:4},value:[],formItemProps:{slots:{default:e=>s("div",{class:"w-[100%]"},[s(x,{multiple:!0,modelValue:e.roomNames,"onUpdate:modelValue":l=>e.roomNames=l},null)])}},hidden:!0},{field:"friendNames",label:"好友名称",colProps:{span:16,push:4},value:[],hidden:!1,formItemProps:{slots:{default:e=>s("div",{class:"w-[100%] flex"},[s(U,{multiple:!0,modelValue:e.friendNames,"onUpdate:modelValue":l=>e.friendNames=l},null)])}}},{label:"定时规则:",value:"",field:"cron",formItemProps:{rules:[a()],slots:{default:e=>s(I,{modelValue:e.cron,"onUpdate:modelValue":l=>e.cron=l},null)}},colProps:{span:16,push:4}},{field:"api",label:"回调地址",component:"Input",value:"",colProps:{span:16,push:4},formItemProps:{slots:{default:e=>s(y,{modelValue:e.api,"onUpdate:modelValue":l=>e.api=l},null)}}}]),t=$({roomNames:[a()],customUrl:[a(),c()],name:[a()],city:[a()],memorialDay:[a()],friendNames:[a()]}),{formRegister:o,formMethods:r}=P(),{setValues:v,getFormData:N,getElFormExpose:V,setSchema:d}=r,b=()=>h(this,null,function*(){const e=yield V();if(yield e==null?void 0:e.validate().catch(f=>{}))return yield N()});return S(()=>n.currentRow,e=>{e&&v(e)},{deep:!0,immediate:!0}),i({submit:b,change:m}),(e,l)=>(k(),B(_(g),{rules:t,"auto-set-placeholder":!1,onRegister:_(o),schema:p.value},null,8,["rules","onRegister","schema"]))}});export{Z as _};
