ls-pro-common 3.1.9 → 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.
- package/dist/common.css +1 -0
- package/dist/common.js +1 -1
- package/dist/common.min.css +1 -0
- package/dist/common.min.js +1 -1
- package/es/components/RecordLog/index.d.ts +2 -0
- package/es/components/RecordLog/index.js +17 -4
- package/es/hooks/useDtl/index.js +1 -1
- package/es/hooks/useSingle/index.d.ts +1 -1
- package/es/hooks/useSingle/index.js +1 -1
- package/es/utils/index.js +10 -4
- package/lib/components/RecordLog/index.d.ts +2 -0
- package/lib/components/RecordLog/index.js +17 -4
- package/lib/hooks/useDtl/index.js +1 -1
- package/lib/hooks/useSingle/index.d.ts +1 -1
- package/lib/hooks/useSingle/index.js +1 -1
- package/lib/utils/index.js +10 -4
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
});
|
package/es/hooks/useDtl/index.js
CHANGED
|
@@ -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/index.js
CHANGED
|
@@ -42,9 +42,10 @@ export var getResourceProps = function getResourceProps(name) {
|
|
|
42
42
|
obj = resList.find(function (o) {
|
|
43
43
|
return o.resourceId === id;
|
|
44
44
|
});
|
|
45
|
-
} else if (location.pathname && location.pathname.length >
|
|
45
|
+
} else if (location.pathname && location.pathname.length > 3) {
|
|
46
|
+
var url = location.pathname + location.hash;
|
|
46
47
|
obj = resList.find(function (o) {
|
|
47
|
-
return o.microUrl === location.pathname;
|
|
48
|
+
return o.microUrl && o.microUrl === location.pathname || o.url === url;
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
if (!obj) return '';
|
|
@@ -399,9 +400,14 @@ export var appPath = function appPath() {
|
|
|
399
400
|
return window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__;
|
|
400
401
|
}
|
|
401
402
|
if (path) return path;
|
|
403
|
+
//本地开发环境,判断是否hash路由,如果是hash路由,则返回./
|
|
404
|
+
if (isDev) {
|
|
405
|
+
return location.hash ? './' : '/';
|
|
406
|
+
}
|
|
407
|
+
// 生产环境,返回当前路径
|
|
402
408
|
var p = location.pathname || '';
|
|
403
|
-
|
|
404
|
-
return
|
|
409
|
+
if (p === '/') return location.origin + '/';
|
|
410
|
+
return location.origin + '/' + p.split('/')[1] + '/';
|
|
405
411
|
};
|
|
406
412
|
/**
|
|
407
413
|
* 深度复制对象
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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/lib/utils/index.js
CHANGED
|
@@ -42,9 +42,10 @@ export var getResourceProps = function getResourceProps(name) {
|
|
|
42
42
|
obj = resList.find(function (o) {
|
|
43
43
|
return o.resourceId === id;
|
|
44
44
|
});
|
|
45
|
-
} else if (location.pathname && location.pathname.length >
|
|
45
|
+
} else if (location.pathname && location.pathname.length > 3) {
|
|
46
|
+
var url = location.pathname + location.hash;
|
|
46
47
|
obj = resList.find(function (o) {
|
|
47
|
-
return o.microUrl === location.pathname;
|
|
48
|
+
return o.microUrl && o.microUrl === location.pathname || o.url === url;
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
if (!obj) return '';
|
|
@@ -399,9 +400,14 @@ export var appPath = function appPath() {
|
|
|
399
400
|
return window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__;
|
|
400
401
|
}
|
|
401
402
|
if (path) return path;
|
|
403
|
+
//本地开发环境,判断是否hash路由,如果是hash路由,则返回./
|
|
404
|
+
if (isDev) {
|
|
405
|
+
return location.hash ? './' : '/';
|
|
406
|
+
}
|
|
407
|
+
// 生产环境,返回当前路径
|
|
402
408
|
var p = location.pathname || '';
|
|
403
|
-
|
|
404
|
-
return
|
|
409
|
+
if (p === '/') return location.origin + '/';
|
|
410
|
+
return location.origin + '/' + p.split('/')[1] + '/';
|
|
405
411
|
};
|
|
406
412
|
/**
|
|
407
413
|
* 深度复制对象
|