import{u as e,a,G as l,o as t,e as n,f as d,g as s,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.347ab8d9.js";import{g as v,d as _,a as w}from"./document.9d5061f8.js";import{_ as y}from"./index.d59ad4c2.js";import"./request.dc2ccb4c.js";const C={name:"document-list",setup(){const t=e(),n=a({title:"",column:"",page:1,pageSize:10}),d=l(!0),s=l([]),u=l(0),o=()=>{v(n).then((e=>{s.value=e.data.data,u.value=e.data.total||0,d.value=!1}))};o();return{query:n,loading:d,tableData:s,pageTotal:u,handleEdit:(e,a)=>{t.push({path:"/document/add",query:{id:a.id}})},handleSearch:()=>{d.value=!0,n.page=1,o()},handlePageChange:e=>{d.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):(s.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("删除成功"),s.value.splice(e,1)):i.error(a.msg)}))})).catch((()=>{i.success("删除失败")}))}}}},x={class:"crumbs"},V=(e=>(b("data-v-7d765bb6"),e=e(),f(),e))((()=>d("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,[d("div",x,[s(v,{separator:"/"},{default:u((()=>[s(f,null,{default:u((()=>[V,q])),_:1})])),_:1})]),d("div",k,[d("div",D,[s(_,{modelValue:i.query.title,"onUpdate:modelValue":a[0]||(a[0]=e=>i.query.title=e),placeholder:"输入文档标题",class:"handle-input mr10",clearable:""},null,8,["modelValue"]),s(_,{modelValue:i.query.column,"onUpdate:modelValue":a[1]||(a[1]=e=>i.query.column=e),placeholder:"输入栏目名称",class:"handle-input mr10",clearable:""},null,8,["modelValue"]),s(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((()=>[s(y,{label:"ID",width:"80",align:"center"},{default:u((e=>[g(h(e.row.id),1)])),_:1}),s(y,{label:"标题",align:"center"},{default:u((e=>[g(h(e.row.title),1)])),_:1}),s(y,{label:"栏目",align:"center"},{default:u((e=>[s(C,{size:"small",type:"success"},{default:u((()=>[g(h(e.row.column_name),1)])),_:2},1024)])),_:1}),s(y,{label:"点击量",align:"center"},{default:u((e=>[g(h(e.row.view),1)])),_:1}),s(y,{label:"发布人",align:"center"},{default:u((e=>[g(h(e.row.username),1)])),_:1}),s(y,{label:"状态",align:"center",width:"100"},{default:u((e=>[s(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}),s(y,{label:"更新时间",align:"center"},{default:u((e=>[g(h(e.row.create_time||"--"),1)])),_:1}),s(y,{label:"操作",align:"center",width:"180"},{default:u((e=>[s(w,{type:"text",icon:"el-icon-edit",onClick:a=>i.handleEdit(e.$index,e.row)},{default:u((()=>[j])),_:2},1032,["onClick"]),s(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]]),d("div",U,[s($,{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-7d765bb6"]]);export{I as default};
