ls-pro-common 3.1.7 → 3.1.8

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.
@@ -50,10 +50,11 @@ export declare function httpDelete(url: string, data: any, needGateWay?: boolean
50
50
  * @param showValue 是否显示值
51
51
  * @param needGateWay 是否需要网关 默认为true
52
52
  * @param timeout 超时时间,默认60000毫秒
53
+ * @param isGet 是否Get请求
53
54
  * @param valueIsNumber 返回值是否为数字,默认false
54
55
  * @returns Promise<Record<string,string>[]>
55
56
  */
56
- export declare function getDict(dictCode: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, valueIsNumber?: boolean): Promise<any>;
57
+ export declare function getDict(dictCodes: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, isGet?: boolean, valueIsNumber?: boolean): Promise<any>;
57
58
  /**
58
59
  * 加载下拉框的数据源
59
60
  *
@@ -63,8 +64,10 @@ export declare function getDict(dictCode: string, showValue?: boolean, needGateW
63
64
  * @param labelField 显示字段
64
65
  * @param showValue 显示值
65
66
  * @param needGateWay 是否需要网关 默认为true
67
+ * @param timeout
68
+ * @param isGet = true 是否get请求,默认true
66
69
  * @param valueIsNumber 返回值是否为数字,默认false
67
70
  * @returns
68
71
  */
69
- export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, valueIsNumber?: boolean): Promise<any>;
72
+ export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, isGet?: boolean, valueIsNumber?: boolean): Promise<any>;
70
73
  export default request;
