ls-pro-common 3.1.39 → 3.1.41

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.
@@ -748,6 +748,7 @@ function useDtl(dtlParam) {
748
748
  showWarn('请配置业务接口 bizApi 属性');
749
749
  return _context10.abrupt("return", false);
750
750
  case 6:
751
+ // 处理接口参数
751
752
  if (param.searchData) {
752
753
  searchArr = (param.searchData || '').split('&');
753
754
  if (isV2) {
@@ -763,15 +764,16 @@ function useDtl(dtlParam) {
763
764
  return item.replace('sort=', 'sort.').replace(' ', '=');
764
765
  } else if (item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('resCode=')) {
765
766
  return item;
766
- } else {
767
- //其它查询条件,添加 search.
767
+ } else if (!item.startsWith('search.')) {
768
+ //其它查询条件,添加 search. 二次调用时不能多次添加。
768
769
  return 'search.' + item;
769
770
  }
771
+ return item;
770
772
  });
771
773
  param.searchData = arr.join('&');
772
774
  } else {
773
775
  otherArr = searchArr.filter(function (item) {
774
- return item.startsWith('page=') || item.startsWith('pageSize=') || item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('sort=') || item.startsWith('resCode=');
776
+ return item.startsWith('page=') || item.startsWith('pageSize=') || item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('sort=') || item.startsWith('resCode=') || item.startsWith('lesoon-tenant=');
775
777
  });
776
778
  whereArr = searchArr.filter(function (item) {
777
779
  return !otherArr.includes(item);
@@ -780,7 +782,18 @@ function useDtl(dtlParam) {
780
782
  if (whereArr.length) {
781
783
  whereArr.forEach(function (item) {
782
784
  var itemArr = item.split('=');
783
- where[itemArr[0]] = itemArr[1];
785
+ if (itemArr[0] === 'where') {
786
+ try {
787
+ var obj = JSON.parse(itemArr[1]);
788
+ for (var key in obj) {
789
+ where[key] = obj[key];
790
+ }
791
+ } catch (e) {
792
+ console.log(e);
793
+ }
794
+ } else {
795
+ where[itemArr[0]] = itemArr[1];
796
+ }
784
797
  });
785
798
  otherArr.push('where=' + JSON.stringify(where));
786
799
  param.searchData = otherArr.join('&');
@@ -561,15 +561,16 @@ function useSingle(inParam) {
561
561
  return item.replace('sort=', 'sort.').replace(' ', '=');
562
562
  } else if (item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('resCode=')) {
563
563
  return item;
564
- } else {
564
+ } else if (!item.startsWith('search.')) {
565
565
  //其它查询条件,添加 search.
566
566
  return 'search.' + item;
567
567
  }
568
+ return item;
568
569
  });
569
570
  param.searchData = arr.join('&');
570
571
  } else {
571
572
  otherArr = searchArr.filter(function (item) {
572
- return item.startsWith('page=') || item.startsWith('pageSize=') || item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('sort=') || item.startsWith('resCode=');
573
+ return item.startsWith('page=') || item.startsWith('pageSize=') || item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('sort=') || item.startsWith('resCode=') || item.startsWith('lesoon-tenant=');
573
574
  });
574
575
  whereArr = searchArr.filter(function (item) {
575
576
  return !otherArr.includes(item);
@@ -578,7 +579,18 @@ function useSingle(inParam) {
578
579
  if (whereArr.length) {
579
580
  whereArr.forEach(function (item) {
580
581
  var itemArr = item.split('=');
581
- where[itemArr[0]] = itemArr[1];
582
+ if (itemArr[0] === 'where') {
583
+ try {
584
+ var obj = JSON.parse(itemArr[1]);
585
+ for (var key in obj) {
586
+ where[key] = obj[key];
587
+ }
588
+ } catch (e) {
589
+ console.log(e);
590
+ }
591
+ } else {
592
+ where[itemArr[0]] = itemArr[1];
593
+ }
582
594
  });
583
595
  otherArr.push('where=' + JSON.stringify(where));
584
596
  param.searchData = otherArr.join('&');
@@ -189,4 +189,5 @@ declare const mdmMap: {
189
189
  };
190
190
  export declare type MdmType = keyof typeof mdmMap;
191
191
  export declare const getMdmData: (type: MdmType, params?: any) => Promise<any>;
192
+ export declare const clearMdmCache: () => void;
192
193
  export {};
@@ -381,4 +381,12 @@ export var getMdmData = function getMdmData(type) {
381
381
  throw new Error("".concat(type, " \u4E0D\u5B58\u5728"));
382
382
  }
383
383
  return fn(params);
384
+ };
385
+ export var clearMdmCache = function clearMdmCache() {
386
+ // 清空所有 mdm- 开头的缓存
387
+ Object.keys(sessionStorage).forEach(function (key) {
388
+ if (key.startsWith('mdm-')) {
389
+ sessionStorage.removeItem(key);
390
+ }
391
+ });
384
392
  };
@@ -748,6 +748,7 @@ function useDtl(dtlParam) {
748
748
  showWarn('请配置业务接口 bizApi 属性');
749
749
  return _context10.abrupt("return", false);
750
750
  case 6:
751
+ // 处理接口参数
751
752
  if (param.searchData) {
752
753
  searchArr = (param.searchData || '').split('&');
753
754
  if (isV2) {
@@ -763,15 +764,16 @@ function useDtl(dtlParam) {
763
764
  return item.replace('sort=', 'sort.').replace(' ', '=');
764
765
  } else if (item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('resCode=')) {
765
766
  return item;
766
- } else {
767
- //其它查询条件,添加 search.
767
+ } else if (!item.startsWith('search.')) {
768
+ //其它查询条件,添加 search. 二次调用时不能多次添加。
768
769
  return 'search.' + item;
769
770
  }
771
+ return item;
770
772
  });
771
773
  param.searchData = arr.join('&');
772
774
  } else {
773
775
  otherArr = searchArr.filter(function (item) {
774
- return item.startsWith('page=') || item.startsWith('pageSize=') || item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('sort=') || item.startsWith('resCode=');
776
+ return item.startsWith('page=') || item.startsWith('pageSize=') || item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('sort=') || item.startsWith('resCode=') || item.startsWith('lesoon-tenant=');
775
777
  });
776
778
  whereArr = searchArr.filter(function (item) {
777
779
  return !otherArr.includes(item);
@@ -780,7 +782,18 @@ function useDtl(dtlParam) {
780
782
  if (whereArr.length) {
781
783
  whereArr.forEach(function (item) {
782
784
  var itemArr = item.split('=');
783
- where[itemArr[0]] = itemArr[1];
785
+ if (itemArr[0] === 'where') {
786
+ try {
787
+ var obj = JSON.parse(itemArr[1]);
788
+ for (var key in obj) {
789
+ where[key] = obj[key];
790
+ }
791
+ } catch (e) {
792
+ console.log(e);
793
+ }
794
+ } else {
795
+ where[itemArr[0]] = itemArr[1];
796
+ }
784
797
  });
785
798
  otherArr.push('where=' + JSON.stringify(where));
786
799
  param.searchData = otherArr.join('&');
@@ -561,15 +561,16 @@ function useSingle(inParam) {
561
561
  return item.replace('sort=', 'sort.').replace(' ', '=');
562
562
  } else if (item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('resCode=')) {
563
563
  return item;
564
- } else {
564
+ } else if (!item.startsWith('search.')) {
565
565
  //其它查询条件,添加 search.
566
566
  return 'search.' + item;
567
567
  }
568
+ return item;
568
569
  });
569
570
  param.searchData = arr.join('&');
570
571
  } else {
571
572
  otherArr = searchArr.filter(function (item) {
572
- return item.startsWith('page=') || item.startsWith('pageSize=') || item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('sort=') || item.startsWith('resCode=');
573
+ return item.startsWith('page=') || item.startsWith('pageSize=') || item.startsWith('ifPage=') || item.startsWith('ifHistory=') || item.startsWith('sort=') || item.startsWith('resCode=') || item.startsWith('lesoon-tenant=');
573
574
  });
574
575
  whereArr = searchArr.filter(function (item) {
575
576
  return !otherArr.includes(item);
@@ -578,7 +579,18 @@ function useSingle(inParam) {
578
579
  if (whereArr.length) {
579
580
  whereArr.forEach(function (item) {
580
581
  var itemArr = item.split('=');
581
- where[itemArr[0]] = itemArr[1];
582
+ if (itemArr[0] === 'where') {
583
+ try {
584
+ var obj = JSON.parse(itemArr[1]);
585
+ for (var key in obj) {
586
+ where[key] = obj[key];
587
+ }
588
+ } catch (e) {
589
+ console.log(e);
590
+ }
591
+ } else {
592
+ where[itemArr[0]] = itemArr[1];
593
+ }
582
594
  });
583
595
  otherArr.push('where=' + JSON.stringify(where));
584
596
  param.searchData = otherArr.join('&');
@@ -189,4 +189,5 @@ declare const mdmMap: {
189
189
  };
190
190
  export declare type MdmType = keyof typeof mdmMap;
191
191
  export declare const getMdmData: (type: MdmType, params?: any) => Promise<any>;
192
+ export declare const clearMdmCache: () => void;
192
193
  export {};
@@ -381,4 +381,12 @@ export var getMdmData = function getMdmData(type) {
381
381
  throw new Error("".concat(type, " \u4E0D\u5B58\u5728"));
382
382
  }
383
383
  return fn(params);
384
+ };
385
+ export var clearMdmCache = function clearMdmCache() {
386
+ // 清空所有 mdm- 开头的缓存
387
+ Object.keys(sessionStorage).forEach(function (key) {
388
+ if (key.startsWith('mdm-')) {
389
+ sessionStorage.removeItem(key);
390
+ }
391
+ });
384
392
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "3.1.39",
3
+ "version": "3.1.41",
4
4
  "description": "ls-pro-common",
5
5
  "license": "MIT",
6
6
  "sideEffects": [