@bit-sun/business-component 2.3.22 → 2.3.23-beta02
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/common/ENUM.d.ts +40 -0
- package/dist/components/Business/AddSelectBusiness/index.d.ts +4 -0
- package/dist/components/Business/BsLayouts/Components/AllFunc/drawContent.d.ts +5 -0
- package/dist/components/Business/BsLayouts/Components/AllFunc/index.d.ts +4 -0
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.d.ts +4 -0
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.d.ts +17 -0
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.d.ts +30 -0
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.d.ts +4 -0
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.d.ts +3 -0
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/index.d.ts +4 -0
- package/dist/components/Business/BsLayouts/Components/GlobalHeader/index.d.ts +5 -0
- package/dist/components/Business/BsLayouts/Components/RightContent/LoginModal.d.ts +3 -0
- package/dist/components/Business/BsLayouts/Components/RightContent/index.d.ts +8 -0
- package/dist/components/Business/BsLayouts/Components/SearchFunc/index.d.ts +8 -0
- package/dist/components/Business/BsLayouts/index.d.ts +18 -0
- package/dist/components/Business/BsLayouts/service.d.ts +1 -0
- package/dist/components/Business/BsLayouts/utils.d.ts +10 -0
- package/dist/components/Business/BsSulaQueryTable/SearchItemSetting.d.ts +60 -0
- package/dist/components/Business/BsSulaQueryTable/index.d.ts +3 -0
- package/dist/components/Business/BsSulaQueryTable/setting.d.ts +60 -0
- package/dist/components/Business/BsSulaQueryTable/utils.d.ts +99 -0
- package/dist/components/Business/CommodityEntry/index.d.ts +3 -0
- package/dist/components/Business/CommonAlert/index.d.ts +4 -0
- package/dist/components/Business/CommonGuideWrapper/index.d.ts +6 -0
- package/dist/components/Business/DetailPageWrapper/index.d.ts +10 -0
- package/dist/components/Business/DetailPageWrapper/utils.d.ts +8 -0
- package/dist/components/Business/HomePageWrapper/index.d.ts +4 -0
- package/dist/components/Business/JsonQueryTable/components/FieldsModifyModal.d.ts +3 -0
- package/dist/components/Business/JsonQueryTable/components/FieldsSettingsTable.d.ts +3 -0
- package/dist/components/Business/JsonQueryTable/components/Formula.d.ts +7 -0
- package/dist/components/Business/JsonQueryTable/components/MaintainOptions.d.ts +3 -0
- package/dist/components/Business/JsonQueryTable/drawer/index.d.ts +3 -0
- package/dist/components/Business/JsonQueryTable/function.d.ts +37 -0
- package/dist/components/Business/JsonQueryTable/index.d.ts +4 -0
- package/dist/components/Business/JsonQueryTable/static.d.ts +44 -0
- package/dist/components/Business/SearchSelect/BusinessUtils.d.ts +5 -0
- package/dist/components/Business/SearchSelect/common.d.ts +25 -0
- package/dist/components/Business/SearchSelect/index.d.ts +3 -0
- package/dist/components/Business/SearchSelect/utils.d.ts +5 -0
- package/dist/components/Business/StateFlow/index.d.ts +4 -0
- package/dist/components/Business/TreeSearchSelect/index.d.ts +3 -0
- package/dist/components/Business/TreeSearchSelect/utils.d.ts +4 -0
- package/dist/components/Business/columnSettingTable/columnSetting.d.ts +54 -0
- package/dist/components/Business/columnSettingTable/index.d.ts +16 -0
- package/dist/components/Business/columnSettingTable/sulaSettingTable.d.ts +17 -0
- package/dist/components/Business/columnSettingTable/utils.d.ts +9 -0
- package/dist/components/Business/moreTreeTable/FixedScrollBar.d.ts +3 -0
- package/dist/components/Business/moreTreeTable/hooks/useSticky.d.ts +8 -0
- package/dist/components/Business/moreTreeTable/index.d.ts +4 -0
- package/dist/components/Business/moreTreeTable/utils.d.ts +9 -0
- package/dist/components/Functional/AddSelect/helps.d.ts +14 -0
- package/dist/components/Functional/AddSelect/index.d.ts +4 -0
- package/dist/components/Functional/BillEntry/index.d.ts +4 -0
- package/dist/components/Functional/BsAntdSula/BsCascader/index.d.ts +18 -0
- package/dist/components/Functional/BsAntdSula/index.d.ts +1 -0
- package/dist/components/Functional/DataImport/index.d.ts +144 -0
- package/dist/components/Functional/DataValidation/index.d.ts +144 -0
- package/dist/components/Functional/ExportFunctions/ExportIcon/index.d.ts +13 -0
- package/dist/components/Functional/QueryMutipleInput/index.d.ts +6 -0
- package/dist/components/Functional/SearchSelect/index.d.ts +4 -0
- package/dist/components/Functional/SearchSelect/utils.d.ts +1 -0
- package/dist/components/Functional/TreeSearchSelect/index.d.ts +3 -0
- package/dist/components/Solution/RuleComponent/Formula.d.ts +9 -0
- package/dist/components/Solution/RuleComponent/InnerSelect.d.ts +12 -0
- package/dist/components/Solution/RuleComponent/services.d.ts +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.esm.js +31367 -0
- package/dist/index.js +31415 -0
- package/dist/plugin/TableColumnSetting/index.d.ts +64 -0
- package/dist/plugin/TableColumnSetting/utils.d.ts +1 -0
- package/dist/utils/CheckOneUser/index.d.ts +2 -0
- package/dist/utils/CustomLoginInfo.d.ts +11 -0
- package/dist/utils/LocalstorageUtils.d.ts +17 -0
- package/dist/utils/TableUtils.d.ts +11 -0
- package/dist/utils/checkUtils.d.ts +3 -0
- package/dist/utils/enumConfig.d.ts +12 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/requestUtils.d.ts +29 -0
- package/dist/utils/utils.d.ts +17 -0
- package/dist 2/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.d.ts +4 -0
- package/dist 2/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.d.ts +4 -0
- package/dist 2/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.d.ts +3 -0
- package/package.json +3 -2
- package/src/components/Business/AddSelectBusiness/index.tsx +3 -2
- package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +9 -7
- package/src/components/Business/BsSulaQueryTable/index.tsx +11 -8
- package/src/components/Business/BsSulaQueryTable/setting.tsx +7 -5
- package/src/components/Business/JsonQueryTable/components/Formula.tsx +3 -2
- package/src/components/Business/JsonQueryTable/index.tsx +8 -6
- package/src/components/Business/JsonQueryTable/static.ts +60 -0
- package/src/components/Business/SearchSelect/BusinessUtils.ts +74 -0
- package/src/components/Business/SearchSelect/index.md +58 -0
- package/src/components/Business/SearchSelect/utils.ts +3 -2
- package/src/components/Business/TreeSearchSelect/index.md +29 -0
- package/src/components/Business/TreeSearchSelect/utils.ts +29 -0
- package/src/components/Business/columnSettingTable/columnSetting.tsx +5 -4
- package/src/components/Business/columnSettingTable/index.tsx +3 -2
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +3 -2
- package/src/components/Functional/AddSelect/helps.ts +2 -1
- package/src/components/Functional/AddSelect/index.tsx +3 -2
- package/src/components/Functional/BillEntry/index.tsx +3 -2
- package/src/components/Functional/DataImport/index.tsx +2 -1
- package/src/components/Functional/DataValidation/index.tsx +2 -1
- package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +2 -1
- package/src/components/Functional/SearchSelect/index.tsx +18 -12
- package/src/components/Functional/TreeSearchSelect/index.tsx +7 -5
- package/src/components/Solution/RuleComponent/InnerSelect.tsx +62 -0
- package/src/components/Solution/RuleComponent/index.js +59 -18
- package/src/components/Solution/RuleComponent/ruleFiled.js +202 -28
- package/src/components/Solution/RuleComponent/util.js +4 -0
- package/src/plugin/TableColumnSetting/index.tsx +4 -3
- package/src/utils/CustomLoginInfo.ts +55 -0
- package/src/utils/requestUtils.ts +139 -7
- package/src/utils/utils.ts +0 -21
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import ENUM from './enumConfig';
|
|
3
3
|
import { getCurrentTenantId, getEmployeeId, getSessionId, getAccountId } from './LocalstorageUtils';
|
|
4
|
+
import { getEekaSessionId, getEekaAccountId, getEekaEmployeeId, getEekaTenantId, getEekaToken,
|
|
5
|
+
getGuoyaoshukeCompanyId, getGuoyaoshukeTenantId, getGuoyaoshukeTenantCode, getGuoyaoshukeToken, getGuoyaoshukeUscCode
|
|
6
|
+
} from './CustomLoginInfo';
|
|
4
7
|
|
|
5
8
|
export function handleRequestAuthHeader(config?: any) {
|
|
6
9
|
// https://www.kdocs.cn/l/coNbPpjamr5v这个表格里面涉及的接口,接口请求头里需要添加参数:x-biz-code 值就是列表里的code
|
|
@@ -15,20 +18,149 @@ export function handleRequestAuthHeader(config?: any) {
|
|
|
15
18
|
}
|
|
16
19
|
}
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
* 获取当前组件服务项目
|
|
24
|
+
* */
|
|
25
|
+
const getCurrentUseProject = () => {
|
|
26
|
+
let project = 'BitSun';
|
|
27
|
+
const hostname = window.location.hostname;
|
|
28
|
+
if(hostname?.indexOf('omni')>-1 || hostname?.indexOf('eeka')>-1 || hostname?.indexOf('koradior')>-1) {
|
|
29
|
+
project = 'YingJia'
|
|
30
|
+
}
|
|
31
|
+
if(hostname?.indexOf('guoyaoshuke')>-1 || hostname?.indexOf('10.31.249.136')>-1) {
|
|
32
|
+
project = 'GuoYao'
|
|
33
|
+
}
|
|
34
|
+
return project
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
* 处理一般请求头
|
|
39
|
+
* @param {*} config 请求参数配置
|
|
40
|
+
* */
|
|
41
|
+
const handleCommonHeader = () => {
|
|
42
|
+
let commonHeaders = {};
|
|
43
|
+
const defaultHeaders = {
|
|
44
|
+
'sso-sessionid': getSessionId(),
|
|
45
|
+
'x-account-id': getAccountId(),
|
|
46
|
+
'x-employee-id': getEmployeeId(),
|
|
47
|
+
'x-tenant-id': getCurrentTenantId()
|
|
48
|
+
};
|
|
49
|
+
const type = getCurrentUseProject()
|
|
50
|
+
switch (type) {
|
|
51
|
+
case 'YingJia':
|
|
52
|
+
commonHeaders = {
|
|
53
|
+
'x-sso-sessionid': getEekaSessionId(),
|
|
54
|
+
'x-account-id': getEekaAccountId(),
|
|
55
|
+
'x-employee-id': getEekaEmployeeId(),
|
|
56
|
+
'x-tenant-id': getEekaTenantId(),
|
|
57
|
+
'x-user-token': getEekaToken()
|
|
58
|
+
}
|
|
59
|
+
break;
|
|
60
|
+
case 'GuoYao':
|
|
61
|
+
commonHeaders = {
|
|
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
|
+
}
|
|
68
|
+
break;
|
|
69
|
+
default:
|
|
70
|
+
commonHeaders = defaultHeaders
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
return commonHeaders
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
/*
|
|
78
|
+
* 处理请求头方法-包含一般请求头、权限请求头。组件默认统一处理一遍,若组件使用处需要可以单独在组件处传参进来处理
|
|
79
|
+
* @param {*} config 请求参数配置
|
|
80
|
+
* */
|
|
19
81
|
const handleRequestHeader = (config: any) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
config.headers['x-tenant-id'] = getCurrentTenantId()
|
|
82
|
+
|
|
83
|
+
let commonHeaders = handleCommonHeader();
|
|
84
|
+
|
|
24
85
|
if (localStorage.getItem('x-user-auth-context')) {
|
|
25
|
-
|
|
86
|
+
// @ts-ignore
|
|
87
|
+
commonHeaders['x-user-auth-context'] = localStorage.getItem('x-user-auth-context');
|
|
88
|
+
}
|
|
89
|
+
!!!config.headers['x-biz-code'] && handleRequestAuthHeader(config)
|
|
90
|
+
|
|
91
|
+
config.headers = {
|
|
92
|
+
...commonHeaders,
|
|
93
|
+
...config.headers
|
|
26
94
|
}
|
|
27
|
-
handleRequestAuthHeader(config)
|
|
28
95
|
}
|
|
29
96
|
|
|
97
|
+
|
|
30
98
|
// 拦截器
|
|
31
99
|
axios.interceptors.request.use((config: any) => {
|
|
32
100
|
handleRequestHeader(config)
|
|
33
101
|
return config
|
|
34
102
|
})
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 处理请求路径前缀/请求路径等使用不一的问题
|
|
109
|
+
* @param {*} defaultUrl 默认请求路径
|
|
110
|
+
* @param {*} defaultPreFix 默认请求路径的前缀
|
|
111
|
+
* @param {*} config 更改请求前缀/路径集合
|
|
112
|
+
* 示例:
|
|
113
|
+
* appRequestConfig: {
|
|
114
|
+
* '/appConfig/saveUserOrder': ['/api/user-manage'],
|
|
115
|
+
* '/appConfig/saveQueryCriteria': ['/api/user-manage']
|
|
116
|
+
* }
|
|
117
|
+
*/
|
|
118
|
+
export const handleRequestUrl = (defaultPreFix: string,defaultUrl: string, config: any) => {
|
|
119
|
+
let rUrl = `${defaultPreFix}${defaultUrl}`;
|
|
120
|
+
if(config && Object.keys((config||{}))?.length) {
|
|
121
|
+
const value = config[defaultUrl] || []
|
|
122
|
+
const newPreFix = value[0] || defaultPreFix;
|
|
123
|
+
const newUrl = value[1] || defaultUrl;
|
|
124
|
+
rUrl = `${newPreFix}${newUrl}`;
|
|
125
|
+
}
|
|
126
|
+
return rUrl
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* 处理错误请求
|
|
132
|
+
* @param {*} response 返回结果
|
|
133
|
+
* @param {*} needBackError 是否需要将错误回传到页面单独处理
|
|
134
|
+
*/
|
|
135
|
+
export function handleError(response: object, needBackError?: boolean) {
|
|
136
|
+
if (judgeIsRequestError(response)) {
|
|
137
|
+
if (response && !needBackError) {
|
|
138
|
+
// @ts-ignore
|
|
139
|
+
response.msg && message.error(response.msg);
|
|
140
|
+
}
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* 判断为请求错误
|
|
149
|
+
* @param {*} res 响应体
|
|
150
|
+
* */
|
|
151
|
+
export const judgeIsRequestError = (res: any) => {
|
|
152
|
+
if (!res || (res?.status && res.status !== '0') || (res?.code && (res.code !== '000000' && res.code !== '0'))) {
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
return false;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* 判断为请求成功
|
|
159
|
+
* @param {*} res 响应体
|
|
160
|
+
* */
|
|
161
|
+
export const judgeIsRequestSuccess = (res: any) => {
|
|
162
|
+
if (res?.status === '0' || res?.code === '000000'|| res?.code === '0') {
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
return false;
|
|
166
|
+
};
|
package/src/utils/utils.ts
CHANGED
|
@@ -189,24 +189,3 @@ export const judgeIsEmpty = (value: any) => {
|
|
|
189
189
|
}
|
|
190
190
|
return false;
|
|
191
191
|
};
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* 处理错误请求
|
|
195
|
-
* @param {*} response 返回结果
|
|
196
|
-
* @param {*} needBackError 是否需要将错误回传到页面单独处理
|
|
197
|
-
*/
|
|
198
|
-
export function handleError(response: object, needBackError?: boolean) {
|
|
199
|
-
// @ts-ignore
|
|
200
|
-
if (
|
|
201
|
-
!response ||
|
|
202
|
-
(response.code ? response.code !== '000000' : response.status !== '0')
|
|
203
|
-
) {
|
|
204
|
-
if (response && !needBackError) {
|
|
205
|
-
// @ts-ignore
|
|
206
|
-
response.msg && message.error(response.msg);
|
|
207
|
-
}
|
|
208
|
-
return false;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
return true;
|
|
212
|
-
}
|