2 lines
3.7 KiB
JavaScript
2 lines
3.7 KiB
JavaScript
import{_ as N}from"./index.vue_vue_type_script_setup_true_lang-BeO8Hyma.js?v=1773287522785";import{l as v,i as V,w as j,c as O}from"./index-BTglIPU2.js?v=1773287522785";import{e as R}from"./file-B5PwfK2h.js?v=1773287522785";import{u as H}from"./useTableData-BmkIKQ_R.js?v=1773287522785";import{u as K}from"./useLoading-CZ2gSAW7.js?v=1773287522785";import{al as U,n as Z,g as x,B as q,k as G,b6 as J}from"./naive-ui--dJnpVcV.js?v=1773287522785";import{k as M,R as Q,r as k,a0 as s,$ as g,Z as y,a9 as $,j as W,aa as d,_ as u,S as p,F as X,P as Y}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import"./data-BVsViUMm.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";const ee={class:"flex flex-col h-full"},te={class:"flex-1 w-0 truncate"},ne={class:"flex flex-1 overflow-hidden"},se={class:"w-160px py-12px overflow-auto"},ae=["onClick"],oe={class:"flex-1 ml-8px"},le={class:"flex-1","b-l":"1 solid #aaa"},ie=M({__name:"index",props:{data:{}},setup(w,{expose:D}){const{t:f}=Q(),I=w,{path:B,checkedType:_,callback:h}=I.data,b=k([]),L=e=>{n.value=e,r()},o=k([]),n=k(B||"/"),{table:m,columns:z}=H([{key:"checkbox",title:"",width:36,render:e=>_.includes(e.type)?s("div",{onClick:t=>{t.stopPropagation()}},[s(U,{checked:e.filename===o.value[0],onUpdateChecked:t=>{t?o.value=[e.filename]:o.value=[]}},null)]):""},{key:"filename",title:f("Component.SelectPath.index_3"),render:e=>s("div",{class:"flex"},[s("div",{class:"flex items-center flex-1 cursor-pointer",onClick:t=>{e.type==="dir"&&(t.preventDefault(),n.value+="".concat(n.value==="/"?"":"/").concat(e.filename),r(),t.stopPropagation())}},[s("div",null,[e.type==="dir"?s(v,{name:"base-dir",size:"16"},null):"",e.type==="file"?s(v,{name:"base-file",size:"16",color:"#666"},null):""]),s("div",{class:"ml-6px flex-1 w-0"},[s(Z,null,{default:()=>[e.filename]})])])])},{key:"time",title:f("Component.SelectPath.index_4"),width:146},{key:"permission",title:f("Component.SelectPath.index_5"),width:86},{key:"owner",title:f("Component.SelectPath.index_6"),width:72}]),E=e=>({onClick:()=>{_.includes(e.type)&&(J(o.value,a=>a===e.filename)!==-1?o.value=[]:o.value=[e.filename])},onDblclick:()=>{_.includes(e.type)&&(n.value+="".concat(n.value==="/"?"":"/").concat(e.filename),r())}}),F=()=>{const e=n.value.substring(0,n.value.lastIndexOf("/"));n.value=e===""?"/":e,r()},{loading:T,setLoading:C}=K(),r=async()=>{try{C(!0),m.data=[],o.value=[];const{message:e}=await R({path:n.value});if(V(e)){const t=[],a=x(e,"DIR",[]),i=x(e,"FILES",[]);a.forEach(l=>{t.push(P(l,"dir"))}),i.forEach(l=>{t.push(P(l,"file"))}),n.value=e.PATH,m.data=t,b.value=x(e,"DISK",[])}}finally{C(!1)}},P=(e,t)=>{const a=e.split(";"),i=a[0],l=j(a[2]),c=a[3],S=a[4];return{path:(n.value!=="/"?n.value+"/":"")+i,filename:i,time:l,permission:c,owner:S,type:t}},A=({hide:e})=>{const t=o.value.length>0?o.value[0]:"",a=(n.value!=="/"?n.value+"/":"")+t,i=m.data.find(l=>l.filename===t);h==null||h(a,i),e()};return r(),D({onConfirm:A}),(e,t)=>{const a=q,i=G,l=N;return g(),y("div",ee,[s(i,{class:"items-center h-50px px-12px","b-b":"1 solid #aaa"},{default:$(()=>[s(a,{onClick:F},{default:$(()=>[W(d(e.$t("Component.SelectPath.index_1")),1)]),_:1}),u("div",te,d(e.$t("Component.SelectPath.index_2"))+": "+d(p(n)),1)]),_:1}),u("div",ne,[u("div",se,[(g(!0),y(X,null,Y(p(b),c=>(g(),y("div",{key:c.path,class:"flex items-center p-8px pl-16px hover:bg-#ececec cursor-pointer transition-colors disk-item",onClick:S=>L(c.path)},[s(v,{name:"file-disk",size:"18",color:"#666"}),u("div",oe,d(c.path)+" "+d(c.size[2]?"(".concat(c.size[2],")"):""),1)],8,ae))),128))]),u("div",le,[s(l,{loading:p(T),"loading-num":10,bordered:!1,"virtual-scroll":!0,"max-height":456,data:p(m).data,columns:p(z),"row-props":E},null,8,["loading","data","columns"])])])])}}}),xe=O(ie,[["__scopeId","data-v-b9968102"]]);export{xe as default};
|