ls-pro-common 3.1.10 → 3.1.12

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.
@@ -5,6 +5,7 @@ export declare type GroupTitleProps = {
5
5
  className?: string;
6
6
  style?: React.CSSProperties;
7
7
  isInner?: boolean;
8
+ children?: React.ReactNode;
8
9
  };
9
10
  declare const GroupTip: React.FC<GroupTitleProps>;
10
11
  export default GroupTip;
@@ -13,6 +13,8 @@ export interface RecordLogProps {
13
13
  showResourceName?: boolean;
14
14
  style?: React.CSSProperties;
15
15
  className?: string;
16
+ showKey?: boolean;
17
+ fieldValueMap?: Record<string, Record<string | number, any>>;
16
18
  }
17
19
  declare const RecordLog: (props: RecordLogProps) => JSX.Element;
18
20
  export default RecordLog;
@@ -32,7 +32,11 @@ var RecordLog = function RecordLog(props) {
32
32
  showResourceName = _props$showResourceNa === void 0 ? true : _props$showResourceNa,
33
33
  style = props.style,
34
34
  _props$className = props.className,
35
- className = _props$className === void 0 ? '' : _props$className;
35
+ className = _props$className === void 0 ? '' : _props$className,
36
+ _props$showKey = props.showKey,
37
+ showKey = _props$showKey === void 0 ? true : _props$showKey,
38
+ _props$fieldValueMap = props.fieldValueMap,
39
+ fieldValueMap = _props$fieldValueMap === void 0 ? {} : _props$fieldValueMap;
36
40
  var getLogData = function getLogData() {
37
41
  var url = '/lesoon-petrel-behaviour-api/behUserOperateLog/page';
38
42
  var params = {
@@ -53,9 +57,18 @@ var RecordLog = function RecordLog(props) {
53
57
  row.content = JSON.parse(row.content);
54
58
  row.content.forEach(function (item) {
55
59
  var o = item.oldValue || '';
56
- item.oldValue = !o || o == '[]' || (o === null || o === void 0 ? void 0 : o.length) == 0 ? '空' : o + '';
60
+ var map = fieldValueMap[item.fieldName];
61
+ if (map && map[o]) {
62
+ item.oldValue = map[o];
63
+ } else {
64
+ item.oldValue = !o || o == '[]' || (o === null || o === void 0 ? void 0 : o.length) == 0 ? '空' : o + '';
65
+ }
57
66
  var n = item.newValue || '';
58
- item.newValue = !n || n == '[]' || (n === null || n === void 0 ? void 0 : n.length) == 0 ? '空' : n + '';
67
+ if (map && map[n]) {
68
+ item.newValue = map[n];
69
+ } else {
70
+ item.newValue = !n || n == '[]' || (n === null || n === void 0 ? void 0 : n.length) == 0 ? '空' : n + '';
71
+ }
59
72
  item.fieldDisPlayName = fieldsMap[item.fieldName] || item.fieldDisPlayName;
60
73
  });
61
74
  } catch (_unused) {
@@ -107,7 +120,7 @@ var RecordLog = function RecordLog(props) {
107
120
  className: "log-item-box"
108
121
  }, /*#__PURE__*/React.createElement("div", {
109
122
  className: "log-item-header"
110
- }, showResourceName && /*#__PURE__*/React.createElement("span", null, item.resourceName || ''), /*#__PURE__*/React.createElement("span", null, item.creator || ''), /*#__PURE__*/React.createElement("span", null, OP_TYPE_MAP[item.operateType] || OP_TYPE_MAP['U']), /*#__PURE__*/React.createElement("span", null, item.dataName || ''), /*#__PURE__*/React.createElement("span", null, item.dataCode || '')), /*#__PURE__*/React.createElement("div", {
123
+ }, showResourceName && /*#__PURE__*/React.createElement("span", null, item.resourceName || ''), /*#__PURE__*/React.createElement("span", null, item.creator || ''), /*#__PURE__*/React.createElement("span", null, OP_TYPE_MAP[item.operateType] || OP_TYPE_MAP['U']), /*#__PURE__*/React.createElement("span", null, item.dataName || ''), showKey && /*#__PURE__*/React.createElement("span", null, item.dataCode || '')), /*#__PURE__*/React.createElement("div", {
111
124
  className: "log-item-content"
112
125
  }, renderFields(item.content)))));
113
126
  });
@@ -927,7 +927,7 @@ function useDtl(dtlParam) {
927
927
  };
928
928
  }();
