import{A as T}from"./index-2927ba89.js";import{L as V}from"./index-a6ee13d3.js";import{_ as B}from"./detail.vue_vue_type_script_setup_true_name_attachDetail_lang-95c0e535.js";import{a as s}from"./element-plus-91d6d961.js";import{H as g,e as f,_ as E,i as L,ah as a,o as n,c as p,V as o,P as l,T as U,F,a8 as M,O as c,S as I,a as m,U as $}from"./@vue-6dabbe94.js";import{_ as j}from"./_plugin-vue_export-helper-c27b6911.js";import"./pinia-b6f74250.js";import"./vue-router-c1461dfc.js";import"./vue-i18n-b3581196.js";import"./@intlify-ea47d1db.js";import"./source-map-7d7e1c08.js";import"./vue-b1ba6f14.js";import"./js-cookie-edb2da2a.js";import"./@element-plus-64e6e14a.js";import"./nprogress-08a53ce8.js";import"./axios-4a70c6fc.js";import"./qs-c5b6dbf2.js";import"./side-channel-394f276c.js";import"./get-intrinsic-bd2830fd.js";import"./has-symbols-e8f3ca0e.js";import"./has-proto-f7d0b240.js";import"./function-bind-22e7ee79.js";import"./has-26d28e02.js";import"./call-bind-e5c1c8b0.js";import"./object-inspect-8fd4bade.js";import"./mitt-f7ef348c.js";import"./vue-grid-layout-ec2a62c3.js";import"./lodash-es-9851428c.js";import"./@vueuse-e129c873.js";import"./@popperjs-c75af06c.js";import"./@ctrl-f8748455.js";import"./dayjs-f6fdf7b4.js";import"./async-validator-dee29e8b.js";import"./memoize-one-297ddbcb.js";import"./escape-html-b8998962.js";import"./normalize-wheel-es-ed76fb12.js";import"./@floating-ui-880a26aa.js";const q={class:"list-adapt-container"},O={key:0},G=["src","fit"],J={style:{padding:"14px"}},K=g({name:"attachManager"}),Q=g({...K,setup(W){const h=T(),d=f(),_=f(),t=E({fit:"fill",queryParams:{},showSearch:!0,limit:5,uploadUrl:"fastcms/api/admin/attachment/upload",headers:{Authorization:V.get("token")},tableData:{data:[],total:0,loading:!1,param:{pageNum:1,pageSize:10}}}),r=()=>{h.getAttachList(t.tableData.param).then(e=>{t.tableData.data=e.data.records,t.tableData.total=e.data.total})},b=e=>{e.code==200?(_.value.clearFiles(),r()):s.error(e.message)},y=()=>{s.error("上传文件数量不能超过 "+t.limit+" 个!")},x=()=>{s.error("上传失败")};L(()=>{r()});const D=e=>{d.value.openDialog(e.id)},k=e=>{t.tableData.param.pageSize=e,r()},C=e=>{t.tableData.param.pageNum=e,r()};return(e,X)=>{const v=a("ele-Plus"),z=a("el-icon"),S=a("el-button"),N=a("el-upload"),u=a("el-card"),w=a("el-col"),A=a("el-row"),H=a("el-empty"),P=a("el-pagination");return n(),p("div",q,[o(u,{shadow:"hover"},{default:l(()=>[o(N,{ref_key:"uploadRef",ref:_,class:"upload-btn",action:t.uploadUrl,name:"files",multiple:"",headers:t.headers,"show-file-list":!1,"on-success":b,"on-exceed":y,"on-error":x,limit:t.limit},{default:l(()=>[o(S,{size:"default",type:"primary"},{default:l(()=>[o(z,null,{default:l(()=>[o(v)]),_:1}),U("上传附件")]),_:1})]),_:1},8,["action","headers","limit"]),t.tableData.data.length>0?(n(),p("div",O,[o(A,{gutter:15},{default:l(()=>[(n(!0),p(F,null,M(t.tableData.data,(i,R)=>(n(),c(w,{xs:24,sm:12,md:8,lg:6,xl:4,class:"",key:R,onClick:Y=>D(i)},{default:l(()=>[o(u,{"body-style":{padding:"0px",width:120}},{default:l(()=>[m("img",{src:i.typePath,fit:t.fit,class:"image"},null,8,G),m("div",J,[m("span",null,$(i.fileName),1)])]),_:2},1024)]),_:2},1032,["onClick"]))),128))]),_:1})])):(n(),c(H,{key:1,description:"暂无数据"})),t.tableData.data.length>0?(n(),c(P,{key:2,style:{"text-align":"right",padding:"15px"},background:"",onSizeChange:k,onCurrentChange:C,"page-sizes":[10,20,30],"current-page":t.tableData.param.pageNum,"page-size":t.tableData.param.pageSize,layout:"total, sizes, prev, pager, next, jumper",total:t.tableData.total},null,8,["current-page","page-size","total"])):I("",!0)]),_:1}),o(B,{ref_key:"detailRef",ref:d,onReloadTable:r},null,512)])}}});const Et=j(Q,[["__scopeId","data-v-b69a133b"]]);export{Et as default};
