index-BupM-FeA.js 6.7 KB

1
  1. var g=(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-yjRWbRcT.js";import{T as X,B as Y,u as Z}from"./index-Ctq9WGad.js";import{ao as _,v as x,ap as ee,_ as oe}from"./entry/index-BR4aaozk-1722999832476.js";import{u as ae}from"./index-C2pYGHuD.js";import{C as le,c as ne,s as ie}from"./CloudFileDrawer-BW0zN3wC.js";import{g as te,u as se,d as P}from"./cloudFile-BfGVmIaB.js";import{i as re}from"./index-CWIMkCyU.js";import{A as de}from"./useForm-BPs-bGop.js";import"./index-D0xvMl_A.js";import{a8 as ce,M as A}from"./antd-BQ3qV6bI.js";import"./index-Bm3tDEoh.js";import{g as me}from"./storageProvider-CluPFqEA.js";import{d as ue,f as t,c as pe,k as l,a7 as c,_ as U,$ as fe,a9 as a,a8 as N,G as b,a1 as f,ab as O,a0 as I}from"./vue-BNCny8i2.js";import"./plugin-DCXEoXS2.js";import"./useWindowSizeFn-BpJljGvW.js";import"./onMountedOrActivated-DUkWHYas.js";import"./sortable.esm-CnNXHMH-.js";import"./useSortable-DWA54z3F.js";import"./index-CotF8ozl.js";import"./cloudFileTag-ChTVMI7m.js";import"./ExclamationCircleOutlined-OYz2z3Y1.js";import"./index-bMIGtX2N.js";import"./tree-Bzlcl2-1.js";import"./copyTextToClipboard-ohAWhynX.js";import"./index-CCbSIA2Z.js";import"./index-94nmOQ7g.js";const he=ue({name:"CloudFileManagement",components:{BasicTable:K,CloudFileDrawer:le,Button:_,TableAction:X,BasicUpload:Y,Image:ce,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},m=t(""),S=t(""),R=t(""),E=t(""),V=t("");function M(){n(!0,{isUpdate:!1})}function $(o){return g(this,null,function*(){if(o.fileType===2)y.value=!0,m.value=o.url;else if(o.fileType===3)C.value=!0,S.value=o.url,R.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),F()}function z(){const o=document.createElement("a");o.href=m.value,o.download=V.value,o.click(),o.remove(),URL.revokeObjectURL(o.href),L()}function F(){C.value=!1}function L(){y.value=!1}function G(o){n(!0,{record:o,isUpdate:!0})}function W(o){return g(this,null,function*(){yield P({ids:[o.id]}),k()})}function q(){return g(this,null,function*(){A.confirm({title:e("common.deleteConfirm"),icon:l(re.ExclamationCircleOutlined),onOk(){return g(this,null,function*(){const d=w.value;(yield P({ids:d})).code===0&&(yield k())})},onCancel(){}})})}function H(o){return g(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:m,videoPath:S,videoTitle:R,imageTitle:E,handleDownloadVideo:j,handleDownloadImage:z,handleCloseVideo:F,handleCloseImage:L,handleCopyToClipboard:H,handleBatchDelete:q,showDeleteButton:h,getStorageProviderList:me}}}),ve={width:"1280",height:"720",controls:""},Ce=["src"];function ge(e,s,u,T,h,w){const v=c("Button"),p=c("ApiSelect"),i=c("BasicUpload"),n=c("a-button"),B=c("TableAction"),k=c("BasicTable"),D=c("CloudFileDrawer"),C=c("Modal"),y=c("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(()=>[b(f(e.t("common.delete")),1)]),_:1},8,["onClick"])):O("",!0)]),toolbar:a(()=>[I("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(()=>[b(f(e.t("fms.cloudFile.addCloudFile")),1)]),_:1},8,["onClick"])]),bodyCell:a(({column:r,record:m})=>[r.key==="action"?(U(),N(B,{key:0,actions:[{icon:"ant-design:cloud-download-outlined",tooltip:e.t("fms.file.download"),onClick:e.handleDownload.bind(null,m)},{icon:"ant-design:copy-outlined",tooltip:e.t("fms.file.copyURL"),onClick:e.handleCopyToClipboard.bind(null,m)},{icon:"clarity:note-edit-line",onClick:e.handleEdit.bind(null,m)},{icon:"ant-design:delete-outlined",color:"error",popConfirm:{title:e.t("common.deleteConfirm"),placement:"left",confirm:e.handleDelete.bind(null,m)}}]},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(()=>[b(f(e.t("common.closeText")),1)]),_:1},8,["onClick"]),l(n,{key:"download",type:"primary",onClick:e.handleDownloadVideo},{default:a(()=>[b(f(e.t("fms.file.download")),1)]),_:1},8,["onClick"])]),default:a(()=>[I("video",ve,[I("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(()=>[b(f(e.t("common.closeText")),1)]),_:1},8,["onClick"]),l(n,{key:"download",type:"primary",onClick:e.handleDownloadImage},{default:a(()=>[b(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 Ke=oe(he,[["render",ge]]);export{Ke as default};