var Y=Object.defineProperty;var A=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var R=(o,s,n)=>s in o?Y(o,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[s]=n,z=(o,s)=>{for(var n in s||(s={}))F.call(s,n)&&R(o,n,s[n]);if(A)for(var n of A(s))U.call(s,n)&&R(o,n,s[n]);return o};var d=(o,s,n)=>new Promise((y,m)=>{var b=i=>{try{p(n.next(i))}catch(c){m(c)}},_=i=>{try{p(n.throw(i))}catch(c){m(c)}},p=i=>i.done?y(i.value):Promise.resolve(i.value).then(b,_);p((n=n.apply(o,s)).next())});import{u as H,a as q,b as I,_ as Z}from"./useCrudSchemas-f5-cIgli.js";import{_ as G}from"./Search.vue_vue_type_script_setup_true_lang-B4LnkeCr.js";import{e as g,c as J}from"./index-D4Ne4xf-.js";import{a as K,b as Q}from"./index-CubYppI2.js";import{u as W}from"./useEventBus-BjGKlZmW.js";import{n as h,r as X,f as ee,b as te}from"./element-plus-DNKe9-lk.js";import{l as ae,aB as ne,r as u,Z as se,U as r,F as M,S as C,u as a,m as oe,M as re,O as w,q as le,T as $,B as j,y as ie}from"./vue-chunks-DyZSmvoe.js";import{v as ce}from"./index-CkdMtLMK.js";import"./tsxHelper-DOqx_mcA.js";import"./tree-Dgaev6Pi.js";import"./useForm-kq1sxERw.js";import"./wang-editor-C7jwA1hA.js";import"./useIcon-CMCVj6oE.js";const ue={class:"mb-10px"};function D(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!ie(o)}const ke=ae({__name:"index",setup(o){const{push:s}=ne(),n=u([]),{tableRegister:y,tableState:m,tableMethods:b}=H({fetchDataApi:()=>d(this,null,function*(){const{currentPage:e,pageSize:t}=m,l=yield Q(z({current:a(e),pageSize:a(t)},a(k)));return{list:l.list,total:l.count}}),fetchDelApi:()=>d(this,null,function*(){})}),{loading:_,dataList:p,total:i,currentPage:c,pageSize:S}=m,{getList:v,getElTableExpose:E,delList:de}=b,k=u({}),B=e=>{k.value=e,v()},{t:f}=J(),L=se([{field:"selection",search:{hidden:!0},form:{hidden:!0},detail:{hidden:!0},table:{type:"selection"}},{field:"type",label:"类型",search:{component:"Select",componentProps:{placeholder:"",options:[{value:"contact",label:"好友"},{value:"room",label:"群组"}]}},colProps:{span:8},formatter:e=>r(h,{type:"primary"},{default:()=>[e.type=="contact"?"好友":"群组"]})},{field:"names",label:"群名/好友昵称",search:{hidden:!0},formatter:e=>r(M,null,[(e.names||[]).map(t=>r(h,{class:"mr-2",type:"primary"},{default:()=>[t.aliasName||t.name]}))])},{field:"cron",label:"定制规则",search:{hidden:!0},formatter:e=>e.cron&&r(h,{type:"primary"},{default:()=>[e.cron]})},{field:"api",label:"定制内容",search:{hidden:!0},formatter:e=>e.api&&r(h,{type:"primary"},{default:()=>[e.api.label]})},{field:"updatedAt",label:"更新时间",search:{hidden:!0},formatter:e=>{let t;return r(h,{type:"primary"},D(t=X(e.updatedAt).format("YYYY-MM-DD HH:mm:ss"))?t:{default:()=>[t]})}},{field:"action",width:"260px",label:f("tableDemo.action"),search:{hidden:!0},form:{hidden:!0},detail:{hidden:!0},fixed:"right",table:{slots:{default:e=>{let t,l;return r(M,null,[r(g,{type:"primary",onClick:()=>V(e.row)},{default:()=>[C("直接发送")]}),r(g,{type:"primary",onClick:()=>O(e.row)},D(t=f("exampleDemo.edit"))?t:{default:()=>[t]}),r(g,{type:"danger",onClick:()=>T(e.row)},D(l=f("exampleDemo.del"))?l:{default:()=>[l]})])}}}}]),{allSchemas:P}=q(L);u(!1),u(""),u(null),u("");const N=()=>{s("/schedule/customContent/add")},x=u(!1),T=e=>d(this,null,function*(){const t=yield E();n.value=e?[e.id]:(t==null?void 0:t.getSelectionRows().map(l=>l.id))||[],x.value=!0,yield ee.confirm("确定删除?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}),yield K(a(n).join(",")).finally(()=>{x.value=!1,v()})}),O=(e,t)=>d(this,null,function*(){s(`/schedule/customContent/edit/${e.id}`)}),V=e=>d(this,null,function*(){yield ce({target:"Tasks",task:e}),te.success("发送成功，5s内请勿再次发送")});return W({name:"getList",callback:e=>{e==="add"&&(c.value=1),v()}}),(e,t)=>(oe(),re(a(Z),{tittle:`每日说定时任务
`,message:`适用于个人和群组，主要发送每日天气，一句随机情话和提示等信息，暂时不可定制，内容为本项目特色

`},{default:w(()=>[r(a(G),{schema:a(P).searchSchema,onSearch:B,onReset:B},null,8,["schema"]),le("div",ue,[r(a(g),{type:"primary",onClick:N},{default:w(()=>[C($(a(f)("exampleDemo.add")),1)]),_:1}),r(a(g),{loading:x.value,type:"danger",onClick:t[0]||(t[0]=l=>T(null))},{default:w(()=>[C($(a(f)("exampleDemo.del")),1)]),_:1},8,["loading"])]),r(a(I),{showOverflowTooltip:!1,pageSize:a(S),"onUpdate:pageSize":t[1]||(t[1]=l=>j(S)?S.value=l:null),currentPage:a(c),"onUpdate:currentPage":t[2]||(t[2]=l=>j(c)?c.value=l:null),columns:a(P).tableColumns,data:a(p),loading:a(_),pagination:{total:a(i)},"image-preview":["url"],onRegister:a(y)},null,8,["pageSize","currentPage","columns","data","loading","pagination","onRegister"])]),_:1}))}});export{ke as default};
