import{c as R,_ as T,l as $,d as D}from"./edit.vue_vue_type_script_setup_true_lang-1426b658.js";import{p as M}from"./global-0d825ba6.js";import{u as N}from"./index-8db2df2c.js";import{M as h,B as V,L as A,S as L,a as H,b as I}from"./ui-ba7aaa7e.js";import{e as U,r as i,d as j,M as q,P as n,a3 as l,a4 as t,a7 as C,A as u,H as f,f as m,I as E}from"./vue-bf422dc1.js";import"./category-7f0098f4.js";import"./date-20546ee0.js";import"./libs-51817cd7.js";import"./plugins-ca970193.js";import"./others-9f318174.js";import"./echarts-bf9d612c.js";import"./icons-a8498fb6.js";const F={class:"category-header c-flex"},G={class:"l"},ie=U({__name:"index",setup(J){const a=i({defaultPageSize:20,total:0,defaultCurrent:1}),r=i([]),p=i(!0),s=async()=>{const{data:e}=await $({page:a.value.defaultCurrent,limit:a.value.defaultPageSize});r.value=e.list,p.value=!1,a.value={defaultPageSize:e.limit,total:e.total,defaultCurrent:e.page}};s();const k=e=>{a.value.defaultCurrent=e.current,a.value.defaultPageSize=e.pageSize,s()},x=N(),b=j(()=>({offsetTop:x.isUseTabsRouter?48:0,container:`.${M}-layout`})),_=i(),v=(e=null)=>{_.value.init(e)},y=async e=>{const o=await D({id:e});o.code===1?(h.success("删除成功"),s()):h.error(o.msg)};return(e,o)=>{const S=V,g=A,z=L,P=H,w=I,c=q("perms");return n(),l(w,{title:"文章管理",class:"basic-container",bordered:!1},{default:t(()=>[C("div",F,[C("div",G,[u((n(),l(S,{theme:"primary",onClick:o[0]||(o[0]=d=>v())},{default:t(()=>[f("添加")]),_:1})),[[c,["adminapi/article/article/add"]]])])]),m(P,{ref:"tableRef","row-key":"id",data:r.value,columns:E(R),hover:r.value.length>0,"header-affixed-top":b.value,"max-height":"auto","table-layout":"auto",pagination:a.value,"lazy-load":"",loading:p.value,onPageChange:k},{operate:t(({row:d})=>[m(z,null,{default:t(()=>[u((n(),l(g,{theme:"primary",size:"small",onClick:B=>v(d)},{default:t(()=>[f("编辑")]),_:2},1032,["onClick"])),[[c,["adminapi/article/article/edit"]]]),u((n(),l(g,{theme:"danger",size:"small",onClick:B=>y(d.id)},{default:t(()=>[f("删除")]),_:2},1032,["onClick"])),[[c,["adminapi/article/article/del"]]])]),_:2},1024)]),_:1},8,["data","columns","hover","header-affixed-top","pagination","loading"]),m(T,{ref_key:"editRef",ref:_,onSuccess:s},null,512)]),_:1})}}});export{ie as default};
