import{l as e,t as a,v as s,L as l,z as t,x as u,dD as c,dE as i,dF as r,_ as n}from"./utils-lib.js?v=20260328163632";import{u as o}from"./index115.js?v=20260328163632";import{N as d,B as p,ax as v,au as m}from"./naive-ui.js?v=20260328163632";import{k as h,a9 as f,r as k,c as b,e as y,O as x,o as _,V as g,W as j,X as w,Z as U,Y as C,F as q,L as I,K as L,j as V,a3 as D,N as E,u as F}from"./base-lib.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";import"./index88.js?v=20260328163632";const N=""+new URL("../images/file_icon/people.png",import.meta.url).href,O={class:"p-20px !text-[var(--text-color-1)]"},A={class:"leading-26px"},K={class:"authority-conter mb-10px"},W=["onClick"],z={class:"leading-26px flex justify-between mt-10px"},B={class:"w-70%"},H={class:"w-30% text-center"},R={class:"authority-conter authority_access mb-10px"},S={class:"authority-item"},X={class:"authority-item"},Y={class:"authority-item"},Z={class:"authority-item"};const G=n(h({__name:"index",props:{compData:{default:{fileItem:{}}}},setup(n,{expose:h}){const G=n,{refreshFilesList:J}=o(),{fileItem:M}=f(G.compData),P=k(!1),Q=k([]),T=k(0),$=b((()=>Q.value[T.value])),ee=k(!1),ae=k(!1),se=y({2032127:!1,1245631:!1,1179817:!1,1179785:!1}),le=[2032127,1245631,1179817,1179785],te=[{content:e("子目录权限继承将遍历整个目录下所有文件并设置权限")},{content:e("如果目录文件较大，请谨慎使用子目录权限继承，否则将会造成面板卡死。")}],ue=async()=>{await t({title:e("删除权限"),content:e("您确定要删除此目录的【{0}】权限吗？",[$.value.user]),type:"check",check:{content:e("子文件夹是否继承 {0}的权限",[$.value.user]),onConfirm:async a=>{u({loading:e("正在删除权限，请稍后..."),request:c({filename:M.value.path,user:$.value.user,is_sub:a}),message:!0,success:()=>{me()}})}}})},ce=k({formAttrs:{labelWidth:"100px"},formItems:[{label:e("用户名"),ruleKey:"user",rules:[{required:!0,message:e("请输入用户名"),trigger:"blur"}],children:[{type:"input",key:"user",attrs:{placeholder:e("请输入用户名")}}]},{label:" ",children:[{type:"custom",key:"path",render:()=>{let a;return x(d,{checked:re.value.is_sub,"onUpdate:checked":e=>re.value.is_sub=e},"function"==typeof(s=a=e("子文件是否继承"))||"[object Object]"===Object.prototype.toString.call(s)&&!F(s)?a:{default:()=>[a]});var s}}]}]}),[ie,re,ne]=a(ce),oe=()=>{re.value.user="",re.value.is_sub=!1,ae.value=!0},de=async()=>{u({loading:e("正在添加目录权限，请稍后..."),request:i({filename:M.value.path,user:re.value.user,is_sub:re.value.is_sub||!1,access:1179817}),message:!0,success:()=>{me()}})},pe=e=>{const a=le.findIndex((a=>a==e));le.forEach(((e,s)=>{se[e]=s>=a}))},ve=e=>{T.value=e,pe($.value.mask)},me=()=>{u({loading:P,request:r({filename:M.value.path}),data:[Array,Q],success:e=>{ve(0)}})};return _((()=>{me()})),h({onConfirm:async()=>{let a=[];le.forEach((e=>{se[e]&&a.push(e)}));const s={filename:M.value.path,user:$.value.user,access:null==a?void 0:a[0],is_sub:ee.value};return 0===(await u({loading:e("正在设置权限，请稍后..."),request:i(s),message:!0,data:{status:Number},success:J})).status}}),(a,t)=>{var u;const c=p,i=v,r=m;return g(),j("div",O,[w("div",A,U(C(e)("用户名:")),1),w("div",K,[(g(!0),j(q,null,I(C(Q),((e,a)=>(g(),j("div",{class:L(["authority-item",a===C(T)?"active":""]),key:a,onClick:e=>ve(a)},[t[7]||(t[7]=w("img",{src:N,class:"w-15px h-15px mr-5px",alt:""},null,-1)),V(" "+U(e.user),1)],10,W)))),128))]),x(r,{justify:"end"},{default:D((()=>[x(i,null,{default:D((()=>[x(c,{onClick:oe},{default:D((()=>[V(U(C(e)("添加")),1)])),_:1}),x(c,{type:"error",onClick:ue},{default:D((()=>[V(U(C(e)("删除")),1)])),_:1})])),_:1})])),_:1}),w("div",z,[w("div",B,U(null==(u=C($))?void 0:u.user)+U(C(e)("的权限")),1),w("div",H,U(C(e)("允许")),1)]),w("div",R,[w("div",S,[w("div",null,U(C(e)("完全控制")),1),w("div",null,[x(C(d),{checked:C(se)[2032127],"onUpdate:checked":[t[0]||(t[0]=e=>C(se)[2032127]=e),t[1]||(t[1]=e=>{return a=e,se[s=2032127]=a,void(a&&pe(s));var a,s})]},null,8,["checked"])])]),w("div",X,[w("div",null,U(C(e)("修改")),1),w("div",null,[x(C(d),{checked:C(se)[1245631],"onUpdate:checked":t[2]||(t[2]=e=>C(se)[1245631]=e)},null,8,["checked"])])]),w("div",Y,[w("div",null,U(C(e)("执行")),1),w("div",null,[x(C(d),{checked:C(se)[1179817],"onUpdate:checked":t[3]||(t[3]=e=>C(se)[1179817]=e)},null,8,["checked"])])]),w("div",Z,[w("div",null,U(C(e)("读取")),1),w("div",null,[x(C(d),{checked:C(se)[1179785],"onUpdate:checked":t[4]||(t[4]=e=>C(se)[1179785]=e)},null,8,["checked"])])])]),x(C(d),{checked:C(ee),"onUpdate:checked":t[5]||(t[5]=e=>E(ee)?ee.value=e:null)},{default:D((()=>{var a;return[V(U(C(e)("子文件是否继承"))+U(null==(a=C($))?void 0:a.user)+U(C(e)("的权限")),1)]})),_:1},8,["checked"]),x(C(s),{options:te,class:"!mt-20px"}),x(C(l),{title:C(e)("添加目录权限"),modelValue:C(ae),"onUpdate:modelValue":t[6]||(t[6]=e=>E(ae)?ae.value=e:null),area:400,onConfirm:de,"show-footer":""},{default:D((()=>[x(C(ie),{class:"p-20px"})])),_:1},8,["title","modelValue"])])}}}),[["__scopeId","data-v-4a6ebebb"]]);export{G as default};
