@zgfe/modules-settings 1.2.4-log.0 → 1.2.4-log.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -17,6 +17,7 @@ import { DatePicker, Radio, Table } from 'antd';
17
17
  import locale from 'antd/es/date-picker/locale/zh_CN';
18
18
  import moment from 'moment';
19
19
  import './index.less';
20
+ import { setColumnsList } from './util';
20
21
  var OperationLog = function OperationLog() {
21
22
  var classPrefix = 'operation-log-page';
22
23
  var _useState = useState({
@@ -44,22 +45,28 @@ var OperationLog = function OperationLog() {
44
45
  _useState10 = _slicedToArray(_useState9, 2),
45
46
  dateRange = _useState10[0],
46
47
  setDateRange = _useState10[1];
47
- var _useState11 = useState(0),
48
+ var _useState11 = useState([]),
48
49
  _useState12 = _slicedToArray(_useState11, 2),
49
- time = _useState12[0],
50
- setTime = _useState12[1];
50
+ tableData = _useState12[0],
51
+ setTableData = _useState12[1];
51
52
  var _useState13 = useState([]),
52
53
  _useState14 = _slicedToArray(_useState13, 2),
53
- tableData = _useState14[0],
54
- setTableData = _useState14[1];
55
- var columns = [{
54
+ columns = _useState14[0],
55
+ setColumns = _useState14[1];
56
+ var columnsList = [{
56
57
  title: '应用(应用ID)',
57
- dataIndex: 'appId',
58
- key: 'appId'
58
+ key: 'appId',
59
+ render: function render(_, record) {
60
+ if (!record.appId) return '-';
61
+ return /*#__PURE__*/React.createElement(React.Fragment, null, record.appName, "(", record.appId, ")");
62
+ }
59
63
  }, {
60
64
  title: '操作人(登录账号)',
61
65
  dataIndex: 'operatorName',
62
- key: 'operatorName'
66
+ key: 'operatorName',
67
+ render: function render(_, record) {
68
+ return /*#__PURE__*/React.createElement(React.Fragment, null, record.operatorName, "(", record.operatorEmail, ")");
69
+ }
63
70
  }, {
64
71
  title: '功能模块',
65
72
  dataIndex: 'targetType',
@@ -68,10 +75,21 @@ var OperationLog = function OperationLog() {
68
75
  title: '操作类型',
69
76
  dataIndex: 'operationType',
70
77
  key: 'operationType'
78
+ }, {
79
+ title: '操作结果',
80
+ dataIndex: 'operationResult',
81
+ key: 'operationResult'
71
82
  }, {
72
83
  title: '操作设备',
73
84
  dataIndex: 'userAgent',
74
- key: 'userAgent'
85
+ key: 'userAgent',
86
+ width: 120,
87
+ ellipsis: true,
88
+ render: function render(text) {
89
+ return /*#__PURE__*/React.createElement("div", {
90
+ className: "".concat(classPrefix, "-columns")
91
+ }, text);
92
+ }
75
93
  }, {
76
94
  title: 'IP地址',
77
95
  dataIndex: 'userAccessIp',
@@ -82,17 +100,20 @@ var OperationLog = function OperationLog() {
82
100
  key: 'gmtCreate'
83
101
  }];
84
102
  useEffect(function () {
103
+ switch (logType) {
104
+ case '1':
105
+ setColumns(setColumnsList(columnsList, ['operationResult']));
106
+ break;
107
+ case '2':
108
+ setColumns(columnsList);
109
+ break;
110
+ case '3':
111
+ setColumns(setColumnsList(columnsList, ['appId']));
112
+ break;
113
+ }
85
114
  queryData();
86
115
  }, [logType]);
87
116
  useEffect(function () {
88
- // if (time) clearTimeout(time);
89
- // setTime(
90
- // setTimeout(() => {
91
- // console.log(condition, 'condition');
92
- // queryLog();
93
- // }, 500),
94
- // );
95
- console.log(condition);
96
117
  queryLog();
97
118
  }, [condition]);
98
119
  function queryData() {
@@ -170,7 +191,7 @@ var OperationLog = function OperationLog() {
170
191
  value: "2"
171
192
  }, "\u64CD\u4F5C\u65E5\u5FD7"), /*#__PURE__*/React.createElement(Radio.Button, {
172
193
  value: "3"
173
- }, "\u6743\u9650\u65E5\u5FD7")), condition.year && /*#__PURE__*/React.createElement(DatePicker, {
194
+ }, "\u6743\u9650\u7BA1\u7406\u65E5\u5FD7")), condition.year && /*#__PURE__*/React.createElement(DatePicker, {
174
195
  value: moment("".concat(condition.year, "-").concat(condition.month), 'YYYY-MM'),
175
196
  picker: "month",
176
197
  disabledDate: disabledDate,
@@ -18,4 +18,10 @@
18
18
  border-radius: 0 4px 4px 0;
19
19
  }
20
20
  }
21
+ &-columns {
22
+ width: 120px;
23
+ overflow: hidden;
24
+ white-space: nowrap;
25
+ text-overflow: ellipsis;
26
+ }
21
27
  }
@@ -0,0 +1,7 @@
1
+ interface ColumnsItem {
2
+ title: string;
3
+ dataIndex?: string;
4
+ key: string;
5
+ }
6
+ export declare const setColumnsList: (list: ColumnsItem[], keyList: string[]) => ColumnsItem[];
7
+ export {};
@@ -0,0 +1,9 @@
1
+ export var setColumnsList = function setColumnsList(list, keyList) {
2
+ var newList = [];
3
+ list.forEach(function (item) {
4
+ if (!keyList.includes(item.key)) {
5
+ newList.push(item);
6
+ }
7
+ });
8
+ return newList;
9
+ };
@@ -106,7 +106,7 @@ var SecurityLog = function SecurityLog() {
106
106
  data: condition
107
107
  }).then(function (res) {
108
108
  if (parseInt(res === null || res === void 0 ? void 0 : res.code) == 100000) {
109
- setTotal(res.data.total);
109
+ setTotal(res.data.count);
110
110
  setTableData(res.data.logs);
111
111
  setTableLoading(false);
112
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-settings",
3
- "version": "1.2.4-log.0",
3
+ "version": "1.2.4-log.2",
4
4
  "module": "es/index.js",
5
5
  "typings": "es/index.d.ts",
6
6
  "files": [
@@ -51,7 +51,7 @@
51
51
  "umi-request": "^1.4.0",
52
52
  "yorkie": "^2.0.0"
53
53
  },
54
- "gitHead": "654a8fad9793509052f832ef2dae04a8fdc7d04e",
54
+ "gitHead": "2f002b33243fef1dde5d165d93b07c9320d9d1a0",
55
55
  "gitHooks": {
56
56
  "pre-commit": "lint-staged"
57
57
  }