ls-pro-common 3.1.10 → 3.1.11

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.
@@ -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();
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "3.1.10",
3
+ "version": "3.1.11",
4
4
  "description": "ls-pro-common",
5
5
  "license": "MIT",
6
6
  "sideEffects": [