antd-management-fast-framework 1.9.31 → 1.9.38
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/es/framework/DataModal/Base/index.js +10 -14
- package/es/framework/FieldExtension/SelectFieldDrawer/SelectFieldBase/index.d.ts +1 -0
- package/es/framework/FieldExtension/SelectFieldDrawer/SelectFieldBase/index.js +6 -2
- package/es/utils/authority.d.ts +4 -0
- package/es/utils/authority.js +42 -3
- package/es/utils/cacheAssist.d.ts +85 -0
- package/es/utils/cacheAssist.js +313 -0
- package/es/utils/requestAssistor.d.ts +14 -14
- package/es/utils/requestAssistor.js +14 -0
- package/package.json +2 -1
|
@@ -108,10 +108,6 @@ var Base = /*#__PURE__*/function (_BaseWindow) {
|
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
_this.getSaveButtonDisabled = function () {
|
|
111
|
-
var _this$state = _this.state,
|
|
112
|
-
dataLoading = _this$state.dataLoading,
|
|
113
|
-
processing = _this$state.processing,
|
|
114
|
-
loadSuccess = _this$state.loadSuccess;
|
|
115
111
|
return _this.checkOperability();
|
|
116
112
|
};
|
|
117
113
|
|
|
@@ -217,11 +213,11 @@ var Base = /*#__PURE__*/function (_BaseWindow) {
|
|
|
217
213
|
};
|
|
218
214
|
|
|
219
215
|
_this.renderForm = function () {
|
|
220
|
-
var _this$
|
|
221
|
-
metaData = _this$
|
|
222
|
-
metaListData = _this$
|
|
223
|
-
metaExtra = _this$
|
|
224
|
-
metaOriginalData = _this$
|
|
216
|
+
var _this$state = _this.state,
|
|
217
|
+
metaData = _this$state.metaData,
|
|
218
|
+
metaListData = _this$state.metaListData,
|
|
219
|
+
metaExtra = _this$state.metaExtra,
|
|
220
|
+
metaOriginalData = _this$state.metaOriginalData;
|
|
225
221
|
|
|
226
222
|
var initialValues = _this.buildInitialValues({
|
|
227
223
|
metaData: metaData,
|
|
@@ -258,11 +254,11 @@ var Base = /*#__PURE__*/function (_BaseWindow) {
|
|
|
258
254
|
value: function renderFurther() {
|
|
259
255
|
var _this2 = this;
|
|
260
256
|
|
|
261
|
-
var _this$
|
|
262
|
-
width = _this$
|
|
263
|
-
visible = _this$
|
|
264
|
-
processing = _this$
|
|
265
|
-
dataLoading = _this$
|
|
257
|
+
var _this$state2 = this.state,
|
|
258
|
+
width = _this$state2.width,
|
|
259
|
+
visible = _this$state2.visible,
|
|
260
|
+
processing = _this$state2.processing,
|
|
261
|
+
dataLoading = _this$state2.dataLoading;
|
|
266
262
|
var maskClosable = this.props.maskClosable;
|
|
267
263
|
return /*#__PURE__*/_react["default"].createElement(_modal["default"], {
|
|
268
264
|
title: this.buildTitle(),
|
|
@@ -16,6 +16,7 @@ declare class SelectFieldBase extends SupplementWrapper {
|
|
|
16
16
|
declare namespace SelectFieldBase {
|
|
17
17
|
export namespace defaultProps {
|
|
18
18
|
export const dataLoading: boolean;
|
|
19
|
+
export const processing: boolean;
|
|
19
20
|
export const loadSuccess: boolean;
|
|
20
21
|
export const required: boolean;
|
|
21
22
|
export const showClear: boolean;
|
|
@@ -97,6 +97,9 @@ var SelectFieldBase = /*#__PURE__*/function (_SupplementWrapper) {
|
|
|
97
97
|
|
|
98
98
|
_this.renderField = function () {
|
|
99
99
|
var _this$props = _this.props,
|
|
100
|
+
dataLoading = _this$props.dataLoading,
|
|
101
|
+
processing = _this$props.processing,
|
|
102
|
+
loadSuccess = _this$props.loadSuccess,
|
|
100
103
|
label = _this$props.label,
|
|
101
104
|
helper = _this$props.helper,
|
|
102
105
|
formItemLayout = _this$props.formItemLayout,
|
|
@@ -122,7 +125,7 @@ var SelectFieldBase = /*#__PURE__*/function (_SupplementWrapper) {
|
|
|
122
125
|
paddingLeft: 0,
|
|
123
126
|
paddingRight: 0
|
|
124
127
|
},
|
|
125
|
-
disabled:
|
|
128
|
+
disabled: dataLoading || processing || !loadSuccess,
|
|
126
129
|
title: "\u9009\u62E9".concat(fieldTitle),
|
|
127
130
|
onClick: function onClick(e) {
|
|
128
131
|
return _this.showSelect(e);
|
|
@@ -141,7 +144,7 @@ var SelectFieldBase = /*#__PURE__*/function (_SupplementWrapper) {
|
|
|
141
144
|
paddingLeft: 0,
|
|
142
145
|
paddingRight: 0
|
|
143
146
|
},
|
|
144
|
-
disabled:
|
|
147
|
+
disabled: dataLoading || processing || !loadSuccess,
|
|
145
148
|
title: "\u6E05\u9664\u9009\u62E9",
|
|
146
149
|
onClick: function onClick() {
|
|
147
150
|
return _this.clearSelect();
|
|
@@ -173,6 +176,7 @@ var SelectFieldBase = /*#__PURE__*/function (_SupplementWrapper) {
|
|
|
173
176
|
|
|
174
177
|
SelectFieldBase.defaultProps = {
|
|
175
178
|
dataLoading: false,
|
|
179
|
+
processing: false,
|
|
176
180
|
loadSuccess: true,
|
|
177
181
|
required: false,
|
|
178
182
|
showClear: true
|
package/es/utils/authority.d.ts
CHANGED
package/es/utils/authority.js
CHANGED
|
@@ -10,6 +10,8 @@ exports.setAuthority = setAuthority;
|
|
|
10
10
|
|
|
11
11
|
var _tools = require("./tools");
|
|
12
12
|
|
|
13
|
+
var _cacheAssist = require("./cacheAssist");
|
|
14
|
+
|
|
13
15
|
var _globalStorageAssist = require("./globalStorageAssist");
|
|
14
16
|
|
|
15
17
|
var _Authorized = require("./Authorized");
|
|
@@ -54,6 +56,28 @@ function checkIsSuper() {
|
|
|
54
56
|
function checkHasAuthority(auth) {
|
|
55
57
|
var _accessWayCollection$;
|
|
56
58
|
|
|
59
|
+
if ((0, _tools.isObject)(auth)) {
|
|
60
|
+
console.log({
|
|
61
|
+
auth: auth,
|
|
62
|
+
attachedTargetName: (this || null) != null ? (this.constructor || null) != null ? this.constructor.name : '' : ''
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
var result = '0';
|
|
67
|
+
var existCache = (0, _cacheAssist.hasCache)({
|
|
68
|
+
key: auth
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
if (existCache) {
|
|
72
|
+
result = (0, _cacheAssist.getCache)({
|
|
73
|
+
key: auth
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
if (result !== undefined) {
|
|
77
|
+
return result !== '0';
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
57
81
|
var list = getAllAuthorityCore();
|
|
58
82
|
var accessWayCollection = (0, _globalStorageAssist.getAccessWayCollectionCache)();
|
|
59
83
|
var superAuth = (_accessWayCollection$ = accessWayCollection["super"].permission) !== null && _accessWayCollection$ !== void 0 ? _accessWayCollection$ : '';
|
|
@@ -62,6 +86,10 @@ function checkHasAuthority(auth) {
|
|
|
62
86
|
});
|
|
63
87
|
|
|
64
88
|
if (isSuper === superAuth) {
|
|
89
|
+
(0, _cacheAssist.setCache)({
|
|
90
|
+
key: auth,
|
|
91
|
+
value: '1'
|
|
92
|
+
});
|
|
65
93
|
return true;
|
|
66
94
|
}
|
|
67
95
|
|
|
@@ -78,12 +106,23 @@ function checkHasAuthority(auth) {
|
|
|
78
106
|
});
|
|
79
107
|
}
|
|
80
108
|
|
|
81
|
-
|
|
109
|
+
result = !!(v !== undefined) ? '1' : '0';
|
|
110
|
+
(0, _cacheAssist.setCache)({
|
|
111
|
+
key: auth,
|
|
112
|
+
value: result
|
|
113
|
+
});
|
|
114
|
+
return result !== '0';
|
|
82
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* 缓存用户权限数据体
|
|
118
|
+
* @param {*} authority
|
|
119
|
+
*/
|
|
120
|
+
|
|
83
121
|
|
|
84
122
|
function setAuthority(authority) {
|
|
85
|
-
var
|
|
86
|
-
(0, _tools.saveJsonToLocalStorage)(_globalStorageAssist.storageKeyCollection.authorityCollection,
|
|
123
|
+
var authorityCollection = typeof authority === 'string' ? [authority] : authority;
|
|
124
|
+
(0, _tools.saveJsonToLocalStorage)(_globalStorageAssist.storageKeyCollection.authorityCollection, authorityCollection);
|
|
125
|
+
(0, _cacheAssist.flushAllCache)(); // auto reload
|
|
87
126
|
|
|
88
127
|
(0, _Authorized.reloadAuthorized)();
|
|
89
128
|
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取缓存池
|
|
3
|
+
* @export
|
|
4
|
+
*/
|
|
5
|
+
export function getCachePool(): any;
|
|
6
|
+
/**
|
|
7
|
+
* Returns boolean indicating if the key is cached
|
|
8
|
+
* @param {*} key
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
export function hasCache({ key }: any): any;
|
|
12
|
+
/**
|
|
13
|
+
* Sets a key value pair. It is possible to define a ttl (in seconds). Returns true on success
|
|
14
|
+
* @param {*} key
|
|
15
|
+
* @param {*} value
|
|
16
|
+
* @param {*} expiration
|
|
17
|
+
*/
|
|
18
|
+
export function setCache({ key, value, expiration }: any): any;
|
|
19
|
+
/**
|
|
20
|
+
* Sets multiple key val pairs. It is possible to define a ttl (seconds). Returns true on success
|
|
21
|
+
* @param {*} list
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
export function setMultiCache(list: any): any;
|
|
25
|
+
/**
|
|
26
|
+
* a timestamp in ms representing the time at which the key will expire
|
|
27
|
+
* @param {*} key
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
export function getExpiration({ key }: any): any;
|
|
31
|
+
/**
|
|
32
|
+
* Redefine the ttl of a key. Returns true if the key has been found and changed. Otherwise returns false. If the ttl-argument isn't passed the default-TTL will be used.
|
|
33
|
+
* The key will be deleted when passing in a ttl < 0
|
|
34
|
+
* @param {*} key
|
|
35
|
+
* @param {*} expiration
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
export function setExpiration({ key, expiration }: any): any;
|
|
39
|
+
/**
|
|
40
|
+
* Gets a saved value from the cache. Returns a undefined if not found or expired. If the value was found it returns the value
|
|
41
|
+
* @param {*} key
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
export function getCache({ key }: any): any;
|
|
45
|
+
/**
|
|
46
|
+
* Gets multiple saved values from the cache. Returns an empty object {} if not found or expired. If the value was found it returns an object with the key value pair.
|
|
47
|
+
* @param {*} list
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
export function getMultiCache(list: any): any;
|
|
51
|
+
/**
|
|
52
|
+
* get the cached value and remove the key from the cache.
|
|
53
|
+
* @param {*} key
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
export function takeCache({ key }: any): any;
|
|
57
|
+
/**
|
|
58
|
+
* delete a key. Returns the number of deleted entries. A delete will never fail.
|
|
59
|
+
* @param {*} key
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
62
|
+
export function deleteCache({ key }: any): any;
|
|
63
|
+
/**
|
|
64
|
+
* Delete multiple keys. Returns the number of deleted entries. A delete will never fail.
|
|
65
|
+
* @param {*} list
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
export function deleteMultiCache(list: any): any;
|
|
69
|
+
/**
|
|
70
|
+
* Flush all data.
|
|
71
|
+
* @returns
|
|
72
|
+
*/
|
|
73
|
+
export function flushAllCache(): any;
|
|
74
|
+
/**
|
|
75
|
+
* Returns the statistics.
|
|
76
|
+
* @returns
|
|
77
|
+
*/
|
|
78
|
+
export function statisticsCache(): any;
|
|
79
|
+
/**
|
|
80
|
+
* 占位函数
|
|
81
|
+
*
|
|
82
|
+
* @export
|
|
83
|
+
* @returns
|
|
84
|
+
*/
|
|
85
|
+
export function emptyExport(): {};
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.deleteCache = deleteCache;
|
|
7
|
+
exports.deleteMultiCache = deleteMultiCache;
|
|
8
|
+
exports.emptyExport = emptyExport;
|
|
9
|
+
exports.flushAllCache = flushAllCache;
|
|
10
|
+
exports.getCache = getCache;
|
|
11
|
+
exports.getCachePool = getCachePool;
|
|
12
|
+
exports.getExpiration = getExpiration;
|
|
13
|
+
exports.getMultiCache = getMultiCache;
|
|
14
|
+
exports.hasCache = hasCache;
|
|
15
|
+
exports.setCache = setCache;
|
|
16
|
+
exports.setExpiration = setExpiration;
|
|
17
|
+
exports.setMultiCache = setMultiCache;
|
|
18
|
+
exports.statisticsCache = statisticsCache;
|
|
19
|
+
exports.takeCache = takeCache;
|
|
20
|
+
|
|
21
|
+
var _nodeCache = _interopRequireDefault(require("node-cache"));
|
|
22
|
+
|
|
23
|
+
var _tools = require("./tools");
|
|
24
|
+
|
|
25
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
26
|
+
|
|
27
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
28
|
+
|
|
29
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
30
|
+
|
|
31
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
32
|
+
|
|
33
|
+
function checkKey(key) {
|
|
34
|
+
if ((0, _tools.stringIsNullOrWhiteSpace)(key)) {
|
|
35
|
+
throw new Error('cache key is null or empty');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (!((0, _tools.isString)(key) || (0, _tools.isNumber)(key))) {
|
|
39
|
+
(0, _tools.recordError)(key);
|
|
40
|
+
throw new Error('cache key must be string or number,you can check it in console');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* 获取缓存池
|
|
45
|
+
* @export
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
function getCachePool() {
|
|
50
|
+
if ((window.localRunningCache || null) == null) {
|
|
51
|
+
window.localRunningCache = new _nodeCache["default"]();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return window.localRunningCache;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Returns boolean indicating if the key is cached
|
|
58
|
+
* @param {*} key
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
function hasCache(_ref) {
|
|
64
|
+
var key = _ref.key;
|
|
65
|
+
var cachePool = getCachePool();
|
|
66
|
+
|
|
67
|
+
if (cachePool == null) {
|
|
68
|
+
throw new Error('cache pool not exist');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return cachePool.has(key);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Sets a key value pair. It is possible to define a ttl (in seconds). Returns true on success
|
|
75
|
+
* @param {*} key
|
|
76
|
+
* @param {*} value
|
|
77
|
+
* @param {*} expiration
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
function setCache(_ref2) {
|
|
82
|
+
var key = _ref2.key,
|
|
83
|
+
value = _ref2.value,
|
|
84
|
+
_ref2$expiration = _ref2.expiration,
|
|
85
|
+
expiration = _ref2$expiration === void 0 ? 0 : _ref2$expiration;
|
|
86
|
+
checkKey(key);
|
|
87
|
+
var cachePool = getCachePool();
|
|
88
|
+
|
|
89
|
+
if (cachePool == null) {
|
|
90
|
+
throw new Error('cache pool not exist');
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return cachePool.set(key, value, expiration);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Sets multiple key val pairs. It is possible to define a ttl (seconds). Returns true on success
|
|
97
|
+
* @param {*} list
|
|
98
|
+
* @returns
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
function setMultiCache(list) {
|
|
103
|
+
if (!(0, _tools.isArray)(list)) {
|
|
104
|
+
throw new Error('setMultiCache: list must be array');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (list.length <= 0) {
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
var listData = [];
|
|
112
|
+
list.forEach(function (o) {
|
|
113
|
+
var _key$value$expiration = _objectSpread(_objectSpread({}, {
|
|
114
|
+
key: '',
|
|
115
|
+
value: '',
|
|
116
|
+
expiration: 0
|
|
117
|
+
}), o),
|
|
118
|
+
key = _key$value$expiration.key,
|
|
119
|
+
value = _key$value$expiration.value,
|
|
120
|
+
expiration = _key$value$expiration.expiration;
|
|
121
|
+
|
|
122
|
+
if (!(0, _tools.stringIsNullOrWhiteSpace)(key)) {
|
|
123
|
+
checkKey(key);
|
|
124
|
+
listData.push({
|
|
125
|
+
key: key,
|
|
126
|
+
value: value,
|
|
127
|
+
ttl: expiration
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
if (listData.length <= 0) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
var cachePool = getCachePool();
|
|
137
|
+
|
|
138
|
+
if (cachePool == null) {
|
|
139
|
+
throw new Error('cache pool not exist');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return cachePool.mset(listData);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* a timestamp in ms representing the time at which the key will expire
|
|
146
|
+
* @param {*} key
|
|
147
|
+
* @returns
|
|
148
|
+
*/
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
function getExpiration(_ref3) {
|
|
152
|
+
var key = _ref3.key;
|
|
153
|
+
var cachePool = getCachePool();
|
|
154
|
+
|
|
155
|
+
if (cachePool == null) {
|
|
156
|
+
throw new Error('cache pool not exist');
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return cachePool.getTtl(key);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Redefine the ttl of a key. Returns true if the key has been found and changed. Otherwise returns false. If the ttl-argument isn't passed the default-TTL will be used.
|
|
163
|
+
* The key will be deleted when passing in a ttl < 0
|
|
164
|
+
* @param {*} key
|
|
165
|
+
* @param {*} expiration
|
|
166
|
+
* @returns
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
function setExpiration(_ref4) {
|
|
171
|
+
var key = _ref4.key,
|
|
172
|
+
expiration = _ref4.expiration;
|
|
173
|
+
var cachePool = getCachePool();
|
|
174
|
+
|
|
175
|
+
if (cachePool == null) {
|
|
176
|
+
throw new Error('cache pool not exist');
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return cachePool.ttl(key, expiration);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Gets a saved value from the cache. Returns a undefined if not found or expired. If the value was found it returns the value
|
|
183
|
+
* @param {*} key
|
|
184
|
+
* @returns
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
function getCache(_ref5) {
|
|
189
|
+
var key = _ref5.key;
|
|
190
|
+
var cachePool = getCachePool();
|
|
191
|
+
|
|
192
|
+
if (cachePool == null) {
|
|
193
|
+
throw new Error('cache pool not exist');
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return cachePool.get(key);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Gets multiple saved values from the cache. Returns an empty object {} if not found or expired. If the value was found it returns an object with the key value pair.
|
|
200
|
+
* @param {*} list
|
|
201
|
+
* @returns
|
|
202
|
+
*/
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
function getMultiCache(list) {
|
|
206
|
+
if (!(0, _tools.isArray)(list)) {
|
|
207
|
+
throw new Error('getMultiCache: list must be array');
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
var cachePool = getCachePool();
|
|
211
|
+
|
|
212
|
+
if (cachePool == null) {
|
|
213
|
+
throw new Error('cache pool not exist');
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return cachePool.mget(list);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* get the cached value and remove the key from the cache.
|
|
220
|
+
* @param {*} key
|
|
221
|
+
* @returns
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
function takeCache(_ref6) {
|
|
226
|
+
var key = _ref6.key;
|
|
227
|
+
var cachePool = getCachePool();
|
|
228
|
+
|
|
229
|
+
if (cachePool == null) {
|
|
230
|
+
throw new Error('cache pool not exist');
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return cachePool.take(key);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* delete a key. Returns the number of deleted entries. A delete will never fail.
|
|
237
|
+
* @param {*} key
|
|
238
|
+
* @returns
|
|
239
|
+
*/
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
function deleteCache(_ref7) {
|
|
243
|
+
var key = _ref7.key;
|
|
244
|
+
checkKey(key);
|
|
245
|
+
var cachePool = getCachePool();
|
|
246
|
+
|
|
247
|
+
if (cachePool == null) {
|
|
248
|
+
throw new Error('cache pool not exist');
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return cachePool.del(key);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Delete multiple keys. Returns the number of deleted entries. A delete will never fail.
|
|
255
|
+
* @param {*} list
|
|
256
|
+
* @returns
|
|
257
|
+
*/
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
function deleteMultiCache(list) {
|
|
261
|
+
if (!(0, _tools.isArray)(list)) {
|
|
262
|
+
throw new Error('deleteMultiCache: list must be array');
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
var cachePool = getCachePool();
|
|
266
|
+
|
|
267
|
+
if (cachePool == null) {
|
|
268
|
+
throw new Error('cache pool not exist');
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return cachePool.del(list);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Flush all data.
|
|
275
|
+
* @returns
|
|
276
|
+
*/
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
function flushAllCache() {
|
|
280
|
+
var cachePool = getCachePool();
|
|
281
|
+
|
|
282
|
+
if (cachePool == null) {
|
|
283
|
+
throw new Error('cache pool not exist');
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return cachePool.flushAll();
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Returns the statistics.
|
|
290
|
+
* @returns
|
|
291
|
+
*/
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
function statisticsCache() {
|
|
295
|
+
var cachePool = getCachePool();
|
|
296
|
+
|
|
297
|
+
if (cachePool == null) {
|
|
298
|
+
throw new Error('cache pool not exist');
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return cachePool.getStats();
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* 占位函数
|
|
305
|
+
*
|
|
306
|
+
* @export
|
|
307
|
+
* @returns
|
|
308
|
+
*/
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
function emptyExport() {
|
|
312
|
+
return {};
|
|
313
|
+
}
|
|
@@ -40,20 +40,20 @@ export function pretreatmentRequestParams(params: any, customHandle: any): {};
|
|
|
40
40
|
export function handleCommonDataAssist(state: any, action: any, callback?: any): any;
|
|
41
41
|
export function handleListDataAssist(state: any, action: any, pretreatment?: any, callback?: any): any;
|
|
42
42
|
export function handlePageListDataAssist(state: any, action: any, pretreatment?: any, callback?: any): any;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}): Promise<any>;
|
|
43
|
+
/**
|
|
44
|
+
* begin request(remote request / local virtual requests)
|
|
45
|
+
* @param {*} api [string]: request address
|
|
46
|
+
* @param {*} params [object]: request params
|
|
47
|
+
* @param {*} method [string]: ’GET‘ or ’POST‘, default is ’POST‘
|
|
48
|
+
* @param {*} useVirtualRequest [bool]: whether to apply virtual requests
|
|
49
|
+
* @param {*} showUseVirtualRequestMessage [bool]: whether display virtual request message prompt
|
|
50
|
+
* @param {*} virtualSuccessResponse [object]: virtual request success response data
|
|
51
|
+
* @param {*} virtualFailResponse [object]: virtual request fail response data
|
|
52
|
+
* @param {*} virtualRequestResult [object]:mandatory set virtual request result, generally used to debug
|
|
53
|
+
* @param {*} virtualNeedAuthorize [object]:set virtual request whether check token, only check mull or empty, generally used to debug
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
export function request({ api, params, method, useVirtualRequest, showUseVirtualRequestMessage, virtualSuccessResponse, virtualFailResponse, virtualRequestResult, virtualNeedAuthorize, }: any): Promise<any>;
|
|
57
57
|
/**
|
|
58
58
|
* 获取配置的 api 版本号
|
|
59
59
|
*/
|
|
@@ -373,6 +373,20 @@ function handlePageListDataAssist(state, action) {
|
|
|
373
373
|
fromRemote: true
|
|
374
374
|
});
|
|
375
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* begin request(remote request / local virtual requests)
|
|
378
|
+
* @param {*} api [string]: request address
|
|
379
|
+
* @param {*} params [object]: request params
|
|
380
|
+
* @param {*} method [string]: ’GET‘ or ’POST‘, default is ’POST‘
|
|
381
|
+
* @param {*} useVirtualRequest [bool]: whether to apply virtual requests
|
|
382
|
+
* @param {*} showUseVirtualRequestMessage [bool]: whether display virtual request message prompt
|
|
383
|
+
* @param {*} virtualSuccessResponse [object]: virtual request success response data
|
|
384
|
+
* @param {*} virtualFailResponse [object]: virtual request fail response data
|
|
385
|
+
* @param {*} virtualRequestResult [object]:mandatory set virtual request result, generally used to debug
|
|
386
|
+
* @param {*} virtualNeedAuthorize [object]:set virtual request whether check token, only check mull or empty, generally used to debug
|
|
387
|
+
* @returns
|
|
388
|
+
*/
|
|
389
|
+
|
|
376
390
|
|
|
377
391
|
function request(_x) {
|
|
378
392
|
return _request.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antd-management-fast-framework",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.38",
|
|
4
4
|
"description": "antd-management-fast-framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antd-management-fast-framework"
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"lodash.isequal": "^4.5.0",
|
|
46
46
|
"memoize-one": "^6.0.0",
|
|
47
47
|
"moment": "^2.29.1",
|
|
48
|
+
"node-cache": "^5.1.2",
|
|
48
49
|
"nprogress": "^0.2.0",
|
|
49
50
|
"numeral": "^2.0.6",
|
|
50
51
|
"omit.js": "^2.0.2",
|