eiam/eiam-console/src/main/resources/fe/p__audit__index.f9240efc.as...

19 lines
15 KiB
JavaScript

/*
* eiam-console - Employee Identity and Access Management Program
* Copyright © 2020-2023 TopIAM (support@topiam.cn)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
"use strict";(self.webpackChunktopiam_console=self.webpackChunktopiam_console||[]).push([[8271],{74622:function(_,D,c){c.d(D,{F:function(){return A},N:function(){return F}});var A;(function(y){y.admin="admin",y.user="user"})(A||(A={}));var F;(function(y){y.success="success",y.fail="fail"})(F||(F={}))},41637:function(_,D,c){c.r(D),c.d(D,{default:function(){return Ne}});var A=c(7863),F=c.n(A),y=c(82925),h=c(74622),ee=c(84019),C=c.n(ee),ne=c(32061),I=c.n(ne),ae=c(76091),Z=c.n(ae),O=c(73575),Y=c(84530);function b(f,i,d){return P.apply(this,arguments)}function P(){return P=I()(C()().mark(function f(i,d,u){return C()().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:return x.abrupt("return",(0,Y.request)("/api/audit/list",{params:Z()(Z()(Z()({},i),{},{startEventTime:i.eventTime&&i.eventTime[0],endEventTime:i.eventTime&&i.eventTime[1]},(0,O.YE)(d)),(0,O.oH)(u))}).then(function(o){var v,r,n,s,l={data:o!=null&&(v=o.result)!==null&&v!==void 0&&v.list?o==null||(r=o.result)===null||r===void 0?void 0:r.list:[],success:o==null?void 0:o.success,total:o!=null&&(n=o.result)!==null&&n!==void 0&&n.pagination?o==null||(s=o.result)===null||s===void 0?void 0:s.pagination.total:0};return Promise.resolve(l)}));case 1:case"end":return x.stop()}},f)})),P.apply(this,arguments)}function w(f){return L.apply(this,arguments)}function L(){return L=I()(C()().mark(function f(i){return C()().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",(0,Y.request)("/api/audit/types/".concat(i)));case 1:case"end":return u.stop()}},f)})),L.apply(this,arguments)}var z=c(5903),G=c(8582),M=c(53802),U=c(15457),T=c(25374),K=c(21451),S=c(81381),W=c(93973),R=c(91902),te=c(66939),E=c.n(te),B=c(79685),se=c(76815),$=c(57346),re=c(96569),ce=c(39620),m=c.n(ce),J=c(84904),Q=c(47918),le=Q.ZP.ConfigContext;function oe(f){var i=".".concat(f),d=(0,B.useContext)(le),u=d.getPrefixCls,p=".".concat(u()),x=(0,J.l)(function(){var o,v,r;return m()({},"".concat(i),(r={display:"flex",paddingLeft:"10px"},m()(r,"&-line-user",{flex:1,marginRight:"24px"}),m()(r,"&-line-event",{flex:1,marginRight:"24px"}),m()(r,"&-line-geo",{flex:1,marginRight:"24px"}),m()(r,"&-label",(o={display:"block",minWidth:"80px",color:"#878a95",fontSize:"14px"},m()(o,"".concat(p,"-collapse-header"),{paddingTop:"0 !important",paddingBottom:"0 !important"}),m()(o,"".concat(p,"-collapse-header-text"),{color:"#878a95"}),o)),m()(r,"&-panel",(v={fontSize:"14px"},m()(v,"".concat(p,"-collapse-header"),{paddingTop:"0 !important",paddingBottom:"0 !important"}),m()(v,"".concat(p,"-collapse-header-text"),{color:"#878a95"}),m()(v,"".concat(p,"-collapse-content>").concat(p,"-collapse-content-box"),{paddingTop:"6px !important",paddingBottom:"6px !important"}),m()(v,"&-content",m()({padding:"0px 24px !important"},"p",{marginBottom:"6px !important"})),v)),m()(r,"&-content",{display:"block",flexWrap:"wrap",overflowX:"auto",color:"#293350",fontSize:"14px"}),m()(r,"&-each-line",{display:"flex",marginBottom:"14px"}),m()(r,"&-target",{flex:1}),r))});return{className:x}}var ue=c(68591),a=c.n(ue),e=c(63342),t="audit-expanded-card",ie=se.Z.Text,H=$.Z.Panel,de={user:"\u7528\u6237",admin:"\u7BA1\u7406\u5458"},V=function(i){var d,u,p,x,o,v,r,n=i.record,s=oe(t),l=s.className,N=function(j){return!j||j==="null"||j==="-"||j==="undefined"?"-":j};return(0,e.jsx)("div",{className:l,children:(0,e.jsxs)("div",{className:a()("".concat(t)),children:[(0,e.jsxs)("div",{className:a()("".concat(t,"-line-user")),children:[(0,e.jsxs)("div",{className:a()("".concat(t,"-each-line")),children:[(0,e.jsx)("span",{className:a()("".concat(t,"-label")),children:"\u64CD\u4F5C\u8005 ID"}),(0,e.jsx)("span",{className:a()("".concat(t,"-content")),children:(0,e.jsx)(re.Z,{style:{marginBottom:0},className:a()("".concat(t,"-content")),copyable:!0,children:N(n.userId)})})]}),(0,e.jsxs)("div",{className:a()("".concat(t,"-each-line")),children:[(0,e.jsx)("span",{className:a()("".concat(t,"-label")),children:"\u64CD\u4F5C\u8005\u540D\u79F0"}),(0,e.jsx)("span",{className:a()("".concat(t,"-content")),children:N(n.username)})]}),(0,e.jsxs)("div",{className:a()("".concat(t,"-each-line")),children:[(0,e.jsx)("span",{className:a()("".concat(t,"-label")),children:"\u64CD\u4F5C\u8005\u7C7B\u578B"}),(0,e.jsx)("span",{className:a()("".concat(t,"-content")),children:de[n.userType]})]})]}),(0,e.jsxs)("div",{className:a()("".concat(t,"-line-geo")),children:[(0,e.jsxs)("div",{className:a()("".concat(t,"-each-line")),children:[(0,e.jsx)("span",{className:a()("".concat(t,"-label")),children:"\u8BBE\u5907\u7C7B\u578B"}),(0,e.jsx)("span",{className:a()("".concat(t,"-content")),children:n.userAgent&&((d=n.userAgent)===null||d===void 0?void 0:d.deviceType)||"-"})]}),(0,e.jsxs)("div",{className:a()("".concat(t,"-each-line")),children:[(0,e.jsx)("span",{className:a()("".concat(t,"-label")),children:"\u64CD\u4F5C\u7CFB\u7EDF"}),(0,e.jsx)("span",{className:a()("".concat(t,"-content")),children:n.userAgent&&((u=n.userAgent)===null||u===void 0?void 0:u.platform)||"-"})]}),(0,e.jsxs)("div",{className:a()("".concat(t,"-each-line")),children:[(0,e.jsx)("span",{className:a()("".concat(t,"-label")),children:"\u5BA2\u6237\u7AEFIP"}),(0,e.jsx)("span",{className:a()("".concat(t,"-content")),children:((p=n.geoLocation)===null||p===void 0?void 0:p.ip)||"-"})]}),(0,e.jsxs)("div",{className:a()("".concat(t,"-each-line")),children:[(0,e.jsx)("span",{className:a()("".concat(t,"-label")),children:"\u6D4F\u89C8\u5668"}),(0,e.jsx)("span",{className:a()("".concat(t,"-content")),children:n.userAgent&&((x=n.userAgent)===null||x===void 0?void 0:x.browser)||"-"})]}),(0,e.jsxs)("div",{className:a()("".concat(t,"-each-line")),children:[(0,e.jsx)("span",{className:a()("".concat(t,"-label")),children:"\u56FD\u5BB6"}),(0,e.jsx)("span",{className:a()("".concat(t,"-content")),children:n.geoLocation&&((o=n.geoLocation)===null||o===void 0?void 0:o.countryName)||"-"})]}),(0,e.jsxs)("div",{className:a()("".concat(t,"-each-line")),children:[(0,e.jsx)("span",{className:a()("".concat(t,"-label")),children:"\u7701\u4EFD"}),(0,e.jsx)("span",{className:a()("".concat(t,"-content")),children:n.geoLocation&&((v=n.geoLocation)===null||v===void 0?void 0:v.provinceName)||"-"})]}),(0,e.jsxs)("div",{className:a()("".concat(t,"-each-line")),children:[(0,e.jsx)("span",{className:a()("".concat(t,"-label")),children:"\u57CE\u5E02"}),(0,e.jsx)("span",{className:a()("".concat(t,"-content")),children:n.geoLocation&&((r=n.geoLocation)===null||r===void 0?void 0:r.cityName)||"-"})]})]}),(0,e.jsxs)("div",{className:a()("".concat(t,"-line-event")),children:[(0,e.jsxs)("div",{className:a()("".concat(t,"-each-line")),children:[(0,e.jsx)("span",{className:a()("".concat(t,"-label")),children:"\u4E8B\u4EF6\u65F6\u95F4"}),(0,e.jsx)("span",{className:a()("".concat(t,"-content")),children:(0,e.jsx)(ie,{style:{maxWidth:"100%"},ellipsis:!0,children:E()(n.eventTime).format("YYYY.MM.DD HH:mm:ss")})})]}),(0,e.jsxs)("div",{className:a()("".concat(t,"-each-line")),children:[(0,e.jsx)("span",{className:a()("".concat(t,"-label")),children:"\u4E8B\u4EF6\u7C7B\u578B"}),(0,e.jsx)("span",{className:a()("".concat(t,"-content")),children:n.eventType})]}),(0,e.jsxs)("div",{className:a()("".concat(t,"-each-line")),children:[(0,e.jsx)("span",{className:a()("".concat(t,"-label")),children:"\u4E8B\u4EF6\u72B6\u6001"}),(0,e.jsxs)("span",{className:a()("".concat(t,"-content")),children:[n.eventStatus===h.N.success&&(0,e.jsx)("span",{style:{color:"#87d068"},children:"\u6210\u529F"}),n.eventStatus===h.N.fail&&(0,e.jsx)("span",{style:{color:"#e54545"},children:"\u5931\u8D25"})]})]})]}),n.targets&&(0,e.jsx)("div",{className:a()("".concat(t,"-line-target")),children:(0,e.jsx)("div",{className:a()("".concat(t,"-each-line")),children:(0,e.jsx)($.Z,{ghost:!0,children:(0,e.jsx)(H,{header:"\u64CD\u4F5C\u5BF9\u8C61",className:a()("".concat(t,"-panel")),children:n.targets.map(function(g){return(0,e.jsx)($.Z,{ghost:!0,children:g!=null&&g.name?(0,e.jsx)(H,{header:g.name,className:a()("".concat(t,"-panel")),children:(0,e.jsxs)("div",{className:a()("".concat(t,"-panel-content")),children:[(0,e.jsxs)("p",{children:["\u5BF9\u8C61 ID\uFF1A",g.id]}),(0,e.jsxs)("p",{children:["\u5BF9\u8C61\u7C7B\u578B\uFF1A",g.typeName]})]})},g.type):(0,e.jsx)(H,{header:g.typeName,className:a()("".concat(t,"-panel")),children:(0,e.jsx)("div",{className:a()("".concat(t,"-panel-content")),children:(0,e.jsxs)("p",{children:["\u5BF9\u8C61\u7C7B\u578B\uFF1A",g.typeName]})})},g.type)},g.type)})},"1")})})})]})})},me=Q.ZP.ConfigContext;function X(f){var i=".".concat(f),d=(0,B.useContext)(me),u=d.getPrefixCls,p=".".concat(u()),x=(0,J.l)(function(){return m()({},"".concat(i),m()({},"".concat(p,"-table-expanded-row-fixed"),{width:"auto !important"}))});return{className:x}}var k="audit-admin",pe=T.Z.OptGroup,xe=T.Z.Option,ve=K.Z.RangePicker,he=function(){var f=(0,B.useRef)(),i=(0,B.useState)(),d=F()(i,2),u=d[0],p=d[1],x=X(k),o=x.className;(0,U.Z)(I()(C()().mark(function r(){return C()().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:w(h.F.admin).then(function(l){l.success&&p(l.result)});case 1:case"end":return s.stop()}},r)})),[]);var v=[{title:"\u4E8B\u4EF6\u7C7B\u578B",dataIndex:"eventType",fixed:"left",renderFormItem:function(){return(0,e.jsx)(T.Z,{placeholder:"\u8BF7\u9009\u62E9\u4E8B\u4EF6\u7C7B\u578B",showSearch:!0,allowClear:!0,mode:"multiple",maxTagCount:"responsive",children:u&&u.map(function(n){return(0,e.jsx)(pe,{label:n.name,children:n.types&&n.types.map(function(s){return(0,e.jsx)(xe,{value:s.code,children:s.name},s.code)})},n.code)})},"select")}},{title:"\u64CD\u4F5C\u8005",ellipsis:!0,dataIndex:"username",fieldProps:{placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u540D"}},{title:"\u5BA2\u6237\u7AEFIP",dataIndex:"geoLocation",ellipsis:!0,valueType:"text",hideInSearch:!0,render:function(n,s){var l=s.geoLocation;return l?(0,e.jsx)(S.Z,{status:"success",text:l.ip}):(0,e.jsx)(S.Z,{status:"error",text:"\u672A\u77E5"})}},{title:"\u64CD\u4F5C\u7CFB\u7EDF",ellipsis:!0,dataIndex:"platform",render:function(n,s){var l=s.userAgent;return l.platform}},{title:"\u6D4F\u89C8\u5668",ellipsis:!0,dataIndex:"browser",render:function(n,s){var l=s.userAgent;return l.browser}},{title:"\u4E8B\u4EF6\u65F6\u95F4",sorter:!0,defaultSortOrder:"descend",ellipsis:!0,align:"center",dataIndex:"eventTime",valueType:"dateTime",renderFormItem:function(){return(0,e.jsx)(ve,{showTime:{hideDisabledOptions:!0,defaultValue:[E()("00:00:00","HH:mm:ss"),E()("11:59:59","HH:mm:ss")]},placeholder:["\u5F00\u59CB\u65F6\u95F4","\u7ED3\u675F\u65F6\u95F4"],format:"YYYY-MM-DD HH:mm:ss"})}},{title:"\u4E8B\u4EF6\u72B6\u6001",dataIndex:"eventStatus",hideInSearch:!0,align:"center",fixed:"right",width:100,render:function(n){return(0,e.jsxs)(W.Z,{children:[n===h.N.success&&(0,e.jsx)(R.Z,{color:"#87d068",children:"\u6210\u529F"}),n===h.N.fail&&(0,e.jsx)(R.Z,{color:"#e54545",children:"\u5931\u8D25"})]})}}];return(0,e.jsx)("div",{className:o,children:(0,e.jsx)(M.Z,{columns:v,scroll:{x:1200},pagination:{showQuickJumper:!0,defaultPageSize:10},search:{},expandable:{expandRowByClick:!0,expandedRowClassName:function(){return a()("".concat(k))},expandedRowRender:function(n,s){return(0,e.jsx)(V,{record:n,index:s,type:h.F.admin})},expandIcon:function(n){var s=n.expanded,l=n.onExpand,N=n.record;return s?(0,e.jsx)(z.Z,{onClick:function(j){return l(N,j)}}):(0,e.jsx)(G.Z,{onClick:function(j){return l(N,j)}})}},actionRef:f,params:{userType:h.F.admin},request:b,rowKey:"id",dateFormatter:"string"})})},q="audit-user",fe=T.Z.OptGroup,ge=T.Z.Option,je=K.Z.RangePicker,Ce=function(){var f=(0,B.useRef)(),i=(0,B.useState)(),d=F()(i,2),u=d[0],p=d[1],x=X(q),o=x.className;(0,U.Z)(I()(C()().mark(function r(){return C()().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:w(h.F.user).then(function(l){l.success&&p(l.result)});case 1:case"end":return s.stop()}},r)})),[]);var v=[{title:"\u4E8B\u4EF6\u7C7B\u578B",dataIndex:"eventType",fixed:"left",renderFormItem:function(){return(0,e.jsx)(T.Z,{placeholder:"\u8BF7\u9009\u62E9\u4E8B\u4EF6\u7C7B\u578B",showSearch:!0,allowClear:!0,mode:"multiple",maxTagCount:"responsive",children:u&&u.map(function(n){return(0,e.jsx)(fe,{label:n.name,children:n.types&&n.types.map(function(s){return(0,e.jsx)(ge,{value:s.code,children:s.name},s.code)})},n.code)})},"select")}},{title:"\u64CD\u4F5C\u8005",ellipsis:!0,dataIndex:"username",fieldProps:{placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u540D"}},{title:"\u5BA2\u6237\u7AEFIP",dataIndex:"geoLocation",ellipsis:!0,valueType:"text",hideInSearch:!0,render:function(n,s){var l=s.geoLocation;return l?(0,e.jsx)(S.Z,{status:"success",text:l.ip}):(0,e.jsx)(S.Z,{status:"error",text:"\u672A\u77E5"})}},{title:"\u64CD\u4F5C\u7CFB\u7EDF",ellipsis:!0,dataIndex:"platform",render:function(n,s){var l=s.userAgent;return l.platform}},{title:"\u6D4F\u89C8\u5668",ellipsis:!0,dataIndex:"browser",render:function(n,s){var l=s.userAgent;return l.browser}},{title:"\u4E8B\u4EF6\u65F6\u95F4",sorter:!0,defaultSortOrder:"descend",ellipsis:!0,align:"center",dataIndex:"eventTime",valueType:"dateTime",renderFormItem:function(){return(0,e.jsx)(je,{showTime:{hideDisabledOptions:!0,defaultValue:[E()("00:00:00","HH:mm:ss"),E()("11:59:59","HH:mm:ss")]},placeholder:["\u5F00\u59CB\u65F6\u95F4","\u7ED3\u675F\u65F6\u95F4"],format:"YYYY-MM-DD HH:mm:ss"})}},{title:"\u4E8B\u4EF6\u72B6\u6001",dataIndex:"eventStatus",hideInSearch:!0,align:"center",fixed:"right",width:100,render:function(n){return(0,e.jsxs)(W.Z,{children:[n===h.N.success&&(0,e.jsx)(R.Z,{color:"#87d068",children:"\u6210\u529F"}),n===h.N.fail&&(0,e.jsx)(R.Z,{color:"#e54545",children:"\u5931\u8D25"})]})}}];return(0,e.jsx)("div",{className:o,children:(0,e.jsx)(M.Z,{columns:v,scroll:{x:1200},pagination:{showQuickJumper:!0,defaultPageSize:10},search:{},expandable:{expandRowByClick:!0,expandedRowClassName:function(){return a()("".concat(q))},expandedRowRender:function(n,s){return(0,e.jsx)(V,{record:n,index:s,type:h.F.user})},expandIcon:function(n){var s=n.expanded,l=n.onExpand,N=n.record;return s?(0,e.jsx)(z.Z,{onClick:function(j){return l(N,j)}}):(0,e.jsx)(G.Z,{onClick:function(j){return l(N,j)}})}},actionRef:f,params:{userType:h.F.user},request:b,rowKey:"id",dateFormatter:"string"})})},Ne=function(){var f=(0,B.useState)(h.F.user),i=F()(f,2),d=i[0],u=i[1];return(0,e.jsxs)(y._z,{tabActiveKey:d,onTabChange:function(x){u(x)},tabList:[{key:h.F.user,tab:"\u7528\u6237\u884C\u4E3A"},{key:h.F.admin,tab:"\u7BA1\u7406\u5458\u884C\u4E3A"}],content:"\u5BA1\u8BA1\u65E5\u5FD7\u8BB0\u5F55\u4E86\u6240\u6709\u5E73\u53F0\u7528\u6237\u8FDB\u884C\u7684\u5173\u952E\u64CD\u4F5C\uFF0C\u65E0\u8BBA\u662F\u7BA1\u7406\u5458\u8FDB\u884C\u7684\u6279\u91CF\u64CD\u4F5C\u3001\u8FD8\u662F\u7528\u6237\u4FA7\u8FDB\u884C\u7684\u591A\u56E0\u7D20\u8BA4\u8BC1\uFF0C\u90FD\u53EF\u4EE5\u5728\u8FD9\u91CC\u627E\u5230\u5BF9\u5E94\u7684\u8BB0\u5F55\uFF0C\u4EE5\u5BF9\u67D0\u6B21\u6539\u53D8\u63D0\u4F9B\u5145\u5206\u7684\u6EAF\u6E90\u6570\u636E\u3002",children:[d===h.F.user&&(0,e.jsx)(Ce,{}),d===h.F.admin&&(0,e.jsx)(he,{})]})}}}]);