import{u as e,a,G as l,o as t,e as n,f as s,g as d,w as r,H as i,c as o,I as u,J as c,r as g,L as p,h,t as m,p as b,i as w}from"./vendor.347ab8d9.js";import{g as f,d as v,a as _}from"./slider.b2a7e5d1.js";import{_ as C}from"./index.d59ad4c2.js";import"./request.dc2ccb4c.js";const y={name:"slider-list",setup(){const t=e(),n=a({title:"",page:1,pageSize:10}),s=l(!0),d=l([]),r=l(0),i=()=>{f(n).then((e=>{d.value=e.data.data,r.value=e.data.total||0,s.value=!1}))};i();return{query:n,loading:s,tableData:d,pageTotal:r,handleEdit:(e,a)=>{t.push({path:"/slider/add",query:{id:a.id}})},handleSearch:()=>{s.value=!0,n.page=1,i()},handlePageChange:e=>{s.value=!0,n.page=e,i()},handleDisable:(e,l)=>{const t=a({id:l.id,status:l.status});v(t).then((a=>{200==a.status?u.success(a.msg):(d.value[e].status=!l.status,u.error(a.msg))}))},handleDelete:(e,l)=>{c.confirm("确定要删除吗？","提示",{type:"warning"}).then((()=>{const t=a({id:l.id});_(t).then((a=>{200==a.status?(u.success("删除成功"),d.value.splice(e,1)):u.error(a.msg)}))})).catch((()=>{u.success("删除失败")}))}}}},x={class:"crumbs"},k=(e=>(b("data-v-4c2d2ed3"),e=e(),w(),e))((()=>s("i",{class:"el-icon-lx-sort"},null,-1))),q=h(" 文档列表 "),D={class:"container"},V={class:"handle-box"},z=h("搜索"),j=h("编辑"),S=h("删除"),I={class:"pagination"};var T=C(y,[["render",function(e,a,l,u,c,b){const w=g("el-breadcrumb-item"),f=g("el-breadcrumb"),v=g("el-input"),_=g("el-button"),C=g("el-table-column"),y=g("el-image"),T=g("el-switch"),U=g("el-table"),$=g("el-pagination"),E=p("loading");return t(),n("div",null,[s("div",x,[d(f,{separator:"/"},{default:r((()=>[d(w,null,{default:r((()=>[k,q])),_:1})])),_:1})]),s("div",D,[s("div",V,[d(v,{modelValue:u.query.title,"onUpdate:modelValue":a[0]||(a[0]=e=>u.query.title=e),placeholder:"输入标题",class:"handle-input mr10",clearable:""},null,8,["modelValue"]),d(_,{type:"primary",icon:"el-icon-search",onClick:u.handleSearch},{default:r((()=>[z])),_:1},8,["onClick"])]),i((t(),o(U,{data:u.tableData,border:"",class:"table",ref:"multipleTable","header-cell-class-name":"table-header"},{default:r((()=>[d(C,{label:"ID",width:"80",align:"center"},{default:r((e=>[h(m(e.row.id),1)])),_:1}),d(C,{label:"标题",align:"center",width:"250"},{default:r((e=>[h(m(e.row.title),1)])),_:1}),d(C,{label:"图片(查看大图)",align:"center"},{default:r((e=>[d(y,{class:"table-td-thumb",fit:"contain",lazy:"true",src:e.row.img_url,"preview-src-list":[e.row.img_url]},null,8,["src","preview-src-list"])])),_:1}),d(C,{label:"链接",align:"center",width:"200"},{default:r((e=>[h(m(e.row.url),1)])),_:1}),d(C,{label:"排序",align:"center",width:"100"},{default:r((e=>[h(m(e.row.sort),1)])),_:1}),d(C,{label:"状态",align:"center",width:"100"},{default:r((e=>[d(T,{"active-value":1,"inactive-value":0,modelValue:e.row.status,"onUpdate:modelValue":a=>e.row.status=a,onChange:a=>u.handleDisable(e.$index,e.row)},null,8,["modelValue","onUpdate:modelValue","onChange"])])),_:1}),d(C,{label:"更新时间",align:"center",width:"180"},{default:r((e=>[h(m(e.row.create_time||"--"),1)])),_:1}),d(C,{label:"操作",align:"center",width:"180"},{default:r((e=>[d(_,{type:"text",icon:"el-icon-edit",onClick:a=>u.handleEdit(e.$index,e.row)},{default:r((()=>[j])),_:2},1032,["onClick"]),d(_,{type:"text",icon:"el-icon-delete",onClick:a=>u.handleDelete(e.$index,e.row)},{default:r((()=>[S])),_:2},1032,["onClick"])])),_:1})])),_:1},8,["data"])),[[E,u.loading]]),s("div",I,[d($,{background:"",layout:"total, prev, pager, next","current-page":u.query.page,"page-size":u.query.pageSize,total:u.pageTotal,onCurrentChange:u.handlePageChange},null,8,["current-page","page-size","total","onCurrentChange"])])])])}],["__scopeId","data-v-4c2d2ed3"]]);export{T as default};
