var v=(r,t,l)=>new Promise((c,n)=>{var d=a=>{try{u(l.next(a))}catch(m){n(m)}},i=a=>{try{u(l.throw(a))}catch(m){n(m)}},u=a=>a.done?c(a.value):Promise.resolve(a.value).then(d,i);u((l=l.apply(r,t)).next())});import{u as w,F as V}from"./useForm-kq1sxERw.js";import{u as y}from"./useValidator-BN3tPovt.js";import{_ as g}from"./selectFriend.vue_vue_type_script_setup_true_lang-BzxfNWW1.js";import{_ as I}from"./selectRoom.vue_vue_type_script_setup_true_lang-C-AHDN4k.js";import{_ as x}from"./Corn.vue_vue_type_script_setup_true_lang-BmMviSI3.js";import"./element-plus-DNKe9-lk.js";import{l as R,r as S,Z as B,w as D,m as F,M as U,u as b,U as s}from"./vue-chunks-DyZSmvoe.js";const h=[{value:46,label:"宠物新闻"},{value:45,label:"电竞资讯"},{value:43,label:"女性新闻"},{value:42,label:"垃圾分类新闻"},{value:41,label:"环保资讯"},{value:40,label:"影视资讯"},{value:38,label:"汉服新闻"},{value:36,label:"科学探索"},{value:35,label:"汽车新闻"},{value:34,label:"互联网资讯"},{value:33,label:"动漫资讯"},{value:32,label:"财经新闻"},{value:31,label:"游戏资讯"},{value:30,label:"CBA新闻"},{value:29,label:"人工智能"},{value:27,label:"军事新闻"},{value:26,label:"足球新闻"},{value:24,label:"创业新闻"},{value:22,label:"IT资讯"},{value:21,label:"VR科技"},{value:20,label:"NBA新闻"},{value:19,label:"苹果新闻"},{value:18,label:"旅游资讯"},{value:17,label:"健康知识"},{value:13,label:"科技新闻"},{value:12,label:"体育新闻"},{value:10,label:"娱乐新闻"},{value:8,label:"国际新闻"},{value:7,label:"国内新闻"},{value:5,label:"社会新闻"}];function k(r){return r.reduce((t,l)=>(t[l.value]=l.label,t),{})}const O=k(h),T=R({__name:"Write",props:{currentRow:{type:Object,default:()=>null}},setup(r,{expose:t}){const{required:l}=y(),c=r,n=e=>{e=="contact"?p([{field:"roomNames",path:"hidden",value:!0},{field:"friendNames",path:"hidden",value:!1}]):p([{field:"roomNames",path:"hidden",value:!1},{field:"friendNames",path:"hidden",value:!0}])},d=S([{field:"type",label:"发送对象",component:"Select",value:"contact",colProps:{span:24},componentProps:{clearable:!1,on:{change:e=>{n(e)}},options:[{value:"contact",label:"好友"},{value:"room",label:"群组"}]}},{field:"roomNames",label:"群名",colProps:{span:24},value:"",formItemProps:{slots:{default:e=>s("div",{class:"w-[100%]"},[s(I,{modelValue:e.roomNames,"onUpdate:modelValue":o=>e.roomNames=o},null)])}},hidden:!0},{field:"friendNames",label:"好友名称",colProps:{span:24},value:"",hidden:!1,formItemProps:{slots:{default:e=>s("div",{class:"w-[100%] flex"},[s(g,{modelValue:e.friendNames,"onUpdate:modelValue":o=>e.friendNames=o},null)])}}},{field:"sortId",label:"新闻类型",component:"Select",colProps:{span:24},componentProps:{options:h}},{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=>s("div",{class:"w-[100%] flex"},[s(x,{modelValue:e.cronDate,"onUpdate:modelValue":o=>e.cronDate=o},null)])}}}]),i=B({roomNames:[l()],name:[l()],endWord:[l()],sortId:[l()],memorialDay:[l()],friendNames:[l()]}),{formRegister:u,formMethods:a}=w(),{setValues:m,getFormData:_,getElFormExpose:N,setSchema:p}=a,P=()=>v(this,null,function*(){const e=yield N();if(yield e==null?void 0:e.validate().catch(f=>{}))return yield _()});return D(()=>c.currentRow,e=>{e&&m(e)},{deep:!0,immediate:!0}),t({submit:P,change:n}),(e,o)=>(F(),U(b(V),{rules:i,"auto-set-placeholder":!1,onRegister:b(u),schema:d.value},null,8,["rules","onRegister","schema"]))}});export{T as _,O as n};
