PageSourceSearch

https://nickz.ai/assets/js/index-qa7ZEX_6.js

js nickz.ai collected 2026-10-05 14:20:18 UTC 11,435 bytes, 1 lines download raw bytes

1import{r as e,j as a}from"./vendor-react-DejgYtBM.js";import{u as t,Z as s,Y as l,ac as r,A as n,s as i,$ as o,w as c}from"./index-BeIIFw6E.js";import{z as d,f as m,j as p,i as u,m as x,E as g,J as h,K as _,B as j,D as f,o as w,M as v}from"./vendor-semi-D8d7bTtM.js";import{C as y}from"./CardTable-Cq0lqlnD.js";import{u as N}from"./useTableCompactMode-DWLN7NUj.js";import{ad as b,T as I,X as C,ae as z,y as S,af as T,S as k,K as P,ag as E,U as D}from"./vendor-icons-EJvJ5X-w.js";import"./vendor-motion-Chfy_MiU.js";import"./useIsMobile-D_kfVI0u.js";const{Text:L,Title:M}=m,V=()=>{const{t:m}=t(),[M,V]=e.useState([]),[$,K]=e.useState(!0),[q,A]=e.useState(1),[O,R]=e.useState(s),[U,W]=e.useState(!1),[B,F]=e.useState(0),J=e.useRef(!1),[X,Y]=N("operationLog"),[Z,G]=e.useState(null),H=[{label:m("全部"),value:""},{label:m("用户管理"),value:"user_management"},{label:m("渠道管理"),value:"channel_management"},{label:m("令牌管理"),value:"token_management"},{label:m("系统配置"),value:"system_config"},{label:m("兑换码管理"),value:"redemption_management"},{label:m("日志管理"),value:"log_management"},{label:m("其他操作"),value:"other"}],Q=[{label:m("全部"),value:""},{label:m("修改额度"),value:"update_quota"},{label:m("修改密码"),value:"update_password"},{label:m("修改角色"),value:"update_role"},{label:m("修改状态"),value:"update_status"},{label:m("修改用户信息"),value:"update_profile"},{label:m("创建用户"),value:"create_user"},{label:m("删除用户"),value:"delete_user"},{label:m("管理用户"),value:"manage_user"},{label:m("预览多人迁移"),value:"preview_user_migration"},{label:m("执行多人迁移"),value:"execute_user_migration"},{label:m("预览单人迁移"),value:"preview_user_migration_single"},{label:m("执行单人迁移"),value:"execute_user_migration_single"},{label:m("发送迁移通知邮件"),value:"send_migration_emails"},{label:m("预览用户迁移回滚"),value:"preview_user_migration_rollback"},{label:m("执行用户迁移回滚"),value:"execute_user_migration_rollback"},{label:m("创建渠道"),value:"create_channel"},{label:m("更新渠道"),value:"update_channel"},{label:m("删除渠道"),value:"delete_channel"},{label:m("测试渠道"),value:"test_channel"}],ee=()=>{const e=Z?Z.getValues():{};return{targetId:e.targetId||"",operatorName:e.operatorName||"",operationCategory:e.operationCategory||"",operationType:e.operationType||"",targetName:e.targetName||"",description:e.description||""}},ae=e=>{switch(e){case"user_management":return a.jsx(D,{size:14,className:"text-blue-500"});case"channel_management":return a.jsx(E,{size:14,className:"text-green-500"});case"token_management":return a.jsx(P,{size:14,className:"text-purple-500"});case"system_config":return a.jsx(k,{size:14,className:"text-orange-500"});case"redemption_management":return a.jsx(T,{size:14,className:"text-pink-500"});case"log_management":return a.jsx(S,{size:14,className:"text-gray-500"});default:return a.jsx(z,{size:14,className:"text-red-500"})}},te=e=>e.field_name?a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{children:[a.jsxs(L,{strong:!0,className:"text-xs",children:[m("字段"),":"]}),a.jsx(L,{className:"ml-2 text-xs",children:e.field_name})]}),e.old_value&&a.jsxs("div",{children:[a.jsxs(L,{strong:!0,className:"text-xs",children:[m("原值"),":"]}),a.jsx(L,{className:"ml-2 text-xs text-red-500",children:e.old_value})]}),e.new_value&&a.jsxs("div",{children:[a.jsxs(L,{strong:!0,className:"text-xs",children:[m("新值"),":"]}),a.jsx(L,{className:"ml-2 text-xs text-green-500",children:e.new_value})]})]}):a.jsx(L,{type:"secondary",children:m("无字段变更")}),se=[{title:"ID",dataIndex:"id",width:60},{title:m("操作时间"),dataIndex:"created_at",width:150,render:e=>a.jsx(d,{content:l(e),position:"top",children:a.jsx(L,{className:"text-xs",children:l(e)})})},{title:m("操作员"),dataIndex:"operator_name",width:120,render:(e,t)=>{return a.jsxs(p,{vertical:!0,spacing:1,children:[a.jsx(L,{strong:!0,className:"text-sm",children:e}),(s=t.operator_role,r(s,m,"small"))]});var s}},{title:m("操作分类"),dataIndex:"operation_category",width:100,render:e=>(e=>{const t={user_management:{label:m("用户管理"),color:"blue"},channel_management:{label:m("渠道管理"),color:"green"},token_management:{label:m("令牌管理"),color:"purple"},system_config:{label:m("系统配置"),color:"orange"},redemption_management:{label:m("兑换码管理"),color:"pink"},log_management:{label:m("日志管理"),color:"grey"}}[e]||{label:e,color:"red"};return a.jsx(u,{size:"small",color:t.color,prefixIcon:ae(e),children:t.label})})(e)},{title:m("操作类型"),dataIndex:"operation_type",width:100,render:e=>{return a.jsx(u,{size:"small",color:"cyan",children:(t=e,{update_quota:m("修改额度"),update_password:m("修改密码"),update_role:m("修改角色"),update_status:m("修改状态"),update_profile:m("修改用户信息"),create_user:m("创建用户"),delete_user:m("删除用户"),manage_user:m("管理用户"),preview_user_migration:m("预览多人迁移"),execute_user_migration:m("执行多人迁移"),preview_user_migration_single:m("预览单人迁移"),execute_user_migration_single:m("执行单人迁移"),send_migration_emails:m("发送迁移通知邮件"),preview_user_migration_rollback:m("预览用户迁移回滚"),execute_user_migration_rollback:m("执行用户迁移回滚"),create_channel:m("创建渠道"),update_channel:m("更新渠道"),delete_channel:m("删除渠道"),test_channel:m("测试渠道")}[t]||t)});var t}},{title:m("目标对象"),dataIndex:"target_name",width:120,render:(e,t)=>e?a.jsxs(p,{vertical:!0,spacing:1,children:[a.jsx(L,{className:"text-sm",children:e}),t.target_id>0&&a.jsxs(L,{type:"secondary",className:"text-xs",children:["ID: ",t.target_id]})]}):a.jsx(L,{type:"secondary",children:"-"})},{title:m("操作描述"),dataIndex:"description",render:e=>a.jsx(d,{content:e,position:"top",children:a.jsx(L,{className:"text-sm max-w-xs truncate",children:e})})},{title:m("变更详情"),dataIndex:"details",width:200,render:(e,t)=>a.jsx(d,{content:te(t),position:"top",children:a.jsx("div",{className:"cursor-pointer",children:te(t)})})},{title:m("IP地址"),dataIndex:"ip_address",width:120,render:e=>a.jsx(L,{className:"text-xs font-mono",children:e||"-"})}],le=async(e,a)=>{try{K(!0);const t=await n.get(`/api/operation_log/?p=${e}&page_size=${a}`),{success:s,message:l,data:r}=t.data;s?(V(r.items||[]),A(r.page||e),F(r.total||0)):i(l)}catch(t){i(m("加载操作日志失败")+":"+t.message)}finally{K(!1)}},re=async(e,a,t=null)=>{null===t&&(t=ee());const{targetId:s,operatorName:l,operationCategory:r,operationType:o,targetName:c,description:d}=t;if(s||l||r||o||c||d)try{W(!0);const t=new URLSearchParams;s&&t.append("target_id",s),l&&t.append("operator_name",l),r&&t.append("operation_category",r),o&&t.append("operation_type",o),c&&t.append("target_name",c),d&&t.append("description",d),t.append("p",e),t.append("page_size",a);const m=await n.get(`/api/operation_log/search?${t.toString()}`),{success:p,message:u,data:x}=m.data;p?(V(x.items||[]),A(x.page||e),F(x.total||0)):i(u)}catch(m){i("搜索操作日志失败:"+m.message)}finally{W(!1)}else await le(e,a)},ne=async()=>{A(1);const e=ee();e.targetId||e.operatorName||e.operationCategory||e.operationType||e.targetName||e.description?await re(1,O,e):await le(1,O)};return e.useEffect(()=>{le(1,O)},[]),a.jsx("div",{className:"",children:a.jsx(x,{className:"!rounded-2xl",title:a.jsxs("div",{className:"flex flex-col w-full",children:[a.jsx("div",{className:"mb-2",children:a.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center gap-2 w-full",children:[a.jsxs("div",{className:"flex items-center text-blue-500",children:[a.jsx(b,{size:16,className:"mr-2"}),a.jsx(L,{children:m("查看系统中所有的操作记录,包括用户管理、系统配置等操作的详细日志。")})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(j,{type:"tertiary",className:"w-full md:w-auto",onClick:()=>Y(!X),size:"small",children:m(X?"自适应列表":"紧凑列表")}),o()&&a.jsx(j,{theme:"light",type:"secondary",icon:a.jsx(I,{size:16}),onClick:()=>{v.confirm({title:m("确认删除"),content:m("确定要删除30天前的操作记录吗?此操作不可逆。"),onOk:async()=>{try{const e=await n.delete("/api/operation_log/?days=30"),{success:a,message:t}=e.data;a?(c(m("删除成功")),await ne()):i(t)}catch(e){i("删除失败:"+e.message)}}})},className:"w-full md:w-auto",children:m("清理历史日志")})]})]})}),a.jsx(f,{margin:"12px"}),a.jsx(w,{initValues:{targetId:"",operatorName:"",operationCategory:"",operationType:"",targetName:"",description:""},getFormApi:e=>G(e),onSubmit:()=>{A(1),re(1,O)},allowEmpty:!0,autoComplete:"off",layout:"horizontal",trigger:"change",stopValidateWithError:!1,className:"w-full",children:a.jsxs("div",{className:"flex flex-col gap-3 w-full",children:[a.jsxs("div",{className:"flex flex-col md:flex-row items-center gap-3 w-full",children:[a.jsx("div",{className:"w-full md:w-40",children:a.jsx(w.Input,{field:"targetId",placeholder:m("目标ID"),showClear:!0,pure:!0})}),a.jsx("div",{className:"w-full md:w-48",children:a.jsx(w.Input,{field:"operatorName",placeholder:m("操作员名称"),showClear:!0,pure:!0})}),a.jsx("div",{className:"w-full md:w-48",children:a.jsx(w.Select,{field:"operationCategory",placeholder:m("操作分类"),optionList:H,className:"w-full",showClear:!0,pure:!0})}),a.jsx("div",{className:"w-full md:w-48",children:a.jsx(w.Select,{field:"operationType",placeholder:m("操作类型"),optionList:Q,className:"w-full",showClear:!0,pure:!0})})]}),a.jsxs("div",{className:"flex flex-col md:flex-row items-center gap-3 w-full",children:[a.jsx("div",{className:"relative flex-1 w-full",children:a.jsx(w.Input,{field:"targetName",prefix:a.jsx(C,{size:16}),placeholder:m("目标对象名称"),showClear:!0,pure:!0})}),a.jsx("div",{className:"relative flex-1 w-full",children:a.jsx(w.Input,{field:"description",prefix:a.jsx(C,{size:16}),placeholder:m("操作描述"),showClear:!0,pure:!0})}),a.jsxs("div",{className:"flex gap-2 w-full md:w-auto",children:[a.jsx(j,{type:"primary",htmlType:"submit",loading:$||U,className:"flex-1 md:flex-initial md:w-auto",children:m("查询")}),a.jsx(j,{theme:"light",onClick:()=>{Z&&(Z.reset(),setTimeout(()=>{A(1),le(1,O)},100))},className:"flex-1 md:flex-initial md:w-auto",children:m("重置")})]})]})]})})]}),shadows:"always",bordered:!1,children:a.jsx(y,{columns:se,dataSource:M,scroll:X?void 0:{x:"max-content"},pagination:{formatPageText:e=>m("第 {{start}} - {{end}} 条,共 {{total}} 条",{start:e.currentStart,end:e.currentEnd,total:B}),currentPage:q,pageSize:O,total:B,pageSizeOpts:[10,20,50,100],showSizeChanger:!0,onPageSizeChange:async e=>{R(e),A(1),J.current=!0;const a=ee(),t=a.targetId||a.operatorName||a.operationCategory||a.operationType||a.targetName||a.description;try{t?await re(1,e,a):await le(1,e)}finally{J.current=!1}},onPageChange:e=>{if(J.current)return;A(e);const a=ee();a.targetId||a.operatorName||a.operationCategory||a.operationType||a.targetName||a.description?re(e,O,a):le(e,O)}},loading:$,empty:a.jsx(g,{image:a.jsx(_,{style:{width:150,height:150}}),darkModeImage:a.jsx(h,{style:{width:150,height:150}}),description:m("暂无操作记录"),style:{padding:30}}),className:"overflow-hidden",size:"small",rowKey:"id"})})})};export{V as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.