1 |
- var b=(e,s,u)=>new Promise((T,h)=>{var w=i=>{try{p(u.next(i))}catch(n){h(n)}},v=i=>{try{p(u.throw(i))}catch(n){h(n)}},p=i=>i.done?T(i.value):Promise.resolve(i.value).then(w,v);p((u=u.apply(e,s)).next())});import{B as K,u as Q}from"./useTable-B6PunZL5.js";import{T as X,B as Y,u as Z}from"./index-BIj58_Cj.js";import{ao as _,v as x,ap as ee,_ as oe}from"./entry/index-DJx93RYF-1731481145019.js";import{u as ae}from"./index-CzIUqxsa.js";import{C as le,c as ne,s as ie}from"./CloudFileDrawer-C4TOWemt.js";import{g as te,u as se,d as P}from"./cloudFile-QePwZ00w.js";import{i as re}from"./index-BQgPd3bX.js";import{A as de}from"./useForm-pwHPrILC.js";import"./index-wDJjh9Os.js";import{a8 as me,M as A}from"./antd-CBeLo_oO.js";import"./index-Cuu0w1HY.js";import{g as ce}from"./storageProvider-DYGKztUN.js";import{d as ue,f as t,c as pe,k as l,a9 as m,_ as U,$ as fe,a7 as a,a6 as N,G as g,a2 as f,a0 as O,a1 as F}from"./vue-B5pbXMv7.js";import"./uuid-BUBnBT7J.js";import"./useWindowSizeFn-BxA6-zLj.js";import"./onMountedOrActivated-C3HH8-CK.js";import"./sortable.esm-BEDva30o.js";import"./useSortable-lvT7rWOs.js";import"./index-DkGmfgEA.js";import"./cloudFileTag-DFmYgOBa.js";import"./ExclamationCircleOutlined-Ca0mYuiu.js";import"./index-D_SNX-7K.js";import"./tree-BtJaOqz0.js";import"./copyTextToClipboard-Dngb1Nn3.js";import"./index-BDsRYE32.js";import"./index-BzfGKMh3.js";import"./plugin-C2XGVjF6.js";const he=ue({name:"CloudFileManagement",components:{BasicTable:K,CloudFileDrawer:le,Button:_,TableAction:X,BasicUpload:Y,Image:me,Modal:A,ApiSelect:de},setup(){const{t:e}=x.useI18n(),{toClipboard:s}=Z(),{createErrorModal:u,createMessage:T}=ee(),h=t(!1),w=t(),v=t(e("fms.storageProvider.chooseProvider")),p=pe(()=>({provider:v.value})),[i,{openDrawer:n}]=ae(),[B,{reload:k}]=Q({title:e("fms.file.fileList"),api:te,columns:ne,formConfig:{labelWidth:140,schemas:ie},useSearchForm:!0,showTableSetting:!0,bordered:!0,clickToRowSelect:!1,showIndexColumn:!1,actionColumn:{width:50,title:e("common.action"),dataIndex:"action",fixed:void 0},rowKey:"id",rowSelection:{type:"checkbox",onChange:(o,d)=>{w.value=o,h.value=o.length>0}}}),D=t(!1),C=t(!1),y=t(!1),r=o=>{D.value=o},c=t(""),S=t(""),I=t(""),E=t(""),V=t("");function M(){n(!0,{isUpdate:!1})}function $(o){return b(this,null,function*(){if(o.fileType===2)y.value=!0,c.value=o.url;else if(o.fileType===3)C.value=!0,S.value=o.url,I.value=o.name;else{const d=document.createElement("a");d.href=o.url,d.download=V.value,d.click(),d.remove(),URL.revokeObjectURL(d.href)}})}function j(){const o=document.createElement("a");o.href=S.value,o.download=V.value,o.click(),o.remove(),URL.revokeObjectURL(o.href),R()}function z(){const o=document.createElement("a");o.href=c.value,o.download=V.value,o.click(),o.remove(),URL.revokeObjectURL(o.href),L()}function R(){C.value=!1}function L(){y.value=!1}function G(o){n(!0,{record:o,isUpdate:!0})}function W(o){return b(this,null,function*(){yield P({ids:[o.id]}),k()})}function q(){return b(this,null,function*(){A.confirm({title:e("common.deleteConfirm"),icon:l(re.ExclamationCircleOutlined),onOk(){return b(this,null,function*(){const d=w.value;(yield P({ids:d})).code===0&&(yield k())})},onCancel(){}})})}function H(o){return b(this,null,function*(){try{yield s(o.url),T.success(e("fms.file.copyURLSuccess"))}catch(d){u({title:e("fms.file.copyURLFailed"),content:o.publicPath})}})}function J(){k()}return{t:e,registerTable:B,registerDrawer:i,handleCreate:M,handleEdit:G,handleDelete:W,handleSuccess:J,providerName:v,providerParams:p,handleDownload:$,handleChange:o=>{},uploadApi:se,visible:D,videoVisible:C,imageVisible:y,setVisible:r,imagePath:c,videoPath:S,videoTitle:I,imageTitle:E,handleDownloadVideo:j,handleDownloadImage:z,handleCloseVideo:R,handleCloseImage:L,handleCopyToClipboard:H,handleBatchDelete:q,showDeleteButton:h,getStorageProviderList:ce}}}),ve={width:"1280",height:"720",controls:""},Ce=["src"];function be(e,s,u,T,h,w){const v=m("Button"),p=m("ApiSelect"),i=m("BasicUpload"),n=m("a-button"),B=m("TableAction"),k=m("BasicTable"),D=m("CloudFileDrawer"),C=m("Modal"),y=m("Image");return U(),fe("div",null,[l(k,{onRegister:e.registerTable},{tableTitle:a(()=>[e.showDeleteButton?(U(),N(v,{key:0,type:"primary",danger:"",preIcon:"ant-design:delete-outlined",onClick:e.handleBatchDelete},{default:a(()=>[g(f(e.t("common.delete")),1)]),_:1},8,["onClick"])):O("",!0)]),toolbar:a(()=>[F("span",null,f(e.t("fms.cloudFile.providerId")),1),l(p,{api:e.getStorageProviderList,params:{page:1,pageSize:1e3},"result-field":"data.data","label-field":"name","value-field":"name",class:"w-32",value:e.providerName,"onUpdate:value":s[0]||(s[0]=r=>e.providerName=r)},null,8,["api","value"]),l(i,{maxSize:1e3,maxNumber:10,onChange:e.handleChange,api:e.uploadApi,"upload-params":e.providerParams,class:"my-5",accept:["image/*","video/*","audio/*"]},null,8,["onChange","api","upload-params"]),l(n,{type:"primary",onClick:e.handleCreate},{default:a(()=>[g(f(e.t("fms.cloudFile.addCloudFile")),1)]),_:1},8,["onClick"])]),bodyCell:a(({column:r,record:c})=>[r.key==="action"?(U(),N(B,{key:0,actions:[{label:e.t("fms.file.download"),onClick:e.handleDownload.bind(null,c)},{label:e.t("fms.file.copyURL"),onClick:e.handleCopyToClipboard.bind(null,c)},{label:"编辑",onClick:e.handleEdit.bind(null,c)},{label:"删除",color:"error",popConfirm:{title:e.t("common.deleteConfirm"),placement:"left",confirm:e.handleDelete.bind(null,c)}}]},null,8,["actions"])):O("",!0)]),_:1},8,["onRegister"]),l(D,{onRegister:e.registerDrawer,onSuccess:e.handleSuccess},null,8,["onRegister","onSuccess"]),l(C,{open:e.videoVisible,"onUpdate:open":s[1]||(s[1]=r=>e.videoVisible=r),title:e.videoTitle,width:"80%","wrap-class-name":"full-modal",onOk:e.handleDownloadVideo},{footer:a(()=>[l(n,{key:"back",onClick:e.handleCloseVideo},{default:a(()=>[g(f(e.t("common.closeText")),1)]),_:1},8,["onClick"]),l(n,{key:"download",type:"primary",onClick:e.handleDownloadVideo},{default:a(()=>[g(f(e.t("fms.file.download")),1)]),_:1},8,["onClick"])]),default:a(()=>[F("video",ve,[F("source",{src:e.videoPath,type:"video/mp4"},null,8,Ce)])]),_:1},8,["open","title","onOk"]),l(C,{open:e.imageVisible,"onUpdate:open":s[2]||(s[2]=r=>e.imageVisible=r),title:e.imageTitle,width:"50%","wrap-class-name":"full-modal",onOk:e.handleDownloadImage},{footer:a(()=>[l(n,{key:"back",onClick:e.handleCloseImage},{default:a(()=>[g(f(e.t("common.closeText")),1)]),_:1},8,["onClick"]),l(n,{key:"download",type:"primary",onClick:e.handleDownloadImage},{default:a(()=>[g(f(e.t("fms.file.download")),1)]),_:1},8,["onClick"])]),default:a(()=>[l(y,{width:"100%",style:{},preview:{visible:e.visible,onVisibleChange:e.setVisible},src:e.imagePath},null,8,["preview","src"])]),_:1},8,["open","title","onOk"])])}const Qe=oe(he,[["render",be]]);export{Qe as default};
|