929
929
  var btnDisabled = function btnDisabled(key) {
930
- if (btnStatus && typeof btnStatus(key) === 'boolean') return btnStatus(key);
930
+ if (btnStatus && typeof btnStatus(key, selectedRows) === 'boolean') return btnStatus(key, selectedRows);
931
931
  switch (key) {
932
932
  case 'edit':
933
933
  return selectedRows.length !== 1;
@@ -17,7 +17,7 @@ export declare type SingleParamType = {
17
17
  afterRemove?: (result: ApiResponse, rows?: any | any[]) => Promise<boolean>;
18
18
  afterSave?: (result: ApiResponse, item?: any, isDtl?: boolean) => Promise<boolean>;
19
19
  afterAudit?: (result: ApiResponse, item?: any | any[]) => Promise<boolean>;
20
- btnStatus?: (btnKey: string) => boolean | undefined;
20
+ btnStatus?: (btnKey: string, selectedRows?: any[]) => boolean | undefined;
21
21
  };
22
22
  /**
23
23
  * 单表基本增删改查 hooks
@@ -640,7 +640,7 @@ function useSingle(inParam) {
640
640
  * @returns
641
641
  */
642
642
  var btnDisabled = function btnDisabled(key) {
643
- if (btnStatus && typeof btnStatus(key) === 'boolean') return btnStatus(key);
643
+ if (btnStatus && typeof btnStatus(key, selectedRows) === 'boolean') return btnStatus(key, selectedRows);
644
644
  switch (key) {
645
645
  case 'edit':
646
646
  return selectedRows.length !== 1 || isAudit();
package/es/utils/modal.js CHANGED
@@ -182,23 +182,24 @@ export var showConfirm = function showConfirm(text) {
182
182
  });
183
183
  });
184
184
  };
185
- var timeout = false;
186
185
  /**
187
186
  * Token过期重新登录
188
187
  *
189
188
  * @returns
190
189
  */
191
190
  export var reLogin = function reLogin() {
192
- if (timeout) return;
193
- timeout = true;
191
+ // 如果已经显示过,则不再显示
192
+ if (sessionStorage.getItem('reLogin') === '1') return;
193
+ sessionStorage.setItem('reLogin', '1');
194
194
  _Modal.warning({
195
195
  title: '登录状态已过期,请重新登录',
196
196
  okText: '重新登录',
197
197
  maskClosable: false,
198
198
  getContainer: getFullScreenElement() || document.body,
199
199
  afterClose: function afterClose() {
200
- timeout = false;
201
- (window.top || window).location.href = location.pathname === '/' ? '/login/' : '/login/?redirect=' + encodeURIComponent(location.href);
200
+ sessionStorage.removeItem('reLogin');
201
+ var win = window.top || window; // 获取顶层窗口,防止iframe加载子工程页面
202
+ win.location.href = location.pathname === '/' ? '/login/' : '/login/?redirect=' + encodeURIComponent(win.location.href);
202
203
  }
203
204
  });
204
205
  };
@@ -5,6 +5,7 @@ export declare type GroupTitleProps = {
5
5
  className?: string;
6
6
  style?: React.CSSProperties;
7
7
  isInner?: boolean;
8
+ children?: React.ReactNode;
8
9
  };
9
10
  declare const GroupTip: React.FC<GroupTitleProps>;
10
11
  export default GroupTip;
@@ -13,6 +13,8 @@ export interface RecordLogProps {
13
13
  showResourceName?: boolean;
14
14
  style?: React.CSSProperties;
15
15
  className?: string;
16
+ showKey?: boolean;
17
+ fieldValueMap?: Record<string, Record<string | number, any>>;
16
18
  }
17
19
  declare const RecordLog: (props: RecordLogProps) => JSX.Element;
18
20
  export default RecordLog;
