ls-pro-common 3.1.45 → 3.1.46
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.css +16 -0
- package/dist/common.js +1 -1
- package/dist/common.less +2 -1
- package/dist/common.min.css +16 -0
- package/dist/common.min.js +1 -1
- package/es/components/Select/AreaCitySelect.d.ts +5 -0
- package/es/components/Select/AreaCitySelect.js +25 -0
- package/es/components/Select/AreaDistrictSelect.d.ts +5 -0
- package/es/components/Select/AreaDistrictSelect.js +25 -0
- package/es/components/Select/AreaProvinceSelect.d.ts +5 -0
- package/es/components/Select/AreaProvinceSelect.js +25 -0
- package/es/components/Select/Base.d.ts +11 -0
- package/es/components/Select/Base.js +128 -0
- package/es/components/Select/BrandDeptSelect.d.ts +5 -0
- package/es/components/Select/BrandDeptSelect.js +12 -0
- package/es/components/Select/CategorySelect.d.ts +5 -0
- package/es/components/Select/CategorySelect.js +12 -0
- package/es/components/Select/ColorSelect.d.ts +5 -0
- package/es/components/Select/ColorSelect.js +12 -0
- package/es/components/Select/ExpressCompanyPageSelect.d.ts +5 -0
- package/es/components/Select/ExpressCompanyPageSelect.js +12 -0
- package/es/components/Select/ExpressCompanySelect.d.ts +5 -0
- package/es/components/Select/ExpressCompanySelect.js +12 -0
- package/es/components/Select/GenderSelect.d.ts +5 -0
- package/es/components/Select/GenderSelect.js +12 -0
- package/es/components/Select/LogisticCategorySelect.d.ts +5 -0
- package/es/components/Select/LogisticCategorySelect.js +12 -0
- package/es/components/Select/LogisticRegionSelect.d.ts +5 -0
- package/es/components/Select/LogisticRegionSelect.js +12 -0
- package/es/components/Select/ManagingCitySelect.d.ts +5 -0
- package/es/components/Select/ManagingCitySelect.js +12 -0
- package/es/components/Select/OwnerSelect.d.ts +5 -0
- package/es/components/Select/OwnerSelect.js +12 -0
- package/es/components/Select/PhysicalStoreSelect.d.ts +5 -0
- package/es/components/Select/PhysicalStoreSelect.js +12 -0
- package/es/components/Select/PowerUnitSelect.d.ts +5 -0
- package/es/components/Select/PowerUnitSelect.js +12 -0
- package/es/components/Select/ProfitLossMainSelect.d.ts +5 -0
- package/es/components/Select/ProfitLossMainSelect.js +12 -0
- package/es/components/Select/SeasonSelect.d.ts +5 -0
- package/es/components/Select/SeasonSelect.js +12 -0
- package/es/components/Select/SettleAccountSelect.d.ts +5 -0
- package/es/components/Select/SettleAccountSelect.js +12 -0
- package/es/components/Select/SettleCategorySelect.d.ts +5 -0
- package/es/components/Select/SettleCategorySelect.js +12 -0
- package/es/components/Select/SettleCompanySelect.d.ts +5 -0
- package/es/components/Select/SettleCompanySelect.js +12 -0
- package/es/components/Select/ShopPageSelect.d.ts +5 -0
- package/es/components/Select/ShopPageSelect.js +12 -0
- package/es/components/Select/SizeTypeSelect.d.ts +5 -0
- package/es/components/Select/SizeTypeSelect.js +12 -0
- package/es/components/Select/StoreSelect.d.ts +5 -0
- package/es/components/Select/StoreSelect.js +12 -0
- package/es/components/Select/SupplierSelect.d.ts +5 -0
- package/es/components/Select/SupplierSelect.js +12 -0
- package/es/components/Select/TransportLocnoSelect.d.ts +5 -0
- package/es/components/Select/TransportLocnoSelect.js +12 -0
- package/es/components/Select/TransportPointPageSelect.d.ts +5 -0
- package/es/components/Select/TransportPointPageSelect.js +12 -0
- package/es/components/Select/UploadPointPageSelect.d.ts +5 -0
- package/es/components/Select/UploadPointPageSelect.js +12 -0
- package/es/components/Select/YearSelect.d.ts +5 -0
- package/es/components/Select/YearSelect.js +12 -0
- package/es/components/Select/common.d.ts +32 -0
- package/es/components/Select/common.js +20 -0
- package/es/components/Select/index.less +17 -0
- package/es/components/ViewOffice.js +1 -0
- package/es/components/index.d.ts +28 -0
- package/es/components/index.js +29 -1
- package/es/hooks/useMdm.d.ts +11 -2
- package/es/hooks/useMdm.js +26 -11
- package/es/http/index.d.ts +21 -0
- package/es/http/index.js +246 -2
- package/es/http/mdmCache.d.ts +19 -0
- package/es/http/mdmCache.js +157 -0
- package/es/http/mdmRequest.d.ts +148 -73
- package/es/http/mdmRequest.js +223 -93
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +1 -0
- package/es/utils/modal.js +1 -1
- package/es/utils/pasteUpload.d.ts +27 -0
- package/es/utils/pasteUpload.js +118 -0
- package/lib/components/Select/AreaCitySelect.d.ts +5 -0
- package/lib/components/Select/AreaCitySelect.js +25 -0
- package/lib/components/Select/AreaDistrictSelect.d.ts +5 -0
- package/lib/components/Select/AreaDistrictSelect.js +25 -0
- package/lib/components/Select/AreaProvinceSelect.d.ts +5 -0
- package/lib/components/Select/AreaProvinceSelect.js +25 -0
- package/lib/components/Select/Base.d.ts +11 -0
- package/lib/components/Select/Base.js +128 -0
- package/lib/components/Select/BrandDeptSelect.d.ts +5 -0
- package/lib/components/Select/BrandDeptSelect.js +12 -0
- package/lib/components/Select/CategorySelect.d.ts +5 -0
- package/lib/components/Select/CategorySelect.js +12 -0
- package/lib/components/Select/ColorSelect.d.ts +5 -0
- package/lib/components/Select/ColorSelect.js +12 -0
- package/lib/components/Select/ExpressCompanyPageSelect.d.ts +5 -0
- package/lib/components/Select/ExpressCompanyPageSelect.js +12 -0
- package/lib/components/Select/ExpressCompanySelect.d.ts +5 -0
- package/lib/components/Select/ExpressCompanySelect.js +12 -0
- package/lib/components/Select/GenderSelect.d.ts +5 -0
- package/lib/components/Select/GenderSelect.js +12 -0
- package/lib/components/Select/LogisticCategorySelect.d.ts +5 -0
- package/lib/components/Select/LogisticCategorySelect.js +12 -0
- package/lib/components/Select/LogisticRegionSelect.d.ts +5 -0
- package/lib/components/Select/LogisticRegionSelect.js +12 -0
- package/lib/components/Select/ManagingCitySelect.d.ts +5 -0
- package/lib/components/Select/ManagingCitySelect.js +12 -0
- package/lib/components/Select/OwnerSelect.d.ts +5 -0
- package/lib/components/Select/OwnerSelect.js +12 -0
- package/lib/components/Select/PhysicalStoreSelect.d.ts +5 -0
- package/lib/components/Select/PhysicalStoreSelect.js +12 -0
- package/lib/components/Select/PowerUnitSelect.d.ts +5 -0
- package/lib/components/Select/PowerUnitSelect.js +12 -0
- package/lib/components/Select/ProfitLossMainSelect.d.ts +5 -0
- package/lib/components/Select/ProfitLossMainSelect.js +12 -0
- package/lib/components/Select/SeasonSelect.d.ts +5 -0
- package/lib/components/Select/SeasonSelect.js +12 -0
- package/lib/components/Select/SettleAccountSelect.d.ts +5 -0
- package/lib/components/Select/SettleAccountSelect.js +12 -0
- package/lib/components/Select/SettleCategorySelect.d.ts +5 -0
- package/lib/components/Select/SettleCategorySelect.js +12 -0
- package/lib/components/Select/SettleCompanySelect.d.ts +5 -0
- package/lib/components/Select/SettleCompanySelect.js +12 -0
- package/lib/components/Select/ShopPageSelect.d.ts +5 -0
- package/lib/components/Select/ShopPageSelect.js +12 -0
- package/lib/components/Select/SizeTypeSelect.d.ts +5 -0
- package/lib/components/Select/SizeTypeSelect.js +12 -0
- package/lib/components/Select/StoreSelect.d.ts +5 -0
- package/lib/components/Select/StoreSelect.js +12 -0
- package/lib/components/Select/SupplierSelect.d.ts +5 -0
- package/lib/components/Select/SupplierSelect.js +12 -0
- package/lib/components/Select/TransportLocnoSelect.d.ts +5 -0
- package/lib/components/Select/TransportLocnoSelect.js +12 -0
- package/lib/components/Select/TransportPointPageSelect.d.ts +5 -0
- package/lib/components/Select/TransportPointPageSelect.js +12 -0
- package/lib/components/Select/UploadPointPageSelect.d.ts +5 -0
- package/lib/components/Select/UploadPointPageSelect.js +12 -0
- package/lib/components/Select/YearSelect.d.ts +5 -0
- package/lib/components/Select/YearSelect.js +12 -0
- package/lib/components/Select/common.d.ts +32 -0
- package/lib/components/Select/common.js +20 -0
- package/lib/components/Select/index.less +17 -0
- package/lib/components/ViewOffice.js +1 -0
- package/lib/components/index.d.ts +28 -0
- package/lib/components/index.js +29 -1
- package/lib/hooks/useMdm.d.ts +11 -2
- package/lib/hooks/useMdm.js +26 -11
- package/lib/http/index.d.ts +21 -0
- package/lib/http/index.js +246 -2
- package/lib/http/mdmCache.d.ts +19 -0
- package/lib/http/mdmCache.js +157 -0
- package/lib/http/mdmRequest.d.ts +148 -73
- package/lib/http/mdmRequest.js +223 -93
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +1 -0
- package/lib/utils/modal.js +1 -1
- package/lib/utils/pasteUpload.d.ts +27 -0
- package/lib/utils/pasteUpload.js +118 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Base from './Base';
|
|
4
|
+
export default /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
5
|
+
return /*#__PURE__*/React.createElement(Base, _extends({
|
|
6
|
+
type: "store",
|
|
7
|
+
labelField: "storeName",
|
|
8
|
+
valueField: "storeNo"
|
|
9
|
+
}, props, {
|
|
10
|
+
ref: ref
|
|
11
|
+
}));
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Base from './Base';
|
|
4
|
+
export default /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
5
|
+
return /*#__PURE__*/React.createElement(Base, _extends({
|
|
6
|
+
type: "supplier",
|
|
7
|
+
labelField: "supplierName",
|
|
8
|
+
valueField: "supplierNo"
|
|
9
|
+
}, props, {
|
|
10
|
+
ref: ref
|
|
11
|
+
}));
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Base from './Base';
|
|
4
|
+
export default /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
5
|
+
return /*#__PURE__*/React.createElement(Base, _extends({
|
|
6
|
+
type: "transportLocno",
|
|
7
|
+
labelField: "transportLocnoName",
|
|
8
|
+
valueField: "transportLocnoNo"
|
|
9
|
+
}, props, {
|
|
10
|
+
ref: ref
|
|
11
|
+
}));
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Base from './Base';
|
|
4
|
+
export default /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
5
|
+
return /*#__PURE__*/React.createElement(Base, _extends({
|
|
6
|
+
type: "transportPointPage",
|
|
7
|
+
labelField: "transportPointName",
|
|
8
|
+
valueField: "transportPointNo"
|
|
9
|
+
}, props, {
|
|
10
|
+
ref: ref
|
|
11
|
+
}));
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Base from './Base';
|
|
4
|
+
export default /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
5
|
+
return /*#__PURE__*/React.createElement(Base, _extends({
|
|
6
|
+
type: "uploadPointPage",
|
|
7
|
+
labelField: "uploadPointName",
|
|
8
|
+
valueField: "uploadPointNo"
|
|
9
|
+
}, props, {
|
|
10
|
+
ref: ref
|
|
11
|
+
}));
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Base from './Base';
|
|
4
|
+
export default /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
5
|
+
return /*#__PURE__*/React.createElement(Base, _extends({
|
|
6
|
+
type: "year",
|
|
7
|
+
labelField: "yearName",
|
|
8
|
+
valueField: "yearNo"
|
|
9
|
+
}, props, {
|
|
10
|
+
ref: ref
|
|
11
|
+
}));
|
|
12
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SelectProps } from 'antd';
|
|
2
|
+
export interface MdmSelectProps extends SelectProps {
|
|
3
|
+
/** @name请求参数 */
|
|
4
|
+
params?: Record<string, any>;
|
|
5
|
+
/** @name 获取选项回调 */
|
|
6
|
+
getOptions?: (list: any[]) => void;
|
|
7
|
+
/** @name 是否显示重新加载按钮 */
|
|
8
|
+
showReload?: boolean;
|
|
9
|
+
/** @name 是否显示总数 */
|
|
10
|
+
showTotal?: boolean;
|
|
11
|
+
/** @name 是否全选 */
|
|
12
|
+
selectAll?: boolean;
|
|
13
|
+
/** @name 本地过滤选项 */
|
|
14
|
+
filterOptions?: (options: SelectOptionProps[]) => SelectOptionProps[];
|
|
15
|
+
}
|
|
16
|
+
export interface SelectOptionProps {
|
|
17
|
+
value: string | number;
|
|
18
|
+
label: string;
|
|
19
|
+
text?: string;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 数据转换
|
|
25
|
+
*
|
|
26
|
+
* @param rows 原始数据集
|
|
27
|
+
* @param valueField 值字段
|
|
28
|
+
* @param labelField 标签字段
|
|
29
|
+
* @param statusField 状态字段
|
|
30
|
+
* @returns 转换后的数据集
|
|
31
|
+
*/
|
|
32
|
+
export declare function transformOption(rows: any[], valueField: string, labelField: string, statusField?: string): SelectOptionProps[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
/**
|
|
3
|
+
* 数据转换
|
|
4
|
+
*
|
|
5
|
+
* @param rows 原始数据集
|
|
6
|
+
* @param valueField 值字段
|
|
7
|
+
* @param labelField 标签字段
|
|
8
|
+
* @param statusField 状态字段
|
|
9
|
+
* @returns 转换后的数据集
|
|
10
|
+
*/
|
|
11
|
+
export function transformOption(rows, valueField, labelField) {
|
|
12
|
+
var statusField = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'status';
|
|
13
|
+
return rows.map(function (row) {
|
|
14
|
+
return _objectSpread(_objectSpread({}, row), {}, {
|
|
15
|
+
value: row[valueField],
|
|
16
|
+
label: row[labelField],
|
|
17
|
+
disabled: statusField in row ? row[statusField] === 0 : false
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.select-footer {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: space-between;
|
|
4
|
+
padding: 4px 12px;
|
|
5
|
+
background-color: #fff;
|
|
6
|
+
|
|
7
|
+
.select-footer-total {
|
|
8
|
+
color: #999;
|
|
9
|
+
font-size: 12px;
|
|
10
|
+
text-align: left;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.select-footer-reload {
|
|
14
|
+
flex: 1;
|
|
15
|
+
text-align: right;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -39,6 +39,7 @@ var ViewDocment = function ViewDocment(props) {
|
|
|
39
39
|
href = href + (href.includes('?') ? '&' : '?') + 'token=' + token;
|
|
40
40
|
}
|
|
41
41
|
if (!href.includes('fullfilename=')) {
|
|
42
|
+
filename = filename.replace(/\//g, '');
|
|
42
43
|
href = href + (href.includes('?') ? '&' : '?') + 'fullfilename=' + filename;
|
|
43
44
|
}
|
|
44
45
|
var doc = base64Encode(href);
|
package/es/components/index.d.ts
CHANGED
|
@@ -19,3 +19,31 @@ export { default as TagCheck } from './TagCheck';
|
|
|
19
19
|
export { default as ViewOffice } from './ViewOffice';
|
|
20
20
|
export { default as ProButton } from './ProButton';
|
|
21
21
|
export { default as RecordLog } from './RecordLog';
|
|
22
|
+
export { default as OwnerSelect } from './Select/OwnerSelect';
|
|
23
|
+
export { default as BrandDeptSelect } from './Select/BrandDeptSelect';
|
|
24
|
+
export { default as StoreSelect } from './Select/StoreSelect';
|
|
25
|
+
export { default as LogisticRegionSelect } from './Select/LogisticRegionSelect';
|
|
26
|
+
export { default as ExpressCompanySelect } from './Select/ExpressCompanySelect';
|
|
27
|
+
export { default as ExpressCompanyPageSelect } from './Select/ExpressCompanyPageSelect';
|
|
28
|
+
export { default as PhysicalStoreSelect } from './Select/PhysicalStoreSelect';
|
|
29
|
+
export { default as SettleCategorySelect } from './Select/SettleCategorySelect';
|
|
30
|
+
export { default as ProfitLossMainSelect } from './Select/ProfitLossMainSelect';
|
|
31
|
+
export { default as SettleCompanySelect } from './Select/SettleCompanySelect';
|
|
32
|
+
export { default as PowerUnitSelect } from './Select/PowerUnitSelect';
|
|
33
|
+
export { default as SettleAccountSelect } from './Select/SettleAccountSelect';
|
|
34
|
+
export { default as LogisticCategorySelect } from './Select/LogisticCategorySelect';
|
|
35
|
+
export { default as ManagingCitySelect } from './Select/ManagingCitySelect';
|
|
36
|
+
export { default as TransportLocnoSelect } from './Select/TransportLocnoSelect';
|
|
37
|
+
export { default as TransportPointPageSelect } from './Select/TransportPointPageSelect';
|
|
38
|
+
export { default as UploadPointPageSelect } from './Select/UploadPointPageSelect';
|
|
39
|
+
export { default as ShopPageSelect } from './Select/ShopPageSelect';
|
|
40
|
+
export { default as ColorSelect } from './Select/ColorSelect';
|
|
41
|
+
export { default as SizeTypeSelect } from './Select/SizeTypeSelect';
|
|
42
|
+
export { default as GenderSelect } from './Select/GenderSelect';
|
|
43
|
+
export { default as YearSelect } from './Select/YearSelect';
|
|
44
|
+
export { default as SeasonSelect } from './Select/SeasonSelect';
|
|
45
|
+
export { default as CategorySelect } from './Select/CategorySelect';
|
|
46
|
+
export { default as SupplierSelect } from './Select/SupplierSelect';
|
|
47
|
+
export { default as AreaProvinceSelect } from './Select/AreaProvinceSelect';
|
|
48
|
+
export { default as AreaCitySelect } from './Select/AreaCitySelect';
|
|
49
|
+
export { default as AreaDistrictSelect } from './Select/AreaDistrictSelect';
|
package/es/components/index.js
CHANGED
|
@@ -18,4 +18,32 @@ export { default as IconSearch } from './IconSearch';
|
|
|
18
18
|
export { default as TagCheck } from './TagCheck';
|
|
19
19
|
export { default as ViewOffice } from './ViewOffice';
|
|
20
20
|
export { default as ProButton } from './ProButton';
|
|
21
|
-
export { default as RecordLog } from './RecordLog';
|
|
21
|
+
export { default as RecordLog } from './RecordLog';
|
|
22
|
+
export { default as OwnerSelect } from './Select/OwnerSelect';
|
|
23
|
+
export { default as BrandDeptSelect } from './Select/BrandDeptSelect';
|
|
24
|
+
export { default as StoreSelect } from './Select/StoreSelect';
|
|
25
|
+
export { default as LogisticRegionSelect } from './Select/LogisticRegionSelect';
|
|
26
|
+
export { default as ExpressCompanySelect } from './Select/ExpressCompanySelect';
|
|
27
|
+
export { default as ExpressCompanyPageSelect } from './Select/ExpressCompanyPageSelect';
|
|
28
|
+
export { default as PhysicalStoreSelect } from './Select/PhysicalStoreSelect';
|
|
29
|
+
export { default as SettleCategorySelect } from './Select/SettleCategorySelect';
|
|
30
|
+
export { default as ProfitLossMainSelect } from './Select/ProfitLossMainSelect';
|
|
31
|
+
export { default as SettleCompanySelect } from './Select/SettleCompanySelect';
|
|
32
|
+
export { default as PowerUnitSelect } from './Select/PowerUnitSelect';
|
|
33
|
+
export { default as SettleAccountSelect } from './Select/SettleAccountSelect';
|
|
34
|
+
export { default as LogisticCategorySelect } from './Select/LogisticCategorySelect';
|
|
35
|
+
export { default as ManagingCitySelect } from './Select/ManagingCitySelect';
|
|
36
|
+
export { default as TransportLocnoSelect } from './Select/TransportLocnoSelect';
|
|
37
|
+
export { default as TransportPointPageSelect } from './Select/TransportPointPageSelect';
|
|
38
|
+
export { default as UploadPointPageSelect } from './Select/UploadPointPageSelect';
|
|
39
|
+
export { default as ShopPageSelect } from './Select/ShopPageSelect';
|
|
40
|
+
export { default as ColorSelect } from './Select/ColorSelect';
|
|
41
|
+
export { default as SizeTypeSelect } from './Select/SizeTypeSelect';
|
|
42
|
+
export { default as GenderSelect } from './Select/GenderSelect';
|
|
43
|
+
export { default as YearSelect } from './Select/YearSelect';
|
|
44
|
+
export { default as SeasonSelect } from './Select/SeasonSelect';
|
|
45
|
+
export { default as CategorySelect } from './Select/CategorySelect';
|
|
46
|
+
export { default as SupplierSelect } from './Select/SupplierSelect';
|
|
47
|
+
export { default as AreaProvinceSelect } from './Select/AreaProvinceSelect';
|
|
48
|
+
export { default as AreaCitySelect } from './Select/AreaCitySelect';
|
|
49
|
+
export { default as AreaDistrictSelect } from './Select/AreaDistrictSelect';
|
package/es/hooks/useMdm.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { type MdmType } from '../http/mdmRequest';
|
|
2
|
-
interface MdmParams {
|
|
2
|
+
interface MdmParams<T = any> {
|
|
3
3
|
type: MdmType;
|
|
4
4
|
params?: any;
|
|
5
|
+
transfor?: (rows: any[]) => T[];
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
+
/**
|
|
8
|
+
* UseMdm hook 返回值类型
|
|
9
|
+
*
|
|
10
|
+
* @template T 数组元素类型,默认为 any
|
|
11
|
+
* @returns 返回一个元组,包含: - run: 执行获取数据的异步函数,返回 Promise<T[]> - list: 当前数据列表,类型为 T[] - setList:
|
|
12
|
+
* 设置数据列表的函数 - loading: 加载状态,类型为 boolean
|
|
13
|
+
*/
|
|
14
|
+
declare type UseMdmReturn<T = any> = [() => Promise<T[]>, T[], (list: T[]) => void, boolean];
|
|
15
|
+
export default function <T = any>(props: MdmParams<T>): UseMdmReturn<T>;
|
|
7
16
|
export {};
|
package/es/hooks/useMdm.js
CHANGED
|
@@ -6,7 +6,8 @@ import { getMdmData } from '../http/mdmRequest';
|
|
|
6
6
|
export default function (props) {
|
|
7
7
|
var type = props.type,
|
|
8
8
|
_props$params = props.params,
|
|
9
|
-
params = _props$params === void 0 ? {} : _props$params
|
|
9
|
+
params = _props$params === void 0 ? {} : _props$params,
|
|
10
|
+
transfor = props.transfor;
|
|
10
11
|
var _useState = useState([]),
|
|
11
12
|
_useState2 = _slicedToArray(_useState, 2),
|
|
12
13
|
list = _useState2[0],
|
|
@@ -17,27 +18,41 @@ export default function (props) {
|
|
|
17
18
|
setLoading = _useState4[1];
|
|
18
19
|
var run = /*#__PURE__*/function () {
|
|
19
20
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
20
|
-
var
|
|
21
|
+
var isCache,
|
|
22
|
+
res,
|
|
23
|
+
rows,
|
|
24
|
+
_args = arguments;
|
|
21
25
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
22
26
|
while (1) switch (_context.prev = _context.next) {
|
|
23
27
|
case 0:
|
|
24
|
-
|
|
28
|
+
isCache = _args.length > 0 && _args[0] !== undefined ? _args[0] : true;
|
|
29
|
+
_context.prev = 1;
|
|
25
30
|
setLoading(true);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
setList([]);
|
|
32
|
+
_context.next = 6;
|
|
33
|
+
return getMdmData(type, params, isCache);
|
|
34
|
+
case 6:
|
|
29
35
|
res = _context.sent;
|
|
30
36
|
rows = res.rows || [];
|
|
37
|
+
if (transfor) {
|
|
38
|
+
rows = transfor(res.rows || []);
|
|
39
|
+
}
|
|
31
40
|
setList(rows);
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
return _context.abrupt("return", rows);
|
|
42
|
+
case 13:
|
|
43
|
+
_context.prev = 13;
|
|
44
|
+
_context.t0 = _context["catch"](1);
|
|
45
|
+
console.error('获取主数据失败:', _context.t0);
|
|
46
|
+
return _context.abrupt("return", []);
|
|
47
|
+
case 17:
|
|
48
|
+
_context.prev = 17;
|
|
34
49
|
setLoading(false);
|
|
35
|
-
return _context.finish(
|
|
36
|
-
case
|
|
50
|
+
return _context.finish(17);
|
|
51
|
+
case 20:
|
|
37
52
|
case "end":
|
|
38
53
|
return _context.stop();
|
|
39
54
|
}
|
|
40
|
-
}, _callee, null, [[
|
|
55
|
+
}, _callee, null, [[1, 13, 17, 20]]);
|
|
41
56
|
}));
|
|
42
57
|
return function run() {
|
|
43
58
|
return _ref.apply(this, arguments);
|
package/es/http/index.d.ts
CHANGED
|
@@ -71,6 +71,27 @@ export declare function getDict(dictCodes: string, showValue?: boolean, needGate
|
|
|
71
71
|
*/
|
|
72
72
|
export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, isGet?: boolean, valueIsNumber?: boolean): Promise<any>;
|
|
73
73
|
export declare const getResourceRight: (ids: string[]) => Promise<any>;
|
|
74
|
+
/** 上传文件进度回调 */
|
|
75
|
+
export interface UploadProgressCallback {
|
|
76
|
+
(progress: number): void;
|
|
77
|
+
}
|
|
78
|
+
/** 上传文件返回值 */
|
|
79
|
+
export interface UploadResult {
|
|
80
|
+
promise: Promise<any>;
|
|
81
|
+
cancel: () => void;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* 上传文件,因fetch不支持进度回调,使用XMLHttpRequest实现上传文件
|
|
85
|
+
*
|
|
86
|
+
* @param url 上传接口地址
|
|
87
|
+
* @param file 要上传的文件
|
|
88
|
+
* @param params 附加其它参数 {key:value}
|
|
89
|
+
* @param labelName 对应后端接口的文件字段名,默认为 'file'
|
|
90
|
+
* @param needGateWay 是否需要网关,默认为 true,如果url里已包含网关,则不需要网关
|
|
91
|
+
* @param onProgress 进度回调函数,参数为 0-100 的进度百分比
|
|
92
|
+
* @returns 返回包含 promise 和 cancel 方法的对象
|
|
93
|
+
*/
|
|
94
|
+
export declare const httpUpload: (url: string, file: File, params?: Record<string, any>, labelName?: string, needGateWay?: boolean, onProgress?: UploadProgressCallback | undefined) => UploadResult;
|
|
74
95
|
/**
|
|
75
96
|
* 分批获取数据,当一次性取大于2000条,且是第一页时,分多次去取,避免一次性取太多数据导致后端工程压力过大
|
|
76
97
|
*
|
package/es/http/index.js
CHANGED
|
@@ -156,7 +156,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
156
156
|
case 18:
|
|
157
157
|
if ((retCode === 'timeout' || retCode === '4011' || retCode === '4013' || retCode === '9009' && retMsg === '令牌不能为空') && !isMobile) {
|
|
158
158
|
if (!getCookie('token')) {
|
|
159
|
-
(window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
|
|
159
|
+
(window.top || window).location.href = location.pathname === '/' || location.pathname.startsWith('/login') ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
|
|
160
160
|
} else {
|
|
161
161
|
reLogin();
|
|
162
162
|
}
|
|
@@ -225,7 +225,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
225
225
|
if (_retCode && !status.includes(_retCode)) {
|
|
226
226
|
if ((_retCode === 'timeout' || _retCode === '4011' || _retCode === '9009' && _retMsg === '令牌不能为空') && !isMobile) {
|
|
227
227
|
if (!getCookie('token')) {
|
|
228
|
-
(window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
|
|
228
|
+
(window.top || window).location.href = location.pathname === '/' || location.pathname.startsWith('/login') ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
|
|
229
229
|
} else {
|
|
230
230
|
reLogin();
|
|
231
231
|
}
|
|
@@ -469,6 +469,250 @@ export var getResourceRight = function getResourceRight(ids) {
|
|
|
469
469
|
resourceIds: ids
|
|
470
470
|
}, true, false);
|
|
471
471
|
};
|
|
472
|
+
/**
|
|
473
|
+
* 上传文件,因fetch不支持进度回调,使用XMLHttpRequest实现上传文件
|
|
474
|
+
*
|
|
475
|
+
* @param url 上传接口地址
|
|
476
|
+
* @param file 要上传的文件
|
|
477
|
+
* @param params 附加其它参数 {key:value}
|
|
478
|
+
* @param labelName 对应后端接口的文件字段名,默认为 'file'
|
|
479
|
+
* @param needGateWay 是否需要网关,默认为 true,如果url里已包含网关,则不需要网关
|
|
480
|
+
* @param onProgress 进度回调函数,参数为 0-100 的进度百分比
|
|
481
|
+
* @returns 返回包含 promise 和 cancel 方法的对象
|
|
482
|
+
*/
|
|
483
|
+
export var httpUpload = function httpUpload(url, file) {
|
|
484
|
+
var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
485
|
+
var labelName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'file';
|
|
486
|
+
var needGateWay = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
487
|
+
var onProgress = arguments.length > 5 ? arguments[5] : undefined;
|
|
488
|
+
var formData = new FormData();
|
|
489
|
+
// 处理附加参数,转换为FormData格式
|
|
490
|
+
Object.keys(params).forEach(function (key) {
|
|
491
|
+
var value = params[key];
|
|
492
|
+
if (value !== undefined && value !== null) {
|
|
493
|
+
formData.append(key, typeof value === 'string' ? value : JSON.stringify(value));
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
// 添加文件
|
|
497
|
+
formData.append(labelName, file);
|
|
498
|
+
// 如果需要网关,转换 URL
|
|
499
|
+
var finalUrl = needGateWay ? toGatewayUrl(url) : url;
|
|
500
|
+
// 创建 XMLHttpRequest 以实现进度追踪和取消功能
|
|
501
|
+
var xhr = new XMLHttpRequest();
|
|
502
|
+
var isCancelled = false;
|
|
503
|
+
var promise = new Promise(function (resolve, reject) {
|
|
504
|
+
var _window$crypto$random2, _window$crypto2;
|
|
505
|
+
// 处理 URL(模拟拦截器的逻辑)
|
|
506
|
+
var requestUrl = finalUrl;
|
|
507
|
+
// 移除 noToken 参数
|
|
508
|
+
requestUrl = requestUrl.replace('&noToken=1', '').replace('noToken=1', '');
|
|
509
|
+
// 处理 resCode
|
|
510
|
+
var resCode = getUrlQuery('resCode', requestUrl) || window.__currentResCode__ || getUrlQuery('resCode') || getUrlQuery('resourceId') || getResourceProps('resourceId');
|
|
511
|
+
// 添加时间戳和随机数参数
|
|
512
|
+
var param = {
|
|
513
|
+
_t1: Date.now(),
|
|
514
|
+
__r: ((_window$crypto$random2 = (_window$crypto2 = window.crypto)['randomUUID']) === null || _window$crypto$random2 === void 0 ? void 0 : _window$crypto$random2.call(_window$crypto2)) || Math.random()
|
|
515
|
+
};
|
|
516
|
+
// 当没有明文参数resCode的时候,添加resCode参数为资源Id
|
|
517
|
+
if (resCode && !getUrlQuery('resCode', requestUrl)) {
|
|
518
|
+
param.resCode = resCode;
|
|
519
|
+
}
|
|
520
|
+
requestUrl = setUrlQuery(requestUrl, param);
|
|
521
|
+
// 设置请求头
|
|
522
|
+
xhr.open('POST', requestUrl, true);
|
|
523
|
+
xhr.timeout = 60000 * 10; // 10分钟超时
|
|
524
|
+
// 设置请求头(模拟拦截器的逻辑)
|
|
525
|
+
var headers = {};
|
|
526
|
+
if (browserId) {
|
|
527
|
+
headers.browserId = browserId;
|
|
528
|
+
} else if (getCache('browserId')) {
|
|
529
|
+
browserId = getCache('browserId');
|
|
530
|
+
headers.browserId = browserId;
|
|
531
|
+
} else {
|
|
532
|
+
// 异步获取 browserId(不影响当前请求)
|
|
533
|
+
getBrowserId().then(function (id) {
|
|
534
|
+
browserId = id;
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
var shopNo = getCacheSessionFirst('shopNo');
|
|
538
|
+
if (shopNo) {
|
|
539
|
+
headers.shopNo = shopNo;
|
|
540
|
+
}
|
|
541
|
+
var shopCode = getCacheSessionFirst('shopCode');
|
|
542
|
+
if (shopCode) {
|
|
543
|
+
headers.shopCode = shopCode;
|
|
544
|
+
}
|
|
545
|
+
var storeNo = getCacheSessionFirst('storeNo');
|
|
546
|
+
if (storeNo) {
|
|
547
|
+
headers.storeNo = storeNo;
|
|
548
|
+
}
|
|
549
|
+
var tag = getCookie('x-asm-prefer-tag');
|
|
550
|
+
if (tag) {
|
|
551
|
+
headers['x-asm-prefer-tag'] = tag;
|
|
552
|
+
}
|
|
553
|
+
if (isDingtalk) {
|
|
554
|
+
headers['terminal'] = 'APP';
|
|
555
|
+
} else {
|
|
556
|
+
headers['terminal'] = 'PC';
|
|
557
|
+
}
|
|
558
|
+
var expireWarnFlag = getCache('expireWarnFlag', true);
|
|
559
|
+
headers.expireWarnFlag = expireWarnFlag === '1' ? '1' : '0';
|
|
560
|
+
var token = getCookie('token');
|
|
561
|
+
if (token && requestUrl.indexOf('noToken=1') === -1) {
|
|
562
|
+
headers.token = token;
|
|
563
|
+
}
|
|
564
|
+
Object.keys(headers).forEach(function (key) {
|
|
565
|
+
xhr.setRequestHeader(key, headers[key]);
|
|
566
|
+
});
|
|
567
|
+
// 监听上传进度
|
|
568
|
+
if (onProgress && xhr.upload) {
|
|
569
|
+
xhr.upload.addEventListener('progress', function (e) {
|
|
570
|
+
if (e.lengthComputable && !isCancelled) {
|
|
571
|
+
var percent = Math.round(e.loaded / e.total * 100);
|
|
572
|
+
onProgress(percent);
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
// 监听请求完成
|
|
577
|
+
xhr.onload = function () {
|
|
578
|
+
var _navigator2, _navigator2$userAgent;
|
|
579
|
+
if (isCancelled) {
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
var noMsg = getUrlQuery('noMsg', requestUrl);
|
|
583
|
+
var userAgent = (_navigator2 = navigator) === null || _navigator2 === void 0 ? void 0 : (_navigator2$userAgent = _navigator2.userAgent) === null || _navigator2$userAgent === void 0 ? void 0 : _navigator2$userAgent.toLowerCase();
|
|
584
|
+
var isMobile = /mobile/i.test(userAgent);
|
|
585
|
+
if (xhr.status >= 200 && xhr.status < 300) {
|
|
586
|
+
try {
|
|
587
|
+
var _response$flag, _response$flag2, _response$flag3;
|
|
588
|
+
var response = JSON.parse(xhr.responseText);
|
|
589
|
+
// 处理业务异常(模拟响应拦截器的逻辑)
|
|
590
|
+
var retCode = (response === null || response === void 0 ? void 0 : (_response$flag = response.flag) === null || _response$flag === void 0 ? void 0 : _response$flag.retCode) || '0';
|
|
591
|
+
var retMsg = (response === null || response === void 0 ? void 0 : (_response$flag2 = response.flag) === null || _response$flag2 === void 0 ? void 0 : _response$flag2.retMsg) || '请求的服务出错';
|
|
592
|
+
var status = (getUrlQuery('apiStatus', requestUrl) || '0').split(',');
|
|
593
|
+
var faultCode = response === null || response === void 0 ? void 0 : (_response$flag3 = response.flag) === null || _response$flag3 === void 0 ? void 0 : _response$flag3.faultCode;
|
|
594
|
+
var is99110 = false;
|
|
595
|
+
// wms 提示,是否排班标识
|
|
596
|
+
if (retCode === '99110') {
|
|
597
|
+
is99110 = true;
|
|
598
|
+
if (getCache('expireWarnFlag', true) === '1' || ifExpireWarn) {
|
|
599
|
+
resolve(response);
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
ifExpireWarn = true;
|
|
603
|
+
setCache('expireWarnFlag', '1', true);
|
|
604
|
+
}
|
|
605
|
+
if (retCode && !status.includes(retCode) && noMsg !== '1') {
|
|
606
|
+
if ((retCode === 'timeout' || retCode === '4011' || retCode === '4013' || retCode === '9009' && retMsg === '令牌不能为空') && !isMobile) {
|
|
607
|
+
if (!getCookie('token')) {
|
|
608
|
+
(window.top || window).location.href = location.pathname === '/' || location.pathname.startsWith('/login') ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
|
|
609
|
+
} else {
|
|
610
|
+
reLogin();
|
|
611
|
+
}
|
|
612
|
+
reject(new Error(retMsg));
|
|
613
|
+
return;
|
|
614
|
+
} else if (faultCode) {
|
|
615
|
+
var text;
|
|
616
|
+
if (retCode === '4012') {
|
|
617
|
+
text = '用户已禁用,无权限进行操作';
|
|
618
|
+
}
|
|
619
|
+
httpError(text || retMsg, retCode, faultCode, {
|
|
620
|
+
title: is99110 ? '账号到期提醒' : '请求接口出错'
|
|
621
|
+
});
|
|
622
|
+
reject(new Error(retMsg));
|
|
623
|
+
return;
|
|
624
|
+
} else {
|
|
625
|
+
showError(retMsg);
|
|
626
|
+
reject(new Error(retMsg));
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
resolve(response);
|
|
631
|
+
} catch (e) {
|
|
632
|
+
resolve(xhr.responseText);
|
|
633
|
+
}
|
|
634
|
+
} else {
|
|
635
|
+
// HTTP 状态码错误
|
|
636
|
+
try {
|
|
637
|
+
var _response$flag4, _response$flag5, _response$flag6;
|
|
638
|
+
var _response = JSON.parse(xhr.responseText);
|
|
639
|
+
var _retCode2 = (_response$flag4 = _response.flag) === null || _response$flag4 === void 0 ? void 0 : _response$flag4.retCode;
|
|
640
|
+
var _retMsg2 = (_response$flag5 = _response.flag) === null || _response$flag5 === void 0 ? void 0 : _response$flag5.retMsg;
|
|
641
|
+
var _faultCode2 = (_response$flag6 = _response.flag) === null || _response$flag6 === void 0 ? void 0 : _response$flag6.faultCode;
|
|
642
|
+
var _is2 = false;
|
|
643
|
+
// wms 提示,是否排班标识
|
|
644
|
+
if (_retCode2 === '99110') {
|
|
645
|
+
_is2 = true;
|
|
646
|
+
if (getCache('expireWarnFlag', true) === '1' || ifExpireWarn) {
|
|
647
|
+
reject(new Error(_retMsg2 || httpStatus[xhr.status] || xhr.statusText));
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
ifExpireWarn = true;
|
|
651
|
+
setCache('expireWarnFlag', '1', true);
|
|
652
|
+
}
|
|
653
|
+
if (noMsg !== '1') {
|
|
654
|
+
if (_faultCode2) {
|
|
655
|
+
var _text3;
|
|
656
|
+
if (_retCode2 === '4012') {
|
|
657
|
+
_text3 = '用户已禁用,无权限进行操作';
|
|
658
|
+
}
|
|
659
|
+
httpError(_text3 || _retMsg2, _retCode2, _faultCode2, {
|
|
660
|
+
title: _is2 ? '账号到期提醒' : '请求接口出错'
|
|
661
|
+
});
|
|
662
|
+
} else {
|
|
663
|
+
var _text4 = httpStatus[xhr.status];
|
|
664
|
+
if (xhr.status === 503 && xhr.statusText === 'no healthy upstream') {
|
|
665
|
+
_text4 = '请求的服务未启动';
|
|
666
|
+
} else if (xhr.status === 503 && xhr.statusText === 'reached concurrency limit') {
|
|
667
|
+
_text4 = '请求的服务被限流';
|
|
668
|
+
}
|
|
669
|
+
showError(_text4 || _retMsg2 || xhr.statusText);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
reject(new Error(_retMsg2 || httpStatus[xhr.status] || xhr.statusText));
|
|
673
|
+
} catch (e) {
|
|
674
|
+
var _text5 = httpStatus[xhr.status];
|
|
675
|
+
if (xhr.status === 503 && xhr.statusText === 'no healthy upstream') {
|
|
676
|
+
_text5 = '请求的服务未启动';
|
|
677
|
+
} else if (xhr.status === 503 && xhr.statusText === 'reached concurrency limit') {
|
|
678
|
+
_text5 = '请求的服务被限流';
|
|
679
|
+
}
|
|
680
|
+
var httpStatusText = _text5 || e.message || xhr.statusText;
|
|
681
|
+
if (noMsg !== '1') {
|
|
682
|
+
showError(httpStatusText);
|
|
683
|
+
}
|
|
684
|
+
reject(new Error(httpStatusText));
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
};
|
|
688
|
+
// 监听错误
|
|
689
|
+
xhr.onerror = function () {
|
|
690
|
+
if (!isCancelled) {
|
|
691
|
+
reject(new Error('网络错误'));
|
|
692
|
+
}
|
|
693
|
+
};
|
|
694
|
+
// 监听超时
|
|
695
|
+
xhr.ontimeout = function () {
|
|
696
|
+
if (!isCancelled) {
|
|
697
|
+
showError('请求超时');
|
|
698
|
+
reject(new Error('请求超时'));
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
// 发送请求
|
|
702
|
+
xhr.send(formData);
|
|
703
|
+
});
|
|
704
|
+
// 取消方法
|
|
705
|
+
var cancel = function cancel() {
|
|
706
|
+
if (!isCancelled) {
|
|
707
|
+
isCancelled = true;
|
|
708
|
+
xhr.abort();
|
|
709
|
+
}
|
|
710
|
+
};
|
|
711
|
+
return {
|
|
712
|
+
promise: promise,
|
|
713
|
+
cancel: cancel
|
|
714
|
+
};
|
|
715
|
+
};
|
|
472
716
|
// 默认分批获取数据的大小
|
|
473
717
|
var defaultPageSize = 2000;
|
|
474
718
|
/**
|