ls-pro-common 3.0.79 → 3.0.81
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.js +1 -1
- package/dist/common.min.js +1 -1
- package/es/hooks/useBaseDict.d.ts +35 -0
- package/es/hooks/useBaseDict.js +104 -0
- package/es/hooks/useDtl/index.js +7 -5
- package/es/hooks/useFilterBack.d.ts +9 -10
- package/es/hooks/useFilterBack.js +6 -6
- package/es/hooks/useSelectOptions.d.ts +81 -0
- package/es/hooks/useSelectOptions.js +210 -0
- package/es/hooks/useShowConfirm.d.ts +9 -0
- package/es/hooks/useShowConfirm.js +23 -0
- package/es/hooks/useSingle/index.js +5 -3
- package/es/http/index.js +1 -1
- package/es/index.d.ts +6 -2
- package/es/index.js +6 -2
- package/es/utils/exportProcess.d.ts +8 -0
- package/es/utils/exportProcess.js +99 -0
- package/es/utils/index.d.ts +2 -0
- package/es/utils/index.js +18 -0
- package/lib/hooks/useBaseDict.d.ts +35 -0
- package/lib/hooks/useBaseDict.js +104 -0
- package/lib/hooks/useDtl/index.js +7 -5
- package/lib/hooks/useFilterBack.d.ts +9 -10
- package/lib/hooks/useFilterBack.js +6 -6
- package/lib/hooks/useSelectOptions.d.ts +81 -0
- package/lib/hooks/useSelectOptions.js +210 -0
- package/lib/hooks/useShowConfirm.d.ts +9 -0
- package/lib/hooks/useShowConfirm.js +23 -0
- package/lib/hooks/useSingle/index.js +5 -3
- package/lib/http/index.js +1 -1
- package/lib/index.d.ts +6 -2
- package/lib/index.js +6 -2
- package/lib/utils/exportProcess.d.ts +8 -0
- package/lib/utils/exportProcess.js +99 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +18 -0
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import "antd/es/modal/style";
|
|
2
|
+
import _Modal from "antd/es/modal";
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import ReactDOM from 'react-dom';
|
|
6
|
+
/**
|
|
7
|
+
* 语法糖实现
|
|
8
|
+
*
|
|
9
|
+
* @param propsFun 参数为关闭函数
|
|
10
|
+
* @name 函数确认框
|
|
11
|
+
*/
|
|
12
|
+
export var showConfirmFun = function showConfirmFun(propsFun) {
|
|
13
|
+
var div = document.createElement('div');
|
|
14
|
+
document.body.appendChild(div);
|
|
15
|
+
var props = propsFun(function () {
|
|
16
|
+
ReactDOM.unmountComponentAtNode(div);
|
|
17
|
+
document.body.removeChild(div);
|
|
18
|
+
});
|
|
19
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(_Modal, _extends({
|
|
20
|
+
visible: true
|
|
21
|
+
}, props), props.content), div);
|
|
22
|
+
};
|
|
23
|
+
export default showConfirmFun;
|
|
@@ -10,6 +10,7 @@ import React from "react";
|
|
|
10
10
|
import { useState, useRef, useMemo, useCallback } from 'react';
|
|
11
11
|
import { PlusCircleOutlined, EditOutlined, DeleteOutlined, ImportOutlined, ExportOutlined, AuditOutlined } from '@ant-design/icons';
|
|
12
12
|
import { showConfirm, showWarn, showSuccess, showError } from '../../utils';
|
|
13
|
+
import exportProcess from '../../utils/exportProcess';
|
|
13
14
|
import { httpPost } from '../../http';
|
|
14
15
|
import usePermission from '../usePermission';
|
|
15
16
|
/**
|
|
@@ -527,7 +528,7 @@ function useSingle(inParam) {
|
|
|
527
528
|
var onExport = /*#__PURE__*/function () {
|
|
528
529
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(url, param) {
|
|
529
530
|
var _param$exportColumns;
|
|
530
|
-
var searchArr, arr, otherArr, whereArr, where, _result$flag4, result, _result$flag5
|
|
531
|
+
var searchArr, arr, otherArr, whereArr, where, _result$flag4, result, _result$flag5;
|
|
531
532
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
532
533
|
while (1) switch (_context7.prev = _context7.next) {
|
|
533
534
|
case 0:
|
|
@@ -600,10 +601,11 @@ function useSingle(inParam) {
|
|
|
600
601
|
_context7.next = 19;
|
|
601
602
|
break;
|
|
602
603
|
}
|
|
603
|
-
showSuccess(
|
|
604
|
+
// showSuccess(result.flag?.retMsg || '导出成功');
|
|
605
|
+
exportProcess(result);
|
|
604
606
|
return _context7.abrupt("return", true);
|
|
605
607
|
case 19:
|
|
606
|
-
showError(((_result$
|
|
608
|
+
showError(((_result$flag5 = result.flag) === null || _result$flag5 === void 0 ? void 0 : _result$flag5.retMsg) || '导出失败,请联系系统管理员');
|
|
607
609
|
return _context7.abrupt("return", false);
|
|
608
610
|
case 21:
|
|
609
611
|
_context7.next = 28;
|
package/lib/http/index.js
CHANGED
|
@@ -128,7 +128,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
128
128
|
_data = _context.sent;
|
|
129
129
|
_retCode = (_data === null || _data === void 0 ? void 0 : (_data$flag4 = _data.flag) === null || _data$flag4 === void 0 ? void 0 : _data$flag4.retCode) || '0';
|
|
130
130
|
_retMsg = ((_data$flag5 = _data.flag) === null || _data$flag5 === void 0 ? void 0 : _data$flag5.retMsg) || '请求的服务出错';
|
|
131
|
-
status = (getUrlQuery('apiStatus') || '0').split(',');
|
|
131
|
+
status = (getUrlQuery('apiStatus', options.url) || '0').split(',');
|
|
132
132
|
requestId = (_data$flag6 = _data.flag) === null || _data$flag6 === void 0 ? void 0 : _data$flag6.requestId;
|
|
133
133
|
_faultCode = (_data$flag7 = _data.flag) === null || _data$flag7 === void 0 ? void 0 : _data$flag7.faultCode;
|
|
134
134
|
if (_retCode && !status.includes(_retCode)) {
|
package/lib/index.d.ts
CHANGED
|
@@ -20,12 +20,16 @@ import ViewOffice from './components/ViewOffice';
|
|
|
20
20
|
import BaseService from './service/BaseService';
|
|
21
21
|
import request, { httpGet, httpPut, httpPost, httpDelete, getDict, fetchOptions } from './http';
|
|
22
22
|
import * as utils from './utils';
|
|
23
|
+
import exportProcess from './utils/exportProcess';
|
|
23
24
|
/** Hooks */
|
|
24
25
|
import useSingle from './hooks/useSingle';
|
|
25
26
|
import useDtl from './hooks/useDtl';
|
|
26
27
|
import usePermission from './hooks/usePermission';
|
|
27
28
|
import useGetState from './hooks/useGetState';
|
|
28
|
-
import
|
|
29
|
+
import useFilterLocal from './hooks/useFilterBack';
|
|
30
|
+
import useBaseDict from './hooks/useBaseDict';
|
|
31
|
+
import useSelectOptions from './hooks/useSelectOptions';
|
|
32
|
+
import showConfirmFun from './hooks/useShowConfirm';
|
|
29
33
|
import useQueue from './hooks/useQueue';
|
|
30
34
|
/** Type */
|
|
31
35
|
import type { ApiResponse, TableToolbar, BaseApiType, MethodType } from './typing';
|
|
@@ -33,4 +37,4 @@ import type { DtlLyaoutProps } from './components/DtlLayout';
|
|
|
33
37
|
import type { DescritionCardProps } from './components/DescritionCard';
|
|
34
38
|
import type { PermissionProps } from './components/Permission';
|
|
35
39
|
export type { ApiResponse, TableToolbar, BaseApiType, MethodType, DtlLyaoutProps, DescritionCardProps, PermissionProps, };
|
|
36
|
-
export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, ViewOffice, IconBack, IconText, IconBell, IconQuestion, IconSearch, TagCheck, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState, useFilterLocal, useQueue, };
|
|
40
|
+
export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, ViewOffice, IconBack, IconText, IconBell, IconQuestion, IconSearch, TagCheck, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState, useFilterLocal, useQueue, useBaseDict, useSelectOptions, showConfirmFun, exportProcess, };
|
package/lib/index.js
CHANGED
|
@@ -20,11 +20,15 @@ import ViewOffice from './components/ViewOffice';
|
|
|
20
20
|
import BaseService from './service/BaseService';
|
|
21
21
|
import request, { httpGet, httpPut, httpPost, httpDelete, getDict, fetchOptions } from './http';
|
|
22
22
|
import * as utils from './utils';
|
|
23
|
+
import exportProcess from './utils/exportProcess';
|
|
23
24
|
/** Hooks */
|
|
24
25
|
import useSingle from './hooks/useSingle';
|
|
25
26
|
import useDtl from './hooks/useDtl';
|
|
26
27
|
import usePermission from './hooks/usePermission';
|
|
27
28
|
import useGetState from './hooks/useGetState';
|
|
28
|
-
import
|
|
29
|
+
import useFilterLocal from './hooks/useFilterBack';
|
|
30
|
+
import useBaseDict from './hooks/useBaseDict';
|
|
31
|
+
import useSelectOptions from './hooks/useSelectOptions';
|
|
32
|
+
import showConfirmFun from './hooks/useShowConfirm';
|
|
29
33
|
import useQueue from './hooks/useQueue';
|
|
30
|
-
export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, ViewOffice, IconBack, IconText, IconBell, IconQuestion, IconSearch, TagCheck, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState, useFilterLocal, useQueue };
|
|
34
|
+
export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, ViewOffice, IconBack, IconText, IconBell, IconQuestion, IconSearch, TagCheck, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState, useFilterLocal, useQueue, useBaseDict, useSelectOptions, showConfirmFun, exportProcess };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import "antd/es/message/style";
|
|
2
|
+
import _message from "antd/es/message";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { CloseOutlined } from '@ant-design/icons';
|
|
5
|
+
import { showSuccess, showError, sleep, downloadFile } from '.';
|
|
6
|
+
import { httpGet } from '../http';
|
|
7
|
+
/**
|
|
8
|
+
* 导出进度查看
|
|
9
|
+
*
|
|
10
|
+
* @param apiResult 导出接口返回数据,
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
var exportProcess = function exportProcess(apiResult) {
|
|
14
|
+
if (!apiResult.taskId) {
|
|
15
|
+
var _apiResult$flag;
|
|
16
|
+
showSuccess((apiResult === null || apiResult === void 0 ? void 0 : (_apiResult$flag = apiResult.flag) === null || _apiResult$flag === void 0 ? void 0 : _apiResult$flag.retMsg) || '导出成功');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
var time = 0;
|
|
20
|
+
var exit = false;
|
|
21
|
+
var win = top || window;
|
|
22
|
+
var loading = _message.loading({
|
|
23
|
+
content: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, "\u6B63\u5728\u5BFC\u51FA\u4E2D,\u8BF7\u7A0D\u5019..."), /*#__PURE__*/React.createElement("a", {
|
|
24
|
+
onClick: function onClick() {
|
|
25
|
+
loading();
|
|
26
|
+
}
|
|
27
|
+
}, /*#__PURE__*/React.createElement(CloseOutlined, {
|
|
28
|
+
style: {
|
|
29
|
+
marginLeft: 20,
|
|
30
|
+
color: 'gray',
|
|
31
|
+
width: 13
|
|
32
|
+
}
|
|
33
|
+
}))),
|
|
34
|
+
duration: 0,
|
|
35
|
+
style: {
|
|
36
|
+
textAlign: 'right'
|
|
37
|
+
},
|
|
38
|
+
onClose: function onClose() {
|
|
39
|
+
exit = true;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
var getResult = function getResult() {
|
|
43
|
+
if (exit) return;
|
|
44
|
+
httpGet('/petrel-poi-center-api/sysPoiExportManage/page', {
|
|
45
|
+
'page.pn': 1,
|
|
46
|
+
'page.size': 1,
|
|
47
|
+
'search.id': apiResult.taskId
|
|
48
|
+
}).then(function (result) {
|
|
49
|
+
var _result$rows = result.rows,
|
|
50
|
+
rows = _result$rows === void 0 ? [] : _result$rows;
|
|
51
|
+
var row = rows === null || rows === void 0 ? void 0 : rows[0];
|
|
52
|
+
if (!row) {
|
|
53
|
+
if (time < 3) {
|
|
54
|
+
time++;
|
|
55
|
+
sleep(5).then(function () {
|
|
56
|
+
return getResult();
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
showError('获取导出进度失败,请在消息中心查看导出结果');
|
|
60
|
+
win.postMessage({
|
|
61
|
+
type: 'exportError'
|
|
62
|
+
});
|
|
63
|
+
loading();
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
var status = row.status,
|
|
67
|
+
downloadUrl = row.downloadUrl;
|
|
68
|
+
//导出中
|
|
69
|
+
if (status < 30) {
|
|
70
|
+
sleep(5).then(function () {
|
|
71
|
+
return getResult();
|
|
72
|
+
});
|
|
73
|
+
} else {
|
|
74
|
+
//导出成功
|
|
75
|
+
if (status === 30 && downloadUrl) {
|
|
76
|
+
downloadFile(downloadUrl);
|
|
77
|
+
} else {
|
|
78
|
+
//导出失败
|
|
79
|
+
showError('导出异常,请在消息中心查看失败原因');
|
|
80
|
+
win.postMessage({
|
|
81
|
+
type: 'exportError'
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
loading();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}).catch(function () {
|
|
88
|
+
showError('获取导出进度失败,请在消息中心查看导出结果');
|
|
89
|
+
loading();
|
|
90
|
+
win.postMessage({
|
|
91
|
+
type: 'exportError'
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
sleep(1).then(function () {
|
|
96
|
+
return getResult();
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
export default exportProcess;
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -314,3 +314,5 @@ export declare const openPageInMain: (option: {
|
|
|
314
314
|
export declare const showLoading: (text?: string) => void;
|
|
315
315
|
export declare const exitLoading: () => void;
|
|
316
316
|
export declare const handleTheme: () => void;
|
|
317
|
+
export declare const sleep: (secord: number) => Promise<unknown>;
|
|
318
|
+
export declare const downloadFile: (url: string, fileName?: string | undefined) => void;
|
package/lib/utils/index.js
CHANGED
|
@@ -889,4 +889,22 @@ export var handleTheme = function handleTheme() {
|
|
|
889
889
|
if (theme) {
|
|
890
890
|
document.body.classList.add('theme-' + theme);
|
|
891
891
|
}
|
|
892
|
+
};
|
|
893
|
+
export var sleep = function sleep(secord) {
|
|
894
|
+
return new Promise(function (resolve) {
|
|
895
|
+
setTimeout(function () {
|
|
896
|
+
resolve(true);
|
|
897
|
+
}, secord * 1000);
|
|
898
|
+
});
|
|
899
|
+
};
|
|
900
|
+
export var downloadFile = function downloadFile(url, fileName) {
|
|
901
|
+
var a = document.createElement('a');
|
|
902
|
+
a.href = url;
|
|
903
|
+
// a.target = '_blank'; // 新开屏有闪烁
|
|
904
|
+
if (fileName) {
|
|
905
|
+
a.setAttribute('download', fileName);
|
|
906
|
+
}
|
|
907
|
+
document.body.appendChild(a);
|
|
908
|
+
a.click();
|
|
909
|
+
document.body.removeChild(a);
|
|
892
910
|
};
|