import{A as q}from"./index-2927ba89.js";import{C as W}from"./client-578c7487.js";import{L as $}from"./index-a6ee13d3.js";import{a as f}from"./element-plus-91d6d961.js";import{H as y,_ as G,i as J,ah as o,o as i,O as d,P as a,a as c,V as l,T as m,c as b,a8 as K,F as Q,S as R,U as X}from"./@vue-6dabbe94.js";import{_ as Y}from"./_plugin-vue_export-helper-c27b6911.js";const Z={style:{width:"100%"}},ee=["onClick"],te=["src","fit"],ae={style:{padding:"14px"}},oe={class:"filename"},le={class:"dialog-footer"},ne=y({name:"attachDialog"}),se=y({...ne,props:{isClient:{type:Boolean},fileType:{type:String}},emits:["attachHandler"],setup(D,{expose:x,emit:k}){const s=D;let u="fastcms/api/admin/attachment/upload";s.isClient&&s.isClient==!0&&(u="fastcms/api/client/attachment/upload");const C=q(),S=W(),e=G({fit:"fill",isShowDialog:!1,queryParams:{},showSearch:!0,max:1,limit:3,uploadUrl:u,headers:{Authorization:$.get("token")},checkedObjs:[],tableData:{data:[],total:99,loading:!1,param:{pageNum:1,pageSize:10}}}),A=t=>{e.isShowDialog=!0,e.max=t},g=()=>{e.isShowDialog=!1,e.max=1},r=()=>{s.fileType&&(console.log("==>fileType:"+s.fileType),e.tableData.param.fileType=s.fileType),s.isClient&&s.isClient==!0?S.getAttachList(e.tableData.param).then(t=>{e.tableData.data=t.data.records,e.tableData.total=t.data.total}):C.getAttachList(e.tableData.param).then(t=>{e.tableData.data=t.data.records,e.tableData.total=t.data.total})},w=()=>{r()},V=()=>{f.error("上传文件数量不能超过 "+e.limit+" 个!")},z=()=>{f.error("上传失败")};J(()=>{r()});const T=t=>{console.log(t)},N=t=>{e.tableData.param.pageSize=t,r()},v=t=>{e.tableData.param.pageNum=t,r()},H=()=>{k("attachHandler",e.checkedObjs),g()};return x({openDialog:A}),(t,p)=>{const U=o("ele-Plus"),j=o("el-icon"),_=o("el-button"),B=o("el-upload"),L=o("el-tooltip"),O=o("el-checkbox"),h=o("el-card"),E=o("el-checkbox-group"),P=o("el-empty"),F=o("el-pagination"),I=o("el-dialog");return i(),d(I,{title:"选择附件",fullscreen:"",modelValue:e.isShowDialog,"onUpdate:modelValue":p[1]||(p[1]=n=>e.isShowDialog=n),"append-to-body":!0},{footer:a(()=>[c("span",le,[l(_,{onClick:g},{default:a(()=>[m("取 消")]),_:1}),l(_,{type:"primary",onClick:H},{default:a(()=>[m("确 定")]),_:1})])]),default:a(()=>[c("div",Z,[l(B,{class:"upload-btn",action:e.uploadUrl,name:"files",multiple:"",headers:e.headers,"show-file-list":!1,"on-success":w,"on-exceed":V,"on-error":z,limit:e.limit},{default:a(()=>[l(_,{type:"primary"},{default:a(()=>[l(j,null,{default:a(()=>[l(U)]),_:1}),m("上传附件")]),_:1})]),_:1},8,["action","headers","limit"]),l(h,{shadow:"hover"},{default:a(()=>[e.tableData.data.length>0?(i(),d(E,{key:0,max:e.max,modelValue:e.checkedObjs,"onUpdate:modelValue":p[0]||(p[0]=n=>e.checkedObjs=n),class:"imgWrap"},{default:a(()=>[(i(!0),b(Q,null,K(e.tableData.data,(n,M)=>(i(),b("div",{class:"mb10",key:M,onClick:ie=>T(n)},[l(h,{"body-style":{padding:"6px"}},{default:a(()=>[c("img",{src:n.path,fit:e.fit,class:"image"},null,8,te),c("div",ae,[l(O,{label:n,style:{width:"100%"}},{default:a(()=>[l(L,{class:"item",effect:"dark",content:n.fileName,placement:"top-start"},{default:a(()=>[c("div",oe,X(n.fileName),1)]),_:2},1032,["content"])]),_:2},1032,["label"])])]),_:2},1024),m("/ ")],8,ee))),128))]),_:1},8,["max","modelValue"])):(i(),d(P,{key:1,description:"暂无数据"})),e.tableData.data.length>0?(i(),d(F,{key:2,style:{"text-align":"right"},background:"",onSizeChange:N,onCurrentChange:v,"page-sizes":[10,20,30],"current-page":e.tableData.param.pageNum,"page-size":e.tableData.param.pageSize,layout:"total, sizes, prev, pager, next, jumper",total:e.tableData.total},null,8,["current-page","page-size","total"])):R("",!0)]),_:1})])]),_:1},8,["modelValue"])}}});const ue=Y(se,[["__scopeId","data-v-14147532"]]);export{ue as A};
