import{P as e,l as a,k as l,j as t,$ as o}from"./utils-lib.js?v=1761009159";import{_ as r}from"./index105.js?v=1761009159";import{c as s,V as d,r as m,e as n,q as p,H as i,v as u,x as c,B as _,C as h,I as f,y as b,Q as w,G as g,ab as y,ak as v,al as V,a9 as j}from"./base-lib.js?v=1761009159";import{_ as k}from"./index103.js?v=1761009159";import{bC as x,bD as q,bE as C}from"./firewall.js?v=1761009159";import{u as U}from"./column.js?v=1761009159";import{f as D}from"./validator.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";const F={class:"px-[1.6rem] py-[1.6rem]"},H=s({__name:"row-reinforce",props:{compData:{default:()=>({})}},setup(s){const H=s.compData.key,I=d(!1),R={a:"追加",i:"只读"},T=d([]),A=m(),B=d(!1),E=m({path:"",chattr:"i",d_mode:""}),G=[{content:"【只读】无法修改、创建、删除文件和目录"},{content:"【追加】只能追加内容，不能删除或修改原有内容"},{content:"【权限】设置文件或目录在受保护状态下的权限(非继承),关闭保护后权限自动还原"},{content:"【如何填写权限】请填写Linux权限代号,如:644、755、600、555等,如果不填写,则使用文件原来的权限"}],L={path:[{required:!0,message:"请输入被保护的文件或路径",trigger:["blur","change"]}],d_mode:[{required:!0,message:"请输入权限",trigger:["blur","change"]}]},O=async()=>{await e({loading:I,request:x({s_key:H}),data:{paths:[Array,T]}})},P=()=>{D({type:"all",path:"/www/wwwroot",change:e=>{E.value.path=e}})},Q=async()=>{await A.value.validate(),await e({loading:"正在添加保护文件/目录，请稍后...",request:C({...E.value,s_key:H}),message:!0}),B.value=!1,O(),E.value={path:"",chattr:"i",d_mode:""}},$=[{label:"路径",prop:"path",showOverflowTooltip:!0},{label:"模式",prop:"chattr",render:e=>R[e.chattr]},{label:"权限",prop:"s_mode",render:(e,a)=>n("span",null,[e.s_mode+(e.s_mode===e.d_mode?"":" >> "+e.d_mode)])},{label:"状态",prop:"state",render:e=>n("span",{class:"text-".concat(e.state?"primary":"danger")},[e.state?"已保护":"未保护"])},U([{title:"删除",onClick:async a=>{await e({request:q({s_key:H,path:a.path}),loading:"正在删除保护配置，请稍后...",message:!0}),O()}}])];return p(()=>O()),(e,s)=>{const d=g,m=a,p=k,x=y,q=v,C=V,U=l,D=j,H=t,R=r,O=o,z=i("bt-loading");return u(),c("div",F,[n(R,null,{"header-left":_(()=>[n(d,{type:"primary",onClick:s[0]||(s[0]=e=>B.value=!0)},{default:_(()=>s[5]||(s[5]=[h(" 添加保护文件/目录 ",-1)])),_:1,__:[5]})]),content:_(()=>[f(n(m,{"max-height":"400",column:$,data:b(T)},null,8,["data"]),[[z,b(I)],[z,"正在加载中，请稍后...","title"]])]),popup:_(()=>[n(H,{title:"添加保护文件/目录",modelValue:b(B),"onUpdate:modelValue":s[4]||(s[4]=e=>w(B)?B.value=e:null),area:42,onConfirm:Q,showFooter:""},{default:_(()=>[n(D,{class:"p-2rem",ref_key:"addReinforceFormRef",ref:A,model:b(E),rules:L},{default:_(()=>[n(x,{label:"路径",prop:"path"},{default:_(()=>[n(p,{icon:"icon-file_mode",modelValue:b(E).path,"onUpdate:modelValue":s[1]||(s[1]=e=>b(E).path=e),width:"24rem",placeholder:"被保护的文件或路径",onIconClick:P,iconType:"folder"},null,8,["modelValue"])]),_:1}),n(x,{label:"模式"},{default:_(()=>[n(C,{modelValue:b(E).chattr,"onUpdate:modelValue":s[2]||(s[2]=e=>b(E).chattr=e),class:"!w-[24rem]"},{default:_(()=>[n(q,{label:"只读",value:"i"}),n(q,{label:"追加",value:"a"})]),_:1},8,["modelValue"])]),_:1}),n(x,{label:"权限",prop:"d_mode"},{default:_(()=>[n(U,{modelValue:b(E).d_mode,"onUpdate:modelValue":s[3]||(s[3]=e=>b(E).d_mode=e),width:"24rem",placeholder:"请输入权限",clearable:""},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"])]),_:1}),n(O,{options:G,class:"mx-[1.6rem] mt-[1.6rem]"})])}}});export{H as default};
