var y=(c,u,a)=>new Promise((d,s)=>{var i=o=>{try{r(a.next(o))}catch(n){s(n)}},p=o=>{try{r(a.throw(o))}catch(n){s(n)}},r=o=>o.done?d(o.value):Promise.resolve(o.value).then(i,p);r((a=a.apply(c,u)).next())});import{u as g,F as w}from"./useForm-DFfbRY9m.js";import{u as x}from"./useValidator-dY8qp_qX.js";import{_ as V}from"./selectFriend.vue_vue_type_script_setup_true_lang-B_XN1vat.js";import{_ as F}from"./selectRoom.vue_vue_type_script_setup_true_lang-CqEi0UST.js";import{_ as O}from"./Corn.vue_vue_type_script_setup_true_lang-X0bhrmk_.js";import{r as m}from"./element-plus-C2aeItNs.js";import{l as I,r as U,Z as j,w as B,m as M,M as R,u as P,U as l,S as h}from"./vue-chunks-l-AyUCfi.js";const C=I({__name:"Write",props:{currentRow:{type:Object,default:()=>null}},setup(c,{expose:u}){const{required:a}=x(),d=c,s=e=>{e=="contact"?v([{field:"roomNames",path:"hidden",value:!0},{field:"friendNames",path:"hidden",value:!1}]):v([{field:"roomNames",path:"hidden",value:!1},{field:"friendNames",path:"hidden",value:!0}])},i=e=>{if(!e)return"";const t=m().startOf("day");return m(e).diff(t,"day")},p=U([{field:"none",label:"内容示例（根据填写变动）",colProps:{span:24},value:"",formItemProps:{slots:{default:e=>l("div",{class:"w-[100%]"},[h("距离"),e.prefix,h("还有：✦✦✦✦ "),i(e.memorialDay),h("天 ✦✦✦✦")])}}},{field:"type",label:"发送对象",component:"Select",value:"contact",colProps:{span:24},componentProps:{clearable:!1,on:{change:e=>{s(e)}},options:[{value:"contact",label:"好友"},{value:"room",label:"群组"}]}},{field:"roomNames",label:"群名",colProps:{span:24},value:null,formItemProps:{slots:{default:e=>l("div",{class:"w-[100%]"},[l(F,{modelValue:e.roomNames,"onUpdate:modelValue":t=>e.roomNames=t},null)])}},hidden:!0},{field:"friendNames",label:"好友名称",colProps:{span:24},value:null,hidden:!1,formItemProps:{slots:{default:e=>l("div",{class:"w-[100%] flex"},[l(V,{modelValue:e.friendNames,"onUpdate:modelValue":t=>e.friendNames=t},null)])}}},{field:"memorialDay",label:"未来日期",component:"DatePicker",colProps:{span:24},componentProps:{valueFormat:"YYYY-MM-DD",disabledDate:e=>(e.getTime(),m().startOf("day").valueOf(),e.getTime()<m().startOf("day").valueOf())}},{field:"prefix",label:"倒计时说明",component:"Input",colProps:{span:24},componentProps:{placeholder:"倒计时说明，例如：女友生日"}},{field:"suffix",label:"后缀说明",component:"Input",colProps:{span:24},componentProps:{placeholder:"后缀说明，例如：不要忘记买礼物"}},{field:"endWord",label:"结尾备注",component:"Input",colProps:{span:24}},{field:"cronDate",label:"周期",colProps:{span:24},value:{type:"day",date:"",cron:"",month:"",day:""},formItemProps:{slots:{default:e=>l("div",{class:"w-[100%] flex"},[l(O,{modelValue:e.cronDate,"onUpdate:modelValue":t=>e.cronDate=t},null)])}}}]),r=j({roomNames:[a()],endWord:[a()],city:[a()],memorialDay:[a()],friendNames:[a()]}),{formRegister:o,formMethods:n}=g(),{setValues:b,getFormData:D,getElFormExpose:_,setSchema:v}=n,N=()=>y(this,null,function*(){const e=yield _();if(yield e==null?void 0:e.validate().catch(f=>{}))return yield D()});return B(()=>d.currentRow,e=>{e&&b(e)},{deep:!0,immediate:!0}),u({submit:N,change:s}),(e,t)=>(M(),R(P(w),{rules:r,"auto-set-placeholder":!1,onRegister:P(o),schema:p.value},null,8,["rules","onRegister","schema"]))}});export{C as _};
