ls-pro-common 1.0.12 → 1.0.13

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.
@@ -3,21 +3,24 @@ declare const request: import("umi-request").RequestMethod<false>;
3
3
  * get请求
4
4
  * @param url 接口
5
5
  * @param params 参数{key:value}
6
+ * @param needGateWay 是否需要网关 默认为true
6
7
  * @returns Promise<ApiResponse>
7
8
  */
8
- export declare function httpGet(url: string, params?: Record<string, any>): Promise<any>;
9
+ export declare function httpGet(url: string, params?: Record<string, any>, needGateWay?: boolean): Promise<any>;
9
10
  /**
10
11
  * post请求
11
12
  * @param url 接口
12
13
  * @param data 参数{key:value}
13
14
  * @param isJson json请求还是form请求,默认为json请求
15
+ * @param needGateWay 是否需要网关 默认为true
14
16
  * @returns Promise<ApiResponse>
15
17
  */
16
- export declare function httpPost(url: string, data?: Record<string, any>, isJson?: boolean): Promise<any>;
18
+ export declare function httpPost(url: string, data?: Record<string, any>, isJson?: boolean, needGateWay?: boolean): Promise<any>;
17
19
  /**
18
20
  * put 请求
19
21
  * @param url 接口
20
22
  * @param data 参数{key:value}
23
+ * @param needGateWay 是否需要网关 默认为true
21
24
  * @returns Promise<ApiResponse>
22
25
  */
23
26
  export declare function httpPut(url: string, data?: Record<string, any>): Promise<any>;
@@ -25,15 +28,17 @@ export declare function httpPut(url: string, data?: Record<string, any>): Promis
25
28
  * delete 请求
26
29
  * @param url 接口
27
30
  * @param data 参数[]
31
+ * @param needGateWay 是否需要网关 默认为true
28
32
  * @returns Promise<ApiResponse>
29
33
  */
30
34
  export declare function httpDelete(url: string, data: any): Promise<any>;
31
35
  /**
32
36
  * 读取数据字典
33
37
  * @param dictCode 字典编码
38
+ * @param needGateWay 是否需要网关 默认为true
34
39
  * @returns Promise<Record<string,string>>
35
40
  */
36
- export declare function getDict(dictCode: string, showValue?: boolean): Promise<any>;
41
+ export declare function getDict(dictCode: string, showValue?: boolean, needGateWay?: boolean): Promise<any>;
37
42
  /**
38
43
  * 加载下拉框的数据源
39
44
  * @param url 后端接口
@@ -41,7 +46,8 @@ export declare function getDict(dictCode: string, showValue?: boolean): Promise<
41
46
  * @param valueField 值字段
42
47
  * @param labelField 显示字段
43
48
  * @param showValue 显示值
49
+ * @param needGateWay 是否需要网关 默认为true
44
50
  * @returns
45
51
  */
46
- export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean): Promise<any>;
52
+ export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean, needGateWay?: boolean): Promise<any>;
47
53
  export default request;
package/es/http/index.js CHANGED
@@ -23,7 +23,7 @@ request.interceptors.request.use(function (url, options) {
23
23
  }
24
24
 
25
25
  return {
26
- url: toGatewayUrl(url),
26
+ url: url,
27
27
  options: opts
28
28
  };
29
29
  });
@@ -84,6 +84,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
84
84
  * get请求
85
85
  * @param url 接口
86
86
  * @param params 参数{key:value}
87
+ * @param needGateWay 是否需要网关 默认为true
87
88
  * @returns Promise<ApiResponse>
88
89
  */
89
90
 
