import{ad as j,d as E,Y as v,ai as K,r as u,aj as w,o as p,f as m,w as t,b as e,k as o,a7 as _,a2 as M,l as i,t as N,al as T,E as h}from"./index.e3896b23.js";import{c as I}from"./constant.71632d98.js";const O=F=>j.post("/sys/attachment",F),Y=i("\u67E5\u8BE2"),G=i("\u4E0A\u4F20"),J=i("\u5220\u9664"),P=i("\u4E0B\u8F7D"),Q=i("\u5220\u9664"),R=E({name:"SysAttachmentIndex"}),Z=E({...R,setup(F){const a=v({dataListUrl:"/sys/attachment/page",deleteUrl:"/sys/attachment",queryForm:{name:"",platform:""}}),C=v({name:"",platform:"",size:"",url:""}),z=(s,l)=>{if(s.code!==0)return h.error("\u4E0A\u4F20\u5931\u8D25\uFF1A"+s.message),!1;Object.assign(C,s.data),O(C).then(()=>{h.success({message:"\u4E0A\u4F20\u6210\u529F",duration:500,onClose:()=>{g()}})})},D=s=>s.size/1024/1024/1024/1024>1?(h.error("\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7100M"),!1):!0,{getDataList:g,selectionChangeHandle:k,sizeChangeHandle:A,currentChangeHandle:S,deleteBatchHandle:y,downloadHandle:B}=K(a);return(s,l)=>{const b=u("el-input"),d=u("el-form-item"),c=u("el-button"),V=u("el-upload"),x=u("el-form"),r=u("el-table-column"),q=u("el-table"),U=u("el-pagination"),H=u("el-card"),f=w("auth"),L=w("loading");return p(),m(H,null,{default:t(()=>[e(x,{inline:!0,model:a.queryForm,onKeyup:l[4]||(l[4]=M(n=>o(g)(),["enter"]))},{default:t(()=>[e(d,null,{default:t(()=>[e(b,{modelValue:a.queryForm.name,"onUpdate:modelValue":l[0]||(l[0]=n=>a.queryForm.name=n),placeholder:"\u9644\u4EF6\u540D\u79F0"},null,8,["modelValue"])]),_:1}),e(d,null,{default:t(()=>[e(b,{modelValue:a.queryForm.platform,"onUpdate:modelValue":l[1]||(l[1]=n=>a.queryForm.platform=n),placeholder:"\u5B58\u50A8\u5E73\u53F0"},null,8,["modelValue"])]),_:1}),e(d,null,{default:t(()=>[e(c,{onClick:l[2]||(l[2]=n=>o(g)())},{default:t(()=>[Y]),_:1})]),_:1}),_((p(),m(d,null,{default:t(()=>[e(V,{action:o(I).uploadUrl,"before-upload":D,"on-success":z,"show-file-list":!1},{default:t(()=>[e(c,{type:"primary"},{default:t(()=>[G]),_:1})]),_:1},8,["action"])]),_:1})),[[f,"sys:attachment:save"]]),e(d,null,{default:t(()=>[_((p(),m(c,{type:"danger",onClick:l[3]||(l[3]=n=>o(y)())},{default:t(()=>[J]),_:1})),[[f,"sys:attachment:delete"]])]),_:1})]),_:1},8,["model"]),_((p(),m(q,{data:a.dataList,border:"",style:{width:"100%"},onSelectionChange:o(k)},{default:t(()=>[e(r,{type:"selection","header-align":"center",align:"center",width:"50"}),e(r,{prop:"name",label:"\u9644\u4EF6\u540D\u79F0","show-overflow-tooltip":"","header-align":"center",align:"center"}),e(r,{prop:"url",label:"\u9644\u4EF6\u5730\u5740","show-overflow-tooltip":"","header-align":"center",align:"center"}),e(r,{prop:"size",label:"\u9644\u4EF6\u5927\u5C0F","header-align":"center",align:"center"},{default:t(n=>[i(N(o(T)(n.row.size)),1)]),_:1}),e(r,{prop:"platform",label:"\u5B58\u50A8\u5E73\u53F0","header-align":"center",align:"center"}),e(r,{prop:"createTime",label:"\u521B\u5EFA\u65F6\u95F4","header-align":"center",align:"center"}),e(r,{label:"\u64CD\u4F5C",fixed:"right","header-align":"center",align:"center",width:"150"},{default:t(n=>[e(c,{type:"primary",link:"",onClick:$=>o(B)(n.row.url,n.row.name)},{default:t(()=>[P]),_:2},1032,["onClick"]),_((p(),m(c,{type:"primary",link:"",onClick:$=>o(y)(n.row.id)},{default:t(()=>[Q]),_:2},1032,["onClick"])),[[f,"sys:attachment:delete"]])]),_:1})]),_:1},8,["data","onSelectionChange"])),[[L,a.dataListLoading]]),e(U,{"current-page":a.page,"page-sizes":a.pageSizes,"page-size":a.limit,total:a.total,layout:"total, sizes, prev, pager, next, jumper",onSizeChange:o(A),onCurrentChange:o(S)},null,8,["current-page","page-sizes","page-size","total","onSizeChange","onCurrentChange"])]),_:1})}}});export{Z as default};
