ls-pro-common 3.0.87 → 3.0.88
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/components/AreaCascader.js +9 -6
- package/es/components/AreaCascaderPanel.js +9 -6
- package/es/http/index.js +4 -1
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +3 -0
- package/lib/components/AreaCascader.js +9 -6
- package/lib/components/AreaCascaderPanel.js +9 -6
- package/lib/http/index.js +4 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +3 -0
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
6
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
7
|
import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
|
|
8
8
|
import { httpGet } from '../http';
|
|
9
|
-
import { getCache, setCache, treeEach } from '../utils';
|
|
9
|
+
import { getCache, setCache, treeEach, isSaasVersion } from '../utils';
|
|
10
10
|
var AreaCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
11
11
|
var _useState = useState([]),
|
|
12
12
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -25,7 +25,7 @@ var AreaCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
25
25
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
26
26
|
while (1) switch (_context.prev = _context.next) {
|
|
27
27
|
case 0:
|
|
28
|
-
cacheItems = getCache(
|
|
28
|
+
cacheItems = getCache('areaOptions', true);
|
|
29
29
|
if (!(cacheItems && Array.isArray(cacheItems))) {
|
|
30
30
|
_context.next = 4;
|
|
31
31
|
break;
|
|
@@ -34,11 +34,14 @@ var AreaCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
34
34
|
return _context.abrupt("return");
|
|
35
35
|
case 4:
|
|
36
36
|
api = '/petrel/petrel-location-center-api/sysAdministrativeDivision/allByTree';
|
|
37
|
-
|
|
37
|
+
if (isSaasVersion()) {
|
|
38
|
+
api = '/lesoon/tenant-lesoon-mdm-center-api/sysAdministrativeDivision/allByTree';
|
|
39
|
+
}
|
|
40
|
+
_context.next = 8;
|
|
38
41
|
return httpGet(api, {}, false);
|
|
39
|
-
case
|
|
42
|
+
case 8:
|
|
40
43
|
result = _context.sent;
|
|
41
|
-
opts = result.rows || [];
|
|
44
|
+
opts = (isSaasVersion() ? result.data : result.rows) || [];
|
|
42
45
|
treeEach(opts, function (item) {
|
|
43
46
|
item.label = item.name;
|
|
44
47
|
item.value = item.id;
|
|
@@ -52,7 +55,7 @@ var AreaCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
52
55
|
});
|
|
53
56
|
setCache('areaOptions', opts, true);
|
|
54
57
|
setOptions(opts);
|
|
55
|
-
case
|
|
58
|
+
case 13:
|
|
56
59
|
case "end":
|
|
57
60
|
return _context.stop();
|
|
58
61
|
}
|
|
@@ -9,7 +9,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
10
|
import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
|
|
11
11
|
import { httpGet } from '../http';
|
|
12
|
-
import { getCache, setCache, treeEach } from '../utils';
|
|
12
|
+
import { getCache, setCache, treeEach, isSaasVersion } from '../utils';
|
|
13
13
|
import './common.less';
|
|
14
14
|
var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
15
15
|
var propsConfig = _objectSpread({
|
|
@@ -17,7 +17,7 @@ var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
17
17
|
var _document;
|
|
18
18
|
return (_document = document) === null || _document === void 0 ? void 0 : _document.body;
|
|
19
19
|
},
|
|
20
|
-
placeholder:
|
|
20
|
+
placeholder: '请选择'
|
|
21
21
|
}, props);
|
|
22
22
|
var _useState = useState(getCache('areaOptionsPanel', true) || []),
|
|
23
23
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -93,11 +93,14 @@ var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
93
93
|
return _context.abrupt("return");
|
|
94
94
|
case 3:
|
|
95
95
|
api = '/petrel/petrel-location-center-api/sysAdministrativeDivision/allByTree';
|
|
96
|
-
|
|
96
|
+
if (isSaasVersion()) {
|
|
97
|
+
api = '/lesoon/tenant-lesoon-mdm-center-api/sysAdministrativeDivision/allByTree';
|
|
98
|
+
}
|
|
99
|
+
_context.next = 7;
|
|
97
100
|
return httpGet(api, {}, false);
|
|
98
|
-
case
|
|
101
|
+
case 7:
|
|
99
102
|
result = _context.sent;
|
|
100
|
-
opts = result.rows || [];
|
|
103
|
+
opts = (isSaasVersion() ? result.data : result.rows) || [];
|
|
101
104
|
treeEach(opts, function (item) {
|
|
102
105
|
item.label = item.name;
|
|
103
106
|
item.value = item.id;
|
|
@@ -111,7 +114,7 @@ var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
111
114
|
setCache('areaOptionsPanel', opts, true);
|
|
112
115
|
setOptions(opts);
|
|
113
116
|
setShowData(opts);
|
|
114
|
-
case
|
|
117
|
+
case 13:
|
|
115
118
|
case "end":
|
|
116
119
|
return _context.stop();
|
|
117
120
|
}
|
package/es/http/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { extend } from 'umi-request';
|
|
4
|
-
import { getCache, getUrlQuery, setUrlQuery, getCookie, getResourceProps, showError, httpError, toGatewayUrl, reLogin, showLoading, exitLoading } from '../utils';
|
|
4
|
+
import { getCache, getUrlQuery, setUrlQuery, getCookie, getResourceProps, showError, httpError, toGatewayUrl, reLogin, showLoading, exitLoading, isSaasVersion } from '../utils';
|
|
5
5
|
//默认超时时间为1分钟
|
|
6
6
|
var request = extend({
|
|
7
7
|
timeout: 60000
|
|
@@ -277,6 +277,9 @@ export function getDict(dictCode) {
|
|
|
277
277
|
var needGateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
278
278
|
var timeout = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 60000;
|
|
279
279
|
var api = '/lesoon-integration/sysDictDtl/listByProperties';
|
|
280
|
+
if (isSaasVersion()) {
|
|
281
|
+
api = '/tenant-lesoon-integration-api/sysDictDtl/listByProperties';
|
|
282
|
+
}
|
|
280
283
|
var param = {
|
|
281
284
|
dictCode: dictCode
|
|
282
285
|
};
|
package/es/utils/index.d.ts
CHANGED
|
@@ -316,3 +316,4 @@ export declare const exitLoading: () => void;
|
|
|
316
316
|
export declare const handleTheme: () => void;
|
|
317
317
|
export declare const sleep: (secord: number) => Promise<unknown>;
|
|
318
318
|
export declare const downloadFile: (url: string, fileName?: string | undefined) => void;
|
|
319
|
+
export declare const isSaasVersion: () => boolean;
|
package/es/utils/index.js
CHANGED
|
@@ -915,4 +915,7 @@ export var downloadFile = function downloadFile(url, fileName) {
|
|
|
915
915
|
document.body.appendChild(a);
|
|
916
916
|
a.click();
|
|
917
917
|
document.body.removeChild(a);
|
|
918
|
+
};
|
|
919
|
+
export var isSaasVersion = function isSaasVersion() {
|
|
920
|
+
return (getCache('poi-center-api') || '').includes('/tenant-lesoon-basic-api/');
|
|
918
921
|
};
|
|
@@ -6,7 +6,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
6
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
7
|
import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
|
|
8
8
|
import { httpGet } from '../http';
|
|
9
|
-
import { getCache, setCache, treeEach } from '../utils';
|
|
9
|
+
import { getCache, setCache, treeEach, isSaasVersion } from '../utils';
|
|
10
10
|
var AreaCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
11
11
|
var _useState = useState([]),
|
|
12
12
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -25,7 +25,7 @@ var AreaCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
25
25
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
26
26
|
while (1) switch (_context.prev = _context.next) {
|
|
27
27
|
case 0:
|
|
28
|
-
cacheItems = getCache(
|
|
28
|
+
cacheItems = getCache('areaOptions', true);
|
|
29
29
|
if (!(cacheItems && Array.isArray(cacheItems))) {
|
|
30
30
|
_context.next = 4;
|
|
31
31
|
break;
|
|
@@ -34,11 +34,14 @@ var AreaCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
34
34
|
return _context.abrupt("return");
|
|
35
35
|
case 4:
|
|
36
36
|
api = '/petrel/petrel-location-center-api/sysAdministrativeDivision/allByTree';
|
|
37
|
-
|
|
37
|
+
if (isSaasVersion()) {
|
|
38
|
+
api = '/lesoon/tenant-lesoon-mdm-center-api/sysAdministrativeDivision/allByTree';
|
|
39
|
+
}
|
|
40
|
+
_context.next = 8;
|
|
38
41
|
return httpGet(api, {}, false);
|
|
39
|
-
case
|
|
42
|
+
case 8:
|
|
40
43
|
result = _context.sent;
|
|
41
|
-
opts = result.rows || [];
|
|
44
|
+
opts = (isSaasVersion() ? result.data : result.rows) || [];
|
|
42
45
|
treeEach(opts, function (item) {
|
|
43
46
|
item.label = item.name;
|
|
44
47
|
item.value = item.id;
|
|
@@ -52,7 +55,7 @@ var AreaCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
52
55
|
});
|
|
53
56
|
setCache('areaOptions', opts, true);
|
|
54
57
|
setOptions(opts);
|
|
55
|
-
case
|
|
58
|
+
case 13:
|
|
56
59
|
case "end":
|
|
57
60
|
return _context.stop();
|
|
58
61
|
}
|
|
@@ -9,7 +9,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
10
|
import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
|
|
11
11
|
import { httpGet } from '../http';
|
|
12
|
-
import { getCache, setCache, treeEach } from '../utils';
|
|
12
|
+
import { getCache, setCache, treeEach, isSaasVersion } from '../utils';
|
|
13
13
|
import './common.less';
|
|
14
14
|
var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
15
15
|
var propsConfig = _objectSpread({
|
|
@@ -17,7 +17,7 @@ var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
17
17
|
var _document;
|
|
18
18
|
return (_document = document) === null || _document === void 0 ? void 0 : _document.body;
|
|
19
19
|
},
|
|
20
|
-
placeholder:
|
|
20
|
+
placeholder: '请选择'
|
|
21
21
|
}, props);
|
|
22
22
|
var _useState = useState(getCache('areaOptionsPanel', true) || []),
|
|
23
23
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -93,11 +93,14 @@ var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
93
93
|
return _context.abrupt("return");
|
|
94
94
|
case 3:
|
|
95
95
|
api = '/petrel/petrel-location-center-api/sysAdministrativeDivision/allByTree';
|
|
96
|
-
|
|
96
|
+
if (isSaasVersion()) {
|
|
97
|
+
api = '/lesoon/tenant-lesoon-mdm-center-api/sysAdministrativeDivision/allByTree';
|
|
98
|
+
}
|
|
99
|
+
_context.next = 7;
|
|
97
100
|
return httpGet(api, {}, false);
|
|
98
|
-
case
|
|
101
|
+
case 7:
|
|
99
102
|
result = _context.sent;
|
|
100
|
-
opts = result.rows || [];
|
|
103
|
+
opts = (isSaasVersion() ? result.data : result.rows) || [];
|
|
101
104
|
treeEach(opts, function (item) {
|
|
102
105
|
item.label = item.name;
|
|
103
106
|
item.value = item.id;
|
|
@@ -111,7 +114,7 @@ var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
111
114
|
setCache('areaOptionsPanel', opts, true);
|
|
112
115
|
setOptions(opts);
|
|
113
116
|
setShowData(opts);
|
|
114
|
-
case
|
|
117
|
+
case 13:
|
|
115
118
|
case "end":
|
|
116
119
|
return _context.stop();
|
|
117
120
|
}
|
package/lib/http/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { extend } from 'umi-request';
|
|
4
|
-
import { getCache, getUrlQuery, setUrlQuery, getCookie, getResourceProps, showError, httpError, toGatewayUrl, reLogin, showLoading, exitLoading } from '../utils';
|
|
4
|
+
import { getCache, getUrlQuery, setUrlQuery, getCookie, getResourceProps, showError, httpError, toGatewayUrl, reLogin, showLoading, exitLoading, isSaasVersion } from '../utils';
|
|
5
5
|
//默认超时时间为1分钟
|
|
6
6
|
var request = extend({
|
|
7
7
|
timeout: 60000
|
|
@@ -277,6 +277,9 @@ export function getDict(dictCode) {
|
|
|
277
277
|
var needGateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
278
278
|
var timeout = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 60000;
|
|
279
279
|
var api = '/lesoon-integration/sysDictDtl/listByProperties';
|
|
280
|
+
if (isSaasVersion()) {
|
|
281
|
+
api = '/tenant-lesoon-integration-api/sysDictDtl/listByProperties';
|
|
282
|
+
}
|
|
280
283
|
var param = {
|
|
281
284
|
dictCode: dictCode
|
|
282
285
|
};
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -316,3 +316,4 @@ export declare const exitLoading: () => void;
|
|
|
316
316
|
export declare const handleTheme: () => void;
|
|
317
317
|
export declare const sleep: (secord: number) => Promise<unknown>;
|
|
318
318
|
export declare const downloadFile: (url: string, fileName?: string | undefined) => void;
|
|
319
|
+
export declare const isSaasVersion: () => boolean;
|
package/lib/utils/index.js
CHANGED
|
@@ -915,4 +915,7 @@ export var downloadFile = function downloadFile(url, fileName) {
|
|
|
915
915
|
document.body.appendChild(a);
|
|
916
916
|
a.click();
|
|
917
917
|
document.body.removeChild(a);
|
|
918
|
+
};
|
|
919
|
+
export var isSaasVersion = function isSaasVersion() {
|
|
920
|
+
return (getCache('poi-center-api') || '').includes('/tenant-lesoon-basic-api/');
|
|
918
921
|
};
|