@@ -95,23 +96,31 @@ export function httpGet(_x3) {
95
96
  * @param url 接口
96
97
  * @param data 参数{key:value}
97
98
  * @param isJson json请求还是form请求,默认为json请求
99
+ * @param needGateWay 是否需要网关 默认为true
98
100
  * @returns Promise<ApiResponse>
99
101
  */
100
102
 
101
103
  function _httpGet() {
102
104
  _httpGet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(url) {
103
105
  var params,
106
+ needGateWay,
104
107
  _args2 = arguments;
105
108
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
106
109
  while (1) {
107
110
  switch (_context2.prev = _context2.next) {
108
111
  case 0:
109
112
  params = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
113
+ needGateWay = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : true;
114
+
115
+ if (needGateWay) {
116
+ url = toGatewayUrl(url);
117
+ }
118
+
110
119
  return _context2.abrupt("return", request.get(url, {
111
120
  params: params
112
121
  }));
113
122
 
114
- case 2:
123
+ case 4:
115
124
  case "end":
116
125
  return _context2.stop();
117
126
  }
@@ -128,6 +137,7 @@ export function httpPost(_x4) {
128
137
  * put 请求
129
138
  * @param url 接口
130
139
  * @param data 参数{key:value}
140
+ * @param needGateWay 是否需要网关 默认为true
131
141
  * @returns Promise<ApiResponse>
132
142
  */
133
143
 
@@ -135,6 +145,7 @@ function _httpPost() {
135
145
  _httpPost = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(url) {
136
146
  var data,
137
147
  isJson,
148
+ needGateWay,
138
149
  _args3 = arguments;
139
150
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
140
151
  while (1) {
@@ -142,12 +153,18 @@ function _httpPost() {
142
153
  case 0:
143
154
  data = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
144
155
  isJson = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : true;
156
+ needGateWay = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : true;
157
+
158
+ if (needGateWay) {
159
+ url = toGatewayUrl(url);
160
+ }
161
+
145
162
  return _context3.abrupt("return", request.post(url, {
146
163
  data: data,
147
164
  requestType: isJson ? 'json' : 'form'
148
165
  }));
149
166
 
150
- case 3:
167
+ case 5:
151
168
  case "end":
152
169
  return _context3.stop();
153
170
  }
@@ -164,6 +181,7 @@ export function httpPut(_x5) {
164
181
  * delete 请求
165
182
  * @param url 接口
166
183
  * @param data 参数[]
184
+ * @param needGateWay 是否需要网关 默认为true
167
185
  * @returns Promise<ApiResponse>
168
186
  */
169
187
 
@@ -196,6 +214,7 @@ export function httpDelete(_x6, _x7) {
196
214
  /**
197
215
  * 读取数据字典
198
216
  * @param dictCode 字典编码
217
+ * @param needGateWay 是否需要网关 默认为true
199
218
  * @returns Promise<Record<string,string>>
200
219
  */
201
220
 
@@ -229,12 +248,14 @@ export function getDict(_x8) {
229
248
  * @param valueField 值字段
230
249
  * @param labelField 显示字段
231
250
  * @param showValue 显示值
251
+ * @param needGateWay 是否需要网关 默认为true
232
252
  * @returns
233
253
  */
234
254
 
235
255
  function _getDict() {
236
256
  _getDict = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(dictCode) {
237
257
  var showValue,
258
+ needGateWay,
238
259
  api,
239
260
  param,
240
261
  _args6 = arguments;
@@ -243,6 +264,7 @@ function _getDict() {
243
264
  switch (_context6.prev = _context6.next) {
244
265
  case 0:
245
266
  showValue = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : true;
267
+ needGateWay = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : true;
246
268
  api = '/lesoon-integration/sysDictDtl';
247
269
  param = {
248
270
  where: {
@@ -250,9 +272,9 @@ function _getDict() {
250
272
  },
251
273
  ifPage: 0
252
274
  };
253
- return _context6.abrupt("return", fetchOptions(api, param, 'dictValue', 'displayName', showValue));
275
+ return _context6.abrupt("return", fetchOptions(api, param, 'dictValue', 'displayName', showValue, needGateWay));
254
276
 
255
- case 4:
277
+ case 5:
256
278
  case "end":
257
279
  return _context6.stop();
258
280
  }
@@ -269,6 +291,7 @@ export function fetchOptions(_x9, _x10, _x11, _x12) {
269
291
  function _fetchOptions() {
270
292
  _fetchOptions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(url, param, valueField, labelField) {
271
293
  var showValue,
294
+ needGateWay,
272
295
  _yield$httpGet,
273
296
  _yield$httpGet$rows,
274
297
  rows,
@@ -280,10 +303,11 @@ function _fetchOptions() {
280
303
  switch (_context7.prev = _context7.next) {
281
304
  case 0:
282
305
  showValue = _args7.length > 4 && _args7[4] !== undefined ? _args7[4] : true;
283
- _context7.next = 3;
284
- return httpGet(url, param);
306
+ needGateWay = _args7.length > 5 && _args7[5] !== undefined ? _args7[5] : true;
307
+ _context7.next = 4;
308
+ return httpGet(url, param, needGateWay);
285
309
 
286
- case 3:
310
+ case 4:
287
311
  _yield$httpGet = _context7.sent;
288
312
  _yield$httpGet$rows = _yield$httpGet.rows;
289
313
  rows = _yield$httpGet$rows === void 0 ? [] : _yield$httpGet$rows;
@@ -297,7 +321,7 @@ function _fetchOptions() {
297
321
  });
298
322
  return _context7.abrupt("return", data);
299
323
 
300
- case 8:
324
+ case 9:
301
325
  case "end":
302
326
  return _context7.stop();
303
327
  }
@@ -3,21 +3,24 @@ declare const request: import("umi-request").RequestMethod<false>;
3
3
  * get请求
4
4
  * @param url 接口
5
5
  * @param params 参数{key:value}
6
+ * @param needGateWay 是否需要网关 默认为true
6
7
  * @returns Promise<ApiResponse>
7
8
  */
8
- export declare function httpGet(url: string, params?: Record<string, any>): Promise<any>;
9
+ export declare function httpGet(url: string, params?: Record<string, any>, needGateWay?: boolean): Promise<any>;
9
10
  /**
10
11
  * post请求
11
12
  * @param url 接口
12
13
  * @param data 参数{key:value}
13
14
  * @param isJson json请求还是form请求,默认为json请求
15
+ * @param needGateWay 是否需要网关 默认为true
14
16
  * @returns Promise<ApiResponse>
15
17
  */
16
- export declare function httpPost(url: string, data?: Record<string, any>, isJson?: boolean): Promise<any>;
18
+ export declare function httpPost(url: string, data?: Record<string, any>, isJson?: boolean, needGateWay?: boolean): Promise<any>;
17
19
  /**
18
20
  * put 请求
19
21
  * @param url 接口
20
22
  * @param data 参数{key:value}
23
+ * @param needGateWay 是否需要网关 默认为true
21
24
  * @returns Promise<ApiResponse>
22
25
  */
23
26
  export declare function httpPut(url: string, data?: Record<string, any>): Promise<any>;
@@ -25,15 +28,17 @@ export declare function httpPut(url: string, data?: Record<string, any>): Promis
25
28
  * delete 请求
26
29
  * @param url 接口
27
30
  * @param data 参数[]
31
+ * @param needGateWay 是否需要网关 默认为true
28
32
  * @returns Promise<ApiResponse>
29
33
  */
30
34
  export declare function httpDelete(url: string, data: any): Promise<any>;
31
35
  /**
32
36
  * 读取数据字典
33
37
  * @param dictCode 字典编码
38
+ * @param needGateWay 是否需要网关 默认为true
34
39
  * @returns Promise<Record<string,string>>
35
40
  */
36
- export declare function getDict(dictCode: string, showValue?: boolean): Promise<any>;
41
+ export declare function getDict(dictCode: string, showValue?: boolean, needGateWay?: boolean): Promise<any>;
37
42
  /**
38
43
  * 加载下拉框的数据源
39
44
  * @param url 后端接口
@@ -41,7 +46,8 @@ export declare function getDict(dictCode: string, showValue?: boolean): Promise<
41
46
  * @param valueField 值字段
42
47
  * @param labelField 显示字段
43
48
  * @param showValue 显示值
49
+ * @param needGateWay 是否需要网关 默认为true
44
50
  * @returns
45
51
  */
46
- export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean): Promise<any>;
52
+ export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean, needGateWay?: boolean): Promise<any>;
47
53
  export default request;
package/lib/http/index.js CHANGED
@@ -42,7 +42,7 @@ request.interceptors.request.use(function (url, options) {
42
42
  }
43
43
 
44
44
  return {
45
- url: (0, _utils.toGatewayUrl)(url),
45
+ url: url,
46
46
  options: opts
47
47
  };
48
48
  });
@@ -103,6 +103,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
103
103
  * get请求
104
104
  * @param url 接口
105
105
  * @param params 参数{key:value}
106
+ * @param needGateWay 是否需要网关 默认为true
106
107
  * @returns Promise<ApiResponse>
107
108
  */
108
109
 
@@ -114,6 +115,7 @@ function httpGet(_x3) {
114
115
  * @param url 接口
115
116
  * @param data 参数{key:value}
116
117
  * @param isJson json请求还是form请求,默认为json请求
118
+ * @param needGateWay 是否需要网关 默认为true
117
119
  * @returns Promise<ApiResponse>
118
120
  */
119
121
 
@@ -121,17 +123,24 @@ function httpGet(_x3) {
121
123
  function _httpGet() {
122
124
  _httpGet = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(url) {
123
125
  var params,
126
+ needGateWay,
124
127
  _args2 = arguments;
125
128
  return _regenerator.default.wrap(function _callee2$(_context2) {
126
129
  while (1) {
127
130
  switch (_context2.prev = _context2.next) {
128
131
  case 0:
129
132
  params = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
133
+ needGateWay = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : true;
134
+
135
+ if (needGateWay) {
136
+ url = (0, _utils.toGatewayUrl)(url);
137
+ }
138
+
130
139
  return _context2.abrupt("return", request.get(url, {
131
140
  params: params
132
141
  }));
133
142
 
134
- case 2:
143
+ case 4:
135
144
  case "end":
136
145
  return _context2.stop();
137
146
  }
@@ -148,6 +157,7 @@ function httpPost(_x4) {
148
157
  * put 请求
149
158
  * @param url 接口
150
159
  * @param data 参数{key:value}
160
+ * @param needGateWay 是否需要网关 默认为true
151
161
  * @returns Promise<ApiResponse>
152
162
  */
153
163
 
@@ -156,6 +166,7 @@ function _httpPost() {
156
166
  _httpPost = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(url) {
157
167
  var data,
158
168
  isJson,
169
+ needGateWay,
159
170
  _args3 = arguments;
160
171
  return _regenerator.default.wrap(function _callee3$(_context3) {
161
172
  while (1) {
@@ -163,12 +174,18 @@ function _httpPost() {
163
174
  case 0:
164
175
  data = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
165
176
  isJson = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : true;
177
+ needGateWay = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : true;
178
+
179
+ if (needGateWay) {
180
+ url = (0, _utils.toGatewayUrl)(url);
181
+ }
182
+
166
183
  return _context3.abrupt("return", request.post(url, {
167
184
  data: data,
168
185
  requestType: isJson ? 'json' : 'form'
169
186
  }));
170
187
 
171
- case 3:
188
+ case 5:
172
189
  case "end":
173
190
  return _context3.stop();
174
191
  }
@@ -185,6 +202,7 @@ function httpPut(_x5) {
185
202
  * delete 请求
186
203
  * @param url 接口
187
204
  * @param data 参数[]
205
+ * @param needGateWay 是否需要网关 默认为true
188
206
  * @returns Promise<ApiResponse>
189
207
  */
190
208
 
@@ -218,6 +236,7 @@ function httpDelete(_x6, _x7) {
218
236
  /**
219
237
  * 读取数据字典
220
238
  * @param dictCode 字典编码
239
+ * @param needGateWay 是否需要网关 默认为true
221
240
  * @returns Promise<Record<string,string>>
222
241
  */
223
242
 
@@ -252,6 +271,7 @@ function getDict(_x8) {
252
271
  * @param valueField 值字段
253
272
  * @param labelField 显示字段
254
273
  * @param showValue 显示值
274
+ * @param needGateWay 是否需要网关 默认为true
255
275
  * @returns
256
276
  */
257
277
 
@@ -259,6 +279,7 @@ function getDict(_x8) {
259
279
  function _getDict() {
260
280
  _getDict = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(dictCode) {
261
281
  var showValue,
282
+ needGateWay,
262
283
  api,
263
284
  param,
264
285
  _args6 = arguments;
@@ -267,6 +288,7 @@ function _getDict() {
267
288
  switch (_context6.prev = _context6.next) {
268
289
  case 0:
269
290
  showValue = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : true;
291
+ needGateWay = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : true;
270
292
  api = '/lesoon-integration/sysDictDtl';
271
293
  param = {
272
294
  where: {
@@ -274,9 +296,9 @@ function _getDict() {
274
296
  },
275
297
  ifPage: 0
276
298
  };
277
- return _context6.abrupt("return", fetchOptions(api, param, 'dictValue', 'displayName', showValue));
299
+ return _context6.abrupt("return", fetchOptions(api, param, 'dictValue', 'displayName', showValue, needGateWay));
278
300
 
279
- case 4:
301
+ case 5:
280
302
  case "end":
281
303
  return _context6.stop();
282
304
  }
@@ -293,6 +315,7 @@ function fetchOptions(_x9, _x10, _x11, _x12) {
293
315
  function _fetchOptions() {
294
316
  _fetchOptions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(url, param, valueField, labelField) {
295
317
  var showValue,
318
+ needGateWay,
296
319
  _yield$httpGet,
297
320
  _yield$httpGet$rows,
298
321
  rows,
@@ -304,10 +327,11 @@ function _fetchOptions() {
304
327
  switch (_context7.prev = _context7.next) {
305
328
  case 0:
306
329
  showValue = _args7.length > 4 && _args7[4] !== undefined ? _args7[4] : true;
307
- _context7.next = 3;
308
- return httpGet(url, param);
330
+ needGateWay = _args7.length > 5 && _args7[5] !== undefined ? _args7[5] : true;
331
+ _context7.next = 4;
332
+ return httpGet(url, param, needGateWay);
309
333
 
310
- case 3:
334
+ case 4:
311
335
  _yield$httpGet = _context7.sent;
312
336
  _yield$httpGet$rows = _yield$httpGet.rows;
313
337
  rows = _yield$httpGet$rows === void 0 ? [] : _yield$httpGet$rows;
@@ -321,7 +345,7 @@ function _fetchOptions() {
321
345
  });
322
346
  return _context7.abrupt("return", data);
323
347
 
324
- case 8:
348
+ case 9:
325
349
  case "end":
326
350
  return _context7.stop();
327
351
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "ls-pro-common",
5
5
  "keywords": [
6
6
  "antd",
@@ -28,7 +28,7 @@
28
28
  ],
29
29
  "dependencies": {
30
30
  "@ant-design/icons": "^4.3.0",
31
- "ls-pro-table": "2.62.18",
31
+ "ls-pro-table": "2.62.19",
32
32
  "ls-pro-form": "1.52.20",
33
33
  "@babel/runtime": "^7.16.3",
34
34
  "classnames": "^2.2.6",