← Back
Editing: index439.js
import{K as a,o as e,k as t,a0 as s,W as l,b as r}from"./utils-lib.js?v=1765440387";import{_ as i}from"./index93.js?v=1765440387";import{c as o,r as n,U as p,k as c,e as m,B as d,p as h,G as f,q as u,v as y,A as b,x as g,H as w,D as _}from"./base-lib.js?v=1765440387";import{_ as v}from"./index91.js?v=1765440387";import{bc as j,bd as x,be as k}from"./firewall.js?v=1765440387";import{a as C,c as q}from"./column.js?v=1765440387";import{f as T}from"./validator.js?v=1765440387";import"./__commonjsHelpers__.js?v=1765440387";import"./index94.js?v=1765440387";const A={class:"p-[2rem]"},V=o({__name:"index",setup(o){const V=r(),H=n(),U=p([]),W=[{content:'注意:添加白名单目录要以"/"结尾'}],B=[{label:"删除",value:"delete",event:async(a,e,t,s)=>{const{label:l,value:r}=s,i=async(a,e)=>{const{path:t,type:s}=a;if("delete"===r)return await x({path:t,type:s})};await a({title:"批量".concat(l,"白名单目录"),content:"批量".concat(l,"已选的白名单目录,是否继续操作!"),column:[{label:"路径",prop:"path"},q()],onConfirm:async()=>(await e(i),G(),!1)})}}],D=c({path:"",type:"dir"}),G=async()=>{a({request:j(),success:a=>{Array.isArray(a.data)||(U.value=[...a.data.dir.map(a=>({path:a,type:"dir",typeTitle:"目录"})),...a.data.file.map(a=>({path:a,type:"file",typeTitle:"文件"}))])}})},I=async()=>{try{if(!D.path)return void V.error("请输入白名单目录");await a({request:k({path:D.path}),message:!0,loading:"正在添加白名单目录,请稍后...",success:G}),D.path=""}catch(e){}},K=[C(),{label:"路径",prop:"path",showOverflowTooltip:!0},{label:"类型",prop:"typeTitle"},{label:"操作",align:"right",fixed:"right",render:t=>m("span",{class:"bt-link",onClick:()=>(async t=>{await e({icon:"warning-filled",title:"删除白名单目录",width:"34rem",content:"删除白名单目录【"+t.path+"】,是否继续操作?"}),a({request:x({path:t.path,type:t.type}),message:!0,loading:"正在删除白名单目录,请稍后...",success:G})})(t)},[d("删除")])}];return h(()=>{G()}),(a,e)=>{const r=v,o=_,n=t,p=s,c=i,h=l,j=f("bt-loading");return u(),y("div",A,[m(c,null,{"header-left":b(()=>[m(r,{modelValue:g(D).path,"onUpdate:modelValue":e[0]||(e[0]=a=>g(D).path=a),name:"path",placeholder:"选择目录/文件全路径",icon:"icon-file_mode",onIconClick:e[1]||(e[1]=a=>{T({type:"all",change(a,e){D.path=a,D.type=e,"dir"!==e||a.endsWith("/")||(D.path+="/")}})}),onChangePassive:e[2]||(e[2]=a=>{var e;D[e="path"]=D[e].replace(/\s+/g,"")}),width:"32rem"},null,8,["modelValue"]),m(o,{class:"!ml-[.8rem]",type:"primary",onClick:I},{default:b(()=>[...e[3]||(e[3]=[d(" 添加 ",-1)])]),_:1})]),content:b(()=>[w(m(n,{ref_key:"whiteList",ref:H,column:K,data:g(U),description:"白名单列表为空"},null,8,["data"]),[[j,"正在加载白名单列表,请稍后...","title"]])]),"footer-left":b(()=>[m(p,{"table-ref":g(H),options:B},null,8,["table-ref"])]),_:1}),m(h,{options:W,class:"mx-[1.6rem] my-[0.6rem]"})])}}});export{V as default};
Save File
Cancel