Files
aiops/backend/static/assets/SystemManager-AIb0OKGv.js
T
Logan 8d46e8f352 feat: 新增日志中心、功能优化与代码重构
- 新增 log_datasource.go / log_proxy.go / user_api_token.go 后端控制器
- 新增 log_datasource.go model
- 新增 monitor/log-center.ts API 模块
- 新增 LogCenter 前端组件及页面
- 重构 deployment 相关组件 (HPDA/UpdateImageModal/bundle-yaml 等)
- 新增 ResetPasswordDialog / code-snippet-block / copy-button 等 UI 组件
- 重构多个 k8s 相关组件 (TopologyView/ResourceVisualEditor/PodFileBrowser 等)
- 更新多个 API 和工具函数 (auth.ts/monitor/index.ts/request.ts 等)
- 更新静态资源 (index.html + 新 JS/CSS bundle)
- 删除废弃静态资源文件
2026-06-26 23:18:05 +08:00

3 lines
103 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 n,j as s}from"./vendor-codemirror-B1SGo4xl.js";import{u as K,D as J,a as X,b as Y,c as Z,d as ss,e as os,B as x,aw as ve,f as Ws,t as H,j as Hs,l as $,k as De}from"./index-lgmWPQDG.js";import{T as fe,a as Le,b as Gs,c as Ks}from"./tabs-CVrkiNvd.js";import{B as cs}from"./badge-Ca5YHtna.js";import{C as ys,a as gs,b as fs,c as Ls,d as Ts}from"./card-CdN7vcLa.js";import{I as D}from"./input-DBDfXZx0.js";import{T as Es,a as zs,b as es,c as C,d as $s,e as w}from"./table-DX6kWYMC.js";import{S as Rs,a as Is,b as _s,c as Fs,d as G}from"./select-Bv_WioDg.js";import{U as le,ag as Bs,aJ as ws,ah as Qs,v as de,y as qs,a as Js,N as Xs,L as Ss,R as Ys,S as Te,P as Zs,ar as we,aq as Ue,x as pe,T as se,j as ee,aO as te,ax as Ce,Q as Me,V as ie,a3 as ke,aw as Re,p as xe}from"./vendor-icons-BlY7QrxS.js";import{T as Ie}from"./textarea-ym7reYBG.js";import{L as bs}from"./label-Bzhjv1tR.js";import{C as _e}from"./checkbox-Dq3LPO2o.js";import{S as Ds}from"./switch-BGnej0rz.js";import{u as Fe}from"./use-toast-DNZLibQY.js";import"./index-5FEebgvX.js";function Oe({open:e,onOpenChange:l,editingUser:t,form:a,setForm:m,saving:p,onSubmit:b}){const[f,S]=n.useState([]);return n.useEffect(()=>{if(!e)return;let c=!1;return(async()=>{try{const L=await K.getRoles();if(c)return;const h=L?.list??[];S(h.map(y=>({id:String(y.id??""),name:y.name??y.code??""})))}catch{c||S([])}})(),()=>{c=!0}},[e]),s.jsx(J,{"code-path":"src/components/system/UserFormDialog.tsx:78:5",open:e,onOpenChange:l,children:s.jsxs(X,{"code-path":"src/components/system/UserFormDialog.tsx:79:7",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Y,{"code-path":"src/components/system/UserFormDialog.tsx:80:9",children:[s.jsxs(Z,{"code-path":"src/components/system/UserFormDialog.tsx:81:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(le,{"code-path":"src/components/system/UserFormDialog.tsx:82:13",className:"h-5 w-5 text-blue-400"}),t?"编辑用户":"新建用户"]}),s.jsx(ss,{"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(D,{"code-path":"src/components/system/UserFormDialog.tsx:94:15",value:a.username,onChange:c=>m({...a,username:c.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(D,{"code-path":"src/components/system/UserFormDialog.tsx:104:15",value:a.nickname,onChange:c=>m({...a,nickname:c.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(D,{"code-path":"src/components/system/UserFormDialog.tsx:113:15",value:a.email,onChange:c=>m({...a,email:c.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(D,{"code-path":"src/components/system/UserFormDialog.tsx:122:15",value:a.phone,onChange:c=>m({...a,phone:c.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(Rs,{"code-path":"src/components/system/UserFormDialog.tsx:131:15",value:a.role,onValueChange:c=>m({...a,role:c}),children:[s.jsx(Is,{"code-path":"src/components/system/UserFormDialog.tsx:132:17",className:"bg-slate-800/50 border-slate-700 text-slate-200",children:s.jsx(_s,{"code-path":"src/components/system/UserFormDialog.tsx:133:19",placeholder:"选择角色"})}),s.jsx(Fs,{"code-path":"src/components/system/UserFormDialog.tsx:135:17",className:"bg-slate-800 border-slate-700",children:f.map(c=>s.jsx(G,{"code-path":"src/components/system/UserFormDialog.tsx:137:21",value:c.name,children:c.name},c.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(Rs,{"code-path":"src/components/system/UserFormDialog.tsx:146:15",value:String(a.status),onValueChange:c=>m({...a,status:Number(c)}),children:[s.jsx(Is,{"code-path":"src/components/system/UserFormDialog.tsx:150:17",className:"bg-slate-800/50 border-slate-700 text-slate-200",children:s.jsx(_s,{"code-path":"src/components/system/UserFormDialog.tsx:151:19"})}),s.jsxs(Fs,{"code-path":"src/components/system/UserFormDialog.tsx:153:17",className:"bg-slate-800 border-slate-700",children:[s.jsx(G,{"code-path":"src/components/system/UserFormDialog.tsx:154:19",value:"1",children:"正常"}),s.jsx(G,{"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(D,{"code-path":"src/components/system/UserFormDialog.tsx:164:13",type:"password",value:a.password,onChange:c=>m({...a,password:c.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:t?"留空则不修改":"设置初始密码"})]})]}),s.jsxs(os,{"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:()=>l(!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:b,disabled:p,children:p?"保存中...":"保存"})]})]})})}function Pe({selectedUser:e,setSelectedUser:l,getUserStatusBadge:t,openEdit:a,onResetPassword:m}){return s.jsx(J,{"code-path":"src/components/system/UserDetailDialog.tsx:31:5",open:!!e,onOpenChange:()=>l(null),children:s.jsxs(X,{"code-path":"src/components/system/UserDetailDialog.tsx:32:7",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Y,{"code-path":"src/components/system/UserDetailDialog.tsx:33:9",children:[s.jsxs(Z,{"code-path":"src/components/system/UserDetailDialog.tsx:34:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(le,{"code-path":"src/components/system/UserDetailDialog.tsx:35:13",className:"h-5 w-5 text-blue-400"}),e?.nickname]}),s.jsxs(ss,{"code-path":"src/components/system/UserDetailDialog.tsx:38:11",className:"text-slate-500",children:["@",e?.username," · ",e?.email]})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:43:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:44: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:45:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:46:15",className:"text-xs text-slate-500 mb-1",children:"用户名"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:47:15",className:"text-sm text-slate-200",children:e?.username})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:49:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:50:15",className:"text-xs text-slate-500 mb-1",children:"昵称"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:51:15",className:"text-sm text-slate-200",children:e?.nickname})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:53:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:54:15",className:"text-xs text-slate-500 mb-1",children:"邮箱"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:55:15",className:"text-sm text-slate-200",children:e?.email})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:57:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:58:15",className:"text-xs text-slate-500 mb-1",children:"手机号"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:59:15",className:"text-sm text-slate-200",children:e?.phone||"--"})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:61:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:62:15",className:"text-xs text-slate-500 mb-1",children:"状态"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:63:15",className:"text-sm text-slate-200",children:e&&t(e.status)})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:65:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:66:15",className:"text-xs text-slate-500 mb-1",children:"创建时间"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:67: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:73:11",children:[s.jsx("h4",{"code-path":"src/components/system/UserDetailDialog.tsx:74:13",className:"text-sm font-medium text-slate-300 mb-2",children:"角色"}),s.jsx("div",{"code-path":"src/components/system/UserDetailDialog.tsx:75:13",className:"flex flex-wrap gap-2",children:e?.roles.map(p=>s.jsx(cs,{"code-path":"src/components/system/UserDetailDialog.tsx:77:17",variant:"outline",className:"border-slate-700 text-slate-400",children:p},p))})]})]}),s.jsxs(os,{"code-path":"src/components/system/UserDetailDialog.tsx:85:9",children:[s.jsxs(x,{"code-path":"src/components/system/UserDetailDialog.tsx:86:11",variant:"outline",className:"border-slate-700 text-slate-300",disabled:e?.authSource==="ldap",onClick:()=>e&&m?.(e),children:[s.jsx(Bs,{"code-path":"src/components/system/UserDetailDialog.tsx:92:13",className:"h-4 w-4 mr-2"}),"重置密码"]}),s.jsxs(x,{"code-path":"src/components/system/UserDetailDialog.tsx:95:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>{e&&(l(null),a(e))},children:[s.jsx(ws,{"code-path":"src/components/system/UserDetailDialog.tsx:104:13",className:"h-4 w-4 mr-2"}),"编辑"]})]})]})})}function Ae({importDialogOpen:e,setImportDialogOpen:l,importPreview:t,setImportPreview:a,importing:m,importResult:p,setImportResult:b,handleCsvUpload:f,handleBatchImport:S}){return s.jsx(J,{"code-path":"src/components/system/CsvImportDialog.tsx:47:5",open:e==="csv",onOpenChange:c=>!c&&l(null),children:s.jsxs(X,{"code-path":"src/components/system/CsvImportDialog.tsx:48:7",className:"bg-slate-900 border-slate-800 max-w-2xl",children:[s.jsxs(Y,{"code-path":"src/components/system/CsvImportDialog.tsx:49:9",children:[s.jsxs(Z,{"code-path":"src/components/system/CsvImportDialog.tsx:50:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Qs,{"code-path":"src/components/system/CsvImportDialog.tsx:51:13",className:"h-5 w-5 text-blue-400"}),"批量导入用户(CSV)"]}),s.jsx(ss,{"code-path":"src/components/system/CsvImportDialog.tsx:54:11",className:"text-slate-500",children:"上传 CSV 文件批量创建用户。请先下载模板,按格式填写后上传。"})]}),p?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 ${p.code===200?"bg-emerald-500/10":"bg-red-500/10"}`,children:[p.code===200?s.jsx(qs,{"code-path":"src/components/system/CsvImportDialog.tsx:123:17",className:"h-6 w-6 text-emerald-400 shrink-0"}):s.jsx(Js,{"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:p.message})]}),p.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:p.errors.map((c,L)=>s.jsx("div",{"code-path":"src/components/system/CsvImportDialog.tsx:132:19",className:"text-xs text-red-400",children:c},L))}),s.jsx(os,{"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:()=>{l(null),a([]),b(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:()=>K.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(Qs,{"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:f})]})]}),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(Es,{"code-path":"src/components/system/CsvImportDialog.tsx:79:19",children:[s.jsx(zs,{"code-path":"src/components/system/CsvImportDialog.tsx:80:21",children:s.jsxs(es,{"code-path":"src/components/system/CsvImportDialog.tsx:81:23",className:"border-slate-800",children:[s.jsx(C,{"code-path":"src/components/system/CsvImportDialog.tsx:82:25",className:"text-slate-400 text-xs",children:"用户名"}),s.jsx(C,{"code-path":"src/components/system/CsvImportDialog.tsx:83:25",className:"text-slate-400 text-xs",children:"昵称"}),s.jsx(C,{"code-path":"src/components/system/CsvImportDialog.tsx:84:25",className:"text-slate-400 text-xs",children:"邮箱"}),s.jsx(C,{"code-path":"src/components/system/CsvImportDialog.tsx:85:25",className:"text-slate-400 text-xs",children:"手机"})]})}),s.jsxs($s,{"code-path":"src/components/system/CsvImportDialog.tsx:88:21",children:[t.slice(0,5).map((c,L)=>s.jsxs(es,{"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:c.username}),s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:92:27",className:"text-slate-300 text-xs",children:c.nickname}),s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:93:27",className:"text-slate-400 text-xs",children:c.email}),s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:94:27",className:"text-slate-400 text-xs",children:c.phone})]},L)),t.length>5&&s.jsx(es,{"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(os,{"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:()=>{l(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:S,disabled:m||t.length===0,children:m?"导入中...":`确认导入 (${t.length})`})]})]})]})})}function Ee({importDialogOpen:e,setImportDialogOpen:l,ldapUsers:t,setLdapUsers:a,ldapSelected:m,setLdapSelected:p,ldapLoading:b,ldapImportOUs:f,ldapImportOUDN:S,setLdapImportOUDN:c,loadLdapUsers:L,handleLdapImport:h,importing:y,importResult:N,setImportResult:j}){return s.jsx(J,{"code-path":"src/components/system/LdapImportDialog.tsx:58:5",open:e==="ldap",onOpenChange:g=>!g&&l(null),children:s.jsxs(X,{"code-path":"src/components/system/LdapImportDialog.tsx:59:7",className:"bg-slate-900 border-slate-800 max-w-2xl",children:[s.jsxs(Y,{"code-path":"src/components/system/LdapImportDialog.tsx:60:9",children:[s.jsxs(Z,{"code-path":"src/components/system/LdapImportDialog.tsx:61:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Xs,{"code-path":"src/components/system/LdapImportDialog.tsx:62:13",className:"h-5 w-5 text-cyan-400"}),"从 LDAP 导入用户"]}),s.jsx(ss,{"code-path":"src/components/system/LdapImportDialog.tsx:65:11",className:"text-slate-500",children:"从 LDAP 服务器检索用户列表,选择需要导入的用户"})]}),N?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 ${N.code===200?"bg-emerald-500/10":"bg-red-500/10"}`,children:[N.code===200?s.jsx(qs,{"code-path":"src/components/system/LdapImportDialog.tsx:166:17",className:"h-6 w-6 text-emerald-400 shrink-0"}):s.jsx(Js,{"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:N.message})]}),s.jsx(os,{"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:()=>{l(null),a([]),j(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:S,onChange:g=>{c(g.target.value),L(g.target.value)},children:[s.jsx("option",{"code-path":"src/components/system/LdapImportDialog.tsx:84:21",value:"",children:"根 (全部)"}),f.map(g=>s.jsx("option",{"code-path":"src/components/system/LdapImportDialog.tsx:86:23",value:g.dn,children:g.name},g.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:()=>L(S),disabled:b,children:[b?s.jsx(Ss,{"code-path":"src/components/system/LdapImportDialog.tsx:91:34",className:"h-4 w-4 mr-1.5 animate-spin"}):s.jsx(Ys,{"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(Es,{"code-path":"src/components/system/LdapImportDialog.tsx:102:19",children:[s.jsx(zs,{"code-path":"src/components/system/LdapImportDialog.tsx:103:21",children:s.jsxs(es,{"code-path":"src/components/system/LdapImportDialog.tsx:104:23",className:"border-slate-800 sticky top-0 bg-slate-900",children:[s.jsx(C,{"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:g=>{g.target.checked?p(new Set(t.map(P=>P.dn))):p(new Set)}})}),s.jsx(C,{"code-path":"src/components/system/LdapImportDialog.tsx:119:25",className:"text-slate-400 text-xs",children:"用户名"}),s.jsx(C,{"code-path":"src/components/system/LdapImportDialog.tsx:120:25",className:"text-slate-400 text-xs",children:"显示名"}),s.jsx(C,{"code-path":"src/components/system/LdapImportDialog.tsx:121:25",className:"text-slate-400 text-xs",children:"邮箱"}),s.jsx(C,{"code-path":"src/components/system/LdapImportDialog.tsx:122:25",className:"text-slate-400 text-xs",children:"DN"})]})}),s.jsx($s,{"code-path":"src/components/system/LdapImportDialog.tsx:125:21",children:t.map(g=>s.jsxs(es,{"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(g.dn),onChange:P=>{const M=new Set(m);P.target.checked?M.add(g.dn):M.delete(g.dn),p(M)}})}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:141:27",className:"text-slate-200 text-xs",children:g.uid}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:142:27",className:"text-slate-300 text-xs",children:g.cn}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:143:27",className:"text-slate-400 text-xs",children:g.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:g.dn})]},g.dn))})]})})]}),s.jsxs(os,{"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:()=>{l(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:y||m.size===0,children:y?"导入中...":`导入选中 (${m.size})`})]})]})]})})}function ze({searchQuery:e,setSearchQuery:l,filteredUsers:t,loading:a,selectedUser:m,setSelectedUser:p,getUserStatusBadge:b,dialogOpen:f,setDialogOpen:S,editingUser:c,form:L,setForm:h,saving:y,handleSubmit:N,openCreate:j,openEdit:g,handleDelete:P,onResetPassword:M,importDialogOpen:E,setImportDialogOpen:k,importPreview:B,setImportPreview:ts,importing:z,importResult:r,setImportResult:I,handleCsvUpload:u,handleBatchImport:_,ldapUsers:V,ldapSelected:Q,setLdapSelected:hs,ldapLoading:F,ldapImportOUs:W,ldapImportOUDN:U,setLdapImportOUDN:ls,loadLdapUsers:ds,handleLdapImport:q,setLdapUsers:ps}){const{hasPermission:A}=ve();return s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:118:7",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:119:9",className:"relative w-64",children:[s.jsx(Te,{"code-path":"src/components/system/SystemUserTab.tsx:120:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),s.jsx(D,{"code-path":"src/components/system/SystemUserTab.tsx:121:11",placeholder:"搜索用户...",value:e,onChange:T=>l(T.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:128:9",className:"flex items-center gap-2",children:[A("system:user")&&s.jsxs(x,{"code-path":"src/components/system/SystemUserTab.tsx:130:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>k("csv"),children:[s.jsx(Qs,{"code-path":"src/components/system/SystemUserTab.tsx:131:13",className:"h-4 w-4 mr-2"}),"批量导入"]}),A("system:user")&&s.jsxs(x,{"code-path":"src/components/system/SystemUserTab.tsx:136:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>k("ldap"),children:[s.jsx(Xs,{"code-path":"src/components/system/SystemUserTab.tsx:137:13",className:"h-4 w-4 mr-2"}),"LDAP 导入"]}),A("system:user")&&s.jsxs(x,{"code-path":"src/components/system/SystemUserTab.tsx:142:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:j,children:[s.jsx(Zs,{"code-path":"src/components/system/SystemUserTab.tsx:143:13",className:"h-4 w-4 mr-2"}),"新建用户"]})]})]}),s.jsx(ys,{"code-path":"src/components/system/SystemUserTab.tsx:151:7",className:"bg-slate-900 border-slate-800",children:s.jsx(gs,{"code-path":"src/components/system/SystemUserTab.tsx:152:9",className:"p-0",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:153:11",className:"border-t border-slate-800",children:s.jsxs(Es,{"code-path":"src/components/system/SystemUserTab.tsx:154:13",children:[s.jsx(zs,{"code-path":"src/components/system/SystemUserTab.tsx:155:15",children:s.jsxs(es,{"code-path":"src/components/system/SystemUserTab.tsx:156:17",className:"border-slate-800 hover:bg-transparent",children:[s.jsx(C,{"code-path":"src/components/system/SystemUserTab.tsx:157:19",className:"text-slate-400",children:"用户信息"}),s.jsx(C,{"code-path":"src/components/system/SystemUserTab.tsx:158:19",className:"text-slate-400",children:"联系方式"}),s.jsx(C,{"code-path":"src/components/system/SystemUserTab.tsx:159:19",className:"text-slate-400",children:"角色"}),s.jsx(C,{"code-path":"src/components/system/SystemUserTab.tsx:160:19",className:"text-slate-400",children:"来源"}),s.jsx(C,{"code-path":"src/components/system/SystemUserTab.tsx:161:19",className:"text-slate-400",children:"状态"}),s.jsx(C,{"code-path":"src/components/system/SystemUserTab.tsx:162:19",className:"text-slate-400",children:"最后登录"}),s.jsx(C,{"code-path":"src/components/system/SystemUserTab.tsx:163:19",className:"text-slate-400 text-right",children:"操作"})]})}),s.jsx($s,{"code-path":"src/components/system/SystemUserTab.tsx:166:15",children:a?s.jsx(es,{"code-path":"src/components/system/SystemUserTab.tsx:168:19",className:"border-slate-800",children:s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:169:21",colSpan:7,className:"text-center py-12",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:170:23",className:"flex items-center justify-center",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:171:25",className:"h-6 w-6 border-2 border-slate-700 border-t-blue-500 rounded-full animate-spin"})})})}):t.length===0?s.jsx(es,{"code-path":"src/components/system/SystemUserTab.tsx:176:19",className:"border-slate-800",children:s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:177:21",colSpan:7,className:"text-center py-12 text-sm text-slate-500",children:"暂无用户数据"})}):t.map(T=>s.jsxs(es,{"code-path":"src/components/system/SystemUserTab.tsx:183:21",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:184:23",children:s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:185:25",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:186:27",className:"w-8 h-8 rounded-full bg-blue-600 flex items-center justify-center text-white text-sm font-medium",children:(T.nickname||T.username||"?").charAt(0)}),s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:189:27",children:[s.jsx("p",{"code-path":"src/components/system/SystemUserTab.tsx:190:29",className:"text-sm font-medium text-slate-200",children:T.nickname||T.username}),s.jsxs("p",{"code-path":"src/components/system/SystemUserTab.tsx:191:29",className:"text-xs text-slate-500",children:["@",T.username]})]})]})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:195:23",children:s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:196:25",className:"space-y-1",children:[s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:197:27",className:"flex items-center gap-1 text-sm text-slate-400",children:[s.jsx(we,{"code-path":"src/components/system/SystemUserTab.tsx:198:29",className:"h-3.5 w-3.5"}),T.email||"--"]}),T.phone&&s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:202:29",className:"flex items-center gap-1 text-sm text-slate-400",children:[s.jsx(Ue,{"code-path":"src/components/system/SystemUserTab.tsx:203:31",className:"h-3.5 w-3.5"}),T.phone]})]})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:209:23",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:210:25",className:"flex flex-wrap gap-1",children:(T.roles||[]).map(O=>s.jsx(cs,{"code-path":"src/components/system/SystemUserTab.tsx:212:29",variant:"outline",className:"border-slate-700 text-slate-400",children:O},O))})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:218:23",children:T.authSource==="ldap"?s.jsx(cs,{"code-path":"src/components/system/SystemUserTab.tsx:220: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:224: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:229:23",children:b(T.status)}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:230:23",children:s.jsx("span",{"code-path":"src/components/system/SystemUserTab.tsx:231:25",className:"text-sm text-slate-400",children:T.lastLoginAt?new Date(T.lastLoginAt).toLocaleString():"--"})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:235:23",className:"text-right",children:s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:236:25",className:"flex items-center justify-end gap-1",children:[s.jsx(x,{"code-path":"src/components/system/SystemUserTab.tsx:237:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-100",onClick:()=>p(T),children:s.jsx(pe,{"code-path":"src/components/system/SystemUserTab.tsx:243:29",className:"h-4 w-4"})}),A("system:user")&&s.jsx(x,{"code-path":"src/components/system/SystemUserTab.tsx:246:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-100",onClick:()=>g(T),children:s.jsx(ws,{"code-path":"src/components/system/SystemUserTab.tsx:252:29",className:"h-4 w-4"})}),A("system:user")&&s.jsx(x,{"code-path":"src/components/system/SystemUserTab.tsx:256:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-400",onClick:()=>P(T),children:s.jsx(se,{"code-path":"src/components/system/SystemUserTab.tsx:262:29",className:"h-4 w-4"})})]})})]},T.id))})]})})})}),s.jsx(Pe,{"code-path":"src/components/system/SystemUserTab.tsx:277:7",selectedUser:m,setSelectedUser:p,getUserStatusBadge:b,openEdit:g,onResetPassword:M}),s.jsx(Oe,{"code-path":"src/components/system/SystemUserTab.tsx:285:7",open:f,onOpenChange:S,editingUser:c,form:L,setForm:h,saving:y,onSubmit:N}),s.jsx(Ae,{"code-path":"src/components/system/SystemUserTab.tsx:295:7",importDialogOpen:E,setImportDialogOpen:k,importPreview:B,setImportPreview:ts,importing:z,importResult:r,setImportResult:I,handleCsvUpload:u,handleBatchImport:_}),s.jsx(Ee,{"code-path":"src/components/system/SystemUserTab.tsx:307:7",importDialogOpen:E,setImportDialogOpen:k,ldapUsers:V,setLdapUsers:ps,ldapSelected:Q,setLdapSelected:hs,ldapLoading:F,ldapImportOUs:W,ldapImportOUDN:U,setLdapImportOUDN:ls,loadLdapUsers:ds,handleLdapImport:q,importing:z,importResult:r,setImportResult:I})]})}const $e=[{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 Be(e){const l=$e.map(m=>({key:m.key,label:m.label,items:e.filter(p=>m.prefixes.some(b=>p.code.startsWith(b)))})).filter(m=>m.items.length>0),t=new Set(l.flatMap(m=>m.items.map(p=>p.id))),a=e.filter(m=>!t.has(m.id));return a.length>0&&l.push({key:"other",label:"📌 其他",items:a}),l}function Ve({open:e,onOpenChange:l,editingRole:t,form:a,setForm:m,saving:p,onSubmit:b,permissions:f}){const S=(h,y)=>{m(N=>{const j=new Set(N.permission_ids);return y?j.add(h):j.delete(h),{...N,permission_ids:Array.from(j)}})},c=(h,y)=>{m(N=>{const j=new Set(N.permission_ids);return h.forEach(g=>y?j.add(g.id):j.delete(g.id)),{...N,permission_ids:Array.from(j)}})},L=Be(f);return s.jsx(J,{"code-path":"src/components/system/RoleFormDialog.tsx:91:5",open:e,onOpenChange:l,children:s.jsxs(X,{"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(Y,{"code-path":"src/components/system/RoleFormDialog.tsx:93:9",children:[s.jsxs(Z,{"code-path":"src/components/system/RoleFormDialog.tsx:94:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[s.jsx(ee,{"code-path":"src/components/system/RoleFormDialog.tsx:95:13",className:"h-5 w-5 text-purple-400"}),t?"编辑角色":"新建角色"]}),s.jsx(ss,{"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(bs,{"code-path":"src/components/system/RoleFormDialog.tsx:106:15",className:"text-xs text-[var(--dg-text-secondary)]",children:"角色名称"}),s.jsx(D,{"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(bs,{"code-path":"src/components/system/RoleFormDialog.tsx:115:15",className:"text-xs text-[var(--dg-text-secondary)]",children:"角色编码"}),s.jsx(D,{"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(bs,{"code-path":"src/components/system/RoleFormDialog.tsx:126:13",className:"text-xs text-[var(--dg-text-secondary)]",children:"描述"}),s.jsx(Ie,{"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(bs,{"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:L.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:"暂无可分配权限"}):L.map(h=>{const y=h.items.filter(j=>a.permission_ids.includes(j.id)).length,N=y===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:()=>c(h.items,!N),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:["(",y,"/",h.items.length,")"]})]}),s.jsx("button",{"code-path":"src/components/system/RoleFormDialog.tsx:163:25",onClick:()=>c(h.items,!N),className:"text-[10px] text-blue-400 hover:text-blue-300 transition-colors",children:N?"取消全选":"全选"})]}),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(j=>s.jsxs(bs,{"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(j.id),onCheckedChange:g=>S(j.id,g===!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:j.name})]},j.id))})]},h.key)})})]})]}),s.jsxs(os,{"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:()=>l(!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:b,disabled:p,children:p?"保存中...":"保存"})]})]})})}const He={super_admin:"👑",k8s_admin:"☸️",resource_admin:"🖥️",monitor_admin:"📡",security_auditor:"🔍",release_admin:"🚀",viewer:"👁️"},Ge=[{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 Ke(e,l){return Ge.map(a=>{const m=e.filter((p,b)=>a.prefixes.some(f=>(l[b]||"").startsWith(f)));return{label:a.label,count:m.length}}).filter(a=>a.count>0)}function Qe(e){const l=Array.isArray(e.permissions)?e.permissions:[];return{id:String(e.id??""),name:e.name??"",code:e.code??"",description:e.description??"",permissions:l.map(t=>typeof t=="string"?t:t?.name??t?.code??"").filter(Boolean),permissionCodes:l.map(t=>typeof t=="string"?t:t?.code??"").filter(Boolean),createdAt:e.createdAt??e.created_at??"",isSystem:e.is_system??e.isSystem??!1,_permissionIds:l.map(t=>typeof t=="object"?Number(t.id):0).filter(Boolean),_raw:e}}const me={name:"",code:"",description:"",permission_ids:[]};function We({selectedRole:e,setSelectedRole:l}){const t=Ws(),[a,m]=n.useState([]),[p,b]=n.useState(!0),[f,S]=n.useState([]),[c,L]=n.useState(!1),[h,y]=n.useState(null),[N,j]=n.useState({...me}),[g,P]=n.useState(!1),M=n.useCallback(async()=>{b(!0);try{const I=(await K.getRoles())?.list??[];m(I.map(Qe))}catch{m([])}finally{b(!1)}},[]),E=n.useCallback(async()=>{try{const I=(await K.getPermissions())?.list??[];S(I.map(u=>({id:Number(u.id),name:u.name??u.code??"",code:u.code??"",type:u.type})))}catch{S([])}},[]);n.useEffect(()=>{M(),E()},[M,E]);const k=()=>{y(null),j({...me}),L(!0)},B=r=>{y(r._raw||r),j({name:r.name??"",code:r.code??"",description:r.description??"",permission_ids:Array.isArray(r._permissionIds)?[...r._permissionIds]:[]}),L(!0)},ts=async()=>{if(!N.name.trim()){H.error("请输入角色名称");return}if(!N.code.trim()){H.error("请输入角色编码");return}P(!0);try{const r={name:N.name.trim(),code:N.code.trim(),description:N.description.trim(),permission_ids:N.permission_ids};h?(await K.updateRole(h.id,r),H.success("角色更新成功")):(await K.createRole(r),H.success("角色创建成功")),L(!1),await M()}catch(r){H.error(r?.message||"保存失败")}finally{P(!1)}},z=async r=>{if(r.isSystem){H.error("系统默认角色不可删除");return}if(await t({title:"删除角色",description:`确认删除角色「${r.name}」吗?该操作不可恢复。`,confirmText:"删除",variant:"destructive"}))try{await K.deleteRole(r.id),H.success("角色已删除"),await M()}catch(u){const _=u?.response?.data?.message||u?.message||"删除失败";H.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:k,children:[s.jsx(Zs,{"code-path":"src/components/system/SystemRolesTab.tsx:190:11",className:"h-4 w-4 mr-2"}),"新建角色"]})]}),p?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(ee,{"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(r=>{const I=r.permissions,u=r.permissionCodes,_=Ke(I,u),V=He[r.code]||"🛡️";return s.jsxs(ys,{"code-path":"src/components/system/SystemRolesTab.tsx:211:15",className:`bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] ${r.isSystem?"border-purple-500/20":""}`,children:[s.jsx(fs,{"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 ${r.isSystem?"bg-purple-500/10":"bg-[var(--dg-bg-tertiary)]"}`,children:V}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:220:23",children:[s.jsxs(Ls,{"code-path":"src/components/system/SystemRolesTab.tsx:221:25",className:"text-base text-[var(--dg-text-primary)] flex items-center gap-1.5",children:[r.name,r.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(te,{"code-path":"src/components/system/SystemRolesTab.tsx:225:31",className:"h-2.5 w-2.5 mr-0.5"}),"系统"]})]}),s.jsx(Ts,{"code-path":"src/components/system/SystemRolesTab.tsx:229:25",className:"text-[var(--dg-text-muted)] text-xs",children:r.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:()=>l(r),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(r),children:s.jsx(ws,{"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:()=>z(r),disabled:r.isSystem,title:r.isSystem?"系统默认角色不可删除":"删除角色",children:s.jsx(se,{"code-path":"src/components/system/SystemRolesTab.tsx:254:25",className:`h-4 w-4 ${r.isSystem?"opacity-30":""}`})})]})]})}),s.jsxs(gs,{"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:r.description||"暂无描述"}),s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:262:19",className:"flex flex-wrap gap-1.5",children:_.map(Q=>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:[Q.label,"·",Q.count]},Q.label))}),I.length===0&&s.jsx("span",{"code-path":"src/components/system/SystemRolesTab.tsx:270:21",className:"text-xs text-[var(--dg-text-muted)]",children:"未分配权限"})]})]},r.id)})}),s.jsx(qe,{"code-path":"src/components/system/SystemRolesTab.tsx:280:7",role:e,onClose:()=>l(null),onEdit:r=>{l(null),B(r)}}),s.jsx(Ve,{"code-path":"src/components/system/SystemRolesTab.tsx:283:7",open:c,onOpenChange:L,editingRole:h,form:N,setForm:j,saving:g,onSubmit:ts,permissions:f})]})}function qe({role:e,onClose:l,onEdit:t}){const m=e?.isSystem??!1;return s.jsx(J,{"code-path":"src/components/system/SystemRolesTab.tsx:299:5",open:!!e,onOpenChange:p=>!p&&l(),children:s.jsxs(X,{"code-path":"src/components/system/SystemRolesTab.tsx:300:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[s.jsxs(Y,{"code-path":"src/components/system/SystemRolesTab.tsx:301:9",children:[s.jsxs(Z,{"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(te,{"code-path":"src/components/system/SystemRolesTab.tsx:307:17",className:"h-2.5 w-2.5 mr-0.5"}),"系统"]})]}),s.jsxs(ss,{"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((p,b)=>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:p},b))}):s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:331:15",className:"text-xs text-[var(--dg-text-muted)]",children:"未分配权限"})]})]}),s.jsx(os,{"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(ws,{"code-path":"src/components/system/SystemRolesTab.tsx:337:13",className:"h-4 w-4 mr-2"}),"编辑"]})})]})})}function Je(e){const{ldapConfig:l,ldapMgmtOpen:t,setLdapMgmtOpen:a,ldapOUs:m,selectedOUDN:p,setSelectedOUDN:b,ldapUsers:f,selectedLDAPUsers:S,setSelectedLDAPUsers:c,loadLdapOUs:L,loadLdapOUUsers:h,handleLdapImport:y,importing:N,importFeedback:j,importResultOpen:g,setImportResultOpen:P,createOUOpen:M,setCreateOUOpen:E,ouForm:k,setOuForm:B,handleCreateOU:ts,ldapSaving:z,createUserOpen:r,setCreateUserOpen:I,newUser:u,setNewUser:_,handleCreateLDAPUser:V,ldapUserTestOpen:Q,setLdapUserTestOpen:hs,ldapTestUser:F,setLdapTestUser:W,ldapTestPass:U,setLdapTestPass:ls,ldapUserTesting:ds,ldapUserTestResult:q,handleLdapUserTest:ps,editLdapUser:A,setEditLdapUser:T,editLdapForm:O,setEditLdapForm:as,handleUpdateLdapUser:i,handleDeleteLDAPEntry:ns,openEditLdapUser:is}=e;return s.jsxs(s.Fragment,{children:[s.jsxs("button",{"code-path":"src/components/system/LdapManagementSection.tsx:140:7",onClick:()=>{const o=!t;a(o),o&&m.length===0&&L()},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(J,{"code-path":"src/components/system/LdapManagementSection.tsx:157:13",open:Q,onOpenChange:hs,children:[s.jsx(Hs,{"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(Bs,{"code-path":"src/components/system/LdapManagementSection.tsx:160:19",className:"h-3.5 w-3.5 mr-1"}),"账号验证"]})}),s.jsxs(X,{"code-path":"src/components/system/LdapManagementSection.tsx:164:15",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(Y,{"code-path":"src/components/system/LdapManagementSection.tsx:165:17",children:[s.jsx(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:166:19",className:"text-slate-100",children:"LDAP 账号验证测试"}),s.jsx(ss,{"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(D,{"code-path":"src/components/system/LdapManagementSection.tsx:172:21",value:F,onChange:o=>W(o.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(D,{"code-path":"src/components/system/LdapManagementSection.tsx:181:21",type:"password",value:U,onChange:o=>ls(o.target.value),onKeyDown:o=>o.key==="Enter"&&ps(),placeholder:"••••••",className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600"})]}),q&&s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:191:21",className:`p-3 rounded-lg text-sm ${q.success?"bg-emerald-500/10 text-emerald-300":"bg-red-500/10 text-red-300"}`,children:[q.message,q.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(q.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:ps,disabled:ds||!F,children:[ds?s.jsx(Ss,{"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:L,children:[s.jsx(Ys,{"code-path":"src/components/system/LdapManagementSection.tsx:211:15",className:"h-3.5 w-3.5 mr-1"}),"刷新"]}),s.jsxs(Rs,{"code-path":"src/components/system/LdapManagementSection.tsx:216:13",value:p,onValueChange:o=>{b(o),h(o)},children:[s.jsx(Is,{"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(_s,{"code-path":"src/components/system/LdapManagementSection.tsx:218:17",placeholder:"选择组织单元"})}),s.jsxs(Fs,{"code-path":"src/components/system/LdapManagementSection.tsx:220:15",className:"bg-slate-800 border-slate-700",children:[s.jsxs(G,{"code-path":"src/components/system/LdapManagementSection.tsx:221:17",value:l.base_dn,children:["根 (",l.base_dn,")"]}),m.map(o=>s.jsx(G,{"code-path":"src/components/system/LdapManagementSection.tsx:223:19",value:o.dn,children:o.description?`${o.name} (${o.description})`:o.name},o.dn))]})]}),s.jsxs(J,{"code-path":"src/components/system/LdapManagementSection.tsx:231:13",open:M,onOpenChange:E,children:[s.jsx(Hs,{"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(Zs,{"code-path":"src/components/system/LdapManagementSection.tsx:234:19",className:"h-3.5 w-3.5 mr-1"}),"新建 OU"]})}),s.jsxs(X,{"code-path":"src/components/system/LdapManagementSection.tsx:238:15",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(Y,{"code-path":"src/components/system/LdapManagementSection.tsx:239:17",children:[s.jsx(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:240:19",className:"text-slate-100",children:"新建组织单元"}),s.jsx(ss,{"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(D,{"code-path":"src/components/system/LdapManagementSection.tsx:246:21",value:k.ou_name,onChange:o=>B({...k,ou_name:o.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(D,{"code-path":"src/components/system/LdapManagementSection.tsx:250:21",value:k.parent_dn,onChange:o=>B({...k,parent_dn:o.target.value}),placeholder:l.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(D,{"code-path":"src/components/system/LdapManagementSection.tsx:254:21",value:k.description,onChange:o=>B({...k,description:o.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:ts,disabled:!k.ou_name||z,children:[z?s.jsx(Ss,{"code-path":"src/components/system/LdapManagementSection.tsx:257:35",className:"h-4 w-4 mr-1.5 animate-spin"}):null,"创建"]})]})]})]}),s.jsxs(J,{"code-path":"src/components/system/LdapManagementSection.tsx:265:13",open:r,onOpenChange:I,children:[s.jsx(Hs,{"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(X,{"code-path":"src/components/system/LdapManagementSection.tsx:272:15",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(Y,{"code-path":"src/components/system/LdapManagementSection.tsx:273:17",children:[s.jsx(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:274:19",className:"text-slate-100",children:"添加 LDAP 用户"}),s.jsx(ss,{"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(D,{"code-path":"src/components/system/LdapManagementSection.tsx:280:21",value:u.username,onChange:o=>_({...u,username:o.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(D,{"code-path":"src/components/system/LdapManagementSection.tsx:284:21",type:"password",value:u.password,onChange:o=>_({...u,password:o.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(D,{"code-path":"src/components/system/LdapManagementSection.tsx:288:21",value:u.display_name,onChange:o=>_({...u,display_name:o.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(D,{"code-path":"src/components/system/LdapManagementSection.tsx:292:21",value:u.email,onChange:o=>_({...u,email:o.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(D,{"code-path":"src/components/system/LdapManagementSection.tsx:296:21",value:u.ou_dn||p||l.base_dn,onChange:o=>_({...u,ou_dn:o.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:V,disabled:!u.username||!u.password||z,children:[z?s.jsx(Ss,{"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:y,disabled:f.length===0||N,children:[N?s.jsx(Ss,{"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"}),S.length>0?`导入 (${S.length})`:`导入全部 (${f.length})`]})]}),j&&s.jsx(J,{"code-path":"src/components/system/LdapManagementSection.tsx:320:13",open:g,onOpenChange:P,children:s.jsxs(X,{"code-path":"src/components/system/LdapManagementSection.tsx:321:15",className:"max-w-sm bg-slate-900 border-slate-800",children:[s.jsxs(Y,{"code-path":"src/components/system/LdapManagementSection.tsx:322:17",children:[s.jsx(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:323:19",className:"text-slate-100",children:"导入结果"}),s.jsx(ss,{"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:j}),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:()=>P(!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(Es,{"code-path":"src/components/system/LdapManagementSection.tsx:338:13",children:[s.jsx(zs,{"code-path":"src/components/system/LdapManagementSection.tsx:339:15",children:s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:340:17",className:"border-slate-800 hover:bg-transparent",children:[s.jsx(C,{"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:S.length>0&&S.length===f.length,onChange:o=>c(o.target.checked?f.map(js=>js.dn):[])})}),s.jsx(C,{"code-path":"src/components/system/LdapManagementSection.tsx:349:19",className:"text-slate-400",children:"用户名"}),s.jsx(C,{"code-path":"src/components/system/LdapManagementSection.tsx:350:19",className:"text-slate-400",children:"显示名称"}),s.jsx(C,{"code-path":"src/components/system/LdapManagementSection.tsx:351:19",className:"text-slate-400",children:"邮箱"}),s.jsx(C,{"code-path":"src/components/system/LdapManagementSection.tsx:352:19",className:"text-slate-400",children:"DN"}),s.jsx(C,{"code-path":"src/components/system/LdapManagementSection.tsx:353:19",className:"text-slate-400 w-12",children:"操作"})]})}),s.jsx($s,{"code-path":"src/components/system/LdapManagementSection.tsx:356:15",children:f.length===0?s.jsx(es,{"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 用户"})}):f.map(o=>s.jsxs(es,{"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:S.includes(o.dn),onChange:js=>{js.target.checked?c([...S,o.dn]):c(S.filter(ms=>ms!==o.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:o.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:o.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:o.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:o.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:()=>is(o),children:s.jsx(ws,{"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:()=>ns(o.dn),children:s.jsx(se,{"code-path":"src/components/system/LdapManagementSection.tsx:405:29",className:"h-3 w-3"})})]})})]},o.dn))})]})})]}),s.jsx(J,{"code-path":"src/components/system/LdapManagementSection.tsx:419:7",open:!!A,onOpenChange:o=>!o&&T(null),children:s.jsxs(X,{"code-path":"src/components/system/LdapManagementSection.tsx:420:9",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(Y,{"code-path":"src/components/system/LdapManagementSection.tsx:421:11",children:[s.jsxs(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:422:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(ws,{"code-path":"src/components/system/LdapManagementSection.tsx:423:15",className:"h-5 w-5 text-blue-400"}),"编辑 LDAP 用户"]}),s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:426:13",className:"text-slate-500",children:["修改 ",A?.uid," 的属性"]})]}),A&&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(D,{"code-path":"src/components/system/LdapManagementSection.tsx:434:17",value:A.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(D,{"code-path":"src/components/system/LdapManagementSection.tsx:438:17",value:O.cn,onChange:o=>as({...O,cn:o.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(D,{"code-path":"src/components/system/LdapManagementSection.tsx:442:17",value:O.mail,onChange:o=>as({...O,mail:o.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(D,{"code-path":"src/components/system/LdapManagementSection.tsx:446:17",value:O.phone,onChange:o=>as({...O,phone:o.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(D,{"code-path":"src/components/system/LdapManagementSection.tsx:450:17",value:O.title,onChange:o=>as({...O,title:o.target.value}),placeholder:"运维工程师",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]})]}),s.jsxs(os,{"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:()=>T(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:i,children:"保存"})]})]})})]})}function Xe(e){const{ldapConfig:l,ldapForm:t,setLdapForm:a,ldapSaving:m,ldapTesting:p,ldapTestResult:b,handleLdapSave:f,handleLdapTest:S}=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(ys,{"code-path":"src/components/system/SystemSettingsTab.tsx:94:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(fs,{"code-path":"src/components/system/SystemSettingsTab.tsx:95:11",children:[s.jsxs(Ls,{"code-path":"src/components/system/SystemSettingsTab.tsx:96:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(te,{"code-path":"src/components/system/SystemSettingsTab.tsx:97:15",className:"h-5 w-5 text-blue-400"}),"安全设置"]}),s.jsx(Ts,{"code-path":"src/components/system/SystemSettingsTab.tsx:100:13",className:"text-slate-500",children:"密码策略与登录安全"})]}),s.jsxs(gs,{"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(Ds,{"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(Ds,{"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(Ds,{"code-path":"src/components/system/SystemSettingsTab.tsx:122:15",className:"data-[state=checked]:bg-blue-600"})]})]})]}),s.jsxs(ys,{"code-path":"src/components/system/SystemSettingsTab.tsx:127:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(fs,{"code-path":"src/components/system/SystemSettingsTab.tsx:128:11",children:[s.jsxs(Ls,{"code-path":"src/components/system/SystemSettingsTab.tsx:129:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Re,{"code-path":"src/components/system/SystemSettingsTab.tsx:130:15",className:"h-5 w-5 text-emerald-400"}),"审计设置"]}),s.jsx(Ts,{"code-path":"src/components/system/SystemSettingsTab.tsx:133:13",className:"text-slate-500",children:"操作日志与审计策略"})]}),s.jsxs(gs,{"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(Ds,{"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(Rs,{"code-path":"src/components/system/SystemSettingsTab.tsx:148:15",defaultValue:"180",children:[s.jsx(Is,{"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(_s,{"code-path":"src/components/system/SystemSettingsTab.tsx:150:19"})}),s.jsxs(Fs,{"code-path":"src/components/system/SystemSettingsTab.tsx:152:17",className:"bg-slate-800 border-slate-700",children:[s.jsx(G,{"code-path":"src/components/system/SystemSettingsTab.tsx:153:19",value:"30",children:"30天"}),s.jsx(G,{"code-path":"src/components/system/SystemSettingsTab.tsx:154:19",value:"90",children:"90天"}),s.jsx(G,{"code-path":"src/components/system/SystemSettingsTab.tsx:155:19",value:"180",children:"180天"}),s.jsx(G,{"code-path":"src/components/system/SystemSettingsTab.tsx:156:19",value:"365",children:"1年"})]})]})]})]})]}),s.jsxs(ys,{"code-path":"src/components/system/SystemSettingsTab.tsx:163:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(fs,{"code-path":"src/components/system/SystemSettingsTab.tsx:164:11",children:[s.jsxs(Ls,{"code-path":"src/components/system/SystemSettingsTab.tsx:165:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:166:15",className:"h-5 w-5 text-amber-400"}),"会话设置"]}),s.jsx(Ts,{"code-path":"src/components/system/SystemSettingsTab.tsx:169:13",className:"text-slate-500",children:"会话超时与Token配置"})]}),s.jsxs(gs,{"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(Rs,{"code-path":"src/components/system/SystemSettingsTab.tsx:177:15",defaultValue:"30",children:[s.jsx(Is,{"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(_s,{"code-path":"src/components/system/SystemSettingsTab.tsx:179:19"})}),s.jsxs(Fs,{"code-path":"src/components/system/SystemSettingsTab.tsx:181:17",className:"bg-slate-800 border-slate-700",children:[s.jsx(G,{"code-path":"src/components/system/SystemSettingsTab.tsx:182:19",value:"15",children:"15分钟"}),s.jsx(G,{"code-path":"src/components/system/SystemSettingsTab.tsx:183:19",value:"30",children:"30分钟"}),s.jsx(G,{"code-path":"src/components/system/SystemSettingsTab.tsx:184:19",value:"60",children:"1小时"}),s.jsx(G,{"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(Ds,{"code-path":"src/components/system/SystemSettingsTab.tsx:194:15",className:"data-[state=checked]:bg-blue-600"})]})]})]}),s.jsxs(ys,{"code-path":"src/components/system/SystemSettingsTab.tsx:199:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(fs,{"code-path":"src/components/system/SystemSettingsTab.tsx:200:11",children:[s.jsxs(Ls,{"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(Ts,{"code-path":"src/components/system/SystemSettingsTab.tsx:205:13",className:"text-slate-500",children:"版本与系统状态"})]}),s.jsxs(gs,{"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(ys,{"code-path":"src/components/system/SystemSettingsTab.tsx:221:7",className:"bg-slate-900 border-slate-800 mt-4",children:[s.jsx(fs,{"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(Ls,{"code-path":"src/components/system/SystemSettingsTab.tsx:225:15",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:226:17",className:"h-5 w-5 text-cyan-400"}),"LDAP / Active Directory"]}),s.jsx(Ts,{"code-path":"src/components/system/SystemSettingsTab.tsx:229:15",className:"text-slate-500 mt-1",children:"配置 LDAP 服务器,实现统一身份认证"})]})})}),s.jsxs(gs,{"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(D,{"code-path":"src/components/system/SystemSettingsTab.tsx:237:15",value:t.ldap_host,onChange:c=>a({...t,ldap_host:c.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(D,{"code-path":"src/components/system/SystemSettingsTab.tsx:246:15",type:"number",value:t.ldap_port,onChange:c=>a({...t,ldap_port:Number(c.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(D,{"code-path":"src/components/system/SystemSettingsTab.tsx:256:15",value:t.base_dn,onChange:c=>a({...t,base_dn:c.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(D,{"code-path":"src/components/system/SystemSettingsTab.tsx:265:15",value:t.admin_dn,onChange:c=>a({...t,admin_dn:c.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:["管理员密码 ",l&&"(留空不修改)"]}),s.jsx(D,{"code-path":"src/components/system/SystemSettingsTab.tsx:274:15",type:"password",value:t.admin_password,onChange:c=>a({...t,admin_password:c.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(D,{"code-path":"src/components/system/SystemSettingsTab.tsx:284:15",value:t.search_filter,onChange:c=>a({...t,search_filter:c.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(Ds,{"code-path":"src/components/system/SystemSettingsTab.tsx:292:15",checked:t.use_ldaps,onCheckedChange:c=>a({...t,use_ldaps:c}),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:[b&&s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:304:15",className:`text-xs ${b.includes("成功")?"text-emerald-400":"text-red-400"}`,children:b}),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:S,disabled:p,children:[p?s.jsx(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:316:32",className:"h-3.5 w-3.5 mr-1 animate-spin"}):s.jsx(Ys,{"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:f,disabled:m,children:m?"保存中...":"保存配置"})]})]})]})]}),l&&s.jsx("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:334:9",className:"mt-4",children:s.jsx(Je,{"code-path":"src/components/system/SystemSettingsTab.tsx:335:11",...e})})]})}function Ye({user:e,onClose:l}){const{toast:t}=Fe(),[a,m]=n.useState(""),[p,b]=n.useState(""),[f,S]=n.useState(!1),c=e?.authSource==="ldap",L=a.length>=6&&a===p&&!c,h=async()=>{if(!(!e||!L)){S(!0);try{await K.resetUserPassword(e.id,a),t({title:"密码已重置",description:`用户 ${e.nickname||e.username} 的新密码已生效`}),m(""),b(""),l()}catch(y){t({title:"重置失败",description:y?.message||String(y),variant:"destructive"})}finally{S(!1)}}};return s.jsx(J,{"code-path":"src/components/system/ResetPasswordDialog.tsx:44:5",open:!!e,onOpenChange:y=>{y||(m(""),b(""),l())},children:s.jsxs(X,{"code-path":"src/components/system/ResetPasswordDialog.tsx:45:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] sm:max-w-md",children:[s.jsxs(Y,{"code-path":"src/components/system/ResetPasswordDialog.tsx:46:9",children:[s.jsxs(Z,{"code-path":"src/components/system/ResetPasswordDialog.tsx:47:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[s.jsx(Bs,{"code-path":"src/components/system/ResetPasswordDialog.tsx:48:13",className:"h-5 w-5 text-[var(--dg-blue)]"}),"重置密码"]}),s.jsx(ss,{"code-path":"src/components/system/ResetPasswordDialog.tsx:51:11",className:"text-[var(--dg-text-muted)]",children:e?`为「${e.nickname||e.username}」设置新密码`:""})]}),c?s.jsx("p",{"code-path":"src/components/system/ResetPasswordDialog.tsx:57:11",className:"text-sm text-amber-400/90 py-2",children:"LDAP 用户请在 LDAP 目录中管理密码,不支持本地重置。"}):s.jsxs("div",{"code-path":"src/components/system/ResetPasswordDialog.tsx:59:11",className:"space-y-3 py-1",children:[s.jsxs("div",{"code-path":"src/components/system/ResetPasswordDialog.tsx:60:13",children:[s.jsx(bs,{"code-path":"src/components/system/ResetPasswordDialog.tsx:61:15",className:"text-xs text-[var(--dg-text-muted)]",children:"新密码"}),s.jsx(D,{"code-path":"src/components/system/ResetPasswordDialog.tsx:62:15",type:"password",value:a,onChange:y=>m(y.target.value),placeholder:"至少 6 位",className:"mt-1 h-9 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"})]}),s.jsxs("div",{"code-path":"src/components/system/ResetPasswordDialog.tsx:70:13",children:[s.jsx(bs,{"code-path":"src/components/system/ResetPasswordDialog.tsx:71:15",className:"text-xs text-[var(--dg-text-muted)]",children:"确认密码"}),s.jsx(D,{"code-path":"src/components/system/ResetPasswordDialog.tsx:72:15",type:"password",value:p,onChange:y=>b(y.target.value),placeholder:"再次输入新密码",className:"mt-1 h-9 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"})]})]}),s.jsxs(os,{"code-path":"src/components/system/ResetPasswordDialog.tsx:83:9",children:[s.jsx(x,{"code-path":"src/components/system/ResetPasswordDialog.tsx:84:11",variant:"outline",className:"border-[var(--dg-border)]",onClick:l,children:"取消"}),!c&&s.jsxs(x,{"code-path":"src/components/system/ResetPasswordDialog.tsx:86:13",onClick:h,disabled:!L||f,className:"bg-[var(--dg-blue)] hover:opacity-90",children:[f?s.jsx(Ss,{"code-path":"src/components/system/ResetPasswordDialog.tsx:87:25",className:"h-4 w-4 animate-spin mr-1"}):null,"确认重置"]})]})]})})}function Ze(e){const l=Ws(),[t,a]=n.useState([]),[m,p]=n.useState(new Set),[b,f]=n.useState(!1),[S,c]=n.useState([]),[L,h]=n.useState(""),[y,N]=n.useState(null),[j,g]=n.useState({ldap_host:"",ldap_port:389,use_ldaps:!1,admin_dn:"",admin_password:"",base_dn:"",search_filter:""}),[P,M]=n.useState(!1),[E,k]=n.useState(!1),[B,ts]=n.useState(null),[z,r]=n.useState(!1),[I,u]=n.useState(null),[_,V]=n.useState(!1),[Q,hs]=n.useState([]),[F,W]=n.useState(""),[U,ls]=n.useState([]),[ds,q]=n.useState(!1),[ps,A]=n.useState(!1),[T,O]=n.useState({ou_name:"",parent_dn:"",description:""}),[as,i]=n.useState({username:"",password:"",display_name:"",email:"",ou_dn:""}),[ns,is]=n.useState(!1),[o,js]=n.useState(""),[ms,xs]=n.useState(""),[Os,Us]=n.useState(!1),[Ps,us]=n.useState(null),[Ns,vs]=n.useState(null),[Cs,v]=n.useState({cn:"",mail:"",phone:"",title:""}),[rs,Ms]=n.useState(!1),ae=async()=>{try{const d=await $.getConfig();d&&d.ldap_host&&(N(d),g({ldap_host:d.ldap_host||"",ldap_port:d.ldap_port||389,use_ldaps:d.use_ldaps||!1,admin_dn:d.admin_dn||"",admin_password:"",base_dn:d.base_dn||"",search_filter:d.search_filter||""}))}catch{}},he=async()=>{M(!0);try{await $.updateConfig(j),await ae()}catch(d){console.error("Failed to save LDAP config:",d)}finally{M(!1)}},ye=async()=>{k(!0),ts(null);try{await $.updateConfig(j);const d=await $.testConnection();ts(d?.message||(d?.success?"连接成功":"连接失败"))}catch(d){ts(d?.message||"连接失败")}finally{k(!1)}},ks=async d=>{try{const R=await $.listUsers(d);a(R||[])}catch(R){console.error("loadOUUsers",R)}},ce=async()=>{try{const d=await $.listOUs();hs(d||[]),!F&&y?.base_dn&&(W(y.base_dn),await ks(y.base_dn))}catch(d){console.error("loadOUs",d)}},ge=async()=>{M(!0);try{await $.createOU(T),q(!1),O({ou_name:"",parent_dn:"",description:""}),await ce()}catch(d){const R=d?.message||"";R.includes("Already Exists")||R.includes("68")?H.error(`OU "${T.ou_name}" 已存在,请使用其他名称`):H.error("创建失败: "+R)}finally{M(!1)}},be=async()=>{M(!0);try{await $.createUser({...as,ou_dn:as.ou_dn||F||y?.base_dn}),A(!1),i({username:"",password:"",display_name:"",email:"",ou_dn:""}),await ks(F)}catch(d){H.error(d?.message||"创建失败")}finally{M(!1)}},Se=async(d,R=!1)=>{if(!(!R&&!await l({title:"删除 LDAP 条目",description:`确定删除 ${d}?`,confirmText:"删除",variant:"destructive"})))try{await $.deleteUser(d),R||await ks(F)}catch(As){R||H.error(As?.message||"删除失败")}},je=d=>{vs(d),v({cn:d.cn||"",mail:d.mail||"",phone:d.phone||"",title:d.title||""})},ue=async()=>{if(Ns)try{await $.updateUser({dn:Ns.dn,...Cs}),vs(null),await ks(F)}catch(d){H.error(d?.message||"修改失败")}},Ne=async()=>{Us(!0),us(null);try{const d=await $.testConnection({test_user:o,test_password:ms});us(d)}catch(d){us({success:!1,message:d?.message||"验证失败"})}finally{Us(!1)}},oe=async d=>{f(!0);try{const R=await $.listUsers(d);a(Array.isArray(R)?R:[]),p(new Set)}catch{a([])}finally{f(!1)}},ne=async()=>{let d=[];if(U.length>0?d=t.filter(R=>U.includes(R.dn)):d=t,d.length!==0){Ms(!0);try{const R=d.map(Vs=>({username:Vs.uid||"",nickname:Vs.cn||"",email:Vs.mail||""})),As=await $.batchImport(R);u(As?.message||`成功导入 ${d.length} 个用户`),V(!0),ls([]),await e()}catch(R){u("导入失败: "+(R?.message||"未知错误")),V(!0)}finally{Ms(!1)}}};return{ldapUsers:t,setLdapUsers:a,ldapSelected:m,setLdapSelected:p,ldapLoading:b,ldapImportOUs:S,ldapImportOUDN:L,setLdapImportOUDN:h,loadLdapUsers:oe,handleLdapImport:ne,loadImportDialogData:()=>{$.listOUs().then(d=>c(Array.isArray(d)?d:[])).catch(()=>{}),oe("")},importing:rs,setImporting:Ms,importFeedback:I,importResultOpen:_,setImportResultOpen:V,loadLdapConfig:ae,settingsTabProps:{ldapConfig:y,ldapForm:j,setLdapForm:g,ldapSaving:P,ldapTesting:E,ldapTestResult:B,handleLdapSave:he,handleLdapTest:ye,ldapMgmtOpen:z,setLdapMgmtOpen:r,ldapOUs:Q,selectedOUDN:F,setSelectedOUDN:W,ldapUsers:t,selectedLDAPUsers:U,setSelectedLDAPUsers:ls,loadLdapOUs:ce,loadLdapOUUsers:ks,handleLdapImport:ne,importing:rs,importFeedback:I,importResultOpen:_,setImportResultOpen:V,createOUOpen:ds,setCreateOUOpen:q,ouForm:T,setOuForm:O,handleCreateOU:ge,createUserOpen:ps,setCreateUserOpen:A,newUser:as,setNewUser:i,handleCreateLDAPUser:be,ldapUserTestOpen:ns,setLdapUserTestOpen:is,ldapTestUser:o,setLdapTestUser:js,ldapTestPass:ms,setLdapTestPass:xs,ldapUserTesting:Os,ldapUserTestResult:Ps,handleLdapUserTest:Ne,editLdapUser:Ns,setEditLdapUser:vs,editLdapForm:Cs,setEditLdapForm:v,handleUpdateLdapUser:ue,handleDeleteLDAPEntry:Se,openEditLdapUser:je}}}function st(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 re={username:"",nickname:"",email:"",phone:"",role:"",password:"",status:1};function St(){const e=Ws(),l=De(),t={"/users":"users","/roles":"roles","/settings":"settings"},[a,m]=n.useState(t[l.pathname]||"users");n.useEffect(()=>{const i=t[l.pathname];i&&i!==a&&m(i)},[l.pathname]);const[p,b]=n.useState(""),[f,S]=n.useState([]),[c,L]=n.useState(!0),[h,y]=n.useState(null),[N,j]=n.useState(null),[g,P]=n.useState(null),[M,E]=n.useState(!1),[k,B]=n.useState(null),[ts,z]=n.useState(!1),[r,I]=n.useState({...re}),[u,_]=n.useState(null),[V,Q]=n.useState([]),[hs,F]=n.useState(null),W=async()=>{L(!0);try{const ns=(await K.getUsers({page:1,page_size:100}))?.list??[];S(ns.map(st))}catch(i){console.error("Failed to fetch users:",i),S([])}finally{L(!1)}},U=Ze(W);n.useEffect(()=>{W(),U.loadLdapConfig()},[]),n.useEffect(()=>{u==="ldap"&&U.loadImportDialogData()},[u]);const ls=f.filter(i=>(i.username||"").toLowerCase().includes(p.toLowerCase())||(i.nickname||"").toLowerCase().includes(p.toLowerCase())||(i.email||"").toLowerCase().includes(p.toLowerCase())),ds=i=>i==="active"?s.jsxs(cs,{"code-path":"src/components/system/SystemManager.tsx:112:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[s.jsx(qs,{"code-path":"src/components/system/SystemManager.tsx:113:9",className:"h-3 w-3 mr-1"}),"正常"]}):s.jsxs(cs,{"code-path":"src/components/system/SystemManager.tsx:117:7",variant:"outline",className:"border-slate-500/30 text-slate-400 bg-slate-500/10",children:[s.jsx(Js,{"code-path":"src/components/system/SystemManager.tsx:118:9",className:"h-3 w-3 mr-1"}),"禁用"]}),q=()=>{B(null),I({...re}),E(!0)},ps=i=>{B(i),I({username:i.username||"",nickname:i.nickname||"",email:i.email||"",phone:i.phone||"",role:Array.isArray(i.roles)?i.roles[0]||"":i.role||"",password:"",status:i.status==="active"?1:0}),E(!0)},A=async()=>{z(!0);try{const i={username:r.username,nickname:r.nickname,email:r.email,phone:r.phone,role:r.role,status:r.status};r.password&&(i.password=r.password),k?await K.updateUser(k.id,i):await K.createUser(i),E(!1),await W()}catch(i){console.error("Failed to save user:",i)}finally{z(!1)}},T=async i=>{if(await e({title:"删除用户",description:`确认删除用户「${i.nickname||i.username}」吗?`,confirmText:"删除",variant:"destructive"}))try{await K.deleteUser(i.id),await W()}catch(is){console.error("Failed to delete user:",is)}},O=i=>{const ns=i.target.files?.[0];if(!ns)return;const is=new FileReader;is.onload=o=>{const ms=(o.target?.result).split(`
`).filter(v=>v.trim()&&!v.startsWith(""));if(ms.length<2)return;const xs=ms[0].split(",").map(v=>v.trim().toLowerCase()),Os=xs.findIndex(v=>v.includes("用户名")||v.includes("username")),Us=xs.findIndex(v=>v.includes("昵称")||v.includes("name")||v.includes("显示名")),Ps=xs.findIndex(v=>v.includes("邮箱")||v.includes("email")||v.includes("mail")),us=xs.findIndex(v=>v.includes("手机")||v.includes("phone")),Ns=xs.findIndex(v=>v.includes("角色")||v.includes("role")),vs=xs.findIndex(v=>v.includes("密码")||v.includes("password")),Cs=[];for(let v=1;v<ms.length;v++){const rs=ms[v].split(",").map(Ms=>Ms.trim());Cs.push({username:Os>=0?rs[Os]:"",nickname:Us>=0?rs[Us]:"",email:Ps>=0?rs[Ps]:"",phone:us>=0?rs[us]:"",role:Ns>=0?rs[Ns]:"",password:vs>=0?rs[vs]:""})}Q(Cs),F(null)},is.readAsText(ns,"UTF-8")},as=async()=>{U.setImporting(!0);try{const i=await K.batchImport({users:V,skip_existing:!0});F(i),await W()}catch(i){F({code:500,message:i?.message||"导入失败"})}finally{U.setImporting(!1)}};return s.jsxs("div",{"code-path":"src/components/system/SystemManager.tsx:234:5",className:"space-y-6",children:[s.jsx("div",{"code-path":"src/components/system/SystemManager.tsx:236:7",className:"flex items-center justify-between",children:s.jsxs("div",{"code-path":"src/components/system/SystemManager.tsx:237:9",children:[s.jsx("h1",{"code-path":"src/components/system/SystemManager.tsx:238:11",className:"text-2xl font-bold text-slate-100",children:"系统管理"}),s.jsx("p",{"code-path":"src/components/system/SystemManager.tsx:239:11",className:"text-sm text-slate-500 mt-1",children:"用户、权限与系统配置"})]})}),s.jsxs(fe,{"code-path":"src/components/system/SystemManager.tsx:244:7",value:a,onValueChange:m,className:"w-full",children:[s.jsxs(Le,{"code-path":"src/components/system/SystemManager.tsx:245:9",className:"bg-slate-800 border border-slate-700",children:[s.jsxs(Gs,{"code-path":"src/components/system/SystemManager.tsx:246:11",value:"users",className:"data-[state=active]:bg-slate-700",children:[s.jsx(ie,{"code-path":"src/components/system/SystemManager.tsx:247:13",className:"h-4 w-4 mr-2"}),"用户管理"]}),s.jsxs(Gs,{"code-path":"src/components/system/SystemManager.tsx:250:11",value:"roles",className:"data-[state=active]:bg-slate-700",children:[s.jsx(ee,{"code-path":"src/components/system/SystemManager.tsx:251:13",className:"h-4 w-4 mr-2"}),"角色权限"]}),s.jsxs(Gs,{"code-path":"src/components/system/SystemManager.tsx:254:11",value:"settings",className:"data-[state=active]:bg-slate-700",children:[s.jsx(xe,{"code-path":"src/components/system/SystemManager.tsx:255:13",className:"h-4 w-4 mr-2"}),"系统设置"]})]}),s.jsx(Ks,{"code-path":"src/components/system/SystemManager.tsx:260:9",value:"users",className:"mt-4 space-y-4",children:s.jsx(ze,{"code-path":"src/components/system/SystemManager.tsx:261:11",searchQuery:p,setSearchQuery:b,filteredUsers:ls,loading:c,selectedUser:h,setSelectedUser:y,getUserStatusBadge:ds,dialogOpen:M,setDialogOpen:E,editingUser:k,form:r,setForm:I,saving:ts,handleSubmit:A,openCreate:q,openEdit:ps,handleDelete:T,onResetPassword:i=>{y(null),j(i)},importDialogOpen:u,setImportDialogOpen:_,importPreview:V,setImportPreview:Q,importing:U.importing,importResult:hs,setImportResult:F,handleCsvUpload:O,handleBatchImport:as,ldapUsers:U.ldapUsers,ldapSelected:U.ldapSelected,setLdapSelected:U.setLdapSelected,ldapLoading:U.ldapLoading,ldapImportOUs:U.ldapImportOUs,ldapImportOUDN:U.ldapImportOUDN,setLdapImportOUDN:U.setLdapImportOUDN,loadLdapUsers:U.loadLdapUsers,handleLdapImport:U.handleLdapImport,setLdapUsers:U.setLdapUsers})}),s.jsx(Ks,{"code-path":"src/components/system/SystemManager.tsx:302:9",value:"roles",className:"mt-4 space-y-4",children:s.jsx(We,{"code-path":"src/components/system/SystemManager.tsx:303:11",selectedRole:g,setSelectedRole:P})}),s.jsx(Ks,{"code-path":"src/components/system/SystemManager.tsx:309:9",value:"settings",className:"mt-4",children:s.jsx(Xe,{"code-path":"src/components/system/SystemManager.tsx:310:11",...U.settingsTabProps})})]}),s.jsx(Ye,{"code-path":"src/components/system/SystemManager.tsx:314:7",user:N,onClose:()=>j(null)})]})}export{St as SystemManager};