import{d as _e,x as ve,r as f,y as ye,G as xe,a as h,f as $,q as C,e as n,h as a,bf as ke,b as u,c as I,H as x,$ as k,t as j,aj as be,I as G,bg as Ce,Y as J,bh as we,A as H,bi as Se,bj as $e,bk as Ee,bl as Te,bm as De,bn as Be,Z as Ie,b5 as ze,ae as z,bo as r,ap as Me,aq as b,ab as Z,bp as Ue,aF as O,a7 as Q,aY as Ve,av as Le,bc as Fe,aw as Re,b3 as Ne,ak as Pe,b4 as je,p as He,m as Oe,_ as qe}from"./index-e450010e.js";import{g as Ke,r as Ye,a as Ae}from"./tools-446dc38a.js";import{_ as Ge}from"./sharePermission.vue_vue_type_script_setup_true_lang-850bb9dd.js";import{p as Je,a as Ze,b as Qe,g as L,c as We}from"./index-a1529bac.js";import{_ as Xe}from"./preview.vue_vue_type_style_index_0_lang-2ef83b9d.js";const W=M=>(He("data-v-f6812792"),M=M(),Oe(),M),et={style:{display:"grid","grid-template-columns":"1fr 4fr",width:"100%",height:"100%"}},tt={class:"menus_tree"},at={class:"app_container"},lt=W(()=>C("span",{style:{"font-weight":"bold","margin-right":"5px"}},"根目录",-1)),nt={style:{"font-weight":"bold",margin:"0 5px"}},it=W(()=>C("span",null,"上传",-1)),ot={key:0,style:{margin:"12px"}},ut={key:1,style:{display:"flex","align-items":"center"}},dt={style:{"margin-left":"10px"}},st={key:0},rt={key:0},ct=_e({__name:"manage",setup(M){const X=ve(),m=btoa("p0"+X.userInfoCont.userId),q=document.location.origin,F="/hxpan/api",w=f([]),E=f(""),T=f(""),K=f(""),S=f("sixhour"),D=f([]),R=f([{name:"root",uuid:"root",children:[]}]),U=f(),s=f({}),ee="https://gyhlw.hxgk.group/kkapi",V=f(null),te=f(),g=f({page:0,total:0}),ae=f({"user-id":m}),le=ye(()=>({userUuid:m,puuid:s.value.uuid})),Y=f([]);function N(e){const t=f(!1);let o="",c="",y=0;z({title:(e==null?void 0:e.name)+" 请选择分享有效时间",message:()=>r("div",{style:{width:"660px"}},[r(Me,{defaultFirstOption:!0,modelValue:S.value,"onUpdate:modelValue":l=>{S.value=l},valueKey:"value",fallbackPlacements:["bottom-start"],style:{width:"360px"}},()=>[r(b,{label:"六小时",key:"sixhour",value:"sixhour"}),r(b,{label:"一 天",key:"oneday",value:"oneday"}),r(b,{label:"三 天",key:"threeday",value:"threeday"}),r(b,{label:"一 周",key:"oneweek",value:"oneweek"}),r(b,{label:"一 月",key:"onemonth",value:"onemonth"}),r(b,{label:"三 月",key:"threemonth",value:"threemonth"}),r(b,{label:"永 久",key:"permanent",value:"permanent"})]),r(Z,{style:"width:30px;margin:0 10px;",icon:Ue,onClick:()=>{t.value=!0}}),r(Ge,{uid:m,uuid:(e==null?void 0:e.uuid)??"",modelValue:t.value,confirmFunc:(l,p)=>{y=l.length,o=btoa(l.join("|")),c=p.join("|"),t.value=!1},closeFunc:()=>{t.value=!1}})]),showCancelButton:!0}).then(()=>{let l;e?l={matterUuids:e.uuid,expireInfinity:!1,expireTime:"",permitList:o,len:y,permitInfos:c}:D.value.length>1&&(l={matterUuids:D.value.map(p=>p.uuid).join(","),expireInfinity:!1,expireTime:"",permitList:o,len:y,permitInfos:c}),l&&(S.value==="permanent"?l.expireInfinity=!0:l.expireTime=Ae(S.value),Je(m,l).then(p=>{ne(p.data)}),v(),S.value="sixhour")}).catch(()=>{S.value="sixhour"})}function ne(e){let t=`${q}/#/doc/share/?uuid=${e.uuid}&code=${e.code}`;z({title:"分享详情",customStyle:{"--el-messagebox-width":"800px",padding:"40px"},message:()=>r("div",{style:{display:"flex","flex-direction":"column","line-height":"34px",width:"600px"}},[r(O,{style:{"align-self":"flex-start"}},()=>e.name),r(O,{style:{"align-self":"flex-start"}},()=>"失效时间:"+e.expireTime),r(O,{style:{"align-self":"flex-start"}},()=>"链接:"+t)]),confirmButtonText:"复制分享链接",showCancelButton:!0}).then(()=>{navigator.clipboard.writeText(t)}).catch(()=>{})}function A(e){e.uuid&&z.confirm(`确认删除( ${e.name}) ?删除后不可恢复!取消则放弃删除操作。`,"警告",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{Ze(m,{uuid:e.uuid}).then(()=>{var t;e.dir&&(s.value.uuid=e.puuid??"",s.value.name=e.path?(t=e.path.replace(`/${e.name}`,"").match(/[^/]+$/g))==null?void 0:t.pop():"上级目录",U.value.remove(e.uuid)),v()})})}function ie(){z.confirm("确认删除选择的内容?","警告",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{Qe(m,{uuids:D.value.map(e=>e.uuid).join(",")}).then(()=>v())})}function oe(e){z.confirm("确认下载此数据项?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{if(e.uuid){let t=F+`/alien/download/${e.uuid}/${e.name}`;window.open(t)}})}function ue(e){L(m,{page:0,pageSize:50,orderCreateTime:"DESC",orderDir:"DESC",name:e}).then(o=>{g.value={total:o.data.totalPages,page:o.data.page},w.value=o.data.data.filter(c=>!c.dir)})}function v(){let e={page:g.value.page,pageSize:50,orderCreateTime:"DESC",orderDir:"DESC",puuid:s.value.uuid,deleted:!1};L(m,e).then(t=>{g.value={total:t.data.totalPages,page:t.data.page},w.value=t.data.data.filter(o=>!o.dir)})}function de(){var e;(e=w.value)==null||e.unshift({name:"",userUuid:m,puuid:"",uuid:"",dir:!0,size:0,deleted:!1})}function se(){We(m,{userUuid:m,puuid:s.value.uuid,name:T.value}).then(e=>{T.value="",U.value.append({uuid:e.data.uuid,dir:!1,name:e.data.name,puuid:e.data.puuid},s.value.uuid),v()}).catch(e=>{Q.error(e.msg)})}function re(e,t,o){if(e.data.uuid){const c=e.data.uuid;s.value=e.data,L(m,{page:0,pageSize:50,orderCreateTime:"DESC",orderDir:"DESC",puuid:c,deleted:!1}).then(l=>{g.value={total:l.data.totalPages,page:l.data.page},w.value=l.data.data.filter(d=>!d.dir);let p=l.data.data.filter(d=>d.dir).map(d=>(d.dir=!d.dir,d));t(p)}).catch(()=>o())}}function P(e,t,o,c){if(s.value.uuid===e.uuid)return;const y=e.uuid;s.value=e,L(m,{page:0,pageSize:50,orderCreateTime:"DESC",orderDir:"DESC",puuid:y,deleted:!1}).then(p=>{g.value={total:p.data.totalPages,page:p.data.page},w.value=p.data.data.filter(_=>!_.dir);let d=p.data.data.filter(_=>_.dir).map(_=>(_.dir=!_.dir,_));t?e.children&&e.children.length!==d.length&&U.value.updateKeyChildren(e.uuid,d):e.children.length!==d.length&&(e.children=d)})}function ce(e){let t=`${e.uuid}${e.name}`,o=document.cookie.match(/hxpan=([\w-]*)/);o&&o.length>1&&(o=o[1]);let c=`${q}${F}/alien/download/${e.uuid}/${e.name}?access_token=${o}&fullfilename=${t}`;V.value=r(Xe,{url:`${ee}/kkpreview/onlinePreview?url=`+window.btoa(unescape(encodeURIComponent(c))),closeFunc:()=>V.value=null})}function pe(e){K.value=e.name}function fe(e){Y.value=[],v()}function me(e,t,o){Q.error(JSON.parse(e.message).msg)}xe(()=>{P(R.value[0],null)});const he=e=>{D.value=e};return(e,t)=>{const o=Ve,c=Le,y=Fe,l=Z,p=Re,d=Ne,_=Pe,ge=je;return h(),$("div",et,[C("div",tt,[n(a(ke),{ref_key:"treeRef",ref:U,style:{"max-width":"600px"},data:a(R),"node-key":"uuid",lazy:"",props:{label:"name",children:"children",isLeaf:"dir"},load:re,"default-expanded-keys":["root"],onNodeClick:P},null,8,["data"])]),C("div",at,[n(c,{gutter:24,style:{margin:"12px 0px"}},{default:u(()=>[a(s).name!=="root"?(h(),I(o,{key:0,onClick:t[0]||(t[0]=i=>P(a(R)[0],null,null,null))},{default:u(()=>[lt,x("/ ")]),_:1})):k("",!0),C("span",nt,j(a(s).name),1)]),_:1}),n(c,{gutter:24},{default:u(()=>[n(p,{span:14},{default:u(()=>[n(y,{class:"el-button el-button--default","file-list":a(Y),headers:a(ae),data:a(le),"on-success":fe,"on-error":me,"show-file-list":!1,action:F+"/matter/upload",limit:1},{default:u(()=>[it]),_:1},8,["file-list","headers","data","action"]),n(l,{onClick:de},{default:u(()=>[x("新建目录")]),_:1}),a(D).length>1?(h(),$("span",ot,[n(l,{onClick:t[1]||(t[1]=i=>N())},{default:u(()=>[x("分享")]),_:1}),n(l,{onClick:ie},{default:u(()=>[x("删除")]),_:1})])):k("",!0),n(l,{onClick:t[2]||(t[2]=i=>v())},{default:u(()=>[x("刷新")]),_:1}),n(l,{type:"danger",plain:"",onClick:t[3]||(t[3]=i=>N({uuid:a(s).uuid,name:a(s).name}))},{default:u(()=>[x("分享目录")]),_:1}),n(l,{type:"danger",plain:"",onClick:t[4]||(t[4]=i=>A({uuid:a(s).uuid,name:a(s).name,dir:!0,puuid:a(s).puuid,path:a(s).path}))},{default:u(()=>[x("删除目录")]),_:1})]),_:1}),n(p,{span:8,class:"search"},{default:u(()=>[n(a(be),{placeholder:"搜索文件",modelValue:a(E),"onUpdate:modelValue":t[5]||(t[5]=i=>G(E)?E.value=i:null),onBlur:t[6]||(t[6]=i=>a(E)===""?v():"")},null,8,["modelValue"]),n(l,{icon:a(Ce),onClick:t[7]||(t[7]=i=>ue(a(E)))},null,8,["icon"])]),_:1})]),_:1}),n(c,{gutter:24,style:{height:"84%","overflow-y":"auto"}},{default:u(()=>[n(ge,{stripe:"",data:a(w),ref_key:"multipleTableRef",ref:te,"header-cell-style":{background:"#f5f8fd"},style:{width:"100%"},"row-key":"uuid","row-style":()=>({lineHeight:"36px"}),onSelectionChange:he,onCellMouseEnter:pe},{default:u(()=>[n(d,{type:"selection",width:"50"}),n(d,{width:"450",property:"name",label:"文件名"},{default:u(i=>[i.row.name===""?J((h(),$("input",{key:0,type:"text",autofocus:"",placeholder:"文件夹名",style:{border:"groove",height:"30px"},"onUpdate:modelValue":t[8]||(t[8]=B=>G(T)?T.value=B:null),onChange:se},null,544)),[[we,a(T)]]):k("",!0),i.row.name?(h(),$("div",ut,[n(_,{size:26},{default:u(()=>[i.row.dir?(h(),I(H(a(Se)),{key:0})):(h(),I(H(a(Ke)(i.row.name)),{key:1}))]),_:2},1024),C("span",dt,j(i.row.name),1)])):k("",!0)]),_:1}),n(d,{width:"250",align:"center"},{default:u(i=>[J(C("div",null,[n(l,{size:"small",icon:a($e),circle:""},null,8,["icon"]),n(l,{size:"small",icon:a(Ee),circle:"",onClick:B=>ce(i.row)},null,8,["icon","onClick"]),n(l,{size:"small",icon:a(Te),circle:"",onClick:B=>N(i.row)},null,8,["icon","onClick"]),n(l,{size:"small",icon:a(De),circle:"",onClick:B=>oe(i.row)},null,8,["icon","onClick"]),n(l,{size:"small",icon:a(Be),circle:"",onClick:B=>A(i.row)},null,8,["icon","onClick"])],512),[[Ie,a(K)===i.row.name]])]),_:1}),n(d,{prop:"size",width:"100",formatter:a(Ye),label:"大小"},null,8,["formatter"]),n(d,{prop:"updateTime",label:"修改日期"},{default:u(i=>[i.row.updateTime?(h(),$("span",st,j(i.row.updateTime.slice(0,16)),1)):k("",!0)]),_:1})]),_:1},8,["data"])]),_:1}),a(g).total>1?(h(),I(c,{key:0,style:{"justify-content":"center"}},{default:u(()=>[n(a(ze),{size:"small",background:"",layout:"prev, pager, next","current-page":a(g).page+1,onCurrentChange:t[9]||(t[9]=i=>{a(g).page=i-1,v()}),"page-count":a(g).total,class:"mt-4"},null,8,["current-page","page-count"])]),_:1})):k("",!0)]),a(V)?(h(),$("div",rt,[(h(),I(H(a(V))))])):k("",!0)])}}});const _t=qe(ct,[["__scopeId","data-v-f6812792"]]);export{_t as default};