@bit-sun/business-component 2.0.8 → 2.0.9
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.d.ts +1 -0
- package/dist/index.esm.js +35 -17
- package/dist/index.js +35 -17
- package/dist/utils/requestUtils.d.ts +1 -0
- package/package.json +1 -1
- package/src/index.ts +1 -11
- package/src/utils/requestUtils.ts +32 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import 'antd/dist/antd.css';
|
|
2
|
+
import './utils/requestUtils';
|
|
2
3
|
export { default as DataValidation } from './components/Functional/DataValidation';
|
|
3
4
|
export { default as DataImport } from './components/Functional/DataImport';
|
|
4
5
|
export { default as QueryMutipleInput } from './components/Functional/QueryMutipleInput';
|
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
1
|
import 'antd/dist/antd.css';
|
|
2
|
+
import axios from 'axios';
|
|
3
3
|
import React, { createContext, useContext, useEffect, forwardRef, createElement, useState, useRef, useMemo } from 'react';
|
|
4
4
|
import { message, Menu, Space, Dropdown, Tooltip, Button, Checkbox, Input, Modal, Select, Form, Divider, Spin, Table, TreeSelect, Tag, InputNumber, Popover } from 'antd';
|
|
5
5
|
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
|
|
@@ -8,6 +8,40 @@ import _ from 'loadsh';
|
|
|
8
8
|
import { useDebounceFn } from 'ahooks';
|
|
9
9
|
import { stringify } from 'querystring';
|
|
10
10
|
|
|
11
|
+
var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
|
|
12
|
+
function handleRequestAuthHeader(config) {
|
|
13
|
+
var _config$url, _config$url2;
|
|
14
|
+
|
|
15
|
+
// https://www.kdocs.cn/l/coNbPpjamr5v这个表格里面涉及的接口,接口请求头里需要添加参数:x-biz-code 值就是列表里的code
|
|
16
|
+
// 例:x-biz-code=STORE_CODE
|
|
17
|
+
// 物理仓选择组件
|
|
18
|
+
if ((config === null || config === void 0 ? void 0 : (_config$url = config.url) === null || _config$url === void 0 ? void 0 : _config$url.indexOf('/stock/physicalWarehouse?')) > -1) {
|
|
19
|
+
config.headers['x-biz-code'] = 'PW_STOCK_CODE';
|
|
20
|
+
} // 逻辑仓选择组件
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
if ((config === null || config === void 0 ? void 0 : (_config$url2 = config.url) === null || _config$url2 === void 0 ? void 0 : _config$url2.indexOf('/stock/realWarehouse?')) > -1) {
|
|
24
|
+
config.headers['x-biz-code'] = 'RW_STOCK_CODE';
|
|
25
|
+
}
|
|
26
|
+
} // 处理请求头
|
|
27
|
+
|
|
28
|
+
var handleRequestHeader = function handleRequestHeader(config) {
|
|
29
|
+
config.headers['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
|
|
30
|
+
config.headers['x-tenant-id'] = (resposne === null || resposne === void 0 ? void 0 : resposne.tenantId) || '1';
|
|
31
|
+
|
|
32
|
+
if (localStorage.getItem('x-user-auth-context')) {
|
|
33
|
+
config.headers['x-user-auth-context'] = localStorage.getItem('x-user-auth-context');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
handleRequestAuthHeader(config);
|
|
37
|
+
}; // 拦截器
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
axios.interceptors.request.use(function (config) {
|
|
41
|
+
handleRequestHeader(config);
|
|
42
|
+
return config;
|
|
43
|
+
});
|
|
44
|
+
|
|
11
45
|
function ownKeys(object, enumerableOnly) {
|
|
12
46
|
var keys = Object.keys(object);
|
|
13
47
|
|
|
@@ -8725,20 +8759,4 @@ var index$1 = /*#__PURE__*/React.memo(BusinessTreeSearchSelect, function (props,
|
|
|
8725
8759
|
return true;
|
|
8726
8760
|
});
|
|
8727
8761
|
|
|
8728
|
-
/*
|
|
8729
|
-
* @Description:
|
|
8730
|
-
* @Author: rodchen
|
|
8731
|
-
* @Date: 2021-11-30 22:59:39
|
|
8732
|
-
* @LastEditTime: 2022-01-14 16:10:27
|
|
8733
|
-
* @LastEditors: rodchen
|
|
8734
|
-
*/
|
|
8735
|
-
var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
|
|
8736
|
-
axios.defaults.headers.common['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
|
|
8737
|
-
axios.defaults.headers.common['x-tenant-id'] = (resposne === null || resposne === void 0 ? void 0 : resposne.tenantId) || '1';
|
|
8738
|
-
|
|
8739
|
-
if (localStorage.getItem('x-user-auth-context')) {
|
|
8740
|
-
// @ts-ignore
|
|
8741
|
-
axios.defaults.headers.common['x-user-auth-context'] = localStorage.getItem('x-user-auth-context');
|
|
8742
|
-
}
|
|
8743
|
-
|
|
8744
8762
|
export { AddSelect, AddSkuSelect, BillEntry, BusinessSearchSelect$1 as BusinessSearchSelect, index$1 as BusinessTreeSearchSelect, index as CheckOneUser, CommodityEntry, DataImport, DataValidation, QueryMutipleInput, SearchSelect, TreeSearchSelect };
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var axios = require('axios');
|
|
6
5
|
require('antd/dist/antd.css');
|
|
6
|
+
var axios = require('axios');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var antd = require('antd');
|
|
9
9
|
var reactBeautifulDnd = require('react-beautiful-dnd');
|
|
@@ -19,6 +19,40 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
19
19
|
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
20
20
|
var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
|
|
21
21
|
|
|
22
|
+
var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
|
|
23
|
+
function handleRequestAuthHeader(config) {
|
|
24
|
+
var _config$url, _config$url2;
|
|
25
|
+
|
|
26
|
+
// https://www.kdocs.cn/l/coNbPpjamr5v这个表格里面涉及的接口,接口请求头里需要添加参数:x-biz-code 值就是列表里的code
|
|
27
|
+
// 例:x-biz-code=STORE_CODE
|
|
28
|
+
// 物理仓选择组件
|
|
29
|
+
if ((config === null || config === void 0 ? void 0 : (_config$url = config.url) === null || _config$url === void 0 ? void 0 : _config$url.indexOf('/stock/physicalWarehouse?')) > -1) {
|
|
30
|
+
config.headers['x-biz-code'] = 'PW_STOCK_CODE';
|
|
31
|
+
} // 逻辑仓选择组件
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
if ((config === null || config === void 0 ? void 0 : (_config$url2 = config.url) === null || _config$url2 === void 0 ? void 0 : _config$url2.indexOf('/stock/realWarehouse?')) > -1) {
|
|
35
|
+
config.headers['x-biz-code'] = 'RW_STOCK_CODE';
|
|
36
|
+
}
|
|
37
|
+
} // 处理请求头
|
|
38
|
+
|
|
39
|
+
var handleRequestHeader = function handleRequestHeader(config) {
|
|
40
|
+
config.headers['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
|
|
41
|
+
config.headers['x-tenant-id'] = (resposne === null || resposne === void 0 ? void 0 : resposne.tenantId) || '1';
|
|
42
|
+
|
|
43
|
+
if (localStorage.getItem('x-user-auth-context')) {
|
|
44
|
+
config.headers['x-user-auth-context'] = localStorage.getItem('x-user-auth-context');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
handleRequestAuthHeader(config);
|
|
48
|
+
}; // 拦截器
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
axios__default['default'].interceptors.request.use(function (config) {
|
|
52
|
+
handleRequestHeader(config);
|
|
53
|
+
return config;
|
|
54
|
+
});
|
|
55
|
+
|
|
22
56
|
function ownKeys(object, enumerableOnly) {
|
|
23
57
|
var keys = Object.keys(object);
|
|
24
58
|
|
|
@@ -8736,22 +8770,6 @@ var index$1 = /*#__PURE__*/React__default['default'].memo(BusinessTreeSearchSele
|
|
|
8736
8770
|
return true;
|
|
8737
8771
|
});
|
|
8738
8772
|
|
|
8739
|
-
/*
|
|
8740
|
-
* @Description:
|
|
8741
|
-
* @Author: rodchen
|
|
8742
|
-
* @Date: 2021-11-30 22:59:39
|
|
8743
|
-
* @LastEditTime: 2022-01-14 16:10:27
|
|
8744
|
-
* @LastEditors: rodchen
|
|
8745
|
-
*/
|
|
8746
|
-
var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
|
|
8747
|
-
axios__default['default'].defaults.headers.common['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
|
|
8748
|
-
axios__default['default'].defaults.headers.common['x-tenant-id'] = (resposne === null || resposne === void 0 ? void 0 : resposne.tenantId) || '1';
|
|
8749
|
-
|
|
8750
|
-
if (localStorage.getItem('x-user-auth-context')) {
|
|
8751
|
-
// @ts-ignore
|
|
8752
|
-
axios__default['default'].defaults.headers.common['x-user-auth-context'] = localStorage.getItem('x-user-auth-context');
|
|
8753
|
-
}
|
|
8754
|
-
|
|
8755
8773
|
exports.AddSelect = AddSelect;
|
|
8756
8774
|
exports.AddSkuSelect = AddSkuSelect;
|
|
8757
8775
|
exports.BillEntry = BillEntry;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function handleRequestAuthHeader(config?: any): void;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -5,18 +5,8 @@
|
|
|
5
5
|
* @LastEditTime: 2022-01-14 16:10:27
|
|
6
6
|
* @LastEditors: rodchen
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
import axios from 'axios';
|
|
10
8
|
import 'antd/dist/antd.css';
|
|
11
|
-
|
|
12
|
-
const resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
|
|
13
|
-
|
|
14
|
-
axios.defaults.headers.common['sso-sessionid'] = resposne?.sessionId || '';
|
|
15
|
-
axios.defaults.headers.common['x-tenant-id'] = resposne?.tenantId || '1';
|
|
16
|
-
if (localStorage.getItem('x-user-auth-context')) {
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
axios.defaults.headers.common['x-user-auth-context'] = localStorage.getItem('x-user-auth-context');
|
|
19
|
-
}
|
|
9
|
+
import './utils/requestUtils';
|
|
20
10
|
|
|
21
11
|
export { default as DataValidation } from './components/Functional/DataValidation';
|
|
22
12
|
export { default as DataImport } from './components/Functional/DataImport';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
|
|
3
|
+
const resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
|
|
4
|
+
|
|
5
|
+
export function handleRequestAuthHeader(config?: any) {
|
|
6
|
+
// https://www.kdocs.cn/l/coNbPpjamr5v这个表格里面涉及的接口,接口请求头里需要添加参数:x-biz-code 值就是列表里的code
|
|
7
|
+
// 例:x-biz-code=STORE_CODE
|
|
8
|
+
// 物理仓选择组件
|
|
9
|
+
if(config?.url?.indexOf( '/stock/physicalWarehouse?') > -1) {
|
|
10
|
+
config.headers['x-biz-code'] = 'PW_STOCK_CODE';
|
|
11
|
+
}
|
|
12
|
+
// 逻辑仓选择组件
|
|
13
|
+
if(config?.url?.indexOf( '/stock/realWarehouse?') > -1) {
|
|
14
|
+
config.headers['x-biz-code'] = 'RW_STOCK_CODE';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// 处理请求头
|
|
19
|
+
const handleRequestHeader = (config: any) => {
|
|
20
|
+
config.headers['sso-sessionid'] = resposne?.sessionId || ''
|
|
21
|
+
config.headers['x-tenant-id'] = resposne?.tenantId || '1'
|
|
22
|
+
if (localStorage.getItem('x-user-auth-context')) {
|
|
23
|
+
config.headers['x-user-auth-context'] = localStorage.getItem('x-user-auth-context');
|
|
24
|
+
}
|
|
25
|
+
handleRequestAuthHeader(config)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// 拦截器
|
|
29
|
+
axios.interceptors.request.use((config: any) => {
|
|
30
|
+
handleRequestHeader(config)
|
|
31
|
+
return config
|
|
32
|
+
})
|