import{C as e,O as t,S as n,T as r,Y as i,cn as a,dt as o,j as s,k as c}from"./vue.runtime.esm-bundler-DpGzKKN4.js";import{g as l,m as u}from"./GxPagination-DOexUzbO.js";import{n as d,t as f}from"./table-C_Bpc8FZ.js";import{n as p,t as m}from"./css--CcZutYI.js";import{t as h}from"./dialog-BLJqz3g4.js";import{t as g}from"./_plugin-vue_export-helper-CnS4QQza.js";import"./css-DxP8XCTD.js";import{ns as _,rs as v}from"./stores-BWYw2E2w.js";import"./css-AklKJXcX.js";import"./css-ropEN6qH.js";import"./css-BrGVMe3H.js";var y=s({name:`NotificationCollector`,data(){return{dialogVisible:!1,activeTab:`latest`,latestNotification:null,historyNotifications:[]}},watch:{dialogVisible(e){e&&(this.loadLatestNotification(),this.activeTab===`history`&&this.loadHistoryNotifications())}},methods:{showHistory(){this.activeTab=`history`,this.dialogVisible=!0},handleClose(){this.dialogVisible=!1},handleTabChange(e){e===`history`&&this.historyNotifications.length===0&&this.loadHistoryNotifications()},async loadLatestNotification(){try{let e=await _();this.latestNotification=e}catch(e){console.error(`加载最新通知失败:`,e)}},async loadHistoryNotifications(){try{let e=await v(20);this.historyNotifications=e}catch(e){console.error(`加载历史通知失败:`,e)}},getTypeTagType(e){return{success:`success`,error:`danger`,info:`info`}[e]||`info`},getTypeText(e){return{success:`成功`,error:`失败`,info:`信息`}[e]||`未知`},formatTimestamp(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}`},formatTimestampCell(e,t,n){return this.formatTimestamp(n)}}}),b={key:0,class:`detail`},x=[`innerHTML`],S={key:1,class:`empty`},C=[`innerHTML`],w={class:`short-content`};function T(s,g,_,v,y,T){let E=u,D=m,O=d,k=l,A=f,j=p,M=h;return i(),e(M,{modelValue:s.dialogVisible,"onUpdate:modelValue":g[1]||=e=>s.dialogVisible=e,title:`消息`,width:`800px`,"close-on-click-modal":!1,onClose:s.handleClose},{default:o(()=>[c(j,{modelValue:s.activeTab,"onUpdate:modelValue":g[0]||=e=>s.activeTab=e,onTabChange:s.handleTabChange},{default:o(()=>[c(D,{label:`最新`,name:`latest`},{default:o(()=>[s.latestNotification?(i(),r(`div`,b,[n(`div`,null,[g[2]||=n(`strong`,null,`时间：`,-1),t(a(s.formatTimestamp(s.latestNotification.timestamp)),1)]),n(`div`,null,[g[3]||=n(`strong`,null,`类型：`,-1),c(E,{type:s.getTypeTagType(s.latestNotification.type)},{default:o(()=>[t(a(s.getTypeText(s.latestNotification.type)),1)]),_:1},8,[`type`])]),n(`div`,null,[g[4]||=n(`strong`,null,`标题：`,-1),t(a(s.latestNotification.title),1)]),n(`div`,null,[g[5]||=n(`strong`,null,`内容：`,-1),n(`div`,{class:`content`,innerHTML:s.latestNotification.content},null,8,x)])])):(i(),r(`div`,S,`暂无通知`))]),_:1}),c(D,{label:`历史`,name:`history`},{default:o(()=>[c(A,{data:s.historyNotifications,"max-height":`400`,"empty-text":`暂无历史通知`},{default:o(()=>[c(O,{prop:`timestamp`,label:`时间`,width:`180`,formatter:s.formatTimestampCell},null,8,[`formatter`]),c(O,{prop:`type`,label:`类型`,width:`100`},{default:o(({row:e})=>[c(E,{type:s.getTypeTagType(e.type),size:`small`},{default:o(()=>[t(a(s.getTypeText(e.type)),1)]),_:2},1032,[`type`])]),_:1}),c(O,{prop:`title`,label:`标题`,"min-width":`150`}),c(O,{prop:`content`,label:`内容`,"min-width":`200`},{default:o(({row:e})=>[c(k,{placement:`right`,effect:`customized-notification-content-tip`,"raw-content":!0},{content:o(()=>[n(`div`,{innerHTML:e.content},null,8,C)]),default:o(()=>[n(`div`,w,a(e.content),1)]),_:2},1024)]),_:1})]),_:1},8,[`data`])]),_:1})]),_:1},8,[`modelValue`,`onTabChange`])]),_:1},8,[`modelValue`,`onClose`])}var E=g(y,[[`render`,T],[`__scopeId`,`data-v-5babb58c`]]);export{E as t};