import{d as M,r as s,a as N,o as P,g as r,c as b,k as m,e as t,w as d,b as i,F as U,y as R,z as q,t as w,l as z,B as j,C as G,D as H,E as J,_ as K}from"./index-CUnFTKV2.js";import O from"./AdvertTable-8WFA8t9u.js";import Q from"./AdvertFormDialog-C9ujy85Q.js";import W from"./AdvertTypeDialog-BXkR8GZ0.js";import{g as X,a as Y,d as Z}from"./advert-y3Emov1a.js";import"./AdvertTypeForm.vue_vue_type_script_setup_true_lang-CGXeAtbP.js";const $={class:"page-container"},ee={class:"card-header"},ae={class:"header-actions"},te={class:"filter-bar"},le=M({__name:"list",setup(oe){const c=s(!1),_=s([]),y=s(0),p=s([]),l=N({page:1,pageSize:20}),u=s(!1),v=s(!1),g=s(!1),f=s(null),h=async()=>{try{const e=await X();p.value=e.data}catch{}},n=async()=>{c.value=!0;try{const e=await Y(l);_.value=e.data.list,y.value=e.data.total}finally{c.value=!1}},A=()=>{l.page=1,n()},D=e=>{l.page=e,n()},T=e=>{l.pageSize=e,l.page=1,n()},k=()=>{g.value=!1,f.value=null,u.value=!0},x=e=>{g.value=!0,f.value={...e},u.value=!0},E=async e=>{try{await H.confirm("确定要删除该广告吗？删除后不可恢复！","删除确认",{type:"warning"}),await Z(e.id),J.success("删除成功"),n()}catch{}},S=()=>{v.value=!0},B=()=>{h(),n()};return P(()=>{h(),n()}),(e,a)=>{const V=r("el-icon"),C=r("el-button"),F=r("el-option"),I=r("el-select"),L=r("el-card");return m(),b("div",$,[t(L,null,{header:d(()=>[i("div",ee,[a[5]||(a[5]=i("span",null,"广告管理",-1)),i("div",ae,[t(C,{type:"info",onClick:S},{default:d(()=>[t(V,null,{default:d(()=>[t(z(j))]),_:1}),a[3]||(a[3]=w("管理类型 ",-1))]),_:1}),t(C,{type:"primary",onClick:k},{default:d(()=>[t(V,null,{default:d(()=>[t(z(G))]),_:1}),a[4]||(a[4]=w("添加轮播图 ",-1))]),_:1})])])]),default:d(()=>[i("div",te,[t(I,{modelValue:l.typeId,"onUpdate:modelValue":a[0]||(a[0]=o=>l.typeId=o),placeholder:"全部类型",clearable:"",style:{width:"200px"},onChange:A},{default:d(()=>[(m(!0),b(U,null,R(p.value,o=>(m(),q(F,{key:o.id,label:o.name,value:o.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),t(O,{data:_.value,loading:c.value,total:y.value,page:l.page,"page-size":l.pageSize,onPageChange:D,onSizeChange:T,onEdit:x,onDelete:E},null,8,["data","loading","total","page","page-size"])]),_:1}),t(Q,{modelValue:u.value,"onUpdate:modelValue":a[1]||(a[1]=o=>u.value=o),advert:f.value,"is-edit":g.value,types:p.value,onSuccess:n},null,8,["modelValue","advert","is-edit","types"]),t(W,{modelValue:v.value,"onUpdate:modelValue":a[2]||(a[2]=o=>v.value=o),onRefresh:B},null,8,["modelValue"])])}}}),ce=K(le,[["__scopeId","data-v-e0f19ad3"]]);export{ce as default};
