Files
aiops/backend/static/assets/SystemManager-B9Kzdis0.js
T
Logan.Li 025e74ff4d feat(k8s): Deployment 存储挂载改 Kuboard 一卷一卡布局
每张数据卷同屏展示卷定义与容器挂载(容器/只读读写/路径/subPath)。
2026-06-26 15:00:09 +08:00

3 lines
99 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{r as o,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{u as q,D as Z,a as ss,b as es,c as ts,d as as,e as ls,B as x,at as ve,f as Ks,t as V,j as Bs,l as $,k as fe}from"./index-LZWfu62c.js";import{T as De,a as Le,b as Vs,c as Hs}from"./tabs-kmtfM2I-.js";import{B as cs}from"./badge-B0F5ZNtn.js";import{C as xs,a as hs,b as Ss,c as js,d as us}from"./card-B-RtdR4H.js";import{I as f}from"./input-BdDauX3U.js";import{T as As,a as Ps,b as J,c as M,d as Es,e as w}from"./table-BPFYQwjr.js";import{S as Us,a as ws,b as Cs,c as Ms,d as H}from"./select-4xU_9B3_.js";import{U as re,ag as Qs,aE as vs,ah as Gs,v as de,y as Ws,a as qs,N as Js,L as Ns,R as Xs,S as Te,P as Ys,al as Ue,ak as we,x as pe,T as Zs,j as se,aN as ee,as as Ce,Q as Me,V as ie,a3 as ke,aq as Ie,p as xe}from"./vendor-icons-Aso0-eeY.js";import{T as Re}from"./textarea-BdtIagjy.js";import{L as Ts}from"./label-u-lNUbKh.js";import{C as _e}from"./checkbox-DL3onEGv.js";import{S as bs}from"./switch-C4PJnJ9I.js";import"./index-CYARH0Cq.js";function Fe({open:e,onOpenChange:d,editingUser:t,form:a,setForm:m,saving:i,onSubmit:u}){const[T,N]=o.useState([]);return o.useEffect(()=>{if(!e)return;let n=!1;return(async()=>{try{const U=await q.getRoles();if(n)return;const h=U?.list??[];N(h.map(D=>({id:String(D.id??""),name:D.name??D.code??""})))}catch{n||N([])}})(),()=>{n=!0}},[e]),s.jsx(Z,{"code-path":"src/components/system/UserFormDialog.tsx:78:5",open:e,onOpenChange:d,children:s.jsxs(ss,{"code-path":"src/components/system/UserFormDialog.tsx:79:7",className:"bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/UserFormDialog.tsx:80:9",children:[s.jsxs(ts,{"code-path":"src/components/system/UserFormDialog.tsx:81:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(re,{"code-path":"src/components/system/UserFormDialog.tsx:82:13",className:"h-5 w-5 text-blue-400"}),t?"编辑用户":"新建用户"]}),s.jsx(as,{"code-path":"src/components/system/UserFormDialog.tsx:85:11",className:"text-slate-500",children:t?"修改用户信息":"创建新的系统用户"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:90:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:91:11",className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:92:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:93:15",className:"text-xs text-slate-500",children:"用户名"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:94:15",value:a.username,onChange:n=>m({...a,username:n.target.value}),disabled:!!t,className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"登录用户名"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:102:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:103:15",className:"text-xs text-slate-500",children:"昵称"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:104:15",value:a.nickname,onChange:n=>m({...a,nickname:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"显示昵称"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:111:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:112:15",className:"text-xs text-slate-500",children:"邮箱"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:113:15",value:a.email,onChange:n=>m({...a,email:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"user@example.com"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:120:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:121:15",className:"text-xs text-slate-500",children:"手机号"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:122:15",value:a.phone,onChange:n=>m({...a,phone:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"可选"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:129:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:130:15",className:"text-xs text-slate-500",children:"角色"}),s.jsxs(Us,{"code-path":"src/components/system/UserFormDialog.tsx:131:15",value:a.role,onValueChange:n=>m({...a,role:n}),children:[s.jsx(ws,{"code-path":"src/components/system/UserFormDialog.tsx:132:17",className:"bg-slate-800/50 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/UserFormDialog.tsx:133:19",placeholder:"选择角色"})}),s.jsx(Ms,{"code-path":"src/components/system/UserFormDialog.tsx:135:17",className:"bg-slate-800 border-slate-700",children:T.map(n=>s.jsx(H,{"code-path":"src/components/system/UserFormDialog.tsx:137:21",value:n.name,children:n.name},n.id))})]})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:144:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:145:15",className:"text-xs text-slate-500",children:"状态"}),s.jsxs(Us,{"code-path":"src/components/system/UserFormDialog.tsx:146:15",value:String(a.status),onValueChange:n=>m({...a,status:Number(n)}),children:[s.jsx(ws,{"code-path":"src/components/system/UserFormDialog.tsx:150:17",className:"bg-slate-800/50 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/UserFormDialog.tsx:151:19"})}),s.jsxs(Ms,{"code-path":"src/components/system/UserFormDialog.tsx:153:17",className:"bg-slate-800 border-slate-700",children:[s.jsx(H,{"code-path":"src/components/system/UserFormDialog.tsx:154:19",value:"1",children:"正常"}),s.jsx(H,{"code-path":"src/components/system/UserFormDialog.tsx:155:19",value:"0",children:"禁用"})]})]})]})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:160:11",className:"space-y-2",children:[s.jsxs("label",{"code-path":"src/components/system/UserFormDialog.tsx:161:13",className:"text-xs text-slate-500",children:["密码",t?"(留空则不修改)":""]}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:164:13",type:"password",value:a.password,onChange:n=>m({...a,password:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:t?"留空则不修改":"设置初始密码"})]})]}),s.jsxs(ls,{"code-path":"src/components/system/UserFormDialog.tsx:174:9",children:[s.jsx(x,{"code-path":"src/components/system/UserFormDialog.tsx:175:11",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>d(!1),children:"取消"}),s.jsx(x,{"code-path":"src/components/system/UserFormDialog.tsx:178:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:u,disabled:i,children:i?"保存中...":"保存"})]})]})})}function Oe({selectedUser:e,setSelectedUser:d,getUserStatusBadge:t,openEdit:a}){return s.jsx(Z,{"code-path":"src/components/system/UserDetailDialog.tsx:29:5",open:!!e,onOpenChange:()=>d(null),children:s.jsxs(ss,{"code-path":"src/components/system/UserDetailDialog.tsx:30:7",className:"bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/UserDetailDialog.tsx:31:9",children:[s.jsxs(ts,{"code-path":"src/components/system/UserDetailDialog.tsx:32:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(re,{"code-path":"src/components/system/UserDetailDialog.tsx:33:13",className:"h-5 w-5 text-blue-400"}),e?.nickname]}),s.jsxs(as,{"code-path":"src/components/system/UserDetailDialog.tsx:36:11",className:"text-slate-500",children:["@",e?.username," · ",e?.email]})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:41:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:42:11",className:"grid grid-cols-2 gap-4 p-4 rounded-lg bg-slate-800/50",children:[s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:43:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:44:15",className:"text-xs text-slate-500 mb-1",children:"用户名"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:45:15",className:"text-sm text-slate-200",children:e?.username})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:47:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:48:15",className:"text-xs text-slate-500 mb-1",children:"昵称"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:49:15",className:"text-sm text-slate-200",children:e?.nickname})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:51:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:52:15",className:"text-xs text-slate-500 mb-1",children:"邮箱"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:53:15",className:"text-sm text-slate-200",children:e?.email})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:55:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:56:15",className:"text-xs text-slate-500 mb-1",children:"手机号"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:57:15",className:"text-sm text-slate-200",children:e?.phone||"--"})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:59:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:60:15",className:"text-xs text-slate-500 mb-1",children:"状态"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:61:15",className:"text-sm text-slate-200",children:e&&t(e.status)})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:63:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:64:15",className:"text-xs text-slate-500 mb-1",children:"创建时间"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:65:15",className:"text-sm text-slate-200",children:e&&e.createdAt?new Date(e.createdAt).toLocaleDateString():"--"})]})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:71:11",children:[s.jsx("h4",{"code-path":"src/components/system/UserDetailDialog.tsx:72:13",className:"text-sm font-medium text-slate-300 mb-2",children:"角色"}),s.jsx("div",{"code-path":"src/components/system/UserDetailDialog.tsx:73:13",className:"flex flex-wrap gap-2",children:e?.roles.map(m=>s.jsx(cs,{"code-path":"src/components/system/UserDetailDialog.tsx:75:17",variant:"outline",className:"border-slate-700 text-slate-400",children:m},m))})]})]}),s.jsxs(ls,{"code-path":"src/components/system/UserDetailDialog.tsx:83:9",children:[s.jsxs(x,{"code-path":"src/components/system/UserDetailDialog.tsx:84:11",variant:"outline",className:"border-slate-700 text-slate-300",children:[s.jsx(Qs,{"code-path":"src/components/system/UserDetailDialog.tsx:85:13",className:"h-4 w-4 mr-2"}),"重置密码"]}),s.jsxs(x,{"code-path":"src/components/system/UserDetailDialog.tsx:88:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>{e&&(d(null),a(e))},children:[s.jsx(vs,{"code-path":"src/components/system/UserDetailDialog.tsx:97:13",className:"h-4 w-4 mr-2"}),"编辑"]})]})]})})}function Ae({importDialogOpen:e,setImportDialogOpen:d,importPreview:t,setImportPreview:a,importing:m,importResult:i,setImportResult:u,handleCsvUpload:T,handleBatchImport:N}){return s.jsx(Z,{"code-path":"src/components/system/CsvImportDialog.tsx:47:5",open:e==="csv",onOpenChange:n=>!n&&d(null),children:s.jsxs(ss,{"code-path":"src/components/system/CsvImportDialog.tsx:48:7",className:"bg-slate-900 border-slate-800 max-w-2xl",children:[s.jsxs(es,{"code-path":"src/components/system/CsvImportDialog.tsx:49:9",children:[s.jsxs(ts,{"code-path":"src/components/system/CsvImportDialog.tsx:50:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Gs,{"code-path":"src/components/system/CsvImportDialog.tsx:51:13",className:"h-5 w-5 text-blue-400"}),"批量导入用户(CSV)"]}),s.jsx(as,{"code-path":"src/components/system/CsvImportDialog.tsx:54:11",className:"text-slate-500",children:"上传 CSV 文件批量创建用户。请先下载模板,按格式填写后上传。"})]}),i?s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:120:11",className:"space-y-4 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:121:13",className:`flex items-center gap-3 p-4 rounded-lg ${i.code===200?"bg-emerald-500/10":"bg-red-500/10"}`,children:[i.code===200?s.jsx(Ws,{"code-path":"src/components/system/CsvImportDialog.tsx:123:17",className:"h-6 w-6 text-emerald-400 shrink-0"}):s.jsx(qs,{"code-path":"src/components/system/CsvImportDialog.tsx:125:17",className:"h-6 w-6 text-red-400 shrink-0"}),s.jsx("span",{"code-path":"src/components/system/CsvImportDialog.tsx:127:15",className:"text-sm text-slate-200",children:i.message})]}),i.errors?.length>0&&s.jsx("div",{"code-path":"src/components/system/CsvImportDialog.tsx:130:15",className:"max-h-32 overflow-auto rounded-lg bg-slate-800/50 p-3 space-y-1",children:i.errors.map((n,U)=>s.jsx("div",{"code-path":"src/components/system/CsvImportDialog.tsx:132:19",className:"text-xs text-red-400",children:n},U))}),s.jsx(ls,{"code-path":"src/components/system/CsvImportDialog.tsx:136:13",children:s.jsx(x,{"code-path":"src/components/system/CsvImportDialog.tsx:137:15",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>{d(null),a([]),u(null)},children:"完成"})})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:61:13",className:"space-y-3",children:[s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:62:15",className:"flex items-center gap-2",children:[s.jsxs(x,{"code-path":"src/components/system/CsvImportDialog.tsx:63:17",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:()=>q.downloadTemplate(),children:[s.jsx(de,{"code-path":"src/components/system/CsvImportDialog.tsx:64:19",className:"h-4 w-4 mr-1.5"}),"下载模板"]}),s.jsxs("label",{"code-path":"src/components/system/CsvImportDialog.tsx:67:17",className:"inline-flex items-center px-3 py-1.5 rounded-md text-sm bg-slate-800 border border-slate-700 text-slate-200 cursor-pointer hover:bg-slate-700 transition-colors",children:[s.jsx(Gs,{"code-path":"src/components/system/CsvImportDialog.tsx:68:19",className:"h-4 w-4 mr-1.5"}),"选择 CSV 文件",s.jsx("input",{"code-path":"src/components/system/CsvImportDialog.tsx:70:19",type:"file",accept:".csv",className:"hidden",onChange:T})]})]}),t.length>0&&s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:75:17",className:"rounded-lg border border-slate-800 overflow-hidden",children:[s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:76:19",className:"px-3 py-2 bg-slate-800/50 text-xs text-slate-400",children:["预览:",t.length," 条数据"]}),s.jsxs(As,{"code-path":"src/components/system/CsvImportDialog.tsx:79:19",children:[s.jsx(Ps,{"code-path":"src/components/system/CsvImportDialog.tsx:80:21",children:s.jsxs(J,{"code-path":"src/components/system/CsvImportDialog.tsx:81:23",className:"border-slate-800",children:[s.jsx(M,{"code-path":"src/components/system/CsvImportDialog.tsx:82:25",className:"text-slate-400 text-xs",children:"用户名"}),s.jsx(M,{"code-path":"src/components/system/CsvImportDialog.tsx:83:25",className:"text-slate-400 text-xs",children:"昵称"}),s.jsx(M,{"code-path":"src/components/system/CsvImportDialog.tsx:84:25",className:"text-slate-400 text-xs",children:"邮箱"}),s.jsx(M,{"code-path":"src/components/system/CsvImportDialog.tsx:85:25",className:"text-slate-400 text-xs",children:"手机"})]})}),s.jsxs(Es,{"code-path":"src/components/system/CsvImportDialog.tsx:88:21",children:[t.slice(0,5).map((n,U)=>s.jsxs(J,{"code-path":"src/components/system/CsvImportDialog.tsx:90:25",className:"border-slate-800",children:[s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:91:27",className:"text-slate-200 text-xs",children:n.username}),s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:92:27",className:"text-slate-300 text-xs",children:n.nickname}),s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:93:27",className:"text-slate-400 text-xs",children:n.email}),s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:94:27",className:"text-slate-400 text-xs",children:n.phone})]},U)),t.length>5&&s.jsx(J,{"code-path":"src/components/system/CsvImportDialog.tsx:98:25",className:"border-slate-800",children:s.jsxs(w,{"code-path":"src/components/system/CsvImportDialog.tsx:99:27",colSpan:4,className:"text-slate-500 text-xs text-center",children:["还有 ",t.length-5," 条..."]})})]})]})]})]}),s.jsxs(ls,{"code-path":"src/components/system/CsvImportDialog.tsx:110:13",children:[s.jsx(x,{"code-path":"src/components/system/CsvImportDialog.tsx:111:15",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>{d(null),a([])},children:"取消"}),s.jsx(x,{"code-path":"src/components/system/CsvImportDialog.tsx:114:15",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:N,disabled:m||t.length===0,children:m?"导入中...":`确认导入 (${t.length})`})]})]})]})})}function Pe({importDialogOpen:e,setImportDialogOpen:d,ldapUsers:t,setLdapUsers:a,ldapSelected:m,setLdapSelected:i,ldapLoading:u,ldapImportOUs:T,ldapImportOUDN:N,setLdapImportOUDN:n,loadLdapUsers:U,handleLdapImport:h,importing:D,importResult:b,setImportResult:S}){return s.jsx(Z,{"code-path":"src/components/system/LdapImportDialog.tsx:58:5",open:e==="ldap",onOpenChange:y=>!y&&d(null),children:s.jsxs(ss,{"code-path":"src/components/system/LdapImportDialog.tsx:59:7",className:"bg-slate-900 border-slate-800 max-w-2xl",children:[s.jsxs(es,{"code-path":"src/components/system/LdapImportDialog.tsx:60:9",children:[s.jsxs(ts,{"code-path":"src/components/system/LdapImportDialog.tsx:61:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Js,{"code-path":"src/components/system/LdapImportDialog.tsx:62:13",className:"h-5 w-5 text-cyan-400"}),"从 LDAP 导入用户"]}),s.jsx(as,{"code-path":"src/components/system/LdapImportDialog.tsx:65:11",className:"text-slate-500",children:"从 LDAP 服务器检索用户列表,选择需要导入的用户"})]}),b?s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:163:11",className:"space-y-4 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:164:13",className:`flex items-center gap-3 p-4 rounded-lg ${b.code===200?"bg-emerald-500/10":"bg-red-500/10"}`,children:[b.code===200?s.jsx(Ws,{"code-path":"src/components/system/LdapImportDialog.tsx:166:17",className:"h-6 w-6 text-emerald-400 shrink-0"}):s.jsx(qs,{"code-path":"src/components/system/LdapImportDialog.tsx:168:17",className:"h-6 w-6 text-red-400 shrink-0"}),s.jsx("span",{"code-path":"src/components/system/LdapImportDialog.tsx:170:15",className:"text-sm text-slate-200",children:b.message})]}),s.jsx(ls,{"code-path":"src/components/system/LdapImportDialog.tsx:172:13",children:s.jsx(x,{"code-path":"src/components/system/LdapImportDialog.tsx:173:15",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>{d(null),a([]),S(null)},children:"完成"})})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:72:13",className:"space-y-3",children:[s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:73:15",className:"flex items-center gap-3",children:[s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:74:17",className:"flex items-center gap-2",children:[s.jsx("span",{"code-path":"src/components/system/LdapImportDialog.tsx:75:19",className:"text-xs text-slate-500 whitespace-nowrap",children:"选择 OU"}),s.jsxs("select",{"code-path":"src/components/system/LdapImportDialog.tsx:76:19",className:"bg-slate-800 border border-slate-700 text-slate-200 text-xs rounded-md px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-blue-500",value:N,onChange:y=>{n(y.target.value),U(y.target.value)},children:[s.jsx("option",{"code-path":"src/components/system/LdapImportDialog.tsx:84:21",value:"",children:"根 (全部)"}),T.map(y=>s.jsx("option",{"code-path":"src/components/system/LdapImportDialog.tsx:86:23",value:y.dn,children:y.name},y.dn))]})]}),s.jsxs(x,{"code-path":"src/components/system/LdapImportDialog.tsx:90:17",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300 ml-auto",onClick:()=>U(N),disabled:u,children:[u?s.jsx(Ns,{"code-path":"src/components/system/LdapImportDialog.tsx:91:34",className:"h-4 w-4 mr-1.5 animate-spin"}):s.jsx(Xs,{"code-path":"src/components/system/LdapImportDialog.tsx:91:88",className:"h-4 w-4 mr-1.5"}),"刷新"]})]}),s.jsx("p",{"code-path":"src/components/system/LdapImportDialog.tsx:96:15",className:"text-xs text-slate-500",children:t.length>0?`找到 ${t.length} 个用户`:"选择 OU 或点击刷新获取用户列表"}),t.length>0&&s.jsx("div",{"code-path":"src/components/system/LdapImportDialog.tsx:101:17",className:"max-h-80 overflow-auto rounded-lg border border-slate-800",children:s.jsxs(As,{"code-path":"src/components/system/LdapImportDialog.tsx:102:19",children:[s.jsx(Ps,{"code-path":"src/components/system/LdapImportDialog.tsx:103:21",children:s.jsxs(J,{"code-path":"src/components/system/LdapImportDialog.tsx:104:23",className:"border-slate-800 sticky top-0 bg-slate-900",children:[s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:105:25",className:"w-10 text-slate-400 text-xs",children:s.jsx("input",{"code-path":"src/components/system/LdapImportDialog.tsx:106:27",type:"checkbox",className:"accent-blue-600",checked:m.size===t.length&&t.length>0,onChange:y=>{y.target.checked?i(new Set(t.map(R=>R.dn))):i(new Set)}})}),s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:119:25",className:"text-slate-400 text-xs",children:"用户名"}),s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:120:25",className:"text-slate-400 text-xs",children:"显示名"}),s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:121:25",className:"text-slate-400 text-xs",children:"邮箱"}),s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:122:25",className:"text-slate-400 text-xs",children:"DN"})]})}),s.jsx(Es,{"code-path":"src/components/system/LdapImportDialog.tsx:125:21",children:t.map(y=>s.jsxs(J,{"code-path":"src/components/system/LdapImportDialog.tsx:127:25",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:128:27",children:s.jsx("input",{"code-path":"src/components/system/LdapImportDialog.tsx:129:29",type:"checkbox",className:"accent-blue-600",checked:m.has(y.dn),onChange:R=>{const C=new Set(m);R.target.checked?C.add(y.dn):C.delete(y.dn),i(C)}})}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:141:27",className:"text-slate-200 text-xs",children:y.uid}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:142:27",className:"text-slate-300 text-xs",children:y.cn}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:143:27",className:"text-slate-400 text-xs",children:y.mail}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:144:27",className:"text-slate-500 text-xs font-mono truncate max-w-[200px]",children:y.dn})]},y.dn))})]})})]}),s.jsxs(ls,{"code-path":"src/components/system/LdapImportDialog.tsx:153:13",children:[s.jsx(x,{"code-path":"src/components/system/LdapImportDialog.tsx:154:15",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>{d(null),a([])},children:"取消"}),s.jsx(x,{"code-path":"src/components/system/LdapImportDialog.tsx:157:15",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:h,disabled:D||m.size===0,children:D?"导入中...":`导入选中 (${m.size})`})]})]})]})})}function Ee({searchQuery:e,setSearchQuery:d,filteredUsers:t,loading:a,selectedUser:m,setSelectedUser:i,getUserStatusBadge:u,dialogOpen:T,setDialogOpen:N,editingUser:n,form:U,setForm:h,saving:D,handleSubmit:b,openCreate:S,openEdit:y,handleDelete:R,importDialogOpen:C,setImportDialogOpen:P,importPreview:F,setImportPreview:B,importing:k,importResult:A,setImportResult:p,handleCsvUpload:O,handleBatchImport:j,ldapUsers:_,ldapSelected:G,setLdapSelected:E,ldapLoading:X,ldapImportOUs:L,ldapImportOUDN:rs,setLdapImportOUDN:ns,loadLdapUsers:ds,handleLdapImport:ps,setLdapUsers:K}){const{hasPermission:Q}=ve();return s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:116:7",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:117:9",className:"relative w-64",children:[s.jsx(Te,{"code-path":"src/components/system/SystemUserTab.tsx:118:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),s.jsx(f,{"code-path":"src/components/system/SystemUserTab.tsx:119:11",placeholder:"搜索用户...",value:e,onChange:v=>d(v.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:126:9",className:"flex items-center gap-2",children:[Q("system:user")&&s.jsxs(x,{"code-path":"src/components/system/SystemUserTab.tsx:128:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>P("csv"),children:[s.jsx(Gs,{"code-path":"src/components/system/SystemUserTab.tsx:129:13",className:"h-4 w-4 mr-2"}),"批量导入"]}),Q("system:user")&&s.jsxs(x,{"code-path":"src/components/system/SystemUserTab.tsx:134:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>P("ldap"),children:[s.jsx(Js,{"code-path":"src/components/system/SystemUserTab.tsx:135:13",className:"h-4 w-4 mr-2"}),"LDAP 导入"]}),Q("system:user")&&s.jsxs(x,{"code-path":"src/components/system/SystemUserTab.tsx:140:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:S,children:[s.jsx(Ys,{"code-path":"src/components/system/SystemUserTab.tsx:141:13",className:"h-4 w-4 mr-2"}),"新建用户"]})]})]}),s.jsx(xs,{"code-path":"src/components/system/SystemUserTab.tsx:149:7",className:"bg-slate-900 border-slate-800",children:s.jsx(hs,{"code-path":"src/components/system/SystemUserTab.tsx:150:9",className:"p-0",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:151:11",className:"border-t border-slate-800",children:s.jsxs(As,{"code-path":"src/components/system/SystemUserTab.tsx:152:13",children:[s.jsx(Ps,{"code-path":"src/components/system/SystemUserTab.tsx:153:15",children:s.jsxs(J,{"code-path":"src/components/system/SystemUserTab.tsx:154:17",className:"border-slate-800 hover:bg-transparent",children:[s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:155:19",className:"text-slate-400",children:"用户信息"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:156:19",className:"text-slate-400",children:"联系方式"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:157:19",className:"text-slate-400",children:"角色"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:158:19",className:"text-slate-400",children:"来源"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:159:19",className:"text-slate-400",children:"状态"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:160:19",className:"text-slate-400",children:"最后登录"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:161:19",className:"text-slate-400 text-right",children:"操作"})]})}),s.jsx(Es,{"code-path":"src/components/system/SystemUserTab.tsx:164:15",children:a?s.jsx(J,{"code-path":"src/components/system/SystemUserTab.tsx:166:19",className:"border-slate-800",children:s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:167:21",colSpan:7,className:"text-center py-12",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:168:23",className:"flex items-center justify-center",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:169:25",className:"h-6 w-6 border-2 border-slate-700 border-t-blue-500 rounded-full animate-spin"})})})}):t.length===0?s.jsx(J,{"code-path":"src/components/system/SystemUserTab.tsx:174:19",className:"border-slate-800",children:s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:175:21",colSpan:7,className:"text-center py-12 text-sm text-slate-500",children:"暂无用户数据"})}):t.map(v=>s.jsxs(J,{"code-path":"src/components/system/SystemUserTab.tsx:181:21",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:182:23",children:s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:183:25",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:184:27",className:"w-8 h-8 rounded-full bg-blue-600 flex items-center justify-center text-white text-sm font-medium",children:(v.nickname||v.username||"?").charAt(0)}),s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:187:27",children:[s.jsx("p",{"code-path":"src/components/system/SystemUserTab.tsx:188:29",className:"text-sm font-medium text-slate-200",children:v.nickname||v.username}),s.jsxs("p",{"code-path":"src/components/system/SystemUserTab.tsx:189:29",className:"text-xs text-slate-500",children:["@",v.username]})]})]})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:193:23",children:s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:194:25",className:"space-y-1",children:[s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:195:27",className:"flex items-center gap-1 text-sm text-slate-400",children:[s.jsx(Ue,{"code-path":"src/components/system/SystemUserTab.tsx:196:29",className:"h-3.5 w-3.5"}),v.email||"--"]}),v.phone&&s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:200:29",className:"flex items-center gap-1 text-sm text-slate-400",children:[s.jsx(we,{"code-path":"src/components/system/SystemUserTab.tsx:201:31",className:"h-3.5 w-3.5"}),v.phone]})]})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:207:23",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:208:25",className:"flex flex-wrap gap-1",children:(v.roles||[]).map(Y=>s.jsx(cs,{"code-path":"src/components/system/SystemUserTab.tsx:210:29",variant:"outline",className:"border-slate-700 text-slate-400",children:Y},Y))})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:216:23",children:v.authSource==="ldap"?s.jsx(cs,{"code-path":"src/components/system/SystemUserTab.tsx:218:27",variant:"outline",className:"border-cyan-500/30 text-cyan-400 bg-cyan-500/10",children:"LDAP"}):s.jsx(cs,{"code-path":"src/components/system/SystemUserTab.tsx:222:27",variant:"outline",className:"border-slate-600/30 text-slate-400 bg-slate-600/10",children:"本地"})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:227:23",children:u(v.status)}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:228:23",children:s.jsx("span",{"code-path":"src/components/system/SystemUserTab.tsx:229:25",className:"text-sm text-slate-400",children:v.lastLoginAt?new Date(v.lastLoginAt).toLocaleString():"--"})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:233:23",className:"text-right",children:s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:234:25",className:"flex items-center justify-end gap-1",children:[s.jsx(x,{"code-path":"src/components/system/SystemUserTab.tsx:235:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-100",onClick:()=>i(v),children:s.jsx(pe,{"code-path":"src/components/system/SystemUserTab.tsx:241:29",className:"h-4 w-4"})}),Q("system:user")&&s.jsx(x,{"code-path":"src/components/system/SystemUserTab.tsx:244:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-100",onClick:()=>y(v),children:s.jsx(vs,{"code-path":"src/components/system/SystemUserTab.tsx:250:29",className:"h-4 w-4"})}),Q("system:user")&&s.jsx(x,{"code-path":"src/components/system/SystemUserTab.tsx:254:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-400",onClick:()=>R(v),children:s.jsx(Zs,{"code-path":"src/components/system/SystemUserTab.tsx:260:29",className:"h-4 w-4"})})]})})]},v.id))})]})})})}),s.jsx(Oe,{"code-path":"src/components/system/SystemUserTab.tsx:275:7",selectedUser:m,setSelectedUser:i,getUserStatusBadge:u,openEdit:y}),s.jsx(Fe,{"code-path":"src/components/system/SystemUserTab.tsx:282:7",open:T,onOpenChange:N,editingUser:n,form:U,setForm:h,saving:D,onSubmit:b}),s.jsx(Ae,{"code-path":"src/components/system/SystemUserTab.tsx:292:7",importDialogOpen:C,setImportDialogOpen:P,importPreview:F,setImportPreview:B,importing:k,importResult:A,setImportResult:p,handleCsvUpload:O,handleBatchImport:j}),s.jsx(Pe,{"code-path":"src/components/system/SystemUserTab.tsx:304:7",importDialogOpen:C,setImportDialogOpen:P,ldapUsers:_,setLdapUsers:K,ldapSelected:G,setLdapSelected:E,ldapLoading:X,ldapImportOUs:L,ldapImportOUDN:rs,setLdapImportOUDN:ns,loadLdapUsers:ds,handleLdapImport:ps,importing:k,importResult:A,setImportResult:p})]})}const ze=[{key:"dashboard",label:"📊 仪表盘",prefixes:["dashboard:"]},{key:"server",label:"🖥️ 资产管理",prefixes:["server:"]},{key:"cloud",label:"☁️ 云资源",prefixes:["cloud:"]},{key:"k8s",label:"☸️ Kubernetes",prefixes:["k8s:"]},{key:"deploy",label:"🚀 应用发布",prefixes:["deploy:"]},{key:"monitor",label:"📡 监控告警",prefixes:["monitor:","agent:"]},{key:"auto",label:"⚙️ 自动化运维",prefixes:["auto:"]},{key:"aiops",label:"🤖 AIOps智能",prefixes:["aiops:"]},{key:"approval",label:"✅ 资源申请",prefixes:["approval:"]},{key:"audit",label:"🔍 安全审计",prefixes:["audit:"]},{key:"system",label:"🔧 系统管理",prefixes:["system:"]}];function $e(e){const d=ze.map(m=>({key:m.key,label:m.label,items:e.filter(i=>m.prefixes.some(u=>i.code.startsWith(u)))})).filter(m=>m.items.length>0),t=new Set(d.flatMap(m=>m.items.map(i=>i.id))),a=e.filter(m=>!t.has(m.id));return a.length>0&&d.push({key:"other",label:"📌 其他",items:a}),d}function Be({open:e,onOpenChange:d,editingRole:t,form:a,setForm:m,saving:i,onSubmit:u,permissions:T}){const N=(h,D)=>{m(b=>{const S=new Set(b.permission_ids);return D?S.add(h):S.delete(h),{...b,permission_ids:Array.from(S)}})},n=(h,D)=>{m(b=>{const S=new Set(b.permission_ids);return h.forEach(y=>D?S.add(y.id):S.delete(y.id)),{...b,permission_ids:Array.from(S)}})},U=$e(T);return s.jsx(Z,{"code-path":"src/components/system/RoleFormDialog.tsx:91:5",open:e,onOpenChange:d,children:s.jsxs(ss,{"code-path":"src/components/system/RoleFormDialog.tsx:92:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(es,{"code-path":"src/components/system/RoleFormDialog.tsx:93:9",children:[s.jsxs(ts,{"code-path":"src/components/system/RoleFormDialog.tsx:94:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[s.jsx(se,{"code-path":"src/components/system/RoleFormDialog.tsx:95:13",className:"h-5 w-5 text-purple-400"}),t?"编辑角色":"新建角色"]}),s.jsx(as,{"code-path":"src/components/system/RoleFormDialog.tsx:98:11",className:"text-[var(--dg-text-secondary)]",children:t?"修改角色信息与权限":"创建新的系统角色并分配权限"})]}),s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:103:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:104:11",className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:105:13",className:"space-y-2",children:[s.jsx(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:106:15",className:"text-xs text-[var(--dg-text-secondary)]",children:"角色名称"}),s.jsx(f,{"code-path":"src/components/system/RoleFormDialog.tsx:107:15",value:a.name,onChange:h=>m({...a,name:h.target.value}),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]",placeholder:"如:运维工程师"})]}),s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:114:13",className:"space-y-2",children:[s.jsx(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:115:15",className:"text-xs text-[var(--dg-text-secondary)]",children:"角色编码"}),s.jsx(f,{"code-path":"src/components/system/RoleFormDialog.tsx:116:15",value:a.code,onChange:h=>m({...a,code:h.target.value}),disabled:!!t,className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] disabled:opacity-60",placeholder:"如:ops_engineer"})]})]}),s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:125:11",className:"space-y-2",children:[s.jsx(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:126:13",className:"text-xs text-[var(--dg-text-secondary)]",children:"描述"}),s.jsx(Re,{"code-path":"src/components/system/RoleFormDialog.tsx:127:13",value:a.description,onChange:h=>m({...a,description:h.target.value}),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] resize-none",placeholder:"角色职责描述(可选)",rows:2})]}),s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:137:11",className:"space-y-2",children:[s.jsxs(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:138:13",className:"text-xs text-[var(--dg-text-secondary)]",children:["权限分配",a.permission_ids.length>0&&s.jsxs("span",{"code-path":"src/components/system/RoleFormDialog.tsx:141:17",className:"ml-2 text-purple-400",children:["已选 ",a.permission_ids.length," 项"]})]}),s.jsx("div",{"code-path":"src/components/system/RoleFormDialog.tsx:144:13",className:"max-h-[40vh] overflow-y-auto rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-tertiary)] p-3 space-y-3",children:U.length===0?s.jsx("p",{"code-path":"src/components/system/RoleFormDialog.tsx:146:17",className:"text-xs text-[var(--dg-text-muted)] text-center py-4",children:"暂无可分配权限"}):U.map(h=>{const D=h.items.filter(S=>a.permission_ids.includes(S.id)).length,b=D===h.items.length&&h.items.length>0;return s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:152:21",children:[s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:153:23",className:"flex items-center justify-between mb-1.5",children:[s.jsxs("button",{"code-path":"src/components/system/RoleFormDialog.tsx:154:25",onClick:()=>n(h.items,!b),className:"text-xs font-medium text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] transition-colors flex items-center gap-1",children:[h.label,s.jsxs("span",{"code-path":"src/components/system/RoleFormDialog.tsx:159:27",className:"text-[var(--dg-text-muted)] text-[10px]",children:["(",D,"/",h.items.length,")"]})]}),s.jsx("button",{"code-path":"src/components/system/RoleFormDialog.tsx:163:25",onClick:()=>n(h.items,!b),className:"text-[10px] text-blue-400 hover:text-blue-300 transition-colors",children:b?"取消全选":"全选"})]}),s.jsx("div",{"code-path":"src/components/system/RoleFormDialog.tsx:170:23",className:"grid grid-cols-2 gap-x-3 gap-y-1 pl-1",children:h.items.map(S=>s.jsxs(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:172:27",className:"flex items-center gap-2 text-xs text-[var(--dg-text-secondary)] font-normal cursor-pointer hover:text-[var(--dg-text-primary)] py-0.5",children:[s.jsx(_e,{"code-path":"src/components/system/RoleFormDialog.tsx:176:29",checked:a.permission_ids.includes(S.id),onCheckedChange:y=>N(S.id,y===!0),className:"border-[var(--dg-border)] data-[state=checked]:bg-blue-600 data-[state=checked]:border-blue-600 h-3.5 w-3.5"}),s.jsx("span",{"code-path":"src/components/system/RoleFormDialog.tsx:181:29",className:"truncate",children:S.name})]},S.id))})]},h.key)})})]})]}),s.jsxs(ls,{"code-path":"src/components/system/RoleFormDialog.tsx:193:9",children:[s.jsx(x,{"code-path":"src/components/system/RoleFormDialog.tsx:194:11",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",onClick:()=>d(!1),children:"取消"}),s.jsx(x,{"code-path":"src/components/system/RoleFormDialog.tsx:197:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:u,disabled:i,children:i?"保存中...":"保存"})]})]})})}const Ve={super_admin:"👑",k8s_admin:"☸️",resource_admin:"🖥️",monitor_admin:"📡",security_auditor:"🔍",release_admin:"🚀",viewer:"👁️"},He=[{label:"仪表盘",prefixes:["dashboard:"]},{label:"资产管理",prefixes:["server:"]},{label:"云资源",prefixes:["cloud:"]},{label:"K8s",prefixes:["k8s:"]},{label:"发布",prefixes:["deploy:"]},{label:"监控",prefixes:["monitor:","agent:"]},{label:"自动化",prefixes:["auto:"]},{label:"AI",prefixes:["aiops:"]},{label:"审批",prefixes:["approval:"]},{label:"审计",prefixes:["audit:"]},{label:"系统",prefixes:["system:"]}];function Ge(e,d){return He.map(a=>{const m=e.filter((i,u)=>a.prefixes.some(T=>(d[u]||"").startsWith(T)));return{label:a.label,count:m.length}}).filter(a=>a.count>0)}function Ke(e){const d=Array.isArray(e.permissions)?e.permissions:[];return{id:String(e.id??""),name:e.name??"",code:e.code??"",description:e.description??"",permissions:d.map(t=>typeof t=="string"?t:t?.name??t?.code??"").filter(Boolean),permissionCodes:d.map(t=>typeof t=="string"?t:t?.code??"").filter(Boolean),createdAt:e.createdAt??e.created_at??"",isSystem:e.is_system??e.isSystem??!1,_permissionIds:d.map(t=>typeof t=="object"?Number(t.id):0).filter(Boolean),_raw:e}}const me={name:"",code:"",description:"",permission_ids:[]};function Qe({selectedRole:e,setSelectedRole:d}){const t=Ks(),[a,m]=o.useState([]),[i,u]=o.useState(!0),[T,N]=o.useState([]),[n,U]=o.useState(!1),[h,D]=o.useState(null),[b,S]=o.useState({...me}),[y,R]=o.useState(!1),C=o.useCallback(async()=>{u(!0);try{const O=(await q.getRoles())?.list??[];m(O.map(Ke))}catch{m([])}finally{u(!1)}},[]),P=o.useCallback(async()=>{try{const O=(await q.getPermissions())?.list??[];N(O.map(j=>({id:Number(j.id),name:j.name??j.code??"",code:j.code??"",type:j.type})))}catch{N([])}},[]);o.useEffect(()=>{C(),P()},[C,P]);const F=()=>{D(null),S({...me}),U(!0)},B=p=>{D(p._raw||p),S({name:p.name??"",code:p.code??"",description:p.description??"",permission_ids:Array.isArray(p._permissionIds)?[...p._permissionIds]:[]}),U(!0)},k=async()=>{if(!b.name.trim()){V.error("请输入角色名称");return}if(!b.code.trim()){V.error("请输入角色编码");return}R(!0);try{const p={name:b.name.trim(),code:b.code.trim(),description:b.description.trim(),permission_ids:b.permission_ids};h?(await q.updateRole(h.id,p),V.success("角色更新成功")):(await q.createRole(p),V.success("角色创建成功")),U(!1),await C()}catch(p){V.error(p?.message||"保存失败")}finally{R(!1)}},A=async p=>{if(p.isSystem){V.error("系统默认角色不可删除");return}if(await t({title:"删除角色",description:`确认删除角色「${p.name}」吗?该操作不可恢复。`,confirmText:"删除",variant:"destructive"}))try{await q.deleteRole(p.id),V.success("角色已删除"),await C()}catch(j){const _=j?.response?.data?.message||j?.message||"删除失败";V.error(_)}};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:187:7",className:"flex items-center justify-end gap-2",children:[s.jsxs("span",{"code-path":"src/components/system/SystemRolesTab.tsx:188:9",className:"text-xs text-[var(--dg-text-muted)]",children:[a.length," 个角色"]}),s.jsxs(x,{"code-path":"src/components/system/SystemRolesTab.tsx:189:9",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:F,children:[s.jsx(Ys,{"code-path":"src/components/system/SystemRolesTab.tsx:190:11",className:"h-4 w-4 mr-2"}),"新建角色"]})]}),i?s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:195:9",className:"flex items-center justify-center py-16",children:s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:196:11",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):a.length===0?s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:199:9",className:"flex flex-col items-center justify-center py-16 text-[var(--dg-text-muted)]",children:[s.jsx(se,{"code-path":"src/components/system/SystemRolesTab.tsx:200:11",className:"h-10 w-10 mb-3 opacity-40"}),s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:201:11",className:"text-sm",children:"暂无角色数据"})]}):s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:204:9",className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:a.map(p=>{const O=p.permissions,j=p.permissionCodes,_=Ge(O,j),G=Ve[p.code]||"🛡️";return s.jsxs(xs,{"code-path":"src/components/system/SystemRolesTab.tsx:211:15",className:`bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] ${p.isSystem?"border-purple-500/20":""}`,children:[s.jsx(Ss,{"code-path":"src/components/system/SystemRolesTab.tsx:212:17",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:213:19",className:"flex items-start justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:214:21",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:215:23",className:`w-10 h-10 rounded-lg flex items-center justify-center text-lg ${p.isSystem?"bg-purple-500/10":"bg-[var(--dg-bg-tertiary)]"}`,children:G}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:220:23",children:[s.jsxs(js,{"code-path":"src/components/system/SystemRolesTab.tsx:221:25",className:"text-base text-[var(--dg-text-primary)] flex items-center gap-1.5",children:[p.name,p.isSystem&&s.jsxs(cs,{"code-path":"src/components/system/SystemRolesTab.tsx:224:29",className:"bg-purple-500/15 text-purple-400 border-purple-500/30 text-[10px] px-1 py-0",children:[s.jsx(ee,{"code-path":"src/components/system/SystemRolesTab.tsx:225:31",className:"h-2.5 w-2.5 mr-0.5"}),"系统"]})]}),s.jsx(us,{"code-path":"src/components/system/SystemRolesTab.tsx:229:25",className:"text-[var(--dg-text-muted)] text-xs",children:p.code})]})]}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:232:21",className:"flex items-center gap-1",children:[s.jsx(x,{"code-path":"src/components/system/SystemRolesTab.tsx:233:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",onClick:()=>d(p),children:s.jsx(pe,{"code-path":"src/components/system/SystemRolesTab.tsx:238:25",className:"h-4 w-4"})}),s.jsx(x,{"code-path":"src/components/system/SystemRolesTab.tsx:240:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-muted)] hover:text-blue-400",onClick:()=>B(p),children:s.jsx(vs,{"code-path":"src/components/system/SystemRolesTab.tsx:245:25",className:"h-4 w-4"})}),s.jsx(x,{"code-path":"src/components/system/SystemRolesTab.tsx:247:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-muted)] hover:text-red-400",onClick:()=>A(p),disabled:p.isSystem,title:p.isSystem?"系统默认角色不可删除":"删除角色",children:s.jsx(Zs,{"code-path":"src/components/system/SystemRolesTab.tsx:254:25",className:`h-4 w-4 ${p.isSystem?"opacity-30":""}`})})]})]})}),s.jsxs(hs,{"code-path":"src/components/system/SystemRolesTab.tsx:259:17",children:[s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:260:19",className:"text-sm text-[var(--dg-text-secondary)] mb-3",children:p.description||"暂无描述"}),s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:262:19",className:"flex flex-wrap gap-1.5",children:_.map(E=>s.jsxs(cs,{"code-path":"src/components/system/SystemRolesTab.tsx:264:23",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-muted)] text-[10px]",children:[E.label,"·",E.count]},E.label))}),O.length===0&&s.jsx("span",{"code-path":"src/components/system/SystemRolesTab.tsx:270:21",className:"text-xs text-[var(--dg-text-muted)]",children:"未分配权限"})]})]},p.id)})}),s.jsx(We,{"code-path":"src/components/system/SystemRolesTab.tsx:280:7",role:e,onClose:()=>d(null),onEdit:p=>{d(null),B(p)}}),s.jsx(Be,{"code-path":"src/components/system/SystemRolesTab.tsx:283:7",open:n,onOpenChange:U,editingRole:h,form:b,setForm:S,saving:y,onSubmit:k,permissions:T})]})}function We({role:e,onClose:d,onEdit:t}){const m=e?.isSystem??!1;return s.jsx(Z,{"code-path":"src/components/system/SystemRolesTab.tsx:299:5",open:!!e,onOpenChange:i=>!i&&d(),children:s.jsxs(ss,{"code-path":"src/components/system/SystemRolesTab.tsx:300:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[s.jsxs(es,{"code-path":"src/components/system/SystemRolesTab.tsx:301:9",children:[s.jsxs(ts,{"code-path":"src/components/system/SystemRolesTab.tsx:302:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[s.jsx(Ce,{"code-path":"src/components/system/SystemRolesTab.tsx:303:13",className:"h-5 w-5 text-purple-400"}),e?.name,m&&s.jsxs(cs,{"code-path":"src/components/system/SystemRolesTab.tsx:306:15",className:"bg-purple-500/15 text-purple-400 border-purple-500/30 text-[10px]",children:[s.jsx(ee,{"code-path":"src/components/system/SystemRolesTab.tsx:307:17",className:"h-2.5 w-2.5 mr-0.5"}),"系统"]})]}),s.jsxs(as,{"code-path":"src/components/system/SystemRolesTab.tsx:311:11",className:"text-[var(--dg-text-muted)]",children:["编码:",e?.code]})]}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:313:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:314:11",className:"rounded-lg bg-[var(--dg-bg-tertiary)] p-4",children:[s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:315:13",className:"text-xs text-[var(--dg-text-muted)] mb-1",children:"描述"}),s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:316:13",className:"text-sm text-[var(--dg-text-primary)]",children:e?.description||"暂无描述"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:318:11",children:[s.jsxs("h4",{"code-path":"src/components/system/SystemRolesTab.tsx:319:13",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-2",children:["权限列表 (",e?.permissions?.length||0," 项)"]}),e&&e.permissions.length>0?s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:323:15",className:"flex flex-wrap gap-2 max-h-60 overflow-y-auto",children:e.permissions.map((i,u)=>s.jsx(cs,{"code-path":"src/components/system/SystemRolesTab.tsx:325:19",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:i},u))}):s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:331:15",className:"text-xs text-[var(--dg-text-muted)]",children:"未分配权限"})]})]}),s.jsx(ls,{"code-path":"src/components/system/SystemRolesTab.tsx:335:9",children:s.jsxs(x,{"code-path":"src/components/system/SystemRolesTab.tsx:336:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>e&&t(e),children:[s.jsx(vs,{"code-path":"src/components/system/SystemRolesTab.tsx:337:13",className:"h-4 w-4 mr-2"}),"编辑"]})})]})})}function qe(e){const{ldapConfig:d,ldapMgmtOpen:t,setLdapMgmtOpen:a,ldapOUs:m,selectedOUDN:i,setSelectedOUDN:u,ldapUsers:T,selectedLDAPUsers:N,setSelectedLDAPUsers:n,loadLdapOUs:U,loadLdapOUUsers:h,handleLdapImport:D,importing:b,importFeedback:S,importResultOpen:y,setImportResultOpen:R,createOUOpen:C,setCreateOUOpen:P,ouForm:F,setOuForm:B,handleCreateOU:k,ldapSaving:A,createUserOpen:p,setCreateUserOpen:O,newUser:j,setNewUser:_,handleCreateLDAPUser:G,ldapUserTestOpen:E,setLdapUserTestOpen:X,ldapTestUser:L,setLdapTestUser:rs,ldapTestPass:ns,setLdapTestPass:ds,ldapUserTesting:ps,ldapUserTestResult:K,handleLdapUserTest:Q,editLdapUser:v,setEditLdapUser:Y,editLdapForm:r,setEditLdapForm:z,handleUpdateLdapUser:os,handleDeleteLDAPEntry:fs,openEditLdapUser:ks}=e;return s.jsxs(s.Fragment,{children:[s.jsxs("button",{"code-path":"src/components/system/LdapManagementSection.tsx:140:7",onClick:()=>{const c=!t;a(c),c&&m.length===0&&U()},className:"w-full flex items-center gap-2 px-4 py-2.5 bg-slate-900/50 hover:bg-slate-800/50 text-slate-400 text-sm transition-colors",children:[s.jsx(Me,{"code-path":"src/components/system/LdapManagementSection.tsx:148:9",className:`h-4 w-4 transition-transform ${t?"":"-rotate-90"}`}),s.jsx(ie,{"code-path":"src/components/system/LdapManagementSection.tsx:149:9",className:"h-4 w-4 text-amber-400"}),s.jsx("span",{"code-path":"src/components/system/LdapManagementSection.tsx:150:9",className:"text-slate-300",children:"LDAP 账号管理"})]}),t&&s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:154:9",className:"bg-slate-900/30 border-t border-slate-800/50 px-4 py-4 space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:155:11",className:"flex items-center gap-3 flex-wrap",children:[s.jsxs(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:157:13",open:E,onOpenChange:X,children:[s.jsx(Bs,{"code-path":"src/components/system/LdapManagementSection.tsx:158:15",asChild:!0,children:s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:159:17",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-200",children:[s.jsx(Qs,{"code-path":"src/components/system/LdapManagementSection.tsx:160:19",className:"h-3.5 w-3.5 mr-1"}),"账号验证"]})}),s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:164:15",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:165:17",children:[s.jsx(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:166:19",className:"text-slate-100",children:"LDAP 账号验证测试"}),s.jsx(as,{"code-path":"src/components/system/LdapManagementSection.tsx:167:19",className:"text-slate-500",children:"输入 LDAP 用户凭据进行认证测试"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:169:17",className:"space-y-3 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:170:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:171:21",className:"text-xs text-slate-500 mb-1 block",children:"用户名"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:172:21",value:L,onChange:c=>rs(c.target.value),placeholder:"zhangsan",className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:179:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:180:21",className:"text-xs text-slate-500 mb-1 block",children:"密码"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:181:21",type:"password",value:ns,onChange:c=>ds(c.target.value),onKeyDown:c=>c.key==="Enter"&&Q(),placeholder:"••••••",className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600"})]}),K&&s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:191:21",className:`p-3 rounded-lg text-sm ${K.success?"bg-emerald-500/10 text-emerald-300":"bg-red-500/10 text-red-300"}`,children:[K.message,K.user_info&&s.jsx("pre",{"code-path":"src/components/system/LdapManagementSection.tsx:194:25",className:"mt-2 text-xs whitespace-pre-wrap",children:JSON.stringify(K.user_info,null,2)})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:198:19",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:Q,disabled:ps||!L,children:[ps?s.jsx(Ns,{"code-path":"src/components/system/LdapManagementSection.tsx:203:40",className:"h-4 w-4 mr-1.5 animate-spin"}):null,"验证"]})]})]})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:210:13",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-200",onClick:U,children:[s.jsx(Xs,{"code-path":"src/components/system/LdapManagementSection.tsx:211:15",className:"h-3.5 w-3.5 mr-1"}),"刷新"]}),s.jsxs(Us,{"code-path":"src/components/system/LdapManagementSection.tsx:216:13",value:i,onValueChange:c=>{u(c),h(c)},children:[s.jsx(ws,{"code-path":"src/components/system/LdapManagementSection.tsx:217:15",className:"w-60 h-7 bg-slate-800 border-slate-700 text-slate-200 text-xs",children:s.jsx(Cs,{"code-path":"src/components/system/LdapManagementSection.tsx:218:17",placeholder:"选择组织单元"})}),s.jsxs(Ms,{"code-path":"src/components/system/LdapManagementSection.tsx:220:15",className:"bg-slate-800 border-slate-700",children:[s.jsxs(H,{"code-path":"src/components/system/LdapManagementSection.tsx:221:17",value:d.base_dn,children:["根 (",d.base_dn,")"]}),m.map(c=>s.jsx(H,{"code-path":"src/components/system/LdapManagementSection.tsx:223:19",value:c.dn,children:c.description?`${c.name} (${c.description})`:c.name},c.dn))]})]}),s.jsxs(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:231:13",open:C,onOpenChange:P,children:[s.jsx(Bs,{"code-path":"src/components/system/LdapManagementSection.tsx:232:15",asChild:!0,children:s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:233:17",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-200",children:[s.jsx(Ys,{"code-path":"src/components/system/LdapManagementSection.tsx:234:19",className:"h-3.5 w-3.5 mr-1"}),"新建 OU"]})}),s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:238:15",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:239:17",children:[s.jsx(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:240:19",className:"text-slate-100",children:"新建组织单元"}),s.jsx(as,{"code-path":"src/components/system/LdapManagementSection.tsx:241:19",className:"text-slate-500",children:"在 LDAP 目录中创建新的组织单元 (OU)"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:243:17",className:"space-y-3 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:244:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:245:21",className:"text-xs text-slate-500 mb-1 block",children:"OU 名称 *"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:246:21",value:F.ou_name,onChange:c=>B({...F,ou_name:c.target.value}),placeholder:"dev",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:248:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:249:21",className:"text-xs text-slate-500 mb-1 block",children:"父级 DN"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:250:21",value:F.parent_dn,onChange:c=>B({...F,parent_dn:c.target.value}),placeholder:d.base_dn,className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:252:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:253:21",className:"text-xs text-slate-500 mb-1 block",children:"描述"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:254:21",value:F.description,onChange:c=>B({...F,description:c.target.value}),placeholder:"开发团队",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:256:19",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:k,disabled:!F.ou_name||A,children:[A?s.jsx(Ns,{"code-path":"src/components/system/LdapManagementSection.tsx:257:35",className:"h-4 w-4 mr-1.5 animate-spin"}):null,"创建"]})]})]})]}),s.jsxs(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:265:13",open:p,onOpenChange:O,children:[s.jsx(Bs,{"code-path":"src/components/system/LdapManagementSection.tsx:266:15",asChild:!0,children:s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:267:17",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-200",children:[s.jsx(ke,{"code-path":"src/components/system/LdapManagementSection.tsx:268:19",className:"h-3.5 w-3.5 mr-1"}),"添加用户"]})}),s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:272:15",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:273:17",children:[s.jsx(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:274:19",className:"text-slate-100",children:"添加 LDAP 用户"}),s.jsx(as,{"code-path":"src/components/system/LdapManagementSection.tsx:275:19",className:"text-slate-500",children:"在 LDAP 目录中创建新的用户账号"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:277:17",className:"space-y-3 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:278:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:279:21",className:"text-xs text-slate-500 mb-1 block",children:"用户名 *"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:280:21",value:j.username,onChange:c=>_({...j,username:c.target.value}),placeholder:"zhangsan",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:282:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:283:21",className:"text-xs text-slate-500 mb-1 block",children:"密码 *"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:284:21",type:"password",value:j.password,onChange:c=>_({...j,password:c.target.value}),placeholder:"••••••",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:286:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:287:21",className:"text-xs text-slate-500 mb-1 block",children:"显示名称"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:288:21",value:j.display_name,onChange:c=>_({...j,display_name:c.target.value}),placeholder:"张三",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:290:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:291:21",className:"text-xs text-slate-500 mb-1 block",children:"邮箱"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:292:21",value:j.email,onChange:c=>_({...j,email:c.target.value}),placeholder:"zs@example.com",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:294:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:295:21",className:"text-xs text-slate-500 mb-1 block",children:"目标 OU"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:296:21",value:j.ou_dn||i||d.base_dn,onChange:c=>_({...j,ou_dn:c.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:298:19",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:G,disabled:!j.username||!j.password||A,children:[A?s.jsx(Ns,{"code-path":"src/components/system/LdapManagementSection.tsx:299:35",className:"h-4 w-4 mr-1.5 animate-spin"}):null,"创建"]})]})]})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:307:13",variant:"outline",size:"sm",className:"border-blue-600/50 text-blue-400 hover:bg-blue-600/10 ml-auto",onClick:D,disabled:T.length===0||b,children:[b?s.jsx(Ns,{"code-path":"src/components/system/LdapManagementSection.tsx:314:28",className:"h-3.5 w-3.5 mr-1 animate-spin"}):s.jsx(de,{"code-path":"src/components/system/LdapManagementSection.tsx:314:84",className:"h-3.5 w-3.5 mr-1"}),N.length>0?`导入 (${N.length})`:`导入全部 (${T.length})`]})]}),S&&s.jsx(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:320:13",open:y,onOpenChange:R,children:s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:321:15",className:"max-w-sm bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:322:17",children:[s.jsx(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:323:19",className:"text-slate-100",children:"导入结果"}),s.jsx(as,{"code-path":"src/components/system/LdapManagementSection.tsx:324:19",className:"text-slate-500",children:"LDAP 用户导入到本地用户库的执行结果"})]}),s.jsx("div",{"code-path":"src/components/system/LdapManagementSection.tsx:326:17",className:"py-3 text-sm text-slate-300",children:S}),s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:329:17",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>R(!1),children:"确定"})]})}),s.jsx("div",{"code-path":"src/components/system/LdapManagementSection.tsx:337:11",className:"border border-slate-800 rounded-lg overflow-hidden",children:s.jsxs(As,{"code-path":"src/components/system/LdapManagementSection.tsx:338:13",children:[s.jsx(Ps,{"code-path":"src/components/system/LdapManagementSection.tsx:339:15",children:s.jsxs(J,{"code-path":"src/components/system/LdapManagementSection.tsx:340:17",className:"border-slate-800 hover:bg-transparent",children:[s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:341:19",className:"text-slate-400 w-8",children:s.jsx("input",{"code-path":"src/components/system/LdapManagementSection.tsx:342:21",type:"checkbox",className:"rounded bg-slate-800 border-slate-600",checked:N.length>0&&N.length===T.length,onChange:c=>n(c.target.checked?T.map(W=>W.dn):[])})}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:349:19",className:"text-slate-400",children:"用户名"}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:350:19",className:"text-slate-400",children:"显示名称"}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:351:19",className:"text-slate-400",children:"邮箱"}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:352:19",className:"text-slate-400",children:"DN"}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:353:19",className:"text-slate-400 w-12",children:"操作"})]})}),s.jsx(Es,{"code-path":"src/components/system/LdapManagementSection.tsx:356:15",children:T.length===0?s.jsx(J,{"code-path":"src/components/system/LdapManagementSection.tsx:358:19",className:"border-slate-800",children:s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:359:21",colSpan:6,className:"text-center text-slate-500 py-8",children:"点击「刷新」加载 LDAP 用户"})}):T.map(c=>s.jsxs(J,{"code-path":"src/components/system/LdapManagementSection.tsx:365:21",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:366:23",children:s.jsx("input",{"code-path":"src/components/system/LdapManagementSection.tsx:367:25",type:"checkbox",className:"rounded bg-slate-800 border-slate-600",checked:N.includes(c.dn),onChange:W=>{W.target.checked?n([...N,c.dn]):n(N.filter(is=>is!==c.dn))}})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:377:23",children:s.jsx("span",{"code-path":"src/components/system/LdapManagementSection.tsx:378:25",className:"text-sm text-slate-200 font-medium",children:c.uid})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:380:23",children:s.jsx("span",{"code-path":"src/components/system/LdapManagementSection.tsx:381:25",className:"text-sm text-slate-300",children:c.cn})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:383:23",children:s.jsx("span",{"code-path":"src/components/system/LdapManagementSection.tsx:384:25",className:"text-sm text-slate-400",children:c.mail||"-"})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:386:23",children:s.jsx("code",{"code-path":"src/components/system/LdapManagementSection.tsx:387:25",className:"text-xs text-slate-500",children:c.dn})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:389:23",children:s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:390:25",className:"flex items-center gap-1",children:[s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:391:27",variant:"ghost",size:"icon",className:"h-6 w-6 text-slate-400 hover:text-blue-400 hover:bg-blue-500/10",onClick:()=>ks(c),children:s.jsx(vs,{"code-path":"src/components/system/LdapManagementSection.tsx:397:29",className:"h-3 w-3"})}),s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:399:27",variant:"ghost",size:"icon",className:"h-6 w-6 text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>fs(c.dn),children:s.jsx(Zs,{"code-path":"src/components/system/LdapManagementSection.tsx:405:29",className:"h-3 w-3"})})]})})]},c.dn))})]})})]}),s.jsx(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:419:7",open:!!v,onOpenChange:c=>!c&&Y(null),children:s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:420:9",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:421:11",children:[s.jsxs(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:422:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(vs,{"code-path":"src/components/system/LdapManagementSection.tsx:423:15",className:"h-5 w-5 text-blue-400"}),"编辑 LDAP 用户"]}),s.jsxs(as,{"code-path":"src/components/system/LdapManagementSection.tsx:426:13",className:"text-slate-500",children:["修改 ",v?.uid," 的属性"]})]}),v&&s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:431:13",className:"space-y-3 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:432:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:433:17",className:"text-xs text-slate-500 mb-1 block",children:"用户名(只读)"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:434:17",value:v.uid||"",disabled:!0,className:"bg-slate-800/50 border-slate-700 text-slate-500"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:436:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:437:17",className:"text-xs text-slate-500 mb-1 block",children:"显示名称 (cn)"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:438:17",value:r.cn,onChange:c=>z({...r,cn:c.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:440:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:441:17",className:"text-xs text-slate-500 mb-1 block",children:"邮箱"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:442:17",value:r.mail,onChange:c=>z({...r,mail:c.target.value}),placeholder:"user@example.com",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:444:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:445:17",className:"text-xs text-slate-500 mb-1 block",children:"电话"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:446:17",value:r.phone,onChange:c=>z({...r,phone:c.target.value}),placeholder:"13800138000",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:448:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:449:17",className:"text-xs text-slate-500 mb-1 block",children:"职位/头衔"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:450:17",value:r.title,onChange:c=>z({...r,title:c.target.value}),placeholder:"运维工程师",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]})]}),s.jsxs(ls,{"code-path":"src/components/system/LdapManagementSection.tsx:454:11",children:[s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:455:13",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>Y(null),children:"取消"}),s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:456:13",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:os,children:"保存"})]})]})})]})}function Je(e){const{ldapConfig:d,ldapForm:t,setLdapForm:a,ldapSaving:m,ldapTesting:i,ldapTestResult:u,handleLdapSave:T,handleLdapTest:N}=e;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:93:7",className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:94:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:95:11",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:96:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(ee,{"code-path":"src/components/system/SystemSettingsTab.tsx:97:15",className:"h-5 w-5 text-blue-400"}),"安全设置"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:100:13",className:"text-slate-500",children:"密码策略与登录安全"})]}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:102:11",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:103:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:104:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:105:17",className:"text-sm font-medium text-slate-200",children:"强制密码复杂度"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:106:17",className:"text-xs text-slate-500",children:"要求密码包含大小写字母、数字和特殊字符"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:108:15",defaultChecked:!0,className:"data-[state=checked]:bg-blue-600"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:110:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:111:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:112:17",className:"text-sm font-medium text-slate-200",children:"登录失败锁定"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:113:17",className:"text-xs text-slate-500",children:"连续5次登录失败锁定账户30分钟"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:115:15",defaultChecked:!0,className:"data-[state=checked]:bg-blue-600"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:117:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:118:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:119:17",className:"text-sm font-medium text-slate-200",children:"双因素认证"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:120:17",className:"text-xs text-slate-500",children:"启用后需要手机验证码登录"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:122:15",className:"data-[state=checked]:bg-blue-600"})]})]})]}),s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:127:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:128:11",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:129:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Ie,{"code-path":"src/components/system/SystemSettingsTab.tsx:130:15",className:"h-5 w-5 text-emerald-400"}),"审计设置"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:133:13",className:"text-slate-500",children:"操作日志与审计策略"})]}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:135:11",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:136:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:137:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:138:17",className:"text-sm font-medium text-slate-200",children:"记录所有操作"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:139:17",className:"text-xs text-slate-500",children:"记录用户的所有操作行为"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:141:15",defaultChecked:!0,className:"data-[state=checked]:bg-blue-600"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:143:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:144:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:145:17",className:"text-sm font-medium text-slate-200",children:"日志保留时间"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:146:17",className:"text-xs text-slate-500",children:"操作日志保留180天"})]}),s.jsxs(Us,{"code-path":"src/components/system/SystemSettingsTab.tsx:148:15",defaultValue:"180",children:[s.jsx(ws,{"code-path":"src/components/system/SystemSettingsTab.tsx:149:17",className:"w-32 h-8 bg-slate-800 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/SystemSettingsTab.tsx:150:19"})}),s.jsxs(Ms,{"code-path":"src/components/system/SystemSettingsTab.tsx:152:17",className:"bg-slate-800 border-slate-700",children:[s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:153:19",value:"30",children:"30天"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:154:19",value:"90",children:"90天"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:155:19",value:"180",children:"180天"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:156:19",value:"365",children:"1年"})]})]})]})]})]}),s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:163:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:164:11",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:165:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Qs,{"code-path":"src/components/system/SystemSettingsTab.tsx:166:15",className:"h-5 w-5 text-amber-400"}),"会话设置"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:169:13",className:"text-slate-500",children:"会话超时与Token配置"})]}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:171:11",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:172:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:173:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:174:17",className:"text-sm font-medium text-slate-200",children:"会话超时时间"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:175:17",className:"text-xs text-slate-500",children:"用户无操作30分钟后自动登出"})]}),s.jsxs(Us,{"code-path":"src/components/system/SystemSettingsTab.tsx:177:15",defaultValue:"30",children:[s.jsx(ws,{"code-path":"src/components/system/SystemSettingsTab.tsx:178:17",className:"w-32 h-8 bg-slate-800 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/SystemSettingsTab.tsx:179:19"})}),s.jsxs(Ms,{"code-path":"src/components/system/SystemSettingsTab.tsx:181:17",className:"bg-slate-800 border-slate-700",children:[s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:182:19",value:"15",children:"15分钟"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:183:19",value:"30",children:"30分钟"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:184:19",value:"60",children:"1小时"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:185:19",value:"120",children:"2小时"})]})]})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:189:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:190:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:191:17",className:"text-sm font-medium text-slate-200",children:"单点登录"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:192:17",className:"text-xs text-slate-500",children:"同一账号只能在一个设备登录"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:194:15",className:"data-[state=checked]:bg-blue-600"})]})]})]}),s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:199:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:200:11",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:201:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(xe,{"code-path":"src/components/system/SystemSettingsTab.tsx:202:15",className:"h-5 w-5 text-purple-400"}),"系统信息"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:205:13",className:"text-slate-500",children:"版本与系统状态"})]}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:207:11",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:208:13",className:"flex items-center justify-between",children:[s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:209:15",className:"text-sm text-slate-400",children:"系统版本"}),s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:210:15",className:"text-sm text-slate-200",children:"v2.5.1"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:212:13",className:"flex items-center justify-between",children:[s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:213:15",className:"text-sm text-slate-400",children:"运行时间"}),s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:214:15",className:"text-sm text-slate-200",children:"30天 12小时"})]})]})]})]}),s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:221:7",className:"bg-slate-900 border-slate-800 mt-4",children:[s.jsx(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:222:9",children:s.jsx("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:223:11",className:"flex items-center justify-between",children:s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:224:13",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:225:15",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Js,{"code-path":"src/components/system/SystemSettingsTab.tsx:226:17",className:"h-5 w-5 text-cyan-400"}),"LDAP / Active Directory"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:229:15",className:"text-slate-500 mt-1",children:"配置 LDAP 服务器,实现统一身份认证"})]})})}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:233:9",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:234:11",className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:235:13",className:"space-y-1.5",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:236:15",className:"text-xs text-slate-500",children:"LDAP 服务器地址"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:237:15",value:t.ldap_host,onChange:n=>a({...t,ldap_host:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"ldap.example.com"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:244:13",className:"space-y-1.5",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:245:15",className:"text-xs text-slate-500",children:"端口"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:246:15",type:"number",value:t.ldap_port,onChange:n=>a({...t,ldap_port:Number(n.target.value)}),className:"bg-slate-800/50 border-slate-700 text-slate-200",placeholder:"389"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:254:13",className:"space-y-1.5 col-span-2",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:255:15",className:"text-xs text-slate-500",children:"Base DN(用户搜索基础)"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:256:15",value:t.base_dn,onChange:n=>a({...t,base_dn:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"ou=users,dc=example,dc=com"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:263:13",className:"space-y-1.5",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:264:15",className:"text-xs text-slate-500",children:"管理员 Bind DN"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:265:15",value:t.admin_dn,onChange:n=>a({...t,admin_dn:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"cn=admin,dc=example,dc=com"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:272:13",className:"space-y-1.5",children:[s.jsxs("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:273:15",className:"text-xs text-slate-500",children:["管理员密码 ",d&&"(留空不修改)"]}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:274:15",type:"password",value:t.admin_password,onChange:n=>a({...t,admin_password:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"******"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:282:13",className:"space-y-1.5 col-span-2",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:283:15",className:"text-xs text-slate-500",children:"搜索过滤器(可选,用 %s 代表用户名)"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:284:15",value:t.search_filter,onChange:n=>a({...t,search_filter:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"(uid=%s)"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:291:13",className:"flex items-center gap-2 col-span-2",children:[s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:292:15",checked:t.use_ldaps,onCheckedChange:n=>a({...t,use_ldaps:n}),className:"data-[state=checked]:bg-blue-600"}),s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:297:15",className:"text-sm text-slate-300",children:"启用 LDAPS(SSL 加密)"})]})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:302:11",className:"flex items-center gap-3 mt-4 pt-4 border-t border-slate-800",children:[u&&s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:304:15",className:`text-xs ${u.includes("成功")?"text-emerald-400":"text-red-400"}`,children:u}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:308:13",className:"flex items-center gap-2 ml-auto",children:[s.jsxs(x,{"code-path":"src/components/system/SystemSettingsTab.tsx:309:15",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:N,disabled:i,children:[i?s.jsx(Ns,{"code-path":"src/components/system/SystemSettingsTab.tsx:316:32",className:"h-3.5 w-3.5 mr-1 animate-spin"}):s.jsx(Xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:316:88",className:"h-3.5 w-3.5 mr-1"}),"测试连接"]}),s.jsx(x,{"code-path":"src/components/system/SystemSettingsTab.tsx:319:15",size:"sm",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:T,disabled:m,children:m?"保存中...":"保存配置"})]})]})]})]}),d&&s.jsx("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:334:9",className:"mt-4",children:s.jsx(qe,{"code-path":"src/components/system/SystemSettingsTab.tsx:335:11",...e})})]})}function Xe(e){const d=Ks(),[t,a]=o.useState([]),[m,i]=o.useState(new Set),[u,T]=o.useState(!1),[N,n]=o.useState([]),[U,h]=o.useState(""),[D,b]=o.useState(null),[S,y]=o.useState({ldap_host:"",ldap_port:389,use_ldaps:!1,admin_dn:"",admin_password:"",base_dn:"",search_filter:""}),[R,C]=o.useState(!1),[P,F]=o.useState(!1),[B,k]=o.useState(null),[A,p]=o.useState(!1),[O,j]=o.useState(null),[_,G]=o.useState(!1),[E,X]=o.useState([]),[L,rs]=o.useState(""),[ns,ds]=o.useState([]),[ps,K]=o.useState(!1),[Q,v]=o.useState(!1),[Y,r]=o.useState({ou_name:"",parent_dn:"",description:""}),[z,os]=o.useState({username:"",password:"",display_name:"",email:"",ou_dn:""}),[fs,ks]=o.useState(!1),[c,W]=o.useState(""),[is,Is]=o.useState(""),[Rs,Ds]=o.useState(!1),[_s,ys]=o.useState(null),[gs,g]=o.useState(null),[ms,Fs]=o.useState({cn:"",mail:"",phone:"",title:""}),[te,zs]=o.useState(!1),ae=async()=>{try{const l=await $.getConfig();l&&l.ldap_host&&(b(l),y({ldap_host:l.ldap_host||"",ldap_port:l.ldap_port||389,use_ldaps:l.use_ldaps||!1,admin_dn:l.admin_dn||"",admin_password:"",base_dn:l.base_dn||"",search_filter:l.search_filter||""}))}catch{}},he=async()=>{C(!0);try{await $.updateConfig(S),await ae()}catch(l){console.error("Failed to save LDAP config:",l)}finally{C(!1)}},ye=async()=>{F(!0),k(null);try{await $.updateConfig(S);const l=await $.testConnection();k(l?.message||(l?.success?"连接成功":"连接失败"))}catch(l){k(l?.message||"连接失败")}finally{F(!1)}},Ls=async l=>{try{const I=await $.listUsers(l);a(I||[])}catch(I){console.error("loadOUUsers",I)}},ce=async()=>{try{const l=await $.listOUs();X(l||[]),!L&&D?.base_dn&&(rs(D.base_dn),await Ls(D.base_dn))}catch(l){console.error("loadOUs",l)}},ge=async()=>{C(!0);try{await $.createOU(Y),K(!1),r({ou_name:"",parent_dn:"",description:""}),await ce()}catch(l){const I=l?.message||"";I.includes("Already Exists")||I.includes("68")?V.error(`OU "${Y.ou_name}" 已存在,请使用其他名称`):V.error("创建失败: "+I)}finally{C(!1)}},be=async()=>{C(!0);try{await $.createUser({...z,ou_dn:z.ou_dn||L||D?.base_dn}),v(!1),os({username:"",password:"",display_name:"",email:"",ou_dn:""}),await Ls(L)}catch(l){V.error(l?.message||"创建失败")}finally{C(!1)}},Se=async(l,I=!1)=>{if(!(!I&&!await d({title:"删除 LDAP 条目",description:`确定删除 ${l}?`,confirmText:"删除",variant:"destructive"})))try{await $.deleteUser(l),I||await Ls(L)}catch(Os){I||V.error(Os?.message||"删除失败")}},je=l=>{g(l),Fs({cn:l.cn||"",mail:l.mail||"",phone:l.phone||"",title:l.title||""})},ue=async()=>{if(gs)try{await $.updateUser({dn:gs.dn,...ms}),g(null),await Ls(L)}catch(l){V.error(l?.message||"修改失败")}},Ne=async()=>{Ds(!0),ys(null);try{const l=await $.testConnection({test_user:c,test_password:is});ys(l)}catch(l){ys({success:!1,message:l?.message||"验证失败"})}finally{Ds(!1)}},ne=async l=>{T(!0);try{const I=await $.listUsers(l);a(Array.isArray(I)?I:[]),i(new Set)}catch{a([])}finally{T(!1)}},oe=async()=>{let l=[];if(ns.length>0?l=t.filter(I=>ns.includes(I.dn)):l=t,l.length!==0){zs(!0);try{const I=l.map($s=>({username:$s.uid||"",nickname:$s.cn||"",email:$s.mail||""})),Os=await $.batchImport(I);j(Os?.message||`成功导入 ${l.length} 个用户`),G(!0),ds([]),await e()}catch(I){j("导入失败: "+(I?.message||"未知错误")),G(!0)}finally{zs(!1)}}};return{ldapUsers:t,setLdapUsers:a,ldapSelected:m,setLdapSelected:i,ldapLoading:u,ldapImportOUs:N,ldapImportOUDN:U,setLdapImportOUDN:h,loadLdapUsers:ne,handleLdapImport:oe,loadImportDialogData:()=>{$.listOUs().then(l=>n(Array.isArray(l)?l:[])).catch(()=>{}),ne("")},importing:te,setImporting:zs,importFeedback:O,importResultOpen:_,setImportResultOpen:G,loadLdapConfig:ae,settingsTabProps:{ldapConfig:D,ldapForm:S,setLdapForm:y,ldapSaving:R,ldapTesting:P,ldapTestResult:B,handleLdapSave:he,handleLdapTest:ye,ldapMgmtOpen:A,setLdapMgmtOpen:p,ldapOUs:E,selectedOUDN:L,setSelectedOUDN:rs,ldapUsers:t,selectedLDAPUsers:ns,setSelectedLDAPUsers:ds,loadLdapOUs:ce,loadLdapOUUsers:Ls,handleLdapImport:oe,importing:te,importFeedback:O,importResultOpen:_,setImportResultOpen:G,createOUOpen:ps,setCreateOUOpen:K,ouForm:Y,setOuForm:r,handleCreateOU:ge,createUserOpen:Q,setCreateUserOpen:v,newUser:z,setNewUser:os,handleCreateLDAPUser:be,ldapUserTestOpen:fs,setLdapUserTestOpen:ks,ldapTestUser:c,setLdapTestUser:W,ldapTestPass:is,setLdapTestPass:Is,ldapUserTesting:Rs,ldapUserTestResult:_s,handleLdapUserTest:Ne,editLdapUser:gs,setEditLdapUser:g,editLdapForm:ms,setEditLdapForm:Fs,handleUpdateLdapUser:ue,handleDeleteLDAPEntry:Se,openEditLdapUser:je}}}function Ye(e){return{...e,status:e.status===1||e.status==="active"?"active":"inactive",roles:Array.isArray(e.roles)?e.roles:e.role?[e.role]:[],lastLoginAt:e.last_login??e.lastLoginAt,createdAt:e.created_at??e.createdAt,authSource:e.auth_source??e.authSource??"local"}}const le={username:"",nickname:"",email:"",phone:"",role:"",password:"",status:1};function yt(){const e=Ks(),d=fe(),t={"/users":"users","/roles":"roles","/settings":"settings"},[a,m]=o.useState(t[d.pathname]||"users");o.useEffect(()=>{const r=t[d.pathname];r&&r!==a&&m(r)},[d.pathname]);const[i,u]=o.useState(""),[T,N]=o.useState([]),[n,U]=o.useState(!0),[h,D]=o.useState(null),[b,S]=o.useState(null),[y,R]=o.useState(!1),[C,P]=o.useState(null),[F,B]=o.useState(!1),[k,A]=o.useState({...le}),[p,O]=o.useState(null),[j,_]=o.useState([]),[G,E]=o.useState(null),X=async()=>{U(!0);try{const z=(await q.getUsers({page:1,page_size:100}))?.list??[];N(z.map(Ye))}catch(r){console.error("Failed to fetch users:",r),N([])}finally{U(!1)}},L=Xe(X);o.useEffect(()=>{X(),L.loadLdapConfig()},[]),o.useEffect(()=>{p==="ldap"&&L.loadImportDialogData()},[p]);const rs=T.filter(r=>(r.username||"").toLowerCase().includes(i.toLowerCase())||(r.nickname||"").toLowerCase().includes(i.toLowerCase())||(r.email||"").toLowerCase().includes(i.toLowerCase())),ns=r=>r==="active"?s.jsxs(cs,{"code-path":"src/components/system/SystemManager.tsx:110:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[s.jsx(Ws,{"code-path":"src/components/system/SystemManager.tsx:111:9",className:"h-3 w-3 mr-1"}),"正常"]}):s.jsxs(cs,{"code-path":"src/components/system/SystemManager.tsx:115:7",variant:"outline",className:"border-slate-500/30 text-slate-400 bg-slate-500/10",children:[s.jsx(qs,{"code-path":"src/components/system/SystemManager.tsx:116:9",className:"h-3 w-3 mr-1"}),"禁用"]}),ds=()=>{P(null),A({...le}),R(!0)},ps=r=>{P(r),A({username:r.username||"",nickname:r.nickname||"",email:r.email||"",phone:r.phone||"",role:Array.isArray(r.roles)?r.roles[0]||"":r.role||"",password:"",status:r.status==="active"?1:0}),R(!0)},K=async()=>{B(!0);try{const r={username:k.username,nickname:k.nickname,email:k.email,phone:k.phone,role:k.role,status:k.status};k.password&&(r.password=k.password),C?await q.updateUser(C.id,r):await q.createUser(r),R(!1),await X()}catch(r){console.error("Failed to save user:",r)}finally{B(!1)}},Q=async r=>{if(await e({title:"删除用户",description:`确认删除用户「${r.nickname||r.username}」吗?`,confirmText:"删除",variant:"destructive"}))try{await q.deleteUser(r.id),await X()}catch(os){console.error("Failed to delete user:",os)}},v=r=>{const z=r.target.files?.[0];if(!z)return;const os=new FileReader;os.onload=fs=>{const c=(fs.target?.result).split(`
`).filter(g=>g.trim()&&!g.startsWith(""));if(c.length<2)return;const W=c[0].split(",").map(g=>g.trim().toLowerCase()),is=W.findIndex(g=>g.includes("用户名")||g.includes("username")),Is=W.findIndex(g=>g.includes("昵称")||g.includes("name")||g.includes("显示名")),Rs=W.findIndex(g=>g.includes("邮箱")||g.includes("email")||g.includes("mail")),Ds=W.findIndex(g=>g.includes("手机")||g.includes("phone")),_s=W.findIndex(g=>g.includes("角色")||g.includes("role")),ys=W.findIndex(g=>g.includes("密码")||g.includes("password")),gs=[];for(let g=1;g<c.length;g++){const ms=c[g].split(",").map(Fs=>Fs.trim());gs.push({username:is>=0?ms[is]:"",nickname:Is>=0?ms[Is]:"",email:Rs>=0?ms[Rs]:"",phone:Ds>=0?ms[Ds]:"",role:_s>=0?ms[_s]:"",password:ys>=0?ms[ys]:""})}_(gs),E(null)},os.readAsText(z,"UTF-8")},Y=async()=>{L.setImporting(!0);try{const r=await q.batchImport({users:j,skip_existing:!0});E(r),await X()}catch(r){E({code:500,message:r?.message||"导入失败"})}finally{L.setImporting(!1)}};return s.jsxs("div",{"code-path":"src/components/system/SystemManager.tsx:232:5",className:"space-y-6",children:[s.jsx("div",{"code-path":"src/components/system/SystemManager.tsx:234:7",className:"flex items-center justify-between",children:s.jsxs("div",{"code-path":"src/components/system/SystemManager.tsx:235:9",children:[s.jsx("h1",{"code-path":"src/components/system/SystemManager.tsx:236:11",className:"text-2xl font-bold text-slate-100",children:"系统管理"}),s.jsx("p",{"code-path":"src/components/system/SystemManager.tsx:237:11",className:"text-sm text-slate-500 mt-1",children:"用户、权限与系统配置"})]})}),s.jsxs(De,{"code-path":"src/components/system/SystemManager.tsx:242:7",value:a,onValueChange:m,className:"w-full",children:[s.jsxs(Le,{"code-path":"src/components/system/SystemManager.tsx:243:9",className:"bg-slate-800 border border-slate-700",children:[s.jsxs(Vs,{"code-path":"src/components/system/SystemManager.tsx:244:11",value:"users",className:"data-[state=active]:bg-slate-700",children:[s.jsx(ie,{"code-path":"src/components/system/SystemManager.tsx:245:13",className:"h-4 w-4 mr-2"}),"用户管理"]}),s.jsxs(Vs,{"code-path":"src/components/system/SystemManager.tsx:248:11",value:"roles",className:"data-[state=active]:bg-slate-700",children:[s.jsx(se,{"code-path":"src/components/system/SystemManager.tsx:249:13",className:"h-4 w-4 mr-2"}),"角色权限"]}),s.jsxs(Vs,{"code-path":"src/components/system/SystemManager.tsx:252:11",value:"settings",className:"data-[state=active]:bg-slate-700",children:[s.jsx(xe,{"code-path":"src/components/system/SystemManager.tsx:253:13",className:"h-4 w-4 mr-2"}),"系统设置"]})]}),s.jsx(Hs,{"code-path":"src/components/system/SystemManager.tsx:258:9",value:"users",className:"mt-4 space-y-4",children:s.jsx(Ee,{"code-path":"src/components/system/SystemManager.tsx:259:11",searchQuery:i,setSearchQuery:u,filteredUsers:rs,loading:n,selectedUser:h,setSelectedUser:D,getUserStatusBadge:ns,dialogOpen:y,setDialogOpen:R,editingUser:C,form:k,setForm:A,saving:F,handleSubmit:K,openCreate:ds,openEdit:ps,handleDelete:Q,importDialogOpen:p,setImportDialogOpen:O,importPreview:j,setImportPreview:_,importing:L.importing,importResult:G,setImportResult:E,handleCsvUpload:v,handleBatchImport:Y,ldapUsers:L.ldapUsers,ldapSelected:L.ldapSelected,setLdapSelected:L.setLdapSelected,ldapLoading:L.ldapLoading,ldapImportOUs:L.ldapImportOUs,ldapImportOUDN:L.ldapImportOUDN,setLdapImportOUDN:L.setLdapImportOUDN,loadLdapUsers:L.loadLdapUsers,handleLdapImport:L.handleLdapImport,setLdapUsers:L.setLdapUsers})}),s.jsx(Hs,{"code-path":"src/components/system/SystemManager.tsx:299:9",value:"roles",className:"mt-4 space-y-4",children:s.jsx(Qe,{"code-path":"src/components/system/SystemManager.tsx:300:11",selectedRole:b,setSelectedRole:S})}),s.jsx(Hs,{"code-path":"src/components/system/SystemManager.tsx:306:9",value:"settings",className:"mt-4",children:s.jsx(Je,{"code-path":"src/components/system/SystemManager.tsx:307:11",...L.settingsTabProps})})]})]})}export{yt as SystemManager};