File: /www/server/panel/BTPanel/static/js/index372.js
import{k as _,w as W,d3 as H,d4 as T,cP as q,f as E}from"./utils-lib.js?v=1777008528";import{_ as L}from"./index118.js?v=1777008528";import{c as $,r as M,V as S,H as A,e as n,x as b,o as I,I as N,j as R,k as j,v as i,p as r,J as z,z as F}from"./base-lib.js?v=1777008528";import{_ as J}from"./index116.js?v=1777008528";import{ac as O,ad as y,ae as U}from"./firewall.js?v=1777008528";import{e as G,w as K,b as Q}from"./index3.js?v=1777008528";import"./__commonjsHelpers__.js?v=1777008528";import"./index119.js?v=1777008528";const X={class:"p-[2rem]"},re=$({__name:"index",setup(Y){const w=E(),d=M(),h=S([]),v=[{content:'注意:添加白名单目录要以"/"结尾'}],C=[{label:"删除",value:"delete",event:async(e,t,f,c)=>{const{label:l,value:p}=c,u=async(m,g)=>{const{path:o,type:V}=m;switch(p){case"delete":return await y({path:o,type:V})}};await e({title:"批量".concat(l,"白名单目录"),content:"批量".concat(l,"已选的白名单目录,是否继续操作!"),column:[{label:"路径",prop:"path"},Q()],onConfirm:async()=>(await t(u),s(),!1)})}}],a=A({path:"",type:"dir"}),s=async()=>{_({request:O(),success:e=>{Array.isArray(e.data)||(h.value=[...e.data.dir.map(t=>({path:t,type:"dir",typeTitle:"目录"})),...e.data.file.map(t=>({path:t,type:"file",typeTitle:"文件"}))])}})},k=()=>{K({type:"all",change(e,t){a.path=e,a.type=t,t==="dir"&&!e.endsWith("/")&&(a.path+="/")}})},x=e=>{a[e]=a[e].replace(/\s+/g,"")},B=async e=>{await W({icon:"warning-filled",title:"删除白名单目录",width:"34rem",content:"删除白名单目录【"+e.path+"】,是否继续操作?"}),_({request:y({path:e.path,type:e.type}),message:!0,loading:"正在删除白名单目录,请稍后...",success:s})},D=async()=>{try{if(!a.path){w.error("请输入白名单目录");return}await _({request:U({path:a.path}),message:!0,loading:"正在添加白名单目录,请稍后...",success:s}),a.path=""}catch(e){}},P=[G(),{label:"路径",prop:"path",showOverflowTooltip:!0},{label:"类型",prop:"typeTitle"},{label:"操作",align:"right",fixed:"right",render:e=>n("span",{class:"bt-link",onClick:()=>B(e)},[b("删除")])}];return I(()=>{s()}),(e,t)=>{const f=J,c=F,l=H,p=T,u=L,m=q,g=N("bt-loading");return R(),j("div",X,[n(u,null,{"header-left":i(()=>[n(f,{modelValue:r(a).path,"onUpdate:modelValue":t[0]||(t[0]=o=>r(a).path=o),name:"path",placeholder:"选择目录/文件全路径",icon:"icon-file_mode",onIconClick:t[1]||(t[1]=o=>k()),onChangePassive:t[2]||(t[2]=o=>x("path")),width:"32rem"},null,8,["modelValue"]),n(c,{class:"!ml-[.8rem]",type:"primary",onClick:D},{default:i(()=>[...t[3]||(t[3]=[b(" 添加 ",-1)])]),_:1})]),content:i(()=>[z(n(l,{ref_key:"whiteList",ref:d,column:P,data:r(h),description:"白名单列表为空"},null,8,["data"]),[[g,"正在加载白名单列表,请稍后...","title"]])]),"footer-left":i(()=>[n(p,{"table-ref":r(d),options:C},null,8,["table-ref"])]),_:1}),n(m,{options:v,class:"mx-[1.6rem] my-[0.6rem]"})])}}});export{re as default};