zmdms-webui 2.7.4 → 2.7.5
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.
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { useState, useCallback } from 'react';
|
|
2
2
|
import { getSetDynamicKey } from './useDynamic.js';
|
|
3
|
+
import '../config/ZtxkContext.js';
|
|
4
|
+
import useBaseContext from '../config/useBaseContext.js';
|
|
5
|
+
import '../config/MyStorage.js';
|
|
3
6
|
|
|
4
7
|
function useDrawer(currentDynamicList, setCurrentDynamicList, dynamicKey, parentDynamicKey, setTempDynamicList, list, onCurrentListChange) {
|
|
5
8
|
// 控制抽屉显示隐藏
|
|
6
9
|
var _a = useState(false), visible = _a[0], setVisible = _a[1];
|
|
10
|
+
var customConfigFetch = useBaseContext().customConfigFetch;
|
|
7
11
|
// 设置缓存数据的方法
|
|
8
12
|
var setDynamicKey = useCallback(function () {
|
|
9
|
-
return getSetDynamicKey(parentDynamicKey, "".concat(parentDynamicKey, "_lru_key"));
|
|
10
|
-
}, [parentDynamicKey]);
|
|
13
|
+
return getSetDynamicKey(parentDynamicKey, "".concat(parentDynamicKey, "_lru_key"), customConfigFetch);
|
|
14
|
+
}, [parentDynamicKey, customConfigFetch]);
|
|
11
15
|
// 关闭
|
|
12
16
|
var onClose = useCallback(function () {
|
|
13
17
|
setVisible(false);
|
|
@@ -143,7 +143,7 @@ function getCurrentDynamicItems(dynamicKey, parentDynamicKey, list) {
|
|
|
143
143
|
* @param dynamicStorageKey 保留的key值
|
|
144
144
|
* @param value 值
|
|
145
145
|
*/
|
|
146
|
-
function getSetDynamicKey(LOCALSTORAGE_KEY, LOCALSTORAGE_LRU_KEY) {
|
|
146
|
+
function getSetDynamicKey(LOCALSTORAGE_KEY, LOCALSTORAGE_LRU_KEY, customConfigFetch) {
|
|
147
147
|
return function (dynamicStorageKey, value) {
|
|
148
148
|
var obj = {};
|
|
149
149
|
var lruKeys = [];
|
|
@@ -184,8 +184,26 @@ function getSetDynamicKey(LOCALSTORAGE_KEY, LOCALSTORAGE_LRU_KEY) {
|
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
obj[dynamicStorageKey] = value;
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
var data = JSON.stringify(obj);
|
|
188
|
+
var lruData = JSON.stringify(lruKeys);
|
|
189
|
+
localStorage.setItem(LOCALSTORAGE_KEY, data);
|
|
190
|
+
localStorage.setItem(LOCALSTORAGE_LRU_KEY, lruData);
|
|
191
|
+
// 持久化存储
|
|
192
|
+
try {
|
|
193
|
+
customConfigFetch === null || customConfigFetch === void 0 ? void 0 : customConfigFetch({
|
|
194
|
+
customKey: LOCALSTORAGE_KEY,
|
|
195
|
+
customValue: data,
|
|
196
|
+
mark: "表单动态列配置缓存数据-新版组件库",
|
|
197
|
+
});
|
|
198
|
+
customConfigFetch === null || customConfigFetch === void 0 ? void 0 : customConfigFetch({
|
|
199
|
+
customKey: LOCALSTORAGE_LRU_KEY,
|
|
200
|
+
customValue: lruData,
|
|
201
|
+
mark: "表单动态列配置缓存LRUKey数据-新版组件库",
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
catch (err) {
|
|
205
|
+
console.error("\u8BBE\u7F6E\u52A8\u6001\u5217\u7F13\u5B58\u6570\u636E\u5931\u8D25!", err);
|
|
206
|
+
}
|
|
189
207
|
};
|
|
190
208
|
}
|
|
191
209
|
/**
|
|
@@ -179,23 +179,20 @@ function useCommonSearch(options) {
|
|
|
179
179
|
return __generator(this, function (_a) {
|
|
180
180
|
switch (_a.label) {
|
|
181
181
|
case 0:
|
|
182
|
-
|
|
183
|
-
_a.label = 1;
|
|
184
|
-
case 1:
|
|
185
|
-
_a.trys.push([1, 3, , 4]);
|
|
182
|
+
_a.trys.push([0, 2, , 3]);
|
|
186
183
|
return [4 /*yield*/, (customConfigFetch === null || customConfigFetch === void 0 ? void 0 : customConfigFetch({
|
|
187
184
|
customKey: COMMON_SEARCH_KEY,
|
|
188
185
|
customValue: JSON.stringify(res),
|
|
189
186
|
mark: "常用搜索用户配置",
|
|
190
187
|
}))];
|
|
191
|
-
case
|
|
188
|
+
case 1:
|
|
192
189
|
_a.sent();
|
|
193
|
-
return [3 /*break*/,
|
|
194
|
-
case
|
|
190
|
+
return [3 /*break*/, 3];
|
|
191
|
+
case 2:
|
|
195
192
|
error_1 = _a.sent();
|
|
196
193
|
console.error("更新服务器数据失败!", error_1);
|
|
197
|
-
return [3 /*break*/,
|
|
198
|
-
case
|
|
194
|
+
return [3 /*break*/, 3];
|
|
195
|
+
case 3: return [2 /*return*/];
|
|
199
196
|
}
|
|
200
197
|
});
|
|
201
198
|
}); })];
|