ls-pro-common 3.0.86 → 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.
@@ -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("areaOptions", true);
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
- _context.next = 7;
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 7:
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 12:
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
- _context.next = 6;
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 6:
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 12:
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
  };
@@ -93,7 +93,8 @@ var exportProcess = function exportProcess(apiResult) {
93
93
  loading(0);
94
94
  var getResult = function getResult() {
95
95
  if (exit) return;
96
- httpGet('/petrel-poi-center-api/sysPoiExportManage/page', {
96
+ var url = (localStorage.getItem('poi-center-api') || '/zuul/petrel-poi-center-api/').replace('/zuul/', '/');
97
+ httpGet(url + 'sysPoiExportManage/page', {
97
98
  'page.pn': 1,
98
99
  'page.size': 1,
99
100
  'search.id': apiResult.taskId
@@ -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("areaOptions", true);
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
- _context.next = 7;
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 7:
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 12:
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
- _context.next = 6;
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 6:
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 12:
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
  };
@@ -93,7 +93,8 @@ var exportProcess = function exportProcess(apiResult) {
93
93
  loading(0);
94
94
  var getResult = function getResult() {
95
95
  if (exit) return;
96
- httpGet('/petrel-poi-center-api/sysPoiExportManage/page', {
96
+ var url = (localStorage.getItem('poi-center-api') || '/zuul/petrel-poi-center-api/').replace('/zuul/', '/');
97
+ httpGet(url + 'sysPoiExportManage/page', {
97
98
  'page.pn': 1,
98
99
  'page.size': 1,
99
100
  'search.id': apiResult.taskId
@@ -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;
@@ -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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "3.0.86",
3
+ "version": "3.0.88",
4
4
  "description": "ls-pro-common",
5
5
  "license": "MIT",
6
6
  "sideEffects": [