@bit-sun/business-component 2.4.19 → 3.0.0-alpha.0
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/components/Business/BsLayouts/Components/ChooseStore/index.d.ts +3 -0
- package/dist/components/Business/BsLayouts/Components/ChooseStore/services.d.ts +1 -0
- package/dist/components/Business/BsLayouts/Components/RightContent/i18n.d.ts +9 -0
- package/dist/components/Business/BsLayouts/service.d.ts +1 -1
- package/dist/components/Business/BsSulaQueryTable/index.d.ts +1 -0
- package/dist/components/Business/BsSulaQueryTable/setting.d.ts +1 -1
- package/dist/components/Business/BsSulaQueryTable/utils.d.ts +1 -0
- package/dist/components/Business/SearchSelect/common.d.ts +1 -5
- package/dist/components/Business/columnSettingTable/columnSetting.d.ts +1 -0
- package/dist/components/Functional/ExportFunctions/ExportIcon/index.d.ts +1 -1
- package/dist/components/Functional/QueryMutipleInput/index.d.ts +2 -1
- package/dist/components/Solution/RuleComponent/RenderCompItem.d.ts +2 -0
- package/dist/components/Solution/RuleComponent/services.d.ts +1 -1
- package/dist/index.esm.js +1566 -1131
- package/dist/index.js +1551 -1114
- package/dist/utils/request.d.ts +2 -0
- package/dist/utils/utils.d.ts +6 -0
- package/package.json +6 -4
- package/src/assets/arrow_top.svg +18 -0
- package/src/components/Business/AddSelectBusiness/index.tsx +38 -19
- package/src/components/Business/BsLayouts/Components/ChooseStore/index.less +0 -0
- package/src/components/Business/BsLayouts/Components/ChooseStore/index.tsx +193 -0
- package/src/components/Business/BsLayouts/Components/ChooseStore/services.ts +10 -0
- package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +7 -1
- package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +3 -3
- package/src/components/Business/BsLayouts/Components/RightContent/i18n.ts +9 -0
- package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +19 -2
- package/src/components/Business/BsLayouts/index.tsx +44 -34
- package/src/components/Business/BsLayouts/service.ts +2 -2
- package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +9 -9
- package/src/components/Business/BsSulaQueryTable/bssulaquerytable.less +5 -0
- package/src/components/Business/BsSulaQueryTable/index.tsx +346 -175
- package/src/components/Business/BsSulaQueryTable/setting.tsx +125 -87
- package/src/components/Business/BsSulaQueryTable/utils.tsx +57 -34
- package/src/components/Business/CommonGuideWrapper/index.tsx +11 -2
- package/src/components/Business/JsonQueryTable/index.tsx +10 -12
- package/src/components/Business/SearchSelect/BusinessUtils.ts +4 -49
- package/src/components/Business/SearchSelect/common.ts +1 -16
- package/src/components/Business/SearchSelect/index.md +1 -58
- package/src/components/Business/SearchSelect/utils.ts +4 -4
- package/src/components/Business/columnSettingTable/columnSetting.tsx +10 -8
- package/src/components/Business/columnSettingTable/utils.tsx +29 -29
- package/src/components/Functional/AddSelect/helps.ts +4 -3
- package/src/components/Functional/AddSelect/index.tsx +79 -33
- package/src/components/Functional/BillEntry/index.tsx +3 -3
- package/src/components/Functional/DataImport/index.tsx +3 -3
- package/src/components/Functional/DataValidation/index.tsx +3 -3
- package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +10 -5
- package/src/components/Functional/QueryMutipleInput/index.tsx +2 -1
- package/src/components/Functional/SearchSelect/index.less +6 -0
- package/src/components/Functional/SearchSelect/index.tsx +152 -45
- package/src/components/Functional/TreeSearchSelect/index.tsx +24 -22
- package/src/components/Solution/RuleComponent/RenderCompItem.tsx +641 -0
- package/src/components/Solution/RuleComponent/index.js +7 -652
- package/src/components/Solution/RuleComponent/services.ts +2 -2
- package/src/plugin/TableColumnSetting/index.tsx +2 -2
- package/src/utils/request.ts +53 -0
- package/src/utils/utils.ts +37 -21
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// 此文件用于 处理业务组件 所用到的公共方法
|
|
2
2
|
// @ts-nocheck
|
|
3
|
-
import { shopFileType, arrivalPaySupportList, sharingType, shopFile2Type, shopFile2Status, employeeType, orgType, nodeType
|
|
3
|
+
import { shopFileType, arrivalPaySupportList, sharingType, shopFile2Type, shopFile2Status, employeeType, orgType, nodeType } from './common';
|
|
4
4
|
import { getDictionarySource, getDictionaryTextByValue, loadSelectSource } from './utils';
|
|
5
5
|
import { handleTextOverflow, tableColumnsImage } from '@/components/Business/BsSulaQueryTable/utils';
|
|
6
6
|
import { getSkuImg } from '@/utils/TableUtils';
|
|
@@ -1900,7 +1900,7 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
|
|
|
1900
1900
|
}
|
|
1901
1901
|
|
|
1902
1902
|
//业务组织选择器(可筛选业务职能/组织类型/组织形态)
|
|
1903
|
-
if (type === 'business-organization') {
|
|
1903
|
+
if (type === 'business-organization') {
|
|
1904
1904
|
requestConfig = {
|
|
1905
1905
|
url: `${prefixUrl.selectPrefix}/orgViewNode/common/pageList`,
|
|
1906
1906
|
filter: 'qp-name-like', // 过滤参数
|
|
@@ -1990,7 +1990,7 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
|
|
|
1990
1990
|
{
|
|
1991
1991
|
title: '组织类型',
|
|
1992
1992
|
dataIndex: 'orgType',
|
|
1993
|
-
render: (text: any) => {
|
|
1993
|
+
render: (text: any) => {
|
|
1994
1994
|
const obj = orgType.find((i: any) => i.value == text);
|
|
1995
1995
|
return obj ? obj.text : '--';
|
|
1996
1996
|
}
|
|
@@ -1998,7 +1998,7 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
|
|
|
1998
1998
|
{
|
|
1999
1999
|
title: '组织形态',
|
|
2000
2000
|
dataIndex: 'nodeType',
|
|
2001
|
-
render: (text: any) => {
|
|
2001
|
+
render: (text: any) => {
|
|
2002
2002
|
const obj = nodeType.find((i: any) => i.value == text);
|
|
2003
2003
|
return obj ? obj.text : '--';
|
|
2004
2004
|
}
|
|
@@ -2008,50 +2008,5 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
|
|
|
2008
2008
|
}
|
|
2009
2009
|
}
|
|
2010
2010
|
|
|
2011
|
-
// 人员选择器
|
|
2012
|
-
if(type === 'person') {
|
|
2013
|
-
requestConfig = {
|
|
2014
|
-
url: `${prefixUrl.selectPrefix}/person`,
|
|
2015
|
-
filter: 'qp-code,name-orGroup,like', // 过滤参数
|
|
2016
|
-
mappingTextField: 'name',
|
|
2017
|
-
mappingTextShowKeyField: 'code',
|
|
2018
|
-
mappingValueField: 'code',
|
|
2019
|
-
otherParams: {
|
|
2020
|
-
sorter: 'desc-id'
|
|
2021
|
-
}, // 默认参数
|
|
2022
|
-
sourceName: 'personCode',
|
|
2023
|
-
...requestConfigProp,
|
|
2024
|
-
}
|
|
2025
|
-
tableSearchForm = [
|
|
2026
|
-
{ name: 'qp-name-like', label: '姓名' },
|
|
2027
|
-
{ name: 'qp-code-like', label: '员工工号' },
|
|
2028
|
-
{ name: 'qp-phone-like', label: '手机号' },
|
|
2029
|
-
]
|
|
2030
|
-
modalTableProps = {
|
|
2031
|
-
modalTableTitle: '添加人员',
|
|
2032
|
-
tableSearchForm,
|
|
2033
|
-
tableColumns: [
|
|
2034
|
-
{
|
|
2035
|
-
title: '姓名',
|
|
2036
|
-
dataIndex: 'name',
|
|
2037
|
-
},
|
|
2038
|
-
{
|
|
2039
|
-
title: '员工工号',
|
|
2040
|
-
dataIndex: 'code',
|
|
2041
|
-
},
|
|
2042
|
-
{
|
|
2043
|
-
title: '员工类型',
|
|
2044
|
-
dataIndex: 'dataSource',
|
|
2045
|
-
render: (text: number) => personDataSourceType.find((i: any) => i.value == text)?.text,
|
|
2046
|
-
},
|
|
2047
|
-
{
|
|
2048
|
-
title: '手机号',
|
|
2049
|
-
dataIndex: 'phone',
|
|
2050
|
-
},
|
|
2051
|
-
],
|
|
2052
|
-
...modalTableBusProps
|
|
2053
|
-
}
|
|
2054
|
-
}
|
|
2055
|
-
|
|
2056
2011
|
return { modalTableProps, requestConfig, needModalTable };
|
|
2057
2012
|
}
|
|
@@ -116,19 +116,4 @@ const nodeType = [
|
|
|
116
116
|
},
|
|
117
117
|
]
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
{
|
|
121
|
-
text: "平台自建",
|
|
122
|
-
value: 10,
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
text: "MDM",
|
|
126
|
-
value: 20,
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
text: "IAM",
|
|
130
|
-
value: 30,
|
|
131
|
-
},
|
|
132
|
-
]
|
|
133
|
-
|
|
134
|
-
export { shopFileType, arrivalPaySupportList, sharingType, shopFile2Type, shopFile2Status, employeeType, orgType, nodeType, personDataSourceType }
|
|
119
|
+
export { shopFileType, arrivalPaySupportList, sharingType, shopFile2Type, shopFile2Status, employeeType, orgType, nodeType }
|
|
@@ -1327,7 +1327,7 @@ export default () => {
|
|
|
1327
1327
|
};
|
|
1328
1328
|
```
|
|
1329
1329
|
|
|
1330
|
-
|
|
1330
|
+
# 角色选择器 Select-ROLE-001
|
|
1331
1331
|
|
|
1332
1332
|
```tsx
|
|
1333
1333
|
import React, { useState } from 'react';
|
|
@@ -1384,61 +1384,4 @@ export default () => {
|
|
|
1384
1384
|
};
|
|
1385
1385
|
```
|
|
1386
1386
|
|
|
1387
|
-
## 人员选择器 Select-PERSON-001
|
|
1388
|
-
|
|
1389
|
-
```tsx
|
|
1390
|
-
import React, { useState } from 'react';
|
|
1391
|
-
import { Tabs } from 'antd';
|
|
1392
|
-
import {BusinessSearchSelect} from '../../../index.ts';
|
|
1393
|
-
|
|
1394
|
-
const { TabPane } = Tabs;
|
|
1395
|
-
|
|
1396
|
-
export default () => {
|
|
1397
|
-
const selectProps = {
|
|
1398
|
-
// mode: 'multiple',
|
|
1399
|
-
// maxTagCount: 1,
|
|
1400
|
-
// disabled: true
|
|
1401
|
-
}
|
|
1402
|
-
const selectPropsMultiple = {
|
|
1403
|
-
mode: 'multiple',
|
|
1404
|
-
maxTagCount: 1,
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
|
-
const [ tabKey, setTabKey ] = useState('single')
|
|
1408
|
-
const [value, setValue] = useState(selectProps?.mode ? [] : null);
|
|
1409
|
-
|
|
1410
|
-
const props = {
|
|
1411
|
-
value,
|
|
1412
|
-
onChange: (value: any) => {
|
|
1413
|
-
console.log(value)
|
|
1414
|
-
setValue(value)
|
|
1415
|
-
},
|
|
1416
|
-
selectProps,
|
|
1417
|
-
selectBusinessType: 'person',
|
|
1418
|
-
};
|
|
1419
|
-
|
|
1420
|
-
const onTabChange = (key) => {
|
|
1421
|
-
setTabKey(key)
|
|
1422
|
-
setValue(key === 'single' ? null: [])
|
|
1423
|
-
}
|
|
1424
|
-
|
|
1425
|
-
return (
|
|
1426
|
-
<div>
|
|
1427
|
-
<Tabs onChange={onTabChange} activeKey={tabKey}>
|
|
1428
|
-
<TabPane tab='单选' key='single'>
|
|
1429
|
-
{tabKey === 'single' && (
|
|
1430
|
-
<BusinessSearchSelect {...props} />
|
|
1431
|
-
)}
|
|
1432
|
-
</TabPane>
|
|
1433
|
-
<TabPane tab='多选' key='multiple'>
|
|
1434
|
-
{tabKey === 'multiple' && (
|
|
1435
|
-
<BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
|
|
1436
|
-
)}
|
|
1437
|
-
</TabPane>
|
|
1438
|
-
</Tabs>
|
|
1439
|
-
</div>
|
|
1440
|
-
);
|
|
1441
|
-
};
|
|
1442
|
-
```
|
|
1443
|
-
|
|
1444
1387
|
More skills for writing demo: https://d.umijs.org/guide/demo-principle
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import request from '@/utils/request';
|
|
2
2
|
import { message } from 'antd';
|
|
3
3
|
import { stringify } from 'querystring';
|
|
4
4
|
import ENUM from '@/utils/enumConfig';
|
|
@@ -57,7 +57,7 @@ const getDictionaryTextByValue = (dicCode: string, value: string | number) => {
|
|
|
57
57
|
|
|
58
58
|
const loadSelectSource = (url: string, params?: any) => {
|
|
59
59
|
return new Promise((resolve, reject) => {
|
|
60
|
-
|
|
60
|
+
request
|
|
61
61
|
.get(`${url}?${stringify(params)}`)
|
|
62
62
|
.then((result: any) => {
|
|
63
63
|
result = result.data;
|
|
@@ -67,7 +67,7 @@ const loadSelectSource = (url: string, params?: any) => {
|
|
|
67
67
|
}
|
|
68
68
|
resolve(result);
|
|
69
69
|
})
|
|
70
|
-
.catch((err) => {
|
|
70
|
+
.catch((err: any) => {
|
|
71
71
|
reject(err);
|
|
72
72
|
});
|
|
73
73
|
})
|
|
@@ -85,7 +85,7 @@ const handleDefaultPrefixUrl = (type: string) => {
|
|
|
85
85
|
case 'physicalWarehouse': case 'realWarehouse': case 'virtualWarehouse': case 'channelWarehouse': case 'ownerWarehouse':
|
|
86
86
|
result = '/stock';
|
|
87
87
|
break;
|
|
88
|
-
case 'inventoryOrg2': case 'purchaseOrg': case 'salesOrg': case 'employee2': case 'role':
|
|
88
|
+
case 'inventoryOrg2': case 'purchaseOrg': case 'salesOrg': case 'employee2': case 'role':
|
|
89
89
|
result = '/user';
|
|
90
90
|
break;
|
|
91
91
|
case 'deliveryMode': case 'ruleTemplate':
|
|
@@ -15,7 +15,7 @@ import fixedLeft from '../../../assets/fixed-left.svg';
|
|
|
15
15
|
import fixedLeftActive from '../../../assets/fixed-left-active.svg';
|
|
16
16
|
import fixedRight from '../../../assets/fixed-right.svg';
|
|
17
17
|
import fixedRightActive from '../../../assets/fixed-right-active.svg';
|
|
18
|
-
import
|
|
18
|
+
import request from '@/utils/request';
|
|
19
19
|
// import { request } from 'umi';
|
|
20
20
|
import './index.less';
|
|
21
21
|
import ENUM from '@/utils/enumConfig';
|
|
@@ -77,7 +77,7 @@ class SortableTable extends React.Component<SortTableProps> {
|
|
|
77
77
|
fixed: item.fixed
|
|
78
78
|
}))
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
request({
|
|
81
81
|
url: handleRequestUrl('/user','/appConfig/saveUserOrder',appRequestConfig),
|
|
82
82
|
method:'POST',
|
|
83
83
|
data: {
|
|
@@ -140,12 +140,14 @@ class SortableTable extends React.Component<SortTableProps> {
|
|
|
140
140
|
});
|
|
141
141
|
};
|
|
142
142
|
|
|
143
|
+
isColumnsChange = (pre=[], next=[]) => {
|
|
144
|
+
const preKeyStr = pre.map(item => item.key || item.dataIndex).join(',');
|
|
145
|
+
const nextKeyStr = next.map(item => item.key || item.dataIndex).join(',');
|
|
146
|
+
return preKeyStr !== nextKeyStr;
|
|
147
|
+
}
|
|
148
|
+
|
|
143
149
|
componentWillReceiveProps(nextProps: any) {
|
|
144
|
-
if (
|
|
145
|
-
this.props?.datasource &&
|
|
146
|
-
JSON.stringify(this.props?.datasource) !=
|
|
147
|
-
JSON.stringify(nextProps?.datasource)
|
|
148
|
-
) {
|
|
150
|
+
if (this.isColumnsChange(this.props?.datasource, nextProps?.datasource)) {
|
|
149
151
|
this.setInitValue(nextProps?.datasource || []);
|
|
150
152
|
}
|
|
151
153
|
}
|
|
@@ -763,4 +765,4 @@ class SortableTable extends React.Component<SortTableProps> {
|
|
|
763
765
|
}
|
|
764
766
|
}
|
|
765
767
|
|
|
766
|
-
export default SortableTable;
|
|
768
|
+
export default SortableTable;
|
|
@@ -13,35 +13,35 @@ import {
|
|
|
13
13
|
//设置queryTable默认列宽
|
|
14
14
|
export const getItemDefaultWidth = (item: any) => {
|
|
15
15
|
let defaultWidth = 200;
|
|
16
|
+
if (Array.isArray(item.key) || Array.isArray(item.dataIndex)) return defaultWidth;
|
|
16
17
|
let lowerCaseKey = (item.key || item.dataIndex)?.toLowerCase();
|
|
17
|
-
if (lowerCaseKey)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
18
|
+
if (!lowerCaseKey) return defaultWidth;
|
|
19
|
+
switch (true) {
|
|
20
|
+
case item?.title === '操作' || lowerCaseKey === 'operate':
|
|
21
|
+
defaultWidth = 60;
|
|
22
|
+
break;
|
|
23
|
+
case lowerCaseKey.indexOf('number') > -1:
|
|
24
|
+
case lowerCaseKey.indexOf('quantity') > -1:
|
|
25
|
+
case lowerCaseKey.indexOf('amount') > -1:
|
|
26
|
+
defaultWidth = 90;
|
|
27
|
+
break;
|
|
28
|
+
case (lowerCaseKey.indexOf('no') > -1):
|
|
29
|
+
defaultWidth = 200;
|
|
30
|
+
break;
|
|
31
|
+
case lowerCaseKey.indexOf('code') > -1:
|
|
32
|
+
defaultWidth = 170;
|
|
33
|
+
break;
|
|
34
|
+
case lowerCaseKey.indexOf('time') > -1:
|
|
35
|
+
defaultWidth = 130;
|
|
36
|
+
break;
|
|
37
|
+
case lowerCaseKey.indexOf('status') > -1:
|
|
38
|
+
defaultWidth = 100;
|
|
39
|
+
break;
|
|
40
|
+
case lowerCaseKey.indexOf('user') > -1:
|
|
41
|
+
defaultWidth = 130;
|
|
42
|
+
break;
|
|
43
|
+
default:
|
|
44
|
+
break;
|
|
45
45
|
}
|
|
46
46
|
return defaultWidth;
|
|
47
47
|
};
|
|
@@ -68,4 +68,4 @@ export const handleTextOverflow = (
|
|
|
68
68
|
</span>
|
|
69
69
|
</Tooltip>
|
|
70
70
|
);
|
|
71
|
-
};
|
|
71
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import request from '@/utils/request';
|
|
2
3
|
import { stringify } from 'querystring';
|
|
3
4
|
import { message } from 'antd';
|
|
4
5
|
import { judgeIsRequestError } from '@/utils/requestUtils';
|
|
@@ -20,7 +21,7 @@ export const getSelectDataList = (record: any,item: any, selectKey: string) => {
|
|
|
20
21
|
|
|
21
22
|
export const loadSelectSource = (url: string, params?: any) => {
|
|
22
23
|
return new Promise((resolve, reject) => {
|
|
23
|
-
|
|
24
|
+
request
|
|
24
25
|
.get(`${url}?${stringify(params)}`)
|
|
25
26
|
.then((result: any) => {
|
|
26
27
|
result = result.data;
|
|
@@ -31,7 +32,7 @@ export const loadSelectSource = (url: string, params?: any) => {
|
|
|
31
32
|
}
|
|
32
33
|
resolve(result);
|
|
33
34
|
})
|
|
34
|
-
.catch((err) => {
|
|
35
|
+
.catch((err:any) => {
|
|
35
36
|
reject(err);
|
|
36
37
|
});
|
|
37
38
|
})
|
|
@@ -3,7 +3,7 @@ import React, { useState, useEffect } from 'react';
|
|
|
3
3
|
import { useDebounceFn } from 'ahooks';
|
|
4
4
|
import { Input, Button, Modal, Select, InputNumber, message, Spin, Form, Table, Checkbox, TreeSelect, Tooltip, Tag } from 'antd';
|
|
5
5
|
import { SearchOutlined, CopyOutlined, CloseCircleOutlined } from '@ant-design/icons';
|
|
6
|
-
import
|
|
6
|
+
import request from '@/utils/request';
|
|
7
7
|
import { stringify } from 'querystring';
|
|
8
8
|
import _ from "lodash"
|
|
9
9
|
import './index.less';
|
|
@@ -18,9 +18,19 @@ import { getItemDefaultWidth, noEmptyArray } from '@/components/Business/columnS
|
|
|
18
18
|
import { getEmployeeId } from '@/utils/LocalstorageUtils';
|
|
19
19
|
import { getSelectDataList, loadSelectSource, formatFormSourceList } from './helps';
|
|
20
20
|
|
|
21
|
+
interface SearchFormItem {
|
|
22
|
+
name: string;
|
|
23
|
+
label: string;
|
|
24
|
+
filterFormItem?: FormItemProps;
|
|
25
|
+
initialSource?: any[];
|
|
26
|
+
field: any;
|
|
27
|
+
type?: string;
|
|
28
|
+
[formItemProps: string]: any;
|
|
29
|
+
}
|
|
30
|
+
|
|
21
31
|
const checkSpuMatchCode = (data: any) => {
|
|
22
32
|
return new Promise((resolve, reject) => {
|
|
23
|
-
|
|
33
|
+
request.post(`/stock/rwFrontRecordSkcDetail/checkSpuMatchCode`,data)
|
|
24
34
|
.then((result: any) => {
|
|
25
35
|
result = result.data;
|
|
26
36
|
if (judgeIsRequestError(result)) {
|
|
@@ -30,7 +40,7 @@ const checkSpuMatchCode = (data: any) => {
|
|
|
30
40
|
}
|
|
31
41
|
resolve(result);
|
|
32
42
|
})
|
|
33
|
-
.catch((err) => {
|
|
43
|
+
.catch((err: any) => {
|
|
34
44
|
reject(err);
|
|
35
45
|
});
|
|
36
46
|
})
|
|
@@ -75,13 +85,14 @@ const AddSelect = (props: any) => {
|
|
|
75
85
|
needModalTable = true,
|
|
76
86
|
getPopupContainer = undefined,
|
|
77
87
|
onSaveCallback,
|
|
88
|
+
onCancelCallback,
|
|
78
89
|
buttonText = '添加',
|
|
79
90
|
buttonProps = {},
|
|
80
91
|
beforeShowModal,
|
|
81
92
|
tableCodeList = [], // 非必填 默认取组件定义code,如需自定义----数组第一位为供选择商品的table的code,第二位为已选择商品的table的code
|
|
82
93
|
businessType = 'sku',
|
|
83
94
|
isAllowRepeatedSelect = false,
|
|
84
|
-
|
|
95
|
+
clearTitle
|
|
85
96
|
} = props;
|
|
86
97
|
const { url, otherParams, isMap, fixedparameter, fieldValToParam, mappingTextField = 'name', mappingTextShowKeyField, mappingValueField = 'code', mappingTextShowTextField } = requestConfig || {};
|
|
87
98
|
const resultSourceKey = sourceName || requestConfig?.sourceName || 'supplierCode'
|
|
@@ -134,7 +145,7 @@ const AddSelect = (props: any) => {
|
|
|
134
145
|
);
|
|
135
146
|
|
|
136
147
|
const [form] = Form.useForm();
|
|
137
|
-
const [tableSearchForm, setTableSearchForm] = useState(modalTableProps?.tableSearchForm)
|
|
148
|
+
const [tableSearchForm, setTableSearchForm] = useState<Array<SearchFormItem>>(modalTableProps?.tableSearchForm)
|
|
138
149
|
const [caretLeftFlag, setCaretLeftFlag] = useState(true);
|
|
139
150
|
const [tableData, setTableData] = useState([]);
|
|
140
151
|
const [tablePagination, setTablePagination] = useState({ total: 0, size: "small", current: 1, pageSize: tableInitPageSize })
|
|
@@ -153,6 +164,7 @@ const AddSelect = (props: any) => {
|
|
|
153
164
|
const codeToChoose = tableCodeList[0] || initTableCode[businessType][0];
|
|
154
165
|
const codeSelected = tableCodeList[1] || initTableCode[businessType][1];
|
|
155
166
|
|
|
167
|
+
// FIXME: 特殊业务逻辑
|
|
156
168
|
const checkSelectChange = async (bType: string, tList: any, recordKey: string, recordItem: any, selectItem: any, changeValue: string) => {
|
|
157
169
|
if(bType == 'skc' && tList.some((i: any) => i[recordKey] == recordItem[recordKey] && i[selectItem.dataIndex] == changeValue)) {
|
|
158
170
|
message.warning('相同skc配码不可设置相同哦')
|
|
@@ -186,6 +198,7 @@ const AddSelect = (props: any) => {
|
|
|
186
198
|
}
|
|
187
199
|
const setBusinessDefaultValue = (list: any, recordList: any) => {
|
|
188
200
|
let result = list;
|
|
201
|
+
// FIXME: 特殊业务逻辑
|
|
189
202
|
if(businessType == 'spu' && (recordList?.some((i: any) => i?.colorValues?.length == 1) || recordList?.some((i: any) => i?.defaultMatchingCode))) {
|
|
190
203
|
result = list.map((i: any) => {
|
|
191
204
|
recordList.forEach((record: any) => {
|
|
@@ -220,6 +233,7 @@ const AddSelect = (props: any) => {
|
|
|
220
233
|
if(record.needFocus === true && currentIndex === 0) {
|
|
221
234
|
|
|
222
235
|
}
|
|
236
|
+
// FIXME: 特殊业务逻辑
|
|
223
237
|
let precisionObj=businessType == 'skc'?{
|
|
224
238
|
precision: 0
|
|
225
239
|
}:{};
|
|
@@ -478,7 +492,17 @@ const AddSelect = (props: any) => {
|
|
|
478
492
|
}
|
|
479
493
|
});
|
|
480
494
|
delete params[key];
|
|
495
|
+
} else if (element && key.indexOf('*multiInput') >= 0) {
|
|
496
|
+
let name = '',
|
|
497
|
+
value = element['value'];
|
|
498
|
+
if (value.indexOf(',') >= 0) {
|
|
499
|
+
name = `qp-${element['name']}-in`;
|
|
500
|
+
} else {
|
|
501
|
+
name = `qp-${element['name']}-like`;
|
|
481
502
|
}
|
|
503
|
+
params[name] = value;
|
|
504
|
+
delete params[key];
|
|
505
|
+
}
|
|
482
506
|
else if (element && key.indexOf('*') >= 0) {
|
|
483
507
|
const dataParams = key.split('*');
|
|
484
508
|
dataParams.forEach((value, index) => {
|
|
@@ -513,8 +537,19 @@ const AddSelect = (props: any) => {
|
|
|
513
537
|
...fixedParam,
|
|
514
538
|
...params,
|
|
515
539
|
}
|
|
516
|
-
|
|
517
|
-
|
|
540
|
+
//todo 为了满足单个使用like查询,多个含,的使用in查询
|
|
541
|
+
if(!queryParams.unConvert){
|
|
542
|
+
Object.keys(queryParams).forEach(key =>{
|
|
543
|
+
if(String(queryParams[key]).includes(',')){
|
|
544
|
+
if(key.includes('like')){
|
|
545
|
+
queryParams[key.replace('like','in')]=queryParams[key];
|
|
546
|
+
delete queryParams[key];
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
})
|
|
550
|
+
}
|
|
551
|
+
request
|
|
552
|
+
.get(`${url}${url.includes("?")?"&":"?"}${stringify(queryParams)}`)
|
|
518
553
|
.then((result: any) => {
|
|
519
554
|
setFetching(false)
|
|
520
555
|
result = result.data;
|
|
@@ -590,7 +625,7 @@ const AddSelect = (props: any) => {
|
|
|
590
625
|
setTablePagination({ ...tablePagination, total: Number(res?.total || res?.totalCount || source.length), pageSize: Number(res?.size || res?.pageSize || (params?.pageSize || pageSize)), current: Number(res?.page || res?.currentPage || (params?.currentPage || currentPage)) })
|
|
591
626
|
}
|
|
592
627
|
})
|
|
593
|
-
.catch((err) => { setFetching(false) });
|
|
628
|
+
.catch((err: any) => { setFetching(false) });
|
|
594
629
|
}
|
|
595
630
|
|
|
596
631
|
const SelectScroll = e => {
|
|
@@ -742,6 +777,7 @@ const AddSelect = (props: any) => {
|
|
|
742
777
|
setTableFormParams({});
|
|
743
778
|
setIsModalVisible(false);
|
|
744
779
|
setTableData([])
|
|
780
|
+
onCancelCallback && onCancelCallback();
|
|
745
781
|
// if (selectMode) {
|
|
746
782
|
// run();
|
|
747
783
|
// }
|
|
@@ -758,18 +794,24 @@ const AddSelect = (props: any) => {
|
|
|
758
794
|
}
|
|
759
795
|
|
|
760
796
|
const onSearchTable = () => {
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
797
|
+
form.validateFields()
|
|
798
|
+
.then(() => {
|
|
799
|
+
const params = form.getFieldsValue();
|
|
800
|
+
setTableFormParams(params);
|
|
801
|
+
getData({ ...params, pageSize: tableInitPageSize }, 2)
|
|
802
|
+
})
|
|
767
803
|
}
|
|
768
804
|
|
|
769
805
|
const onResetTable = () => {
|
|
770
806
|
form.resetFields();
|
|
771
807
|
setTableFormParams({});
|
|
772
|
-
|
|
808
|
+
form.validateFields()
|
|
809
|
+
.then(() => {
|
|
810
|
+
getData({ pageSize: tableInitPageSize, currentPage: 1 }, 2)
|
|
811
|
+
})
|
|
812
|
+
.catch(() => {
|
|
813
|
+
setTableData([]);
|
|
814
|
+
})
|
|
773
815
|
}
|
|
774
816
|
|
|
775
817
|
const handleTableChange = (pagination) => {
|
|
@@ -846,14 +888,18 @@ const AddSelect = (props: any) => {
|
|
|
846
888
|
|
|
847
889
|
const themeColor = { color: '#005CFF' }
|
|
848
890
|
|
|
849
|
-
const formItem = (list) => {
|
|
891
|
+
const formItem = (list: Array<SearchFormItem>) => {
|
|
850
892
|
if (isModalVisible && list?.length) {
|
|
851
|
-
return list.map((i:
|
|
852
|
-
|
|
893
|
+
return list.map((i: SearchFormItem, index) => {
|
|
894
|
+
const {name, label, field, type='', filterFormItem, initialSource=[], ...restProps} = i;
|
|
895
|
+
|
|
896
|
+
if (type === 'custom_filter_form_item') return filterFormItem;
|
|
897
|
+
|
|
898
|
+
if (type === 'select' || field?.type === 'select') {
|
|
853
899
|
return (
|
|
854
|
-
<Form.Item name={
|
|
855
|
-
<Select style={{ width: '100%' }} placeholder='请选择' {...
|
|
856
|
-
{
|
|
900
|
+
<Form.Item name={name} label={label} key={name} {...restProps}>
|
|
901
|
+
<Select style={{ width: '100%' }} placeholder='请选择' {...field?.props}>
|
|
902
|
+
{initialSource.length && initialSource.map((m: any) => (
|
|
857
903
|
<Option value={m.value} key={m.value}>{m.text}</Option>
|
|
858
904
|
))}
|
|
859
905
|
</Select>
|
|
@@ -861,31 +907,31 @@ const AddSelect = (props: any) => {
|
|
|
861
907
|
)
|
|
862
908
|
}
|
|
863
909
|
|
|
864
|
-
if (
|
|
910
|
+
if (type === 'treeSelect' || field?.type === 'treeSelect') {
|
|
865
911
|
return (
|
|
866
|
-
<Form.Item name={
|
|
867
|
-
<TreeSelect style={{ width: '100%' }} placeholder='请选择' {...
|
|
912
|
+
<Form.Item name={name} label={label} key={name} {...restProps}>
|
|
913
|
+
<TreeSelect style={{ width: '100%' }} placeholder='请选择' {...field?.props}></TreeSelect>
|
|
868
914
|
</Form.Item>
|
|
869
915
|
)
|
|
870
916
|
}
|
|
871
917
|
|
|
872
|
-
if (
|
|
918
|
+
if (type === 'BusinessSearchSelect' || field?.type === 'BusinessSearchSelect') {
|
|
873
919
|
return (
|
|
874
920
|
<div>
|
|
875
|
-
<Form.Item name={
|
|
876
|
-
<BusinessSearchSelect {...
|
|
921
|
+
<Form.Item name={name} label={label} key={name} {...restProps}>
|
|
922
|
+
<BusinessSearchSelect {...field?.props} />
|
|
877
923
|
</Form.Item>
|
|
878
924
|
</div>
|
|
879
925
|
)
|
|
880
926
|
}
|
|
881
927
|
|
|
882
|
-
if (
|
|
928
|
+
if (type === 'multipleQueryInput' || field?.type === 'multipleQueryInput') {
|
|
883
929
|
return (
|
|
884
930
|
<div>
|
|
885
|
-
<Form.Item name={
|
|
931
|
+
<Form.Item name={name} label={label} key={name} {...restProps}>
|
|
886
932
|
<QueryMutipleInput onValueChange={(value) => {
|
|
887
933
|
form.setFieldsValue({
|
|
888
|
-
[
|
|
934
|
+
[name]: value
|
|
889
935
|
})
|
|
890
936
|
}} />
|
|
891
937
|
</Form.Item>
|
|
@@ -895,12 +941,12 @@ const AddSelect = (props: any) => {
|
|
|
895
941
|
|
|
896
942
|
// 默认type是input
|
|
897
943
|
return (
|
|
898
|
-
<Form.Item name={
|
|
944
|
+
<Form.Item name={name} label={label} key={name} {...restProps}>
|
|
899
945
|
<Input id={index === 0 ? "first-query" : 'index'} style={{ width: '100%' }} onKeyDown={(e) => {
|
|
900
946
|
if (e.keyCode === 13) {
|
|
901
947
|
onSearchTable()
|
|
902
948
|
}
|
|
903
|
-
}} placeholder='请输入' allowClear maxLength={100} {...
|
|
949
|
+
}} placeholder='请输入' allowClear maxLength={100} {...field?.props} />
|
|
904
950
|
</Form.Item>
|
|
905
951
|
)
|
|
906
952
|
})
|
|
@@ -1137,7 +1183,7 @@ const AddSelect = (props: any) => {
|
|
|
1137
1183
|
settingImgAttribute={{ width: 20, style: { marginTop: -2 } }}
|
|
1138
1184
|
/>
|
|
1139
1185
|
</span>
|
|
1140
|
-
<div style={{ marginRight: 8 }}><span onClick={deleteSelectRows} style={{ ...themeColor, cursor: 'pointer' }}
|
|
1186
|
+
<div style={{ marginRight: 8 }}><span onClick={deleteSelectRows} style={{ ...themeColor, cursor: 'pointer' }}>{clearTitle??'清空所选商品'}</span></div>
|
|
1141
1187
|
</div>
|
|
1142
1188
|
</div>
|
|
1143
1189
|
<Table
|
|
@@ -4,7 +4,7 @@ import React, { useState, useRef, useEffect } from 'react';
|
|
|
4
4
|
import { SearchOutlined, CopyOutlined, CloseCircleOutlined } from '@ant-design/icons';
|
|
5
5
|
import { stringify } from 'querystring';
|
|
6
6
|
import './index.less';
|
|
7
|
-
import
|
|
7
|
+
import request from '@/utils/request';
|
|
8
8
|
import { Resizable } from 'react-resizable';
|
|
9
9
|
import { checkQuantityAccuracy, precisionQuantity } from '@/utils/checkUtils';
|
|
10
10
|
import { tableColumnsImage } from '@/components/Business/BsSulaQueryTable/utils';
|
|
@@ -27,7 +27,7 @@ const InputElement = ({
|
|
|
27
27
|
const inputRef = useRef(false);
|
|
28
28
|
|
|
29
29
|
const onSerchdata = (name: any) => {
|
|
30
|
-
|
|
30
|
+
request
|
|
31
31
|
.get(`/items/sku/pager/v2?${stringify({ 'skuCodeAndSkuName': name, 'pageSize': 100, 'qp-combination-eq': false, 'qp-approveStatus-eq': 1, 'qp-status-eq': 1 })}`)
|
|
32
32
|
.then(({ data, status }: any) => {
|
|
33
33
|
if (status === 200) {
|
|
@@ -624,7 +624,7 @@ const BillEntry: React.FC = ({ onSaveCallback, validDataUrl="/items/sku/import/c
|
|
|
624
624
|
if(isBrandAuth){
|
|
625
625
|
otherParams = { brandAuth: 'ctl-withAuth' }
|
|
626
626
|
}
|
|
627
|
-
return
|
|
627
|
+
return request
|
|
628
628
|
.post(validDataUrl, {
|
|
629
629
|
...otherParams,
|
|
630
630
|
columns: ["skuCode", "quantity"],
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
ProfileTwoTone,
|
|
26
26
|
UnorderedListOutlined,
|
|
27
27
|
} from '@ant-design/icons';
|
|
28
|
-
import
|
|
28
|
+
import request from '@/utils/request';
|
|
29
29
|
import './index.less';
|
|
30
30
|
import _ from "lodash"
|
|
31
31
|
import { judgeIsRequestError } from '@/utils/requestUtils';
|
|
@@ -429,7 +429,7 @@ class DataImport extends React.Component {
|
|
|
429
429
|
return _.compact(Object.values(d)).length
|
|
430
430
|
})
|
|
431
431
|
|
|
432
|
-
|
|
432
|
+
request
|
|
433
433
|
.post(validDataUrl, {
|
|
434
434
|
columns: columns,
|
|
435
435
|
data: resultData,
|
|
@@ -489,7 +489,7 @@ class DataImport extends React.Component {
|
|
|
489
489
|
console.log(setExportData);
|
|
490
490
|
setExportData([123123]);
|
|
491
491
|
})
|
|
492
|
-
.catch((err) => { });
|
|
492
|
+
.catch((err: any) => { });
|
|
493
493
|
};
|
|
494
494
|
|
|
495
495
|
filterData = (type: string) => {
|