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

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.
@@ -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,27 @@ 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
+ return /*#__PURE__*/React.createElement(React.Fragment, null, record.appName, "(", record.appId, ")");
61
+ }
59
62
  }, {
60
63
  title: '操作人(登录账号)',
61
64
  dataIndex: 'operatorName',
62
- key: 'operatorName'
65
+ key: 'operatorName',
66
+ render: function render(_, record) {
67
+ return /*#__PURE__*/React.createElement(React.Fragment, null, record.operatorName, "(", record.operatorEmail, ")");
68
+ }
63
69
  }, {
64
70
  title: '功能模块',
65
71
  dataIndex: 'targetType',
@@ -68,10 +74,21 @@ var OperationLog = function OperationLog() {
68
74
  title: '操作类型',
69
75
  dataIndex: 'operationType',
70
76
  key: 'operationType'
77
+ }, {
78
+ title: '操作结果',
79
+ dataIndex: 'operationResult',
80
+ key: 'operationResult'
71
81
  }, {
72
82
  title: '操作设备',
73
83
  dataIndex: 'userAgent',
74
- key: 'userAgent'
84
+ key: 'userAgent',
85
+ width: 120,
86
+ ellipsis: true,
87
+ render: function render(text) {
88
+ return /*#__PURE__*/React.createElement("div", {
89
+ className: "".concat(classPrefix, "-columns")
90
+ }, text);
91
+ }
75
92
  }, {
76
93
  title: 'IP地址',
77
94
  dataIndex: 'userAccessIp',
@@ -82,17 +99,20 @@ var OperationLog = function OperationLog() {
82
99
  key: 'gmtCreate'
83
100
  }];
84
101
  useEffect(function () {
102
+ switch (logType) {
103
+ case '1':
104
+ setColumns(setColumnsList(columnsList, ['operationResult']));
105
+ break;
106
+ case '2':
107
+ setColumns(columnsList);
108
+ break;
109
+ case '3':
110
+ setColumns(setColumnsList(columnsList, ['appId']));
111
+ break;
112
+ }
85
113
  queryData();
86
114
  }, [logType]);
87
115
  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
116
  queryLog();
97
117
  }, [condition]);
98
118
  function queryData() {
@@ -170,7 +190,7 @@ var OperationLog = function OperationLog() {
170
190
  value: "2"
171
191
  }, "\u64CD\u4F5C\u65E5\u5FD7"), /*#__PURE__*/React.createElement(Radio.Button, {
172
192
  value: "3"
173
- }, "\u6743\u9650\u65E5\u5FD7")), condition.year && /*#__PURE__*/React.createElement(DatePicker, {
193
+ }, "\u6743\u9650\u7BA1\u7406\u65E5\u5FD7")), condition.year && /*#__PURE__*/React.createElement(DatePicker, {
174
194
  value: moment("".concat(condition.year, "-").concat(condition.month), 'YYYY-MM'),
175
195
  picker: "month",
176
196
  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.1",
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": "9efa0c3ab66d6da579d43eea30841b9ce16655c2",
55
55
  "gitHooks": {
56
56
  "pre-commit": "lint-staged"
57
57
  }