package/es/http/index.js CHANGED
@@ -325,19 +325,21 @@ export function httpDelete(url, data) {
325
325
  * @param showValue 是否显示值
326
326
  * @param needGateWay 是否需要网关 默认为true
327
327
  * @param timeout 超时时间,默认60000毫秒
328
+ * @param isGet 是否Get请求
328
329
  * @param valueIsNumber 返回值是否为数字,默认false
329
330
  * @returns Promise<Record<string,string>[]>
330
331
  */
331
- export function getDict(dictCode) {
332
+ export function getDict(dictCodes) {
332
333
  var showValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
333
334
  var needGateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
334
335
  var timeout = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 60000;
335
- var valueIsNumber = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
336
+ var isGet = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
337
+ var valueIsNumber = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
336
338
  var api = '/lesoon-petrel-integration-api/sysDictDtl/listByProperties';
337
339
  var param = {
338
- dictCode: dictCode
340
+ dictCodes: (dictCodes || '').split(',')
339
341
  };
340
- return fetchOptions(api, param, 'dictValue', 'displayName', showValue, needGateWay, timeout, valueIsNumber);
342
+ return fetchOptions(api, param, 'dictValue', 'displayName', showValue, needGateWay, timeout, isGet, valueIsNumber);
341
343
  }
342
344
  /**
343
345
  * 加载下拉框的数据源
@@ -348,6 +350,8 @@ export function getDict(dictCode) {
348
350
  * @param labelField 显示字段
349
351
  * @param showValue 显示值
350
352
  * @param needGateWay 是否需要网关 默认为true
353
+ * @param timeout
354
+ * @param isGet = true 是否get请求,默认true
351
355
  * @param valueIsNumber 返回值是否为数字,默认false
352
356
  * @returns
353
357
  */
@@ -359,9 +363,8 @@ function _fetchOptions() {
359
363
  var showValue,
360
364
  needGateWay,
361
365
  timeout,
366
+ isGet,
362
367
  valueIsNumber,
363
- _yield$httpGet,
364
- _yield$httpGet$rows,
365
368
  rows,
366
369
  data,
367
370
  _args2 = arguments;
@@ -371,13 +374,38 @@ function _fetchOptions() {
371
374
  showValue = _args2.length > 4 && _args2[4] !== undefined ? _args2[4] : true;
372
375
  needGateWay = _args2.length > 5 && _args2[5] !== undefined ? _args2[5] : true;
373
376
  timeout = _args2.length > 6 && _args2[6] !== undefined ? _args2[6] : 60000;
374
- valueIsNumber = _args2.length > 7 && _args2[7] !== undefined ? _args2[7] : false;
375
- _context2.next = 6;
377
+ isGet = _args2.length > 7 && _args2[7] !== undefined ? _args2[7] : true;
378
+ valueIsNumber = _args2.length > 8 && _args2[8] !== undefined ? _args2[8] : false;
379
+ if (!isGet) {
380
+ _context2.next = 14;
381
+ break;
382
+ }
383
+ _context2.next = 8;
376
384
  return httpGet(url, param, needGateWay, timeout);
377
- case 6:
378
- _yield$httpGet = _context2.sent;
379
- _yield$httpGet$rows = _yield$httpGet.rows;
380
- rows = _yield$httpGet$rows === void 0 ? [] : _yield$httpGet$rows;
385
+ case 8:
386
+ _context2.t0 = _context2.sent.rows;
387
+ if (_context2.t0) {
388
+ _context2.next = 11;
389
+ break;
390
+ }
391
+ _context2.t0 = [];
392
+ case 11:
393
+ rows = _context2.t0;
394
+ _context2.next = 20;
395
+ break;
396
+ case 14:
397
+ _context2.next = 16;
398
+ return httpPost(url, param, true, needGateWay, timeout);
399
+ case 16:
400
+ _context2.t1 = _context2.sent.rows;
401
+ if (_context2.t1) {
402
+ _context2.next = 19;
403
+ break;
404
+ }
405
+ _context2.t1 = [];
406
+ case 19:
407
+ rows = _context2.t1;
408
+ case 20:
381
409
  data = (rows || []).map(function (o) {
382
410
  return _objectSpread(_objectSpread({}, o), {}, {
383
411
  value: valueIsNumber && !isNaN(o[valueField]) ? Number(o[valueField]) : o[valueField],
@@ -386,7 +414,7 @@ function _fetchOptions() {
386
414
  });
387
415
  });
388
416
  return _context2.abrupt("return", data);
389
- case 11:
417
+ case 22:
390
418
  case "end":
391
419
  return _context2.stop();
392
420
  }
@@ -50,10 +50,11 @@ export declare function httpDelete(url: string, data: any, needGateWay?: boolean
50
50
  * @param showValue 是否显示值
51
51
  * @param needGateWay 是否需要网关 默认为true
52
52
  * @param timeout 超时时间,默认60000毫秒
53
+ * @param isGet 是否Get请求
53
54
  * @param valueIsNumber 返回值是否为数字,默认false
54
55
  * @returns Promise<Record<string,string>[]>
55
56
  */
56
- export declare function getDict(dictCode: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, valueIsNumber?: boolean): Promise<any>;
57
+ export declare function getDict(dictCodes: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, isGet?: boolean, valueIsNumber?: boolean): Promise<any>;
57
58
  /**
58
59
  * 加载下拉框的数据源
59
60
  *
@@ -63,8 +64,10 @@ export declare function getDict(dictCode: string, showValue?: boolean, needGateW
63
64
  * @param labelField 显示字段
64
65
  * @param showValue 显示值
65
66
  * @param needGateWay 是否需要网关 默认为true
67
+ * @param timeout
68
+ * @param isGet = true 是否get请求,默认true
66
69
  * @param valueIsNumber 返回值是否为数字,默认false
67
70
  * @returns
68
71
  */
69
- export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, valueIsNumber?: boolean): Promise<any>;
72
+ export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, isGet?: boolean, valueIsNumber?: boolean): Promise<any>;
70
73
  export default request;
package/lib/http/index.js CHANGED
@@ -325,19 +325,21 @@ export function httpDelete(url, data) {
325
325
  * @param showValue 是否显示值
326
326
  * @param needGateWay 是否需要网关 默认为true
327
327
  * @param timeout 超时时间,默认60000毫秒
328
+ * @param isGet 是否Get请求
328
329
  * @param valueIsNumber 返回值是否为数字,默认false
329
330
  * @returns Promise<Record<string,string>[]>
330
331
  */
331
- export function getDict(dictCode) {
332
+ export function getDict(dictCodes) {
332
333
  var showValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
333
334
  var needGateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
334
335
  var timeout = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 60000;
335
- var valueIsNumber = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
336
+ var isGet = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
337
+ var valueIsNumber = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
336
338
  var api = '/lesoon-petrel-integration-api/sysDictDtl/listByProperties';
337
339
  var param = {
338
- dictCode: dictCode
340
+ dictCodes: (dictCodes || '').split(',')
339
341
  };
340
- return fetchOptions(api, param, 'dictValue', 'displayName', showValue, needGateWay, timeout, valueIsNumber);
342
+ return fetchOptions(api, param, 'dictValue', 'displayName', showValue, needGateWay, timeout, isGet, valueIsNumber);
341
343
  }
342
344
  /**
343
345
  * 加载下拉框的数据源
@@ -348,6 +350,8 @@ export function getDict(dictCode) {
348
350
  * @param labelField 显示字段
349
351
  * @param showValue 显示值
350
352
  * @param needGateWay 是否需要网关 默认为true
353
+ * @param timeout
354
+ * @param isGet = true 是否get请求,默认true
351
355
  * @param valueIsNumber 返回值是否为数字,默认false
352
356
  * @returns
353
357
  */
@@ -359,9 +363,8 @@ function _fetchOptions() {
359
363
  var showValue,
360
364
  needGateWay,
361
365
  timeout,
366
+ isGet,
362
367
  valueIsNumber,
363
- _yield$httpGet,
364
- _yield$httpGet$rows,
365
368
  rows,
366
369
  data,
367
370
  _args2 = arguments;
@@ -371,13 +374,38 @@ function _fetchOptions() {
371
374
  showValue = _args2.length > 4 && _args2[4] !== undefined ? _args2[4] : true;
372
375
  needGateWay = _args2.length > 5 && _args2[5] !== undefined ? _args2[5] : true;
373
376
  timeout = _args2.length > 6 && _args2[6] !== undefined ? _args2[6] : 60000;
374
- valueIsNumber = _args2.length > 7 && _args2[7] !== undefined ? _args2[7] : false;
375
- _context2.next = 6;
377
+ isGet = _args2.length > 7 && _args2[7] !== undefined ? _args2[7] : true;
378
+ valueIsNumber = _args2.length > 8 && _args2[8] !== undefined ? _args2[8] : false;
379
+ if (!isGet) {
380
+ _context2.next = 14;
381
+ break;
382
+ }
383
+ _context2.next = 8;
376
384
  return httpGet(url, param, needGateWay, timeout);
377
- case 6:
378
- _yield$httpGet = _context2.sent;
379
- _yield$httpGet$rows = _yield$httpGet.rows;
380
- rows = _yield$httpGet$rows === void 0 ? [] : _yield$httpGet$rows;
385
+ case 8:
386
+ _context2.t0 = _context2.sent.rows;
387
+ if (_context2.t0) {
388
+ _context2.next = 11;
389
+ break;
390
+ }
391
+ _context2.t0 = [];
392
+ case 11:
393
+ rows = _context2.t0;
394
+ _context2.next = 20;
395
+ break;
396
+ case 14:
397
+ _context2.next = 16;
398
+ return httpPost(url, param, true, needGateWay, timeout);
399
+ case 16:
400
+ _context2.t1 = _context2.sent.rows;
401
+ if (_context2.t1) {
402
+ _context2.next = 19;
403
+ break;
404
+ }
405
+ _context2.t1 = [];
406
+ case 19:
407
+ rows = _context2.t1;
408
+ case 20:
381
409
  data = (rows || []).map(function (o) {
382
410
  return _objectSpread(_objectSpread({}, o), {}, {
383
411
  value: valueIsNumber && !isNaN(o[valueField]) ? Number(o[valueField]) : o[valueField],
@@ -386,7 +414,7 @@ function _fetchOptions() {
386
414
  });
387
415
  });
388
416
  return _context2.abrupt("return", data);
389
- case 11:
417
+ case 22:
390
418
  case "end":
391
419
  return _context2.stop();
392
420
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "3.1.7",
3
+ "version": "3.1.8",
4
4
  "description": "ls-pro-common",
5
5
  "license": "MIT",
6
6
  "sideEffects": [