ls-pro-common 3.1.30 → 3.1.32

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/es/http/index.js CHANGED
@@ -57,12 +57,10 @@ request.interceptors.request.use(function (url, options) {
57
57
  options.headers = options.headers || {};
58
58
  // 处理浏览器指纹
59
59
  if (browserId) {
60
- // @ts-ignore
61
60
  options.headers.browserId = browserId;
62
61
  } else {
63
62
  if (getCache('browserId')) {
64
63
  browserId = getCache('browserId');
65
- // @ts-ignore
66
64
  options.headers.browserId = browserId;
67
65
  } else {
68
66
  getBrowserId().then(function (id) {
@@ -73,45 +71,37 @@ request.interceptors.request.use(function (url, options) {
73
71
  // 处理门店
74
72
  var shopNo = getCacheSessionFirst('shopNo');
75
73
  if (shopNo) {
76
- // @ts-ignore
77
74
  options.headers.shopNo = shopNo;
78
75
  }
79
76
  // 处理门店
80
77
  var shopCode = getCacheSessionFirst('shopCode');
81
78
  if (shopCode) {
82
- // @ts-ignore
83
79
  options.headers.shopCode = shopCode;
84
80
  }
85
81
  // 处理仓库
86
82
  var storeNo = getCacheSessionFirst('storeNo');
87
83
  if (storeNo) {
88
- // @ts-ignore
89
84
  options.headers.storeNo = storeNo;
90
85
  }
91
86
  var tag = getCookie('x-asm-prefer-tag');
92
87
  if (tag) {
93
- // @ts-ignore
94
88
  options.headers['x-asm-prefer-tag'] = tag; //灰度发版标识
95
89
  }
96
- // @ts-ignore
90
+
97
91
  options.headers['terminal'] = 'PC';
98
- // wms 提示,是否排班标识
99
92
  var expireWarnFlag = getCache('expireWarnFlag', true);
100
- // @ts-ignore
101
93
  options.headers.expireWarnFlag = expireWarnFlag === '1' ? '1' : '0';
102
94
  var token = getCookie('token');
103
95
  if (token && url.indexOf('noToken=1') === -1) {
104
- //@ts-ignore
105
96
  options.headers.token = token;
106
97
  }
107
98
  url = url.replace('&noToken=1', '').replace('noToken=1', '');
108
- var resCode = getUrlQuery('resCode', url) || getUrlQuery('resCode') || getUrlQuery('resourceId') || getResourceProps('resourceId');
99
+ var resCode = getUrlQuery('resCode', url) || window.__currentResCode__ || getUrlQuery('resCode') || getUrlQuery('resourceId') || getResourceProps('resourceId');
109
100
  var param = {
110
101
  _t1: Date.now(),
111
102
  __r: ((_window$crypto$random = (_window$crypto = window.crypto)['randomUUID']) === null || _window$crypto$random === void 0 ? void 0 : _window$crypto$random.call(_window$crypto)) || Math.random()
112
103
  };
113
104
  // 当没有明文参数resCode的时候,添加resCode参数为资源Id
114
- //@ts-ignore
115
105
  if (resCode && !((_options$params = options.params) === null || _options$params === void 0 ? void 0 : _options$params.resCode)) {
116
106
  param.resCode = resCode;
117
107
  }
@@ -152,6 +152,7 @@ export declare const getSeason: (params?: any) => Promise<any>;
152
152
  * @returns
153
153
  */
154
154
  export declare const getCategory: (params?: any) => Promise<any>;
155
+ export declare const getSupplier: (params?: any) => Promise<any>;
155
156
  declare const mdmMap: {
156
157
  owner: (params?: any) => Promise<any>;
157
158
  store: (params?: any) => Promise<any>;
@@ -178,6 +179,7 @@ declare const mdmMap: {
178
179
  year: (params?: any) => Promise<any>;
179
180
  season: (params?: any) => Promise<any>;
180
181
  category: (params?: any) => Promise<any>;
182
+ supplier: (params?: any) => Promise<any>;
181
183
  };
182
184
  export declare type MdmType = keyof typeof mdmMap;
183
185
  export declare const getMdmData: (type: MdmType, params?: any) => Promise<any>;
@@ -335,6 +335,12 @@ export var getCategory = function getCategory() {
335
335
  var url = '/lesoon-mdm-center-api/bmCategory/page';
336
336
  return httpGetWithCache('category', url, params);
337
337
  };
338
+ export var getSupplier = function getSupplier() {
339
+ var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
340
+ setPageSize(params);
341
+ var url = '/lesoon-mdm-center-api/bmSupplier/page';
342
+ return httpGetWithCache('supplier', url, params);
343
+ };
338
344
  var mdmMap = {
339
345
  owner: getOwner,
340
346
  store: getStore,
@@ -360,7 +366,8 @@ var mdmMap = {
360
366
  gender: getGender,
361
367
  year: getYear,
362
368
  season: getSeason,
363
- category: getCategory
369
+ category: getCategory,
370
+ supplier: getSupplier
364
371
  };
365
372
  export var getMdmData = function getMdmData(type) {
366
373
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -229,3 +229,9 @@ export declare const urlDownloadDomain: (url: string) => string;
229
229
  * @param isBlank 是否新开窗口下载,默认新开窗口,不影响原页面展示
230
230
  */
231
231
  export declare const downloadFile: (url: string, fileName?: string | undefined, isBlank?: boolean) => void;
232
+ /**
233
+ * 微前端主工程注入子工程时,子工程调用此方法设置资源Id,权限等参数
234
+ *
235
+ * @param props
236
+ */
237
+ export declare const setCurrentResCode: (props: any) => void;
package/es/utils/index.js CHANGED
@@ -28,7 +28,7 @@ export var getUrlQuery = function getUrlQuery(name) {
28
28
  };
29
29
  export var getResourceProps = function getResourceProps(name) {
30
30
  if (!name) return '';
31
- var id = getUrlQuery('resCode');
31
+ var id = window.__currentResCode__ || getUrlQuery('resCode');
32
32
  var obj;
33
33
  // window.lsResourceList 为主工程写入的资源
34
34
  // @ts-ignore
@@ -510,4 +510,20 @@ export var downloadFile = function downloadFile(url, fileName) {
510
510
  document.body.appendChild(a);
511
511
  a.click();
512
512
  document.body.removeChild(a);
513
+ };
514
+ /**
515
+ * 微前端主工程注入子工程时,子工程调用此方法设置资源Id,权限等参数
516
+ *
517
+ * @param props
518
+ */
519
+ export var setCurrentResCode = function setCurrentResCode(props) {
520
+ var _props$history;
521
+ var initialValue = props === null || props === void 0 ? void 0 : (_props$history = props.history) === null || _props$history === void 0 ? void 0 : _props$history.initialEntries;
522
+ if (Array.isArray(initialValue) && initialValue.length > 0) {
523
+ var parentParams = initialValue[0];
524
+ window.__initVal__ = parentParams;
525
+ window.__currentResCode__ = getUrlQuery('resCode', parentParams);
526
+ window.__currentRight__ = getUrlQuery('right', parentParams);
527
+ window.__currentResRight__ = getUrlQuery('resRight', parentParams);
528
+ }
513
529
  };
package/lib/http/index.js CHANGED
@@ -57,12 +57,10 @@ request.interceptors.request.use(function (url, options) {
57
57
  options.headers = options.headers || {};
58
58
  // 处理浏览器指纹
59
59
  if (browserId) {
60
- // @ts-ignore
61
60
  options.headers.browserId = browserId;
62
61
  } else {
63
62
  if (getCache('browserId')) {
64
63
  browserId = getCache('browserId');
65
- // @ts-ignore
66
64
  options.headers.browserId = browserId;
67
65
  } else {
68
66
  getBrowserId().then(function (id) {
@@ -73,45 +71,37 @@ request.interceptors.request.use(function (url, options) {
73
71
  // 处理门店
74
72
  var shopNo = getCacheSessionFirst('shopNo');
75
73
  if (shopNo) {
76
- // @ts-ignore
77
74
  options.headers.shopNo = shopNo;
78
75
  }
79
76
  // 处理门店
80
77
  var shopCode = getCacheSessionFirst('shopCode');
81
78
  if (shopCode) {
82
- // @ts-ignore
83
79
  options.headers.shopCode = shopCode;
84
80
  }
85
81
  // 处理仓库
86
82
  var storeNo = getCacheSessionFirst('storeNo');
87
83
  if (storeNo) {
88
- // @ts-ignore
89
84
  options.headers.storeNo = storeNo;
90
85
  }
91
86
  var tag = getCookie('x-asm-prefer-tag');
92
87
  if (tag) {
93
- // @ts-ignore
94
88
  options.headers['x-asm-prefer-tag'] = tag; //灰度发版标识
95
89
  }
96
- // @ts-ignore
90
+
97
91
  options.headers['terminal'] = 'PC';
98
- // wms 提示,是否排班标识
99
92
  var expireWarnFlag = getCache('expireWarnFlag', true);
100
- // @ts-ignore
101
93
  options.headers.expireWarnFlag = expireWarnFlag === '1' ? '1' : '0';
102
94
  var token = getCookie('token');
103
95
  if (token && url.indexOf('noToken=1') === -1) {
104
- //@ts-ignore
105
96
  options.headers.token = token;
106
97
  }
107
98
  url = url.replace('&noToken=1', '').replace('noToken=1', '');
108
- var resCode = getUrlQuery('resCode', url) || getUrlQuery('resCode') || getUrlQuery('resourceId') || getResourceProps('resourceId');
99
+ var resCode = getUrlQuery('resCode', url) || window.__currentResCode__ || getUrlQuery('resCode') || getUrlQuery('resourceId') || getResourceProps('resourceId');
109
100
  var param = {
110
101
  _t1: Date.now(),
111
102
  __r: ((_window$crypto$random = (_window$crypto = window.crypto)['randomUUID']) === null || _window$crypto$random === void 0 ? void 0 : _window$crypto$random.call(_window$crypto)) || Math.random()
112
103
  };
113
104
  // 当没有明文参数resCode的时候,添加resCode参数为资源Id
114
- //@ts-ignore
115
105
  if (resCode && !((_options$params = options.params) === null || _options$params === void 0 ? void 0 : _options$params.resCode)) {
116
106
  param.resCode = resCode;
117
107
  }
@@ -152,6 +152,7 @@ export declare const getSeason: (params?: any) => Promise<any>;
152
152
  * @returns
153
153
  */
154
154
  export declare const getCategory: (params?: any) => Promise<any>;
155
+ export declare const getSupplier: (params?: any) => Promise<any>;
155
156
  declare const mdmMap: {
156
157
  owner: (params?: any) => Promise<any>;
157
158
  store: (params?: any) => Promise<any>;
@@ -178,6 +179,7 @@ declare const mdmMap: {
178
179
  year: (params?: any) => Promise<any>;
179
180
  season: (params?: any) => Promise<any>;
180
181
  category: (params?: any) => Promise<any>;
182
+ supplier: (params?: any) => Promise<any>;
181
183
  };
182
184
  export declare type MdmType = keyof typeof mdmMap;
183
185
  export declare const getMdmData: (type: MdmType, params?: any) => Promise<any>;
@@ -335,6 +335,12 @@ export var getCategory = function getCategory() {
335
335
  var url = '/lesoon-mdm-center-api/bmCategory/page';
336
336
  return httpGetWithCache('category', url, params);
337
337
  };
338
+ export var getSupplier = function getSupplier() {
339
+ var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
340
+ setPageSize(params);
341
+ var url = '/lesoon-mdm-center-api/bmSupplier/page';
342
+ return httpGetWithCache('supplier', url, params);
343
+ };
338
344
  var mdmMap = {
339
345
  owner: getOwner,
340
346
  store: getStore,
@@ -360,7 +366,8 @@ var mdmMap = {
360
366
  gender: getGender,
361
367
  year: getYear,
362
368
  season: getSeason,
363
- category: getCategory
369
+ category: getCategory,
370
+ supplier: getSupplier
364
371
  };
365
372
  export var getMdmData = function getMdmData(type) {
366
373
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -229,3 +229,9 @@ export declare const urlDownloadDomain: (url: string) => string;
229
229
  * @param isBlank 是否新开窗口下载,默认新开窗口,不影响原页面展示
230
230
  */
231
231
  export declare const downloadFile: (url: string, fileName?: string | undefined, isBlank?: boolean) => void;
232
+ /**
233
+ * 微前端主工程注入子工程时,子工程调用此方法设置资源Id,权限等参数
234
+ *
235
+ * @param props
236
+ */
237
+ export declare const setCurrentResCode: (props: any) => void;
@@ -28,7 +28,7 @@ export var getUrlQuery = function getUrlQuery(name) {
28
28
  };
29
29
  export var getResourceProps = function getResourceProps(name) {
30
30
  if (!name) return '';
31
- var id = getUrlQuery('resCode');
31
+ var id = window.__currentResCode__ || getUrlQuery('resCode');
32
32
  var obj;
33
33
  // window.lsResourceList 为主工程写入的资源
34
34
  // @ts-ignore
@@ -510,4 +510,20 @@ export var downloadFile = function downloadFile(url, fileName) {
510
510
  document.body.appendChild(a);
511
511
  a.click();
512
512
  document.body.removeChild(a);
513
+ };
514
+ /**
515
+ * 微前端主工程注入子工程时,子工程调用此方法设置资源Id,权限等参数
516
+ *
517
+ * @param props
518
+ */
519
+ export var setCurrentResCode = function setCurrentResCode(props) {
520
+ var _props$history;
521
+ var initialValue = props === null || props === void 0 ? void 0 : (_props$history = props.history) === null || _props$history === void 0 ? void 0 : _props$history.initialEntries;
522
+ if (Array.isArray(initialValue) && initialValue.length > 0) {
523
+ var parentParams = initialValue[0];
524
+ window.__initVal__ = parentParams;
525
+ window.__currentResCode__ = getUrlQuery('resCode', parentParams);
526
+ window.__currentRight__ = getUrlQuery('right', parentParams);
527
+ window.__currentResRight__ = getUrlQuery('resRight', parentParams);
528
+ }
513
529
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "3.1.30",
3
+ "version": "3.1.32",
4
4
  "description": "ls-pro-common",
5
5
  "license": "MIT",
6
6
  "sideEffects": [