@bit-sun/business-component 2.4.3 → 2.4.5

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/index.esm.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import axios from 'axios';
2
+ import cookie from 'js-cookie';
2
3
  import { message as message$1, Image, Popover, Card, Avatar, Tooltip, Menu, Space, Dropdown, Button, Checkbox, Input, Modal, Select, Form, Divider, Spin, Table, TreeSelect, Tag, InputNumber, Typography, Alert, Anchor, Breadcrumb, Drawer as Drawer$1, List, Tree, Row, Col, Tabs, Affix, Cascader, DatePicker, TimePicker, Switch } from 'antd';
3
4
  import _, { omit, debounce, cloneDeep as cloneDeep$1, throttle, isEmpty } from 'lodash';
4
5
  import { history, formatMessage, useLocation, Link, useModel, useIntl } from 'umi';
@@ -716,19 +717,36 @@ function getEekaToken() {
716
717
  }
717
718
  //--------赢家项目登录信息---------
718
719
  //--------国药项目登录信息---------
719
- function getGuoyaoshukeSessionId() {
720
- return (resposne$1 === null || resposne$1 === void 0 ? void 0 : resposne$1.sessionId) || '';
720
+ function getLoginHeaderInfo(headerkey) {
721
+ var storage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'cookie';
722
+ if (storage) {
723
+ if ('localStorage' === storage) {
724
+ return localStorage.getItem(headerkey);
725
+ } else if ('sessionStorage' === storage) {
726
+ return sessionStorage.getItem(headerkey);
727
+ } else if ('cookie' === storage) {
728
+ return cookie.get(headerkey);
729
+ } else {
730
+ return localStorage.getItem(headerkey);
731
+ }
732
+ } else {
733
+ return localStorage.getItem(headerkey);
734
+ }
721
735
  }
722
- function getGuoyaoshukeAccountId() {
723
- var _resposne$accountPers;
724
- return (resposne$1 === null || resposne$1 === void 0 ? void 0 : (_resposne$accountPers = resposne$1.accountPersonDetail) === null || _resposne$accountPers === void 0 ? void 0 : _resposne$accountPers.accountId) || -1;
736
+ function getGuoyaoshukeCompanyId() {
737
+ return getLoginHeaderInfo('COMPANY_ID');
725
738
  }
726
- function getGuoyaoshukeEmployeeId() {
727
- var _resposne$employeeRes;
728
- return (resposne$1 === null || resposne$1 === void 0 ? void 0 : (_resposne$employeeRes = resposne$1.employeeResVo) === null || _resposne$employeeRes === void 0 ? void 0 : _resposne$employeeRes.id) || 2;
739
+ function getGuoyaoshukeTenantCode() {
740
+ return getLoginHeaderInfo('TENANT_ID');
741
+ }
742
+ function getGuoyaoshukeTenantId() {
743
+ return getLoginHeaderInfo('TENANT_CODE') || 1;
729
744
  }
730
745
  function getGuoyaoshukeToken() {
731
- return (resposne$1 === null || resposne$1 === void 0 ? void 0 : resposne$1.token) || '';
746
+ return getLoginHeaderInfo('gksk-access-token');
747
+ }
748
+ function getGuoyaoshukeUscCode() {
749
+ return getLoginHeaderInfo('USC_CODE');
732
750
  }
733
751
  //--------国药项目登录信息---------
734
752
 
@@ -749,13 +767,14 @@ function handleRequestAuthHeader(config) {
749
767
  * 获取当前组件服务项目
750
768
  * */
751
769
  var getCurrentUseProject = function getCurrentUseProject() {
752
- var project = 'GuoYao';
753
- // if(hostname?.indexOf('omni')>-1 || hostname?.indexOf('eeka')>-1 || hostname?.indexOf('koradior')>-1) {
754
- // project = 'YingJia'
755
- // }
756
- // if(hostname?.indexOf('guoyaoshuke')>-1 || hostname?.indexOf('10.31.249.136')>-1) {
757
- // project = 'GuoYao'
758
- // }
770
+ var project = 'BitSun';
771
+ var hostname = window.location.hostname;
772
+ if ((hostname === null || hostname === void 0 ? void 0 : hostname.indexOf('omni')) > -1 || (hostname === null || hostname === void 0 ? void 0 : hostname.indexOf('eeka')) > -1 || (hostname === null || hostname === void 0 ? void 0 : hostname.indexOf('koradior')) > -1) {
773
+ project = 'YingJia';
774
+ }
775
+ if ((hostname === null || hostname === void 0 ? void 0 : hostname.indexOf('guoyaoshuke')) > -1 || (hostname === null || hostname === void 0 ? void 0 : hostname.indexOf('10.31.249.136')) > -1) {
776
+ project = 'GuoYao';
777
+ }
759
778
  return project;
760
779
  };
761
780
  /*
@@ -783,11 +802,11 @@ var handleCommonHeader = function handleCommonHeader() {
783
802
  break;
784
803
  case 'GuoYao':
785
804
  commonHeaders = {
786
- 'sso-sessionid': getGuoyaoshukeSessionId(),
787
- 'gksk-account-id': getGuoyaoshukeAccountId(),
788
- 'gksk-employee-id': getGuoyaoshukeEmployeeId(),
789
- 'gksk-tenant-id': getCurrentTenantId(),
790
- 'gksk-user-token': getGuoyaoshukeToken()
805
+ 'gksk-company-id': getGuoyaoshukeCompanyId(),
806
+ 'gksk-tenant-id': getGuoyaoshukeTenantId(),
807
+ 'gksk-tenant-code': getGuoyaoshukeTenantCode(),
808
+ 'gksk-access-token': getGuoyaoshukeToken(),
809
+ 'gksk-usc-code': getGuoyaoshukeUscCode()
791
810
  };
792
811
  break;
793
812
  default:
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var axios = require('axios');
6
+ var cookie = require('js-cookie');
6
7
  var antd = require('antd');
7
8
  var _ = require('lodash');
8
9
  var umi = require('umi');
@@ -32,6 +33,7 @@ var isArray$1 = require('lodash/isArray');
32
33
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
33
34
 
34
35
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
36
+ var cookie__default = /*#__PURE__*/_interopDefaultLegacy(cookie);
35
37
  var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
36
38
  var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
37
39
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
@@ -735,19 +737,36 @@ function getEekaToken() {
735
737
  }
736
738
  //--------赢家项目登录信息---------
737
739
  //--------国药项目登录信息---------
738
- function getGuoyaoshukeSessionId() {
739
- return (resposne$1 === null || resposne$1 === void 0 ? void 0 : resposne$1.sessionId) || '';
740
+ function getLoginHeaderInfo(headerkey) {
741
+ var storage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'cookie';
742
+ if (storage) {
743
+ if ('localStorage' === storage) {
744
+ return localStorage.getItem(headerkey);
745
+ } else if ('sessionStorage' === storage) {
746
+ return sessionStorage.getItem(headerkey);
747
+ } else if ('cookie' === storage) {
748
+ return cookie__default['default'].get(headerkey);
749
+ } else {
750
+ return localStorage.getItem(headerkey);
751
+ }
752
+ } else {
753
+ return localStorage.getItem(headerkey);
754
+ }
740
755
  }
741
- function getGuoyaoshukeAccountId() {
742
- var _resposne$accountPers;
743
- return (resposne$1 === null || resposne$1 === void 0 ? void 0 : (_resposne$accountPers = resposne$1.accountPersonDetail) === null || _resposne$accountPers === void 0 ? void 0 : _resposne$accountPers.accountId) || -1;
756
+ function getGuoyaoshukeCompanyId() {
757
+ return getLoginHeaderInfo('COMPANY_ID');
744
758
  }
745
- function getGuoyaoshukeEmployeeId() {
746
- var _resposne$employeeRes;
747
- return (resposne$1 === null || resposne$1 === void 0 ? void 0 : (_resposne$employeeRes = resposne$1.employeeResVo) === null || _resposne$employeeRes === void 0 ? void 0 : _resposne$employeeRes.id) || 2;
759
+ function getGuoyaoshukeTenantCode() {
760
+ return getLoginHeaderInfo('TENANT_ID');
761
+ }
762
+ function getGuoyaoshukeTenantId() {
763
+ return getLoginHeaderInfo('TENANT_CODE') || 1;
748
764
  }
749
765
  function getGuoyaoshukeToken() {
750
- return (resposne$1 === null || resposne$1 === void 0 ? void 0 : resposne$1.token) || '';
766
+ return getLoginHeaderInfo('gksk-access-token');
767
+ }
768
+ function getGuoyaoshukeUscCode() {
769
+ return getLoginHeaderInfo('USC_CODE');
751
770
  }
752
771
  //--------国药项目登录信息---------
753
772
 
@@ -768,13 +787,14 @@ function handleRequestAuthHeader(config) {
768
787
  * 获取当前组件服务项目
769
788
  * */
770
789
  var getCurrentUseProject = function getCurrentUseProject() {
771
- var project = 'GuoYao';
772
- // if(hostname?.indexOf('omni')>-1 || hostname?.indexOf('eeka')>-1 || hostname?.indexOf('koradior')>-1) {
773
- // project = 'YingJia'
774
- // }
775
- // if(hostname?.indexOf('guoyaoshuke')>-1 || hostname?.indexOf('10.31.249.136')>-1) {
776
- // project = 'GuoYao'
777
- // }
790
+ var project = 'BitSun';
791
+ var hostname = window.location.hostname;
792
+ if ((hostname === null || hostname === void 0 ? void 0 : hostname.indexOf('omni')) > -1 || (hostname === null || hostname === void 0 ? void 0 : hostname.indexOf('eeka')) > -1 || (hostname === null || hostname === void 0 ? void 0 : hostname.indexOf('koradior')) > -1) {
793
+ project = 'YingJia';
794
+ }
795
+ if ((hostname === null || hostname === void 0 ? void 0 : hostname.indexOf('guoyaoshuke')) > -1 || (hostname === null || hostname === void 0 ? void 0 : hostname.indexOf('10.31.249.136')) > -1) {
796
+ project = 'GuoYao';
797
+ }
778
798
  return project;
779
799
  };
780
800
  /*
@@ -802,11 +822,11 @@ var handleCommonHeader = function handleCommonHeader() {
802
822
  break;
803
823
  case 'GuoYao':
804
824
  commonHeaders = {
805
- 'sso-sessionid': getGuoyaoshukeSessionId(),
806
- 'gksk-account-id': getGuoyaoshukeAccountId(),
807
- 'gksk-employee-id': getGuoyaoshukeEmployeeId(),
808
- 'gksk-tenant-id': getCurrentTenantId(),
809
- 'gksk-user-token': getGuoyaoshukeToken()
825
+ 'gksk-company-id': getGuoyaoshukeCompanyId(),
826
+ 'gksk-tenant-id': getGuoyaoshukeTenantId(),
827
+ 'gksk-tenant-code': getGuoyaoshukeTenantCode(),
828
+ 'gksk-access-token': getGuoyaoshukeToken(),
829
+ 'gksk-usc-code': getGuoyaoshukeUscCode()
810
830
  };
811
831
  break;
812
832
  default:
@@ -3,8 +3,9 @@ export declare function getEekaAccountId(): any;
3
3
  export declare function getEekaEmployeeId(): any;
4
4
  export declare function getEekaTenantId(): any;
5
5
  export declare function getEekaToken(): any;
6
- export declare function getGuoyaoshukeSessionId(): any;
7
- export declare function getGuoyaoshukeAccountId(): any;
8
- export declare function getGuoyaoshukeEmployeeId(): any;
9
- export declare function getGuoyaoshukeTenantId(): any;
10
- export declare function getGuoyaoshukeToken(): any;
6
+ export declare function getLoginHeaderInfo(headerkey: string, storage?: string): string | null | undefined;
7
+ export declare function getGuoyaoshukeCompanyId(): string | null | undefined;
8
+ export declare function getGuoyaoshukeTenantCode(): string | null | undefined;
9
+ export declare function getGuoyaoshukeTenantId(): string | 1;
10
+ export declare function getGuoyaoshukeToken(): string | null | undefined;
11
+ export declare function getGuoyaoshukeUscCode(): string | null | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "2.4.3",
3
+ "version": "2.4.5",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -53,7 +53,8 @@
53
53
  "react-resizable": "^3.0.4",
54
54
  "react-sortable-hoc": "^2.0.0",
55
55
  "warning": "^4.0.3",
56
- "ast-types": "^0.13.3"
56
+ "ast-types": "^0.13.3",
57
+ "js-cookie": "^3.0.1"
57
58
  },
58
59
  "devDependencies": {
59
60
  "@ant-design/pro-layout": "^7.1.3",
@@ -1157,6 +1157,7 @@ export default () => {
1157
1157
  const props2 = {
1158
1158
  ...props,
1159
1159
  // prefixUrl: { selectPrefix: '/user/api', formSelectFix: '/user/api' },
1160
+ // prefixUrl: { selectPrefix: '/api/user-manage/', formSelectFix: '/api/user-manage/' },
1160
1161
  modalTableProps: {
1161
1162
  needTypeSearch: true
1162
1163
  },
@@ -1,4 +1,5 @@
1
1
  import ENUM from '@/utils/enumConfig';
2
+ import cookie from 'js-cookie'
2
3
 
3
4
  const resposne = JSON.parse(localStorage.getItem(ENUM.BROWSER_CACHE.USER_INFO) || '{}');
4
5
  //--------赢家项目登录信息---------
@@ -21,19 +22,34 @@ export function getEekaToken() {
21
22
 
22
23
 
23
24
  //--------国药项目登录信息---------
24
- export function getGuoyaoshukeSessionId() {
25
- return resposne?.sessionId || '';
26
- }
27
- export function getGuoyaoshukeAccountId() {
28
- return resposne?.accountPersonDetail?.accountId || -1;
29
- }
30
- export function getGuoyaoshukeEmployeeId() {
31
- return resposne?.employeeResVo?.id || 2;
25
+ export function getLoginHeaderInfo(headerkey: string,storage='cookie') {
26
+ if (storage) {
27
+ if ('localStorage' === storage) {
28
+ return localStorage.getItem(headerkey)
29
+ } else if ('sessionStorage' === storage) {
30
+ return sessionStorage.getItem(headerkey)
31
+ } else if ('cookie' === storage) {
32
+ return cookie.get(headerkey)
33
+ } else {
34
+ return localStorage.getItem(headerkey)
35
+ }
36
+ } else {
37
+ return localStorage.getItem(headerkey)
38
+ }
39
+ }
40
+ export function getGuoyaoshukeCompanyId() {
41
+ return getLoginHeaderInfo('COMPANY_ID');
42
+ }
43
+ export function getGuoyaoshukeTenantCode() {
44
+ return getLoginHeaderInfo('TENANT_ID');
32
45
  }
33
46
  export function getGuoyaoshukeTenantId() {
34
- return resposne?.personDetailResDto?.tenantId || 1;
47
+ return getLoginHeaderInfo('TENANT_CODE') || 1;
35
48
  }
36
49
  export function getGuoyaoshukeToken() {
37
- return resposne?.token || '';
50
+ return getLoginHeaderInfo('gksk-access-token');
51
+ }
52
+ export function getGuoyaoshukeUscCode() {
53
+ return getLoginHeaderInfo('USC_CODE');
38
54
  }
39
55
  //--------国药项目登录信息---------
@@ -2,7 +2,7 @@ import axios from 'axios';
2
2
  import ENUM from './enumConfig';
3
3
  import { getCurrentTenantId, getEmployeeId, getSessionId, getAccountId } from './LocalstorageUtils';
4
4
  import { getEekaSessionId, getEekaAccountId, getEekaEmployeeId, getEekaTenantId, getEekaToken,
5
- getGuoyaoshukeSessionId, getGuoyaoshukeAccountId, getGuoyaoshukeEmployeeId, getGuoyaoshukeToken,
5
+ getGuoyaoshukeCompanyId, getGuoyaoshukeTenantId, getGuoyaoshukeTenantCode, getGuoyaoshukeToken, getGuoyaoshukeUscCode
6
6
  } from './CustomLoginInfo';
7
7
 
8
8
  export function handleRequestAuthHeader(config?: any) {
@@ -59,11 +59,11 @@ const handleCommonHeader = () => {
59
59
  break;
60
60
  case 'GuoYao':
61
61
  commonHeaders = {
62
- 'sso-sessionid': getGuoyaoshukeSessionId(),
63
- // 'gksk-account-id': getGuoyaoshukeAccountId(),
64
- // 'gksk-employee-id': getGuoyaoshukeEmployeeId(),
65
- 'Gksk-Tenant-Id': getCurrentTenantId(),
66
- 'Gksk-Access-Token': getGuoyaoshukeToken()
62
+ 'gksk-company-id': getGuoyaoshukeCompanyId(),
63
+ 'gksk-tenant-id': getGuoyaoshukeTenantId(),
64
+ 'gksk-tenant-code': getGuoyaoshukeTenantCode(),
65
+ 'gksk-access-token': getGuoyaoshukeToken(),
66
+ 'gksk-usc-code': getGuoyaoshukeUscCode(),
67
67
  }
68
68
  break;
69
69
  default: