import{V as I,d as q,dW as X,c$ as Z,r as x,a as S,aw as J,c as p,o as i,w as t,j as o,W as Q,x as Y,l as a,h as $,F as ee,a9 as ae,ib as te,p as _,A as m,D as y,aI as se,gE as ne,E as M,aG as oe,O as ie,H as le,i as N,B as ce,ef as re,cC as pe,X as me,g3 as ue,cZ as ge,c_ as _e,ic as de,hn as fe}from"./index-9PRMimni.js";import{_ as ye}from"./VirtualList-CyTw9HCK.js";const{t:L}=I();function ve(){return{firstTabList:[{value:0,label:L("system.messageManagement.tabUnread")},{value:1,label:L("system.messageManagement.tabRead")}]}}const xe={class:"font-medium text-base"},be={class:"text-gray-400"},Te=q({__name:"index",setup(K){const b=ge(),A=_e(),k=X(),z=Z(),{t:l}=I(),d=x(!1),g=x([]),n=S({page:1,pageSize:10,itemCount:0}),{firstTabList:C}=ve(),c=S({tabsList:C,activeKey:C[0]?.value}),B=x(window.innerHeight-225);async function R(r){await ue(r.id),b.success(l("system.messageManagement.readTips")),await u(!1),await z.getmsg()}function V(){A.info({title:l("common.tipsText"),content:l("system.messageManagement.markAllReadTips"),positiveText:l("common.okText"),negativeText:l("common.closeText"),onPositiveClick:async()=>{await de(),b.success(l("system.messageManagement.readTips")),await u(!1),await z.getmsg()}})}async function u(r){try{r&&(n.page=1,n.pageSize=10),d.value=!0,g.value=[];const s=await fe({isRead:c.activeKey,category:1,pageNum:n.page,pageSize:n.pageSize});g.value=s?.list||[],n.itemCount=s?.total||0,d.value=!1}catch{d.value=!1}}function D(r){n.page=r,u(!1)}function U(r){n.pageSize=r,u(!1)}async function E(){await u(!0)}return J(()=>{E()}),(r,s)=>{const P=te,f=ne,T=se,W=Y,h=ie,j=ce,v=le,H=ye,F=re,w=Q,G=pe,O=me;return i(),p(O,{loading:a(d)},{default:t(()=>[o(w,{bordered:!1,class:"proCard"},{default:t(()=>[o(W,{value:a(c).activeKey,"onUpdate:value":[s[1]||(s[1]=e=>a(c).activeKey=e),s[2]||(s[2]=e=>u(!0))],type:"card",size:"small",class:"mb-2"},{suffix:t(()=>[+a(c).activeKey==0&&a(g)?.length?(i(),p(T,{key:0,trigger:"hover"},{trigger:t(()=>[o(f,{iconName:"view",iconType:"lineIcon",class:M(`cursor-pointer text-[22px] text-[${a(k).primaryColor}]`),onClick:s[0]||(s[0]=e=>V())},null,8,["class"])]),default:t(()=>[_(" "+m(a(l)("system.messageManagement.markAllRead")),1)]),_:1})):y("",!0)]),default:t(()=>[(i(!0),$(ee,null,ae(a(c).tabsList,e=>(i(),p(P,{key:e.value,name:e.value},{default:t(()=>[_(m(e.label),1)]),_:2},1032,["name"]))),128))]),_:1},8,["value"]),a(g)?.length?(i(),p(w,{key:0,bordered:!1,"content-style":"padding: 0",size:"small",class:"proCard"},{default:t(()=>[o(H,{style:oe(`max-height: ${a(B)}px`),"item-size":60,items:a(g),"item-resizable":""},{default:t(({item:e})=>[(i(),$("div",{class:"flex items-center border-b pt-[15px] pb-[15px]",key:e.id},[+a(c).activeKey==0?(i(),p(h,{key:0,style:{color:"#fff",backgroundColor:"#2d8cf0"},round:"",size:"large",class:"mr-[16px]"},{default:t(()=>[o(f,{iconName:"message",iconType:"lineIcon"})]),_:1})):y("",!0),+a(c).activeKey==1?(i(),p(h,{key:1,style:{color:"#fff",backgroundColor:"#0EC06A"},round:"",size:"large",class:"mr-[16px]"},{default:t(()=>[o(f,{iconName:"message",iconType:"lineIcon"})]),_:1})):y("",!0),o(v,{class:"flex-1 overflow-hidden",vertical:""},{default:t(()=>[N("span",xe,m(e.genContent),1),o(v,null,{default:t(()=>[N("span",be,m(e.createTime),1),o(j,{secondary:"",size:"small",type:+e.msgType==1?"success":e.msgType===2?"info":"warning",class:"cursor-default"},{default:t(()=>[_(m(e.moduleName),1)]),_:2},1032,["type"])]),_:2},1024)]),_:2},1024),+a(c).activeKey==0?(i(),p(T,{key:2,trigger:"hover"},{trigger:t(()=>[o(f,{iconName:"view",iconType:"lineIcon",class:M(`cursor-pointer text-[22px] text-[${a(k).primaryColor}]`),onClick:ke=>R(e)},null,8,["class","onClick"])]),default:t(()=>[_(" "+m(a(l)("system.messageManagement.markAsRead")),1)]),_:2},1024)):y("",!0)]))]),_:1},8,["style","items"]),o(v,{justify:"end",class:"mt-3"},{default:t(()=>[o(F,{page:a(n).page,"onUpdate:page":[s[3]||(s[3]=e=>a(n).page=e),D],"page-size":a(n).pageSize,"onUpdate:pageSize":[s[4]||(s[4]=e=>a(n).pageSize=e),U],"show-size-picker":"","page-sizes":[10,20,30,40,50,60,70,80],"item-count":a(n).itemCount,"show-quick-jumper":""},{prefix:t(({itemCount:e})=>[_(m(`Total: ${e} `),1)]),_:1},8,["page","page-size","item-count"])]),_:1})]),_:1})):(i(),p(G,{key:1,size:"large",description:"No Data",class:"mt-[100px] mb-[100px]"}))]),_:1})]),_:1},8,["loading"])}}});export{Te as default};
