import{$ as e,H as t,L as n,P as r,V as i,Vt as a,Wt as o,_ as s,d as c,et as l,i as u,lt as d,p as f,st as p,u as m,v as h,z as g}from"./runtime-core.esm-bundler-DbRZbT7v.js";import{s as _,t as v}from"./index-Mgun2LFs.js";import"./request-DG5cMCYw.js";import{a as y}from"./office-B6vgiUI4.js";var b={class:`p-6 space-y-4`},x={class:`bg-white rounded-2xl border border-gray-100 shadow-sm p-4 flex items-center flex-wrap gap-3`},S={class:`bg-white rounded-2xl border border-gray-100 shadow-sm`},C={class:`flex items-center justify-between px-5 py-4 border-b border-gray-50`},w={class:`px-2`},T={key:1,class:`text-muted`},E={class:`px-5 py-3 border-t border-gray-50`},D=v({__name:`index`,setup(v){let D=d([]),O=d(0),k=d(!1),A=p({type:``,is_read:``}),j=p({page:1,per_page:20}),M={1:`系统`,2:`审批`,3:`待办`,4:`提醒`},N={1:``,2:`warning`,3:`danger`,4:`success`};async function P(){k.value=!0;try{let e=await y.getList({...A,...j});D.value=e.data?.list||e.data?.data||[],O.value=e.data?.total||0}finally{k.value=!1}}function F(){j.page=1,P()}function I(){Object.assign(A,{type:``,is_read:``}),F()}async function L(e){await y.markRead(e.id),_.success(`已标记为已读`),P()}async function R(){await y.markAllRead(),_.success(`全部标记为已读`),P()}function z(e){j.page=e,P()}function B(e){j.per_page=e,j.page=1,P()}return r(P),(r,d)=>{let p=i(`el-option`),_=i(`el-select`),v=i(`el-button`),y=i(`el-table-column`),P=i(`el-tag`),V=i(`el-table`),H=i(`el-pagination`),U=t(`loading`);return n(),f(`div`,b,[m(`div`,x,[h(_,{modelValue:A.type,"onUpdate:modelValue":d[0]||=e=>A.type=e,placeholder:`通知类型`,clearable:``,style:{width:`140px`}},{default:e(()=>[(n(),f(u,null,g(M,(e,t)=>h(p,{key:t,label:e,value:Number(t)},null,8,[`label`,`value`])),64))]),_:1},8,[`modelValue`]),h(_,{modelValue:A.is_read,"onUpdate:modelValue":d[1]||=e=>A.is_read=e,placeholder:`读取状态`,clearable:``,style:{width:`130px`}},{default:e(()=>[h(p,{label:`未读`,value:0}),h(p,{label:`已读`,value:1})]),_:1},8,[`modelValue`]),h(v,{type:`primary`,onClick:F},{default:e(()=>[...d[4]||=[s(`查询`,-1)]]),_:1}),h(v,{onClick:I},{default:e(()=>[...d[5]||=[s(`重置`,-1)]]),_:1})]),m(`div`,S,[m(`div`,C,[d[7]||=m(`div`,{class:`flex items-center gap-3`},[m(`span`,{class:`font-medium text-gray-700`},`通知列表`)],-1),h(v,{type:`primary`,onClick:R},{default:e(()=>[...d[6]||=[s(`全部标记已读`,-1)]]),_:1})]),m(`div`,w,[l((n(),c(V,{data:D.value,style:{width:`100%`}},{default:e(()=>[h(y,{prop:`title`,label:`标题`,"min-width":`180`}),h(y,{prop:`content`,label:`内容`,"min-width":`260`,"show-overflow-tooltip":``}),h(y,{label:`类型`,width:`90`,align:`center`},{default:e(({row:t})=>[h(P,{type:N[t.type],size:`small`},{default:e(()=>[s(o(M[t.type]||`-`),1)]),_:2},1032,[`type`])]),_:1}),h(y,{label:`状态`,width:`80`,align:`center`},{default:e(({row:e})=>[m(`span`,{class:a([`read-dot`,e.is_read?`read`:`unread`])},null,2),m(`span`,null,o(e.is_read?`已读`:`未读`),1)]),_:1}),h(y,{prop:`created_at`,label:`创建时间`,"min-width":`160`}),h(y,{label:`操作`,width:`120`,fixed:`right`,align:`center`},{default:e(({row:t})=>[t.is_read?(n(),f(`span`,T,`-`)):(n(),c(v,{key:0,size:`small`,type:`primary`,text:``,onClick:e=>L(t)},{default:e(()=>[...d[8]||=[s(`标记已读`,-1)]]),_:1},8,[`onClick`]))]),_:1})]),_:1},8,[`data`])),[[U,k.value]])]),m(`div`,E,[h(H,{"current-page":j.page,"onUpdate:currentPage":d[2]||=e=>j.page=e,"page-size":j.per_page,"onUpdate:pageSize":d[3]||=e=>j.per_page=e,total:O.value,"page-sizes":[10,20,50],layout:`total, sizes, prev, pager, next, jumper`,background:``,onCurrentChange:z,onSizeChange:B},null,8,[`current-page`,`page-size`,`total`])])])])}}},[[`__scopeId`,`data-v-0e888ba3`]]);export{D as default};