@lingxiteam/ebe-utils 0.3.28 → 0.3.29
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.
|
@@ -6,7 +6,6 @@ import { cloneDeep, isPlainObject } from 'lodash';
|
|
|
6
6
|
import { useEffect, useRef, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
export interface UpdateDataSourceOptions {
|
|
9
|
-
|
|
10
9
|
/**
|
|
11
10
|
* 数据源名称
|
|
12
11
|
*/
|
|
@@ -52,7 +51,6 @@ export interface DataSourceOptions {
|
|
|
52
51
|
|
|
53
52
|
export interface BaseDataSourceType {
|
|
54
53
|
_others_: {
|
|
55
|
-
|
|
56
54
|
/**
|
|
57
55
|
* 用户信息
|
|
58
56
|
*/
|
|
@@ -165,6 +163,16 @@ const useBaseDataSource = <T extends BaseDataSourceType>(options: DataSourceOpti
|
|
|
165
163
|
[name]: params,
|
|
166
164
|
});
|
|
167
165
|
|
|
166
|
+
const getParams = (params: any) => {
|
|
167
|
+
if (params?.serviceRequest) {
|
|
168
|
+
return params?.serviceRequest;
|
|
169
|
+
} else if (params?.parameters) {
|
|
170
|
+
return params?.parameters;
|
|
171
|
+
} else if (params?.params) {
|
|
172
|
+
return params?.params;
|
|
173
|
+
}
|
|
174
|
+
return params;
|
|
175
|
+
};
|
|
168
176
|
/**
|
|
169
177
|
* 刷新对象数据源
|
|
170
178
|
*/
|
|
@@ -174,15 +182,15 @@ const useBaseDataSource = <T extends BaseDataSourceType>(options: DataSourceOpti
|
|
|
174
182
|
...options,
|
|
175
183
|
attrs: params,
|
|
176
184
|
})
|
|
177
|
-
.then(res => {
|
|
185
|
+
.then((res) => {
|
|
178
186
|
setData({
|
|
179
187
|
[name]: res,
|
|
180
|
-
[`${name}Filter`]: params,
|
|
188
|
+
[`${name}Filter`]: getParams(params),
|
|
181
189
|
});
|
|
182
190
|
const snapShot = cloneDeep(res);
|
|
183
191
|
setDataSnapshot({
|
|
184
192
|
[name]: snapShot,
|
|
185
|
-
[`${name}Filter`]: params,
|
|
193
|
+
[`${name}Filter`]: getParams(params),
|
|
186
194
|
});
|
|
187
195
|
return res;
|
|
188
196
|
})
|
|
@@ -195,18 +203,18 @@ const useBaseDataSource = <T extends BaseDataSourceType>(options: DataSourceOpti
|
|
|
195
203
|
/**
|
|
196
204
|
* 刷新服务数据源
|
|
197
205
|
*/
|
|
198
|
-
const reloadServiceDataSource = (name: string,
|
|
206
|
+
const reloadServiceDataSource = (name: string, url: any, params: any) => {
|
|
199
207
|
setLoading(true);
|
|
200
|
-
return fetchQueryService(
|
|
201
|
-
.then(res => {
|
|
208
|
+
return fetchQueryService(url, params)
|
|
209
|
+
.then((res) => {
|
|
202
210
|
setData({
|
|
203
211
|
[name]: res,
|
|
204
|
-
[`${name}Filter`]: params,
|
|
212
|
+
[`${name}Filter`]: getParams(params),
|
|
205
213
|
});
|
|
206
214
|
const snapShot = cloneDeep(res);
|
|
207
215
|
setDataSnapshot({
|
|
208
216
|
[name]: snapShot,
|
|
209
|
-
[`${name}Filter`]: params,
|
|
217
|
+
[`${name}Filter`]: getParams(params),
|
|
210
218
|
});
|
|
211
219
|
return res;
|
|
212
220
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingxiteam/ebe-utils",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.29",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@babel/types": "^7.12.12",
|
|
20
20
|
"cac": "^6.7.14",
|
|
21
21
|
"fs-extra": "9.x",
|
|
22
|
-
"@lingxiteam/ebe": "0.3.
|
|
22
|
+
"@lingxiteam/ebe": "0.3.29"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|