@@ -32,7 +32,11 @@ var RecordLog = function RecordLog(props) {
32
32
  showResourceName = _props$showResourceNa === void 0 ? true : _props$showResourceNa,
33
33
  style = props.style,
34
34
  _props$className = props.className,
35
- className = _props$className === void 0 ? '' : _props$className;
35
+ className = _props$className === void 0 ? '' : _props$className,
36
+ _props$showKey = props.showKey,
37
+ showKey = _props$showKey === void 0 ? true : _props$showKey,
38
+ _props$fieldValueMap = props.fieldValueMap,
39
+ fieldValueMap = _props$fieldValueMap === void 0 ? {} : _props$fieldValueMap;
36
40
  var getLogData = function getLogData() {
37
41
  var url = '/lesoon-petrel-behaviour-api/behUserOperateLog/page';
38
42
  var params = {
@@ -53,9 +57,18 @@ var RecordLog = function RecordLog(props) {
53
57
  row.content = JSON.parse(row.content);
54
58
  row.content.forEach(function (item) {
55
59
  var o = item.oldValue || '';
56
- item.oldValue = !o || o == '[]' || (o === null || o === void 0 ? void 0 : o.length) == 0 ? '空' : o + '';
60
+ var map = fieldValueMap[item.fieldName];
61
+ if (map && map[o]) {
62
+ item.oldValue = map[o];
63
+ } else {
64
+ item.oldValue = !o || o == '[]' || (o === null || o === void 0 ? void 0 : o.length) == 0 ? '空' : o + '';
65
+ }
57
66
  var n = item.newValue || '';
58
- item.newValue = !n || n == '[]' || (n === null || n === void 0 ? void 0 : n.length) == 0 ? '空' : n + '';
67
+ if (map && map[n]) {
68
+ item.newValue = map[n];
69
+ } else {
70
+ item.newValue = !n || n == '[]' || (n === null || n === void 0 ? void 0 : n.length) == 0 ? '空' : n + '';
71
+ }
59
72
  item.fieldDisPlayName = fieldsMap[item.fieldName] || item.fieldDisPlayName;
60
73
  });
61
74
  } catch (_unused) {
@@ -107,7 +120,7 @@ var RecordLog = function RecordLog(props) {
107
120
  className: "log-item-box"
108
121
  }, /*#__PURE__*/React.createElement("div", {
109
122
  className: "log-item-header"
110
- }, showResourceName && /*#__PURE__*/React.createElement("span", null, item.resourceName || ''), /*#__PURE__*/React.createElement("span", null, item.creator || ''), /*#__PURE__*/React.createElement("span", null, OP_TYPE_MAP[item.operateType] || OP_TYPE_MAP['U']), /*#__PURE__*/React.createElement("span", null, item.dataName || ''), /*#__PURE__*/React.createElement("span", null, item.dataCode || '')), /*#__PURE__*/React.createElement("div", {
123
+ }, showResourceName && /*#__PURE__*/React.createElement("span", null, item.resourceName || ''), /*#__PURE__*/React.createElement("span", null, item.creator || ''), /*#__PURE__*/React.createElement("span", null, OP_TYPE_MAP[item.operateType] || OP_TYPE_MAP['U']), /*#__PURE__*/React.createElement("span", null, item.dataName || ''), showKey && /*#__PURE__*/React.createElement("span", null, item.dataCode || '')), /*#__PURE__*/React.createElement("div", {
111
124
  className: "log-item-content"
112
125
  }, renderFields(item.content)))));
113
126
  });
@@ -927,7 +927,7 @@ function useDtl(dtlParam) {
927
927
  };
928
928
  }();
929
929
  var btnDisabled = function btnDisabled(key) {
930
- if (btnStatus && typeof btnStatus(key) === 'boolean') return btnStatus(key);
930
+ if (btnStatus && typeof btnStatus(key, selectedRows) === 'boolean') return btnStatus(key, selectedRows);
931
931
  switch (key) {
932
932
  case 'edit':
933
933
  return selectedRows.length !== 1;
@@ -17,7 +17,7 @@ export declare type SingleParamType = {
17
17
  afterRemove?: (result: ApiResponse, rows?: any | any[]) => Promise<boolean>;
18
18
  afterSave?: (result: ApiResponse, item?: any, isDtl?: boolean) => Promise<boolean>;
19
19
  afterAudit?: (result: ApiResponse, item?: any | any[]) => Promise<boolean>;
20
- btnStatus?: (btnKey: string) => boolean | undefined;
20
+ btnStatus?: (btnKey: string, selectedRows?: any[]) => boolean | undefined;
21
21
  };
22
22
  /**
23
23
  * 单表基本增删改查 hooks
@@ -640,7 +640,7 @@ function useSingle(inParam) {
640
640
  * @returns
641
641
  */
642
642
  var btnDisabled = function btnDisabled(key) {
643
- if (btnStatus && typeof btnStatus(key) === 'boolean') return btnStatus(key);
643
+ if (btnStatus && typeof btnStatus(key, selectedRows) === 'boolean') return btnStatus(key, selectedRows);
644
644
  switch (key) {
645
645
  case 'edit':
646
646
  return selectedRows.length !== 1 || isAudit();
@@ -182,23 +182,24 @@ export var showConfirm = function showConfirm(text) {
182
182
  });
183
183
  });
184
184
  };
185
- var timeout = false;
186
185
  /**
187
186
  * Token过期重新登录
188
187
  *
189
188
  * @returns
190
189
  */
191
190
  export var reLogin = function reLogin() {
192
- if (timeout) return;
193
- timeout = true;
191
+ // 如果已经显示过,则不再显示
192
+ if (sessionStorage.getItem('reLogin') === '1') return;
193
+ sessionStorage.setItem('reLogin', '1');
194
194
  _Modal.warning({
195
195
  title: '登录状态已过期,请重新登录',
196
196
  okText: '重新登录',
197
197
  maskClosable: false,
198
198
  getContainer: getFullScreenElement() || document.body,
199
199
  afterClose: function afterClose() {
200
- timeout = false;
201
- (window.top || window).location.href = location.pathname === '/' ? '/login/' : '/login/?redirect=' + encodeURIComponent(location.href);
200
+ sessionStorage.removeItem('reLogin');
201
+ var win = window.top || window; // 获取顶层窗口,防止iframe加载子工程页面
202
+ win.location.href = location.pathname === '/' ? '/login/' : '/login/?redirect=' + encodeURIComponent(win.location.href);
202
203
  }
203
204
  });
204
205
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "3.1.10",
3
+ "version": "3.1.12",
4
4
  "description": "ls-pro-common",
5
5
  "license": "MIT",
6
6
  "sideEffects": [