ls-pro-common 3.1.5 → 3.1.7
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/dist/common.css +52 -0
- package/dist/common.js +1 -1
- package/dist/common.min.css +52 -0
- package/dist/common.min.js +1 -1
- package/es/hooks/useBaseDict.js +1 -1
- package/es/hooks/useDtl/index.d.ts +2 -1
- package/es/hooks/useDtl/index.js +18 -12
- package/es/hooks/useSingle/index.d.ts +1 -1
- package/es/hooks/useSingle/index.js +20 -13
- package/es/http/index.d.ts +5 -2
- package/es/http/index.js +12 -6
- package/lib/hooks/useBaseDict.js +1 -1
- package/lib/hooks/useDtl/index.d.ts +2 -1
- package/lib/hooks/useDtl/index.js +18 -12
- package/lib/hooks/useSingle/index.d.ts +1 -1
- package/lib/hooks/useSingle/index.js +20 -13
- package/lib/http/index.d.ts +5 -2
- package/lib/http/index.js +12 -6
- package/package.json +1 -1
package/es/hooks/useBaseDict.js
CHANGED
|
@@ -13,7 +13,7 @@ import { showWarn } from '../utils';
|
|
|
13
13
|
*/
|
|
14
14
|
export var useBaseDict = function useBaseDict(props) {
|
|
15
15
|
var _props$url = props.url,
|
|
16
|
-
url = _props$url === void 0 ? '/lesoon-integration/sysDictDtl
|
|
16
|
+
url = _props$url === void 0 ? '/lesoon-petrel-integration-api/sysDictDtl/page' : _props$url,
|
|
17
17
|
_props$method = props.method,
|
|
18
18
|
method = _props$method === void 0 ? 'GET' : _props$method,
|
|
19
19
|
_props$dictValue = props.dictValue,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ActionType } from 'ls-pro-table';
|
|
2
2
|
import type { ProFormInstance } from 'ls-pro-form';
|
|
3
|
+
import type { ApiResponse } from '../../typing';
|
|
3
4
|
import type { SingleParamType } from '../useSingle';
|
|
4
5
|
export declare type DtlParamType = SingleParamType & {
|
|
5
6
|
/** 重置主表对象方法 */
|
|
@@ -40,7 +41,7 @@ declare function useDtl(dtlParam: DtlParamType): {
|
|
|
40
41
|
onSaveMst: (values: any) => Promise<boolean>;
|
|
41
42
|
onSaveMstDtl: (isDelete?: boolean) => Promise<boolean | undefined>;
|
|
42
43
|
onRemoveMst: () => Promise<boolean | undefined>;
|
|
43
|
-
onExportDtl: (url: string, param: any) => Promise<boolean>;
|
|
44
|
+
onExportDtl: (url: string, param: any) => Promise<boolean | ApiResponse>;
|
|
44
45
|
isAudit: () => boolean;
|
|
45
46
|
onAudit: () => Promise<void>;
|
|
46
47
|
};
|
package/es/hooks/useDtl/index.js
CHANGED
|
@@ -730,7 +730,7 @@ function useDtl(dtlParam) {
|
|
|
730
730
|
var onExportDtl = /*#__PURE__*/function () {
|
|
731
731
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(url, param) {
|
|
732
732
|
var _param$exportColumns;
|
|
733
|
-
var searchArr, arr, otherArr, whereArr, where, _result$flag6, result, _result$
|
|
733
|
+
var searchArr, arr, otherArr, whereArr, where, _result$flag6, _result$flag7, _result$flag8, result, _result$flag9;
|
|
734
734
|
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
735
735
|
while (1) switch (_context9.prev = _context9.next) {
|
|
736
736
|
case 0:
|
|
@@ -792,14 +792,14 @@ function useDtl(dtlParam) {
|
|
|
792
792
|
return httpPost(url, param);
|
|
793
793
|
case 10:
|
|
794
794
|
result = _context9.sent;
|
|
795
|
-
if (!(result.data && typeof result.data === 'string')) {
|
|
795
|
+
if (!(result.data && typeof result.data === 'string' && ((_result$flag6 = result.flag) === null || _result$flag6 === void 0 ? void 0 : _result$flag6.retCode) === '0')) {
|
|
796
796
|
_context9.next = 14;
|
|
797
797
|
break;
|
|
798
798
|
}
|
|
799
799
|
downloadFile(result.data);
|
|
800
800
|
return _context9.abrupt("return", true);
|
|
801
801
|
case 14:
|
|
802
|
-
if (!(((_result$
|
|
802
|
+
if (!(((_result$flag7 = result.flag) === null || _result$flag7 === void 0 ? void 0 : _result$flag7.retCode) === '0')) {
|
|
803
803
|
_context9.next = 19;
|
|
804
804
|
break;
|
|
805
805
|
}
|
|
@@ -807,21 +807,27 @@ function useDtl(dtlParam) {
|
|
|
807
807
|
// showSuccess(result.flag?.retMsg || '导出成功');
|
|
808
808
|
return _context9.abrupt("return", true);
|
|
809
809
|
case 19:
|
|
810
|
-
|
|
810
|
+
if (!['9101', '9102', '9103', '9013', '9014', '9110'].includes((result === null || result === void 0 ? void 0 : (_result$flag8 = result.flag) === null || _result$flag8 === void 0 ? void 0 : _result$flag8.retCode) || '0')) {
|
|
811
|
+
_context9.next = 23;
|
|
812
|
+
break;
|
|
813
|
+
}
|
|
814
|
+
return _context9.abrupt("return", result);
|
|
815
|
+
case 23:
|
|
816
|
+
showError(((_result$flag9 = result.flag) === null || _result$flag9 === void 0 ? void 0 : _result$flag9.retMsg) || '导出失败,请联系系统管理员');
|
|
811
817
|
return _context9.abrupt("return", false);
|
|
812
|
-
case
|
|
813
|
-
_context9.next =
|
|
818
|
+
case 25:
|
|
819
|
+
_context9.next = 31;
|
|
814
820
|
break;
|
|
815
|
-
case
|
|
816
|
-
_context9.prev =
|
|
821
|
+
case 27:
|
|
822
|
+
_context9.prev = 27;
|
|
817
823
|
_context9.t0 = _context9["catch"](7);
|
|
818
824
|
showError(_context9.t0.message);
|
|
819
825
|
return _context9.abrupt("return", false);
|
|
820
|
-
case
|
|
826
|
+
case 31:
|
|
821
827
|
case "end":
|
|
822
828
|
return _context9.stop();
|
|
823
829
|
}
|
|
824
|
-
}, _callee9, null, [[7,
|
|
830
|
+
}, _callee9, null, [[7, 27]]);
|
|
825
831
|
}));
|
|
826
832
|
return function onExportDtl(_x6, _x7) {
|
|
827
833
|
return _ref9.apply(this, arguments);
|
|
@@ -830,7 +836,7 @@ function useDtl(dtlParam) {
|
|
|
830
836
|
/** 审核按钮事件 */
|
|
831
837
|
var onAudit = /*#__PURE__*/function () {
|
|
832
838
|
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
|
|
833
|
-
var obj, _result$
|
|
839
|
+
var obj, _result$flag10, result;
|
|
834
840
|
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
835
841
|
while (1) switch (_context10.prev = _context10.next) {
|
|
836
842
|
case 0:
|
|
@@ -900,7 +906,7 @@ function useDtl(dtlParam) {
|
|
|
900
906
|
}
|
|
901
907
|
return _context10.abrupt("return");
|
|
902
908
|
case 36:
|
|
903
|
-
if ((result === null || result === void 0 ? void 0 : (_result$
|
|
909
|
+
if ((result === null || result === void 0 ? void 0 : (_result$flag10 = result.flag) === null || _result$flag10 === void 0 ? void 0 : _result$flag10.retCode) === '0') {
|
|
904
910
|
showSuccess(result.flag.retMsg || '审核成功');
|
|
905
911
|
Object.assign(masterObject, result.data);
|
|
906
912
|
}
|
|
@@ -44,7 +44,7 @@ declare function useSingle(inParam: SingleParamType): {
|
|
|
44
44
|
onLoad: (params: Record<string, any>, sort: Record<string, any>, filter: Record<string, any>, isHistory: any) => Promise<any>;
|
|
45
45
|
onAdd: (item: any) => Promise<void>;
|
|
46
46
|
onEdit: (item: any) => Promise<void>;
|
|
47
|
-
onExport: (url: string, param: any) => Promise<boolean>;
|
|
47
|
+
onExport: (url: string, param: any) => Promise<boolean | ApiResponse>;
|
|
48
48
|
onAudit: (row: any) => Promise<void>;
|
|
49
49
|
resourceId: any;
|
|
50
50
|
checkRight: (val: number) => boolean;
|
|
@@ -528,7 +528,7 @@ function useSingle(inParam) {
|
|
|
528
528
|
var onExport = /*#__PURE__*/function () {
|
|
529
529
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(url, param) {
|
|
530
530
|
var _param$exportColumns;
|
|
531
|
-
var searchArr, arr, otherArr, whereArr, where, _result$flag4, result, _result$flag5;
|
|
531
|
+
var searchArr, arr, otherArr, whereArr, where, _result$flag4, result, code, _result$flag5;
|
|
532
532
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
533
533
|
while (1) switch (_context7.prev = _context7.next) {
|
|
534
534
|
case 0:
|
|
@@ -590,37 +590,44 @@ function useSingle(inParam) {
|
|
|
590
590
|
return httpPost(url, param, true, false);
|
|
591
591
|
case 10:
|
|
592
592
|
result = _context7.sent;
|
|
593
|
-
|
|
594
|
-
|
|
593
|
+
code = ((_result$flag4 = result.flag) === null || _result$flag4 === void 0 ? void 0 : _result$flag4.retCode) || '9009'; // 后端直接返回导出文件地址,直接打开相当于是下载
|
|
594
|
+
if (!(result.data && typeof result.data === 'string' && code === '0')) {
|
|
595
|
+
_context7.next = 15;
|
|
595
596
|
break;
|
|
596
597
|
}
|
|
597
598
|
downloadFile(result.data);
|
|
598
599
|
return _context7.abrupt("return", true);
|
|
599
|
-
case
|
|
600
|
-
if (!(
|
|
601
|
-
_context7.next =
|
|
600
|
+
case 15:
|
|
601
|
+
if (!(code === '0')) {
|
|
602
|
+
_context7.next = 20;
|
|
602
603
|
break;
|
|
603
604
|
}
|
|
604
605
|
// showSuccess(result.flag?.retMsg || '导出成功');
|
|
605
606
|
exportProcess(result);
|
|
606
607
|
return _context7.abrupt("return", true);
|
|
607
|
-
case
|
|
608
|
+
case 20:
|
|
609
|
+
if (!['9101', '9102', '9103', '9013', '9014', '9110'].includes(code)) {
|
|
610
|
+
_context7.next = 24;
|
|
611
|
+
break;
|
|
612
|
+
}
|
|
613
|
+
return _context7.abrupt("return", result);
|
|
614
|
+
case 24:
|
|
608
615
|
showError(((_result$flag5 = result.flag) === null || _result$flag5 === void 0 ? void 0 : _result$flag5.retMsg) || '导出失败,请联系系统管理员');
|
|
609
616
|
return _context7.abrupt("return", false);
|
|
610
|
-
case
|
|
611
|
-
_context7.next =
|
|
617
|
+
case 26:
|
|
618
|
+
_context7.next = 33;
|
|
612
619
|
break;
|
|
613
|
-
case
|
|
614
|
-
_context7.prev =
|
|
620
|
+
case 28:
|
|
621
|
+
_context7.prev = 28;
|
|
615
622
|
_context7.t0 = _context7["catch"](7);
|
|
616
623
|
console.log(_context7.t0);
|
|
617
624
|
showError(_context7.t0.message);
|
|
618
625
|
return _context7.abrupt("return", false);
|
|
619
|
-
case
|
|
626
|
+
case 33:
|
|
620
627
|
case "end":
|
|
621
628
|
return _context7.stop();
|
|
622
629
|
}
|
|
623
|
-
}, _callee7, null, [[7,
|
|
630
|
+
}, _callee7, null, [[7, 28]]);
|
|
624
631
|
}));
|
|
625
632
|
return function onExport(_x9, _x10) {
|
|
626
633
|
return _ref7.apply(this, arguments);
|
package/es/http/index.d.ts
CHANGED
|
@@ -49,9 +49,11 @@ export declare function httpDelete(url: string, data: any, needGateWay?: boolean
|
|
|
49
49
|
* @param dictCode 字典编码
|
|
50
50
|
* @param showValue 是否显示值
|
|
51
51
|
* @param needGateWay 是否需要网关 默认为true
|
|
52
|
+
* @param timeout 超时时间,默认60000毫秒
|
|
53
|
+
* @param valueIsNumber 返回值是否为数字,默认false
|
|
52
54
|
* @returns Promise<Record<string,string>[]>
|
|
53
55
|
*/
|
|
54
|
-
export declare function getDict(dictCode: string, showValue?: boolean, needGateWay?: boolean, timeout?: number): Promise<any>;
|
|
56
|
+
export declare function getDict(dictCode: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, valueIsNumber?: boolean): Promise<any>;
|
|
55
57
|
/**
|
|
56
58
|
* 加载下拉框的数据源
|
|
57
59
|
*
|
|
@@ -61,7 +63,8 @@ export declare function getDict(dictCode: string, showValue?: boolean, needGateW
|
|
|
61
63
|
* @param labelField 显示字段
|
|
62
64
|
* @param showValue 显示值
|
|
63
65
|
* @param needGateWay 是否需要网关 默认为true
|
|
66
|
+
* @param valueIsNumber 返回值是否为数字,默认false
|
|
64
67
|
* @returns
|
|
65
68
|
*/
|
|
66
|
-
export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean, needGateWay?: boolean, timeout?: number): Promise<any>;
|
|
69
|
+
export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, valueIsNumber?: boolean): Promise<any>;
|
|
67
70
|
export default request;
|
package/es/http/index.js
CHANGED
|
@@ -324,17 +324,20 @@ export function httpDelete(url, data) {
|
|
|
324
324
|
* @param dictCode 字典编码
|
|
325
325
|
* @param showValue 是否显示值
|
|
326
326
|
* @param needGateWay 是否需要网关 默认为true
|
|
327
|
+
* @param timeout 超时时间,默认60000毫秒
|
|
328
|
+
* @param valueIsNumber 返回值是否为数字,默认false
|
|
327
329
|
* @returns Promise<Record<string,string>[]>
|
|
328
330
|
*/
|
|
329
331
|
export function getDict(dictCode) {
|
|
330
332
|
var showValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
331
333
|
var needGateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
332
334
|
var timeout = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 60000;
|
|
333
|
-
var
|
|
335
|
+
var valueIsNumber = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
336
|
+
var api = '/lesoon-petrel-integration-api/sysDictDtl/listByProperties';
|
|
334
337
|
var param = {
|
|
335
338
|
dictCode: dictCode
|
|
336
339
|
};
|
|
337
|
-
return fetchOptions(api, param, 'dictValue', 'displayName', showValue, needGateWay, timeout);
|
|
340
|
+
return fetchOptions(api, param, 'dictValue', 'displayName', showValue, needGateWay, timeout, valueIsNumber);
|
|
338
341
|
}
|
|
339
342
|
/**
|
|
340
343
|
* 加载下拉框的数据源
|
|
@@ -345,6 +348,7 @@ export function getDict(dictCode) {
|
|
|
345
348
|
* @param labelField 显示字段
|
|
346
349
|
* @param showValue 显示值
|
|
347
350
|
* @param needGateWay 是否需要网关 默认为true
|
|
351
|
+
* @param valueIsNumber 返回值是否为数字,默认false
|
|
348
352
|
* @returns
|
|
349
353
|
*/
|
|
350
354
|
export function fetchOptions(_x3, _x4, _x5, _x6) {
|
|
@@ -355,6 +359,7 @@ function _fetchOptions() {
|
|
|
355
359
|
var showValue,
|
|
356
360
|
needGateWay,
|
|
357
361
|
timeout,
|
|
362
|
+
valueIsNumber,
|
|
358
363
|
_yield$httpGet,
|
|
359
364
|
_yield$httpGet$rows,
|
|
360
365
|
rows,
|
|
@@ -366,21 +371,22 @@ function _fetchOptions() {
|
|
|
366
371
|
showValue = _args2.length > 4 && _args2[4] !== undefined ? _args2[4] : true;
|
|
367
372
|
needGateWay = _args2.length > 5 && _args2[5] !== undefined ? _args2[5] : true;
|
|
368
373
|
timeout = _args2.length > 6 && _args2[6] !== undefined ? _args2[6] : 60000;
|
|
369
|
-
|
|
374
|
+
valueIsNumber = _args2.length > 7 && _args2[7] !== undefined ? _args2[7] : false;
|
|
375
|
+
_context2.next = 6;
|
|
370
376
|
return httpGet(url, param, needGateWay, timeout);
|
|
371
|
-
case
|
|
377
|
+
case 6:
|
|
372
378
|
_yield$httpGet = _context2.sent;
|
|
373
379
|
_yield$httpGet$rows = _yield$httpGet.rows;
|
|
374
380
|
rows = _yield$httpGet$rows === void 0 ? [] : _yield$httpGet$rows;
|
|
375
381
|
data = (rows || []).map(function (o) {
|
|
376
382
|
return _objectSpread(_objectSpread({}, o), {}, {
|
|
377
|
-
value: o[valueField],
|
|
383
|
+
value: valueIsNumber && !isNaN(o[valueField]) ? Number(o[valueField]) : o[valueField],
|
|
378
384
|
text: o[labelField],
|
|
379
385
|
label: (showValue ? o[valueField] + '→' : '') + o[labelField]
|
|
380
386
|
});
|
|
381
387
|
});
|
|
382
388
|
return _context2.abrupt("return", data);
|
|
383
|
-
case
|
|
389
|
+
case 11:
|
|
384
390
|
case "end":
|
|
385
391
|
return _context2.stop();
|
|
386
392
|
}
|
package/lib/hooks/useBaseDict.js
CHANGED
|
@@ -13,7 +13,7 @@ import { showWarn } from '../utils';
|
|
|
13
13
|
*/
|
|
14
14
|
export var useBaseDict = function useBaseDict(props) {
|
|
15
15
|
var _props$url = props.url,
|
|
16
|
-
url = _props$url === void 0 ? '/lesoon-integration/sysDictDtl
|
|
16
|
+
url = _props$url === void 0 ? '/lesoon-petrel-integration-api/sysDictDtl/page' : _props$url,
|
|
17
17
|
_props$method = props.method,
|
|
18
18
|
method = _props$method === void 0 ? 'GET' : _props$method,
|
|
19
19
|
_props$dictValue = props.dictValue,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ActionType } from 'ls-pro-table';
|
|
2
2
|
import type { ProFormInstance } from 'ls-pro-form';
|
|
3
|
+
import type { ApiResponse } from '../../typing';
|
|
3
4
|
import type { SingleParamType } from '../useSingle';
|
|
4
5
|
export declare type DtlParamType = SingleParamType & {
|
|
5
6
|
/** 重置主表对象方法 */
|
|
@@ -40,7 +41,7 @@ declare function useDtl(dtlParam: DtlParamType): {
|
|
|
40
41
|
onSaveMst: (values: any) => Promise<boolean>;
|
|
41
42
|
onSaveMstDtl: (isDelete?: boolean) => Promise<boolean | undefined>;
|
|
42
43
|
onRemoveMst: () => Promise<boolean | undefined>;
|
|
43
|
-
onExportDtl: (url: string, param: any) => Promise<boolean>;
|
|
44
|
+
onExportDtl: (url: string, param: any) => Promise<boolean | ApiResponse>;
|
|
44
45
|
isAudit: () => boolean;
|
|
45
46
|
onAudit: () => Promise<void>;
|
|
46
47
|
};
|
|
@@ -730,7 +730,7 @@ function useDtl(dtlParam) {
|
|
|
730
730
|
var onExportDtl = /*#__PURE__*/function () {
|
|
731
731
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(url, param) {
|
|
732
732
|
var _param$exportColumns;
|
|
733
|
-
var searchArr, arr, otherArr, whereArr, where, _result$flag6, result, _result$
|
|
733
|
+
var searchArr, arr, otherArr, whereArr, where, _result$flag6, _result$flag7, _result$flag8, result, _result$flag9;
|
|
734
734
|
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
735
735
|
while (1) switch (_context9.prev = _context9.next) {
|
|
736
736
|
case 0:
|
|
@@ -792,14 +792,14 @@ function useDtl(dtlParam) {
|
|
|
792
792
|
return httpPost(url, param);
|
|
793
793
|
case 10:
|
|
794
794
|
result = _context9.sent;
|
|
795
|
-
if (!(result.data && typeof result.data === 'string')) {
|
|
795
|
+
if (!(result.data && typeof result.data === 'string' && ((_result$flag6 = result.flag) === null || _result$flag6 === void 0 ? void 0 : _result$flag6.retCode) === '0')) {
|
|
796
796
|
_context9.next = 14;
|
|
797
797
|
break;
|
|
798
798
|
}
|
|
799
799
|
downloadFile(result.data);
|
|
800
800
|
return _context9.abrupt("return", true);
|
|
801
801
|
case 14:
|
|
802
|
-
if (!(((_result$
|
|
802
|
+
if (!(((_result$flag7 = result.flag) === null || _result$flag7 === void 0 ? void 0 : _result$flag7.retCode) === '0')) {
|
|
803
803
|
_context9.next = 19;
|
|
804
804
|
break;
|
|
805
805
|
}
|
|
@@ -807,21 +807,27 @@ function useDtl(dtlParam) {
|
|
|
807
807
|
// showSuccess(result.flag?.retMsg || '导出成功');
|
|
808
808
|
return _context9.abrupt("return", true);
|
|
809
809
|
case 19:
|
|
810
|
-
|
|
810
|
+
if (!['9101', '9102', '9103', '9013', '9014', '9110'].includes((result === null || result === void 0 ? void 0 : (_result$flag8 = result.flag) === null || _result$flag8 === void 0 ? void 0 : _result$flag8.retCode) || '0')) {
|
|
811
|
+
_context9.next = 23;
|
|
812
|
+
break;
|
|
813
|
+
}
|
|
814
|
+
return _context9.abrupt("return", result);
|
|
815
|
+
case 23:
|
|
816
|
+
showError(((_result$flag9 = result.flag) === null || _result$flag9 === void 0 ? void 0 : _result$flag9.retMsg) || '导出失败,请联系系统管理员');
|
|
811
817
|
return _context9.abrupt("return", false);
|
|
812
|
-
case
|
|
813
|
-
_context9.next =
|
|
818
|
+
case 25:
|
|
819
|
+
_context9.next = 31;
|
|
814
820
|
break;
|
|
815
|
-
case
|
|
816
|
-
_context9.prev =
|
|
821
|
+
case 27:
|
|
822
|
+
_context9.prev = 27;
|
|
817
823
|
_context9.t0 = _context9["catch"](7);
|
|
818
824
|
showError(_context9.t0.message);
|
|
819
825
|
return _context9.abrupt("return", false);
|
|
820
|
-
case
|
|
826
|
+
case 31:
|
|
821
827
|
case "end":
|
|
822
828
|
return _context9.stop();
|
|
823
829
|
}
|
|
824
|
-
}, _callee9, null, [[7,
|
|
830
|
+
}, _callee9, null, [[7, 27]]);
|
|
825
831
|
}));
|
|
826
832
|
return function onExportDtl(_x6, _x7) {
|
|
827
833
|
return _ref9.apply(this, arguments);
|
|
@@ -830,7 +836,7 @@ function useDtl(dtlParam) {
|
|
|
830
836
|
/** 审核按钮事件 */
|
|
831
837
|
var onAudit = /*#__PURE__*/function () {
|
|
832
838
|
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
|
|
833
|
-
var obj, _result$
|
|
839
|
+
var obj, _result$flag10, result;
|
|
834
840
|
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
835
841
|
while (1) switch (_context10.prev = _context10.next) {
|
|
836
842
|
case 0:
|
|
@@ -900,7 +906,7 @@ function useDtl(dtlParam) {
|
|
|
900
906
|
}
|
|
901
907
|
return _context10.abrupt("return");
|
|
902
908
|
case 36:
|
|
903
|
-
if ((result === null || result === void 0 ? void 0 : (_result$
|
|
909
|
+
if ((result === null || result === void 0 ? void 0 : (_result$flag10 = result.flag) === null || _result$flag10 === void 0 ? void 0 : _result$flag10.retCode) === '0') {
|
|
904
910
|
showSuccess(result.flag.retMsg || '审核成功');
|
|
905
911
|
Object.assign(masterObject, result.data);
|
|
906
912
|
}
|
|
@@ -44,7 +44,7 @@ declare function useSingle(inParam: SingleParamType): {
|
|
|
44
44
|
onLoad: (params: Record<string, any>, sort: Record<string, any>, filter: Record<string, any>, isHistory: any) => Promise<any>;
|
|
45
45
|
onAdd: (item: any) => Promise<void>;
|
|
46
46
|
onEdit: (item: any) => Promise<void>;
|
|
47
|
-
onExport: (url: string, param: any) => Promise<boolean>;
|
|
47
|
+
onExport: (url: string, param: any) => Promise<boolean | ApiResponse>;
|
|
48
48
|
onAudit: (row: any) => Promise<void>;
|
|
49
49
|
resourceId: any;
|
|
50
50
|
checkRight: (val: number) => boolean;
|
|
@@ -528,7 +528,7 @@ function useSingle(inParam) {
|
|
|
528
528
|
var onExport = /*#__PURE__*/function () {
|
|
529
529
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(url, param) {
|
|
530
530
|
var _param$exportColumns;
|
|
531
|
-
var searchArr, arr, otherArr, whereArr, where, _result$flag4, result, _result$flag5;
|
|
531
|
+
var searchArr, arr, otherArr, whereArr, where, _result$flag4, result, code, _result$flag5;
|
|
532
532
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
533
533
|
while (1) switch (_context7.prev = _context7.next) {
|
|
534
534
|
case 0:
|
|
@@ -590,37 +590,44 @@ function useSingle(inParam) {
|
|
|
590
590
|
return httpPost(url, param, true, false);
|
|
591
591
|
case 10:
|
|
592
592
|
result = _context7.sent;
|
|
593
|
-
|
|
594
|
-
|
|
593
|
+
code = ((_result$flag4 = result.flag) === null || _result$flag4 === void 0 ? void 0 : _result$flag4.retCode) || '9009'; // 后端直接返回导出文件地址,直接打开相当于是下载
|
|
594
|
+
if (!(result.data && typeof result.data === 'string' && code === '0')) {
|
|
595
|
+
_context7.next = 15;
|
|
595
596
|
break;
|
|
596
597
|
}
|
|
597
598
|
downloadFile(result.data);
|
|
598
599
|
return _context7.abrupt("return", true);
|
|
599
|
-
case
|
|
600
|
-
if (!(
|
|
601
|
-
_context7.next =
|
|
600
|
+
case 15:
|
|
601
|
+
if (!(code === '0')) {
|
|
602
|
+
_context7.next = 20;
|
|
602
603
|
break;
|
|
603
604
|
}
|
|
604
605
|
// showSuccess(result.flag?.retMsg || '导出成功');
|
|
605
606
|
exportProcess(result);
|
|
606
607
|
return _context7.abrupt("return", true);
|
|
607
|
-
case
|
|
608
|
+
case 20:
|
|
609
|
+
if (!['9101', '9102', '9103', '9013', '9014', '9110'].includes(code)) {
|
|
610
|
+
_context7.next = 24;
|
|
611
|
+
break;
|
|
612
|
+
}
|
|
613
|
+
return _context7.abrupt("return", result);
|
|
614
|
+
case 24:
|
|
608
615
|
showError(((_result$flag5 = result.flag) === null || _result$flag5 === void 0 ? void 0 : _result$flag5.retMsg) || '导出失败,请联系系统管理员');
|
|
609
616
|
return _context7.abrupt("return", false);
|
|
610
|
-
case
|
|
611
|
-
_context7.next =
|
|
617
|
+
case 26:
|
|
618
|
+
_context7.next = 33;
|
|
612
619
|
break;
|
|
613
|
-
case
|
|
614
|
-
_context7.prev =
|
|
620
|
+
case 28:
|
|
621
|
+
_context7.prev = 28;
|
|
615
622
|
_context7.t0 = _context7["catch"](7);
|
|
616
623
|
console.log(_context7.t0);
|
|
617
624
|
showError(_context7.t0.message);
|
|
618
625
|
return _context7.abrupt("return", false);
|
|
619
|
-
case
|
|
626
|
+
case 33:
|
|
620
627
|
case "end":
|
|
621
628
|
return _context7.stop();
|
|
622
629
|
}
|
|
623
|
-
}, _callee7, null, [[7,
|
|
630
|
+
}, _callee7, null, [[7, 28]]);
|
|
624
631
|
}));
|
|
625
632
|
return function onExport(_x9, _x10) {
|
|
626
633
|
return _ref7.apply(this, arguments);
|
package/lib/http/index.d.ts
CHANGED
|
@@ -49,9 +49,11 @@ export declare function httpDelete(url: string, data: any, needGateWay?: boolean
|
|
|
49
49
|
* @param dictCode 字典编码
|
|
50
50
|
* @param showValue 是否显示值
|
|
51
51
|
* @param needGateWay 是否需要网关 默认为true
|
|
52
|
+
* @param timeout 超时时间,默认60000毫秒
|
|
53
|
+
* @param valueIsNumber 返回值是否为数字,默认false
|
|
52
54
|
* @returns Promise<Record<string,string>[]>
|
|
53
55
|
*/
|
|
54
|
-
export declare function getDict(dictCode: string, showValue?: boolean, needGateWay?: boolean, timeout?: number): Promise<any>;
|
|
56
|
+
export declare function getDict(dictCode: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, valueIsNumber?: boolean): Promise<any>;
|
|
55
57
|
/**
|
|
56
58
|
* 加载下拉框的数据源
|
|
57
59
|
*
|
|
@@ -61,7 +63,8 @@ export declare function getDict(dictCode: string, showValue?: boolean, needGateW
|
|
|
61
63
|
* @param labelField 显示字段
|
|
62
64
|
* @param showValue 显示值
|
|
63
65
|
* @param needGateWay 是否需要网关 默认为true
|
|
66
|
+
* @param valueIsNumber 返回值是否为数字,默认false
|
|
64
67
|
* @returns
|
|
65
68
|
*/
|
|
66
|
-
export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean, needGateWay?: boolean, timeout?: number): Promise<any>;
|
|
69
|
+
export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, valueIsNumber?: boolean): Promise<any>;
|
|
67
70
|
export default request;
|
package/lib/http/index.js
CHANGED
|
@@ -324,17 +324,20 @@ export function httpDelete(url, data) {
|
|
|
324
324
|
* @param dictCode 字典编码
|
|
325
325
|
* @param showValue 是否显示值
|
|
326
326
|
* @param needGateWay 是否需要网关 默认为true
|
|
327
|
+
* @param timeout 超时时间,默认60000毫秒
|
|
328
|
+
* @param valueIsNumber 返回值是否为数字,默认false
|
|
327
329
|
* @returns Promise<Record<string,string>[]>
|
|
328
330
|
*/
|
|
329
331
|
export function getDict(dictCode) {
|
|
330
332
|
var showValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
331
333
|
var needGateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
332
334
|
var timeout = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 60000;
|
|
333
|
-
var
|
|
335
|
+
var valueIsNumber = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
336
|
+
var api = '/lesoon-petrel-integration-api/sysDictDtl/listByProperties';
|
|
334
337
|
var param = {
|
|
335
338
|
dictCode: dictCode
|
|
336
339
|
};
|
|
337
|
-
return fetchOptions(api, param, 'dictValue', 'displayName', showValue, needGateWay, timeout);
|
|
340
|
+
return fetchOptions(api, param, 'dictValue', 'displayName', showValue, needGateWay, timeout, valueIsNumber);
|
|
338
341
|
}
|
|
339
342
|
/**
|
|
340
343
|
* 加载下拉框的数据源
|
|
@@ -345,6 +348,7 @@ export function getDict(dictCode) {
|
|
|
345
348
|
* @param labelField 显示字段
|
|
346
349
|
* @param showValue 显示值
|
|
347
350
|
* @param needGateWay 是否需要网关 默认为true
|
|
351
|
+
* @param valueIsNumber 返回值是否为数字,默认false
|
|
348
352
|
* @returns
|
|
349
353
|
*/
|
|
350
354
|
export function fetchOptions(_x3, _x4, _x5, _x6) {
|
|
@@ -355,6 +359,7 @@ function _fetchOptions() {
|
|
|
355
359
|
var showValue,
|
|
356
360
|
needGateWay,
|
|
357
361
|
timeout,
|
|
362
|
+
valueIsNumber,
|
|
358
363
|
_yield$httpGet,
|
|
359
364
|
_yield$httpGet$rows,
|
|
360
365
|
rows,
|
|
@@ -366,21 +371,22 @@ function _fetchOptions() {
|
|
|
366
371
|
showValue = _args2.length > 4 && _args2[4] !== undefined ? _args2[4] : true;
|
|
367
372
|
needGateWay = _args2.length > 5 && _args2[5] !== undefined ? _args2[5] : true;
|
|
368
373
|
timeout = _args2.length > 6 && _args2[6] !== undefined ? _args2[6] : 60000;
|
|
369
|
-
|
|
374
|
+
valueIsNumber = _args2.length > 7 && _args2[7] !== undefined ? _args2[7] : false;
|
|
375
|
+
_context2.next = 6;
|
|
370
376
|
return httpGet(url, param, needGateWay, timeout);
|
|
371
|
-
case
|
|
377
|
+
case 6:
|
|
372
378
|
_yield$httpGet = _context2.sent;
|
|
373
379
|
_yield$httpGet$rows = _yield$httpGet.rows;
|
|
374
380
|
rows = _yield$httpGet$rows === void 0 ? [] : _yield$httpGet$rows;
|
|
375
381
|
data = (rows || []).map(function (o) {
|
|
376
382
|
return _objectSpread(_objectSpread({}, o), {}, {
|
|
377
|
-
value: o[valueField],
|
|
383
|
+
value: valueIsNumber && !isNaN(o[valueField]) ? Number(o[valueField]) : o[valueField],
|
|
378
384
|
text: o[labelField],
|
|
379
385
|
label: (showValue ? o[valueField] + '→' : '') + o[labelField]
|
|
380
386
|
});
|
|
381
387
|
});
|
|
382
388
|
return _context2.abrupt("return", data);
|
|
383
|
-
case
|
|
389
|
+
case 11:
|
|
384
390
|
case "end":
|
|
385
391
|
return _context2.stop();
|
|
386
392
|
}
|