import{u as e,a,G as l,o as t,e as n,f as s,g as d,w as u,H as o,c as r,I as i,J as c,r as p,L as m,h as g,t as h,p as b,i as f}from"./vendor.08ecc2ea.js";import{g as v,d as _,a as w}from"./document.2bda4967.js";import{_ as y}from"./index.4567af67.js";import"./request.33748d8c.js";const C={name:"document-list",setup(){const t=e(),n=a({title:"",column:"",page:1,pageSize:10}),s=l(!0),d=l([]),u=l(0),o=()=>{v(n).then((e=>{d.value=e.data.data,u.value=e.data.total||0,s.value=!1}))};o();return{query:n,loading:s,tableData:d,pageTotal:u,handleEdit:(e,a)=>{t.push({path:"/document/edit",query:{id:a.id}})},handleSearch:()=>{s.value=!0,n.page=1,o()},handlePageChange:e=>{s.value=!0,n.page=e,o()},handleDisable:(e,l)=>{const t=a({id:l.id,status:l.status});_(t).then((a=>{200==a.status?i.success(a.msg):(d.value[e].status=!l.status,i.error(a.msg))}))},handleDelete:(e,l)=>{c.confirm("确定要删除吗？","提示",{type:"warning"}).then((()=>{const t=a({id:l.id});w(t).then((a=>{200==a.status?(i.success("删除成功"),d.value.splice(e,1)):i.error(a.msg)}))})).catch((()=>{i.success("删除失败")}))}}}},x={class:"crumbs"},V=(e=>(b("data-v-3ef83372"),e=e(),f(),e))((()=>s("i",{class:"el-icon-lx-sort"},null,-1))),q=g(" 文档列表 "),k={class:"container"},D={class:"handle-box"},z=g("搜索"),j=g("编辑"),S=g("删除"),U={class:"pagination"};var I=y(C,[["render",function(e,a,l,i,c,b){const f=p("el-breadcrumb-item"),v=p("el-breadcrumb"),_=p("el-input"),w=p("el-button"),y=p("el-table-column"),C=p("el-tag"),I=p("el-switch"),T=p("el-table"),$=p("el-pagination"),E=m("loading");return t(),n("div",null,[s("div",x,[d(v,{separator:"/"},{default:u((()=>[d(f,null,{default:u((()=>[V,q])),_:1})])),_:1})]),s("div",k,[s("div",D,[d(_,{modelValue:i.query.title,"onUpdate:modelValue":a[0]||(a[0]=e=>i.query.title=e),placeholder:"输入文档标题",class:"handle-input mr10",clearable:""},null,8,["modelValue"]),d(_,{modelValue:i.query.column,"onUpdate:modelValue":a[1]||(a[1]=e=>i.query.column=e),placeholder:"输入栏目名称",class:"handle-input mr10",clearable:""},null,8,["modelValue"]),d(w,{type:"primary",icon:"el-icon-search",onClick:i.handleSearch},{default:u((()=>[z])),_:1},8,["onClick"])]),o((t(),r(T,{data:i.tableData,border:"",class:"table",ref:"multipleTable","header-cell-class-name":"table-header"},{default:u((()=>[d(y,{label:"ID",width:"80",align:"center"},{default:u((e=>[g(h(e.row.id),1)])),_:1}),d(y,{label:"标题",align:"center"},{default:u((e=>[g(h(e.row.title),1)])),_:1}),d(y,{label:"栏目",align:"center"},{default:u((e=>[d(C,{size:"small",type:"success"},{default:u((()=>[g(h(e.row.column_name),1)])),_:2},1024)])),_:1}),d(y,{label:"发布人",align:"center"},{default:u((e=>[g(h(e.row.username),1)])),_:1}),d(y,{label:"状态",align:"center",width:"100"},{default:u((e=>[d(I,{"active-value":1,"inactive-value":0,modelValue:e.row.status,"onUpdate:modelValue":a=>e.row.status=a,onChange:a=>i.handleDisable(e.$index,e.row)},null,8,["modelValue","onUpdate:modelValue","onChange"])])),_:1}),d(y,{label:"更新时间",align:"center"},{default:u((e=>[g(h(e.row.update_time||"--"),1)])),_:1}),d(y,{label:"操作",align:"center",width:"180"},{default:u((e=>[d(w,{type:"text",icon:"el-icon-edit",onClick:a=>i.handleEdit(e.$index,e.row)},{default:u((()=>[j])),_:2},1032,["onClick"]),d(w,{type:"text",icon:"el-icon-delete",onClick:a=>i.handleDelete(e.$index,e.row)},{default:u((()=>[S])),_:2},1032,["onClick"])])),_:1})])),_:1},8,["data"])),[[E,i.loading]]),s("div",U,[d($,{background:"",layout:"total, prev, pager, next","current-page":i.query.page,"page-size":i.query.pageSize,total:i.pageTotal,onCurrentChange:i.handlePageChange},null,8,["current-page","page-size","total","onCurrentChange"])])])])}],["__scopeId","data-v-3ef83372"]]);export{I as default};
