@bit-sun/business-component 4.0.12-alpha.19 → 4.0.12-alpha.20
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 +0 -1
- package/dist/index.esm.js +527 -979
- package/dist/index.js +525 -978
- package/package.json +1 -1
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +15 -4
- package/src/components/Functional/SearchSelect/index.tsx +6 -23
- package/src/index.ts +0 -1
- package/dist/components/Business/PropertyModal/index.d.ts +0 -23
- package/dist/components/Business/PropertyModal/mockData.d.ts +0 -10
- package/dist/components/Business/PropertyModal/propertyGroup.d.ts +0 -4
- package/src/components/Business/PropertyModal/index.less +0 -58
- package/src/components/Business/PropertyModal/index.md +0 -33
- package/src/components/Business/PropertyModal/index.tsx +0 -266
- package/src/components/Business/PropertyModal/mockData.ts +0 -160
- package/src/components/Business/PropertyModal/propertyGroup.tsx +0 -205
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
15
15
|
|
|
16
16
|
// 默认type === 'supplier' 供应商选择器
|
|
17
17
|
let requestConfig = {
|
|
18
|
+
init: true,
|
|
18
19
|
url: `${prefixUrl.selectPrefix}/supplier`,
|
|
19
20
|
filter: 'qp-name,code-orGroup,like', // 过滤参数
|
|
20
21
|
otherParams: {
|
|
@@ -295,7 +296,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
295
296
|
// 商品选择器sku
|
|
296
297
|
if(type === 'skuCommodity') {
|
|
297
298
|
requestConfig = {
|
|
298
|
-
url: `${prefixUrl.selectPrefix}/sku/doPageBySelect/
|
|
299
|
+
url: `${prefixUrl.selectPrefix}/sku/doPageBySelect/v3`,
|
|
299
300
|
filter: 'skuCodeAndSkuName', // 过滤参数
|
|
300
301
|
searchStartLength: 4,
|
|
301
302
|
mappingTextField: 'name',
|
|
@@ -365,9 +366,6 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
365
366
|
dropdownStyle: { maxHeight: 400, maxWidth: 100, overflow: 'auto' }
|
|
366
367
|
},
|
|
367
368
|
} },
|
|
368
|
-
{ name: 'UNIQUE_SPEC', label: '属性', field: {
|
|
369
|
-
type: 'proppertySelector',
|
|
370
|
-
} },
|
|
371
369
|
]
|
|
372
370
|
Promise.all([
|
|
373
371
|
loadSelectSource(`${prefixUrl.formSelectFix}/brand/queryBrandList`, {
|
|
@@ -787,6 +785,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
787
785
|
...selectConfigProps,
|
|
788
786
|
}
|
|
789
787
|
requestConfig = {
|
|
788
|
+
init: true,
|
|
790
789
|
url: `${prefixUrl.selectPrefix}/skuPropertyValue/list`,
|
|
791
790
|
filter: 'qp-value-like', // 过滤参数
|
|
792
791
|
mappingTextField: 'value',
|
|
@@ -1697,6 +1696,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
1697
1696
|
...selectConfigProps,
|
|
1698
1697
|
}
|
|
1699
1698
|
requestConfig = {
|
|
1699
|
+
init: true,
|
|
1700
1700
|
url: `${prefixUrl.selectPrefix}/inventoryOrg`,
|
|
1701
1701
|
filter: 'qp-name,code-orGroup,like', // 过滤参数
|
|
1702
1702
|
mappingTextField: 'name',
|
|
@@ -1729,6 +1729,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
1729
1729
|
...selectConfigProps,
|
|
1730
1730
|
}
|
|
1731
1731
|
requestConfig = {
|
|
1732
|
+
init: true,
|
|
1732
1733
|
url: `${prefixUrl.selectPrefix}/company`,
|
|
1733
1734
|
filter: 'qp-name,code-orGroup,like', // 过滤参数
|
|
1734
1735
|
mappingTextField: 'name',
|
|
@@ -1761,6 +1762,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
1761
1762
|
...selectConfigProps,
|
|
1762
1763
|
}
|
|
1763
1764
|
requestConfig = {
|
|
1765
|
+
init: true,
|
|
1764
1766
|
url: `${prefixUrl.selectPrefix}/platCompany`,
|
|
1765
1767
|
filter: 'qp-name,socialCreditCode-orGroup,like', // 过滤参数
|
|
1766
1768
|
mappingTextField: 'name',
|
|
@@ -1793,6 +1795,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
1793
1795
|
...selectConfigProps,
|
|
1794
1796
|
}
|
|
1795
1797
|
requestConfig = {
|
|
1798
|
+
init: true,
|
|
1796
1799
|
url: `${prefixUrl.selectPrefix}/employee/v2`,
|
|
1797
1800
|
filter: 'qp-employeeNumber,name-orGroup,like', // 过滤参数
|
|
1798
1801
|
mappingTextField: 'name',
|
|
@@ -1890,6 +1893,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
1890
1893
|
...selectConfigProps,
|
|
1891
1894
|
}
|
|
1892
1895
|
requestConfig = {
|
|
1896
|
+
init: true,
|
|
1893
1897
|
url: `${prefixUrl.selectPrefix}/employee/pageList/v2`,
|
|
1894
1898
|
filter: 'qp-username,name-orGroup,like', // 过滤参数
|
|
1895
1899
|
mappingTextField: 'name',
|
|
@@ -2011,6 +2015,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
2011
2015
|
const isLogisCompanyCodeSingleSearch = requestConfigProp?.fixedparameter?.some((i: any) => i == 'qp-logisCompanyCode-eq');
|
|
2012
2016
|
const logisCompanyCodeSingleSearchName = isLogisCompanyCodeSingleSearch ? 'qp-logisCompanyCode-eq' : 'qp-logisCompanyCode-in';
|
|
2013
2017
|
requestConfig = {
|
|
2018
|
+
init: true,
|
|
2014
2019
|
url: `${prefixUrl.selectPrefix}/deliveryMode`,
|
|
2015
2020
|
filter: 'qp-name,code-orGroup,like', // 过滤参数
|
|
2016
2021
|
mappingTextField: 'name',
|
|
@@ -2138,6 +2143,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
2138
2143
|
...selectConfigProps,
|
|
2139
2144
|
}
|
|
2140
2145
|
requestConfig = {
|
|
2146
|
+
init: true,
|
|
2141
2147
|
url: `${prefixUrl.selectPrefix}/ruleTemplate`,
|
|
2142
2148
|
filter: 'qp-name,code-orGroup,like', // 过滤参数
|
|
2143
2149
|
mappingTextField: 'name',
|
|
@@ -2213,6 +2219,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
2213
2219
|
...selectConfigProps,
|
|
2214
2220
|
}
|
|
2215
2221
|
requestConfig = {
|
|
2222
|
+
init: true,
|
|
2216
2223
|
url: `${prefixUrl.selectPrefix}/role`,
|
|
2217
2224
|
filter: 'qp-name,code-orGroup,like', // 过滤参数
|
|
2218
2225
|
mappingTextField: 'name',
|
|
@@ -2311,6 +2318,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
2311
2318
|
...selectConfigProps,
|
|
2312
2319
|
}
|
|
2313
2320
|
requestConfig = {
|
|
2321
|
+
init: true,
|
|
2314
2322
|
url: `${prefixUrl.selectPrefix}/channelInfo`,
|
|
2315
2323
|
filter: 'qp-name,code-orGroup,like', // 过滤参数
|
|
2316
2324
|
mappingTextField: 'name',
|
|
@@ -2401,6 +2409,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
2401
2409
|
...selectConfigProps,
|
|
2402
2410
|
}
|
|
2403
2411
|
requestConfig = {
|
|
2412
|
+
init: true,
|
|
2404
2413
|
url: `${prefixUrl.selectPrefix}/orgViewNode/common/pageList`,
|
|
2405
2414
|
filter: 'qp-name-like', // 过滤参数
|
|
2406
2415
|
mappingTextField: 'name',
|
|
@@ -2534,6 +2543,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
2534
2543
|
...selectConfigProps,
|
|
2535
2544
|
}
|
|
2536
2545
|
requestConfig = {
|
|
2546
|
+
init: true,
|
|
2537
2547
|
url: `${prefixUrl.selectPrefix}/person`,
|
|
2538
2548
|
filter: 'qp-code,name-orGroup,like', // 过滤参数
|
|
2539
2549
|
mappingTextField: 'name',
|
|
@@ -2690,6 +2700,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
2690
2700
|
...selectConfigProps,
|
|
2691
2701
|
}
|
|
2692
2702
|
requestConfig = {
|
|
2703
|
+
init: true,
|
|
2693
2704
|
url: `${prefixUrl.selectPrefix}/priceType`,
|
|
2694
2705
|
filter: 'qp-code,name-orGroup,like', // 过滤参数
|
|
2695
2706
|
mappingTextField: 'name',
|
|
@@ -11,7 +11,6 @@ import { BusinessSearchSelect, QueryMutipleInput } from '@/index';
|
|
|
11
11
|
import { handleSourceName, getFormRowInfo, hasMoreQueryFields, defaultVisibleFieldsCount, getRealStr, ColSpan, getTableHeigth, getCurrentSRKs, getRenderSource } from './utils';
|
|
12
12
|
import { judgeIsRequestError } from '@/utils/requestUtils';
|
|
13
13
|
import zhankaitiaojian from '../../../assets/zhankaitiaojian-icon.svg';
|
|
14
|
-
import PropertySelector from '@/components/Business/PropertyModal';
|
|
15
14
|
|
|
16
15
|
const { Option } = Select;
|
|
17
16
|
|
|
@@ -181,7 +180,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
181
180
|
}))
|
|
182
181
|
|
|
183
182
|
// 获取数据源 (type: 1下拉框 2/3弹框 不传值默认为下拉框)
|
|
184
|
-
const getData = (params = {}, type = 1,callback?: any
|
|
183
|
+
const getData = (params = {}, type = 1,callback?: any) => {
|
|
185
184
|
if (!requestConfig) return;
|
|
186
185
|
|
|
187
186
|
setFetching(true)
|
|
@@ -328,12 +327,12 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
328
327
|
if (isNil(queryParams[selectParamsKey])) {
|
|
329
328
|
queryParams[selectParamsKey] = searchValue;
|
|
330
329
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
330
|
request
|
|
334
|
-
.
|
|
331
|
+
.get(
|
|
335
332
|
`${url}?${stringify(queryParams)}`,
|
|
336
|
-
|
|
333
|
+
{
|
|
334
|
+
headers: { ...extralHeaders }
|
|
335
|
+
})
|
|
337
336
|
.then((result: any) => {
|
|
338
337
|
setFetching(false)
|
|
339
338
|
result = result.data;
|
|
@@ -633,18 +632,12 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
633
632
|
|
|
634
633
|
const onSearchTable = () => {
|
|
635
634
|
const params = form.getFieldsValue();
|
|
636
|
-
console.log('dddd', params);
|
|
637
635
|
|
|
638
636
|
// const isHaveParams = params && Object.keys(params).filter(item => params[item]).length > 0;
|
|
639
637
|
setModalSearched(true);
|
|
640
|
-
|
|
641
|
-
let unique_params = null;
|
|
642
|
-
if (params['UNIQUE_SPEC']) {
|
|
643
|
-
unique_params = params['UNIQUE_SPEC']?.propertyList || [];
|
|
644
|
-
}
|
|
645
638
|
|
|
646
639
|
setTableFormParams(params);
|
|
647
|
-
getData({ ...params, pageSize: tableInitPageSize }, 2
|
|
640
|
+
getData({ ...params, pageSize: tableInitPageSize }, 2)
|
|
648
641
|
}
|
|
649
642
|
|
|
650
643
|
const onResetTable = () => {
|
|
@@ -824,16 +817,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
824
817
|
</Col>
|
|
825
818
|
);
|
|
826
819
|
}
|
|
827
|
-
if (i?.field?.type === 'proppertySelector') {
|
|
828
|
-
return (
|
|
829
|
-
<Col span={ColSpan} key={i.name}>
|
|
830
|
-
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
831
|
-
<PropertySelector
|
|
832
|
-
/>
|
|
833
|
-
</Form.Item>
|
|
834
|
-
</Col>
|
|
835
|
-
);
|
|
836
|
-
}
|
|
837
820
|
|
|
838
821
|
// 默认type是input
|
|
839
822
|
return (
|
package/src/index.ts
CHANGED
|
@@ -35,7 +35,6 @@ export { default as JsonQueryTable } from './components/Business/JsonQueryTable'
|
|
|
35
35
|
export { default as TableColumnSetting} from './plugin/TableColumnSetting';
|
|
36
36
|
export { default as AuthButton } from './components/Functional/AuthButton';
|
|
37
37
|
export { default as CustomSelector } from './components/Solution/RuleComponent/CustomPlugin/CustomSelector';
|
|
38
|
-
export { default as PropertySelector} from './components/Business/PropertyModal';
|
|
39
38
|
|
|
40
39
|
export { default as EllipsisTooltip} from './components/Functional/EllipsisTooltip';
|
|
41
40
|
export * from './components/Functional/BsAntdSula/index';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import "./index.less";
|
|
3
|
-
interface propertyValueType {
|
|
4
|
-
propertyName: string;
|
|
5
|
-
propertyCode: string;
|
|
6
|
-
isCommonUse?: Boolean | String;
|
|
7
|
-
detailList: Array<{
|
|
8
|
-
name: string;
|
|
9
|
-
value: string;
|
|
10
|
-
isCommonUse?: Boolean | String;
|
|
11
|
-
}>;
|
|
12
|
-
}
|
|
13
|
-
interface valueType {
|
|
14
|
-
classifyCode: string;
|
|
15
|
-
classifyName: string;
|
|
16
|
-
propertyList: propertyValueType[];
|
|
17
|
-
}
|
|
18
|
-
declare const PropertySelector: ({ value, onChange, width, ...restProps }: {
|
|
19
|
-
value: valueType;
|
|
20
|
-
onChange: any;
|
|
21
|
-
width: string;
|
|
22
|
-
}) => React.JSX.Element;
|
|
23
|
-
export default PropertySelector;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
.property_classify_content {
|
|
2
|
-
margin-bottom: 15px;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.property_classify_content1 {
|
|
6
|
-
max-height: 350px;
|
|
7
|
-
overflow-y: scroll;
|
|
8
|
-
overflow-x: hidden;
|
|
9
|
-
}
|
|
10
|
-
//滚动条
|
|
11
|
-
/* 滚动槽(轨道)宽高 */
|
|
12
|
-
.property_classify_content1::-webkit-scrollbar {
|
|
13
|
-
width: 5px; /*对垂直流动条有效*/
|
|
14
|
-
height: 5px; /*对水平流动条有效*/
|
|
15
|
-
}
|
|
16
|
-
/* 滚动槽(轨道)样式 */
|
|
17
|
-
.property_classify_content1::-webkit-scrollbar-track {
|
|
18
|
-
background-color: #ffffff;
|
|
19
|
-
border-radius: 8px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/*定义滑块颜色、内阴影及圆角*/
|
|
23
|
-
.property_classify_content1::-webkit-scrollbar-thumb {
|
|
24
|
-
border-radius: 7px;
|
|
25
|
-
background-color: #CECECE;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/*定义两端按钮的样式*/
|
|
29
|
-
.property_classify_content1::-webkit-scrollbar-button {
|
|
30
|
-
display: none;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.propertyGroup_container {
|
|
34
|
-
display: flex;
|
|
35
|
-
margin-bottom: 16px;
|
|
36
|
-
.propertyGroup_container_left {
|
|
37
|
-
width: 100px;
|
|
38
|
-
flex-shrink: 0;
|
|
39
|
-
flex-grow: 0;
|
|
40
|
-
}
|
|
41
|
-
.propertyGroup_container_right {
|
|
42
|
-
width: 560px;
|
|
43
|
-
flex-shrink: 0;
|
|
44
|
-
flex-grow: 0;
|
|
45
|
-
display: flex;
|
|
46
|
-
flex-wrap: wrap;
|
|
47
|
-
}
|
|
48
|
-
.ant-checkbox-wrapper + .ant-checkbox-wrapper {
|
|
49
|
-
margin-left: 0px;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.propertyGroup_checkbox_container {
|
|
54
|
-
width: 80px;
|
|
55
|
-
overflow: hidden;
|
|
56
|
-
text-overflow: ellipsis;
|
|
57
|
-
white-space: nowrap;
|
|
58
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
nav:
|
|
3
|
-
title: '组件'
|
|
4
|
-
order: 1
|
|
5
|
-
group:
|
|
6
|
-
title: 业务组件
|
|
7
|
-
order: 1
|
|
8
|
-
title: PropertySelector 属性选择器
|
|
9
|
-
order: 1
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# PropertySelector
|
|
13
|
-
|
|
14
|
-
## 属性选择器
|
|
15
|
-
|
|
16
|
-
```tsx
|
|
17
|
-
import React, { useState } from 'react';
|
|
18
|
-
import PropertySelector from './index.tsx';
|
|
19
|
-
|
|
20
|
-
export default () => {
|
|
21
|
-
|
|
22
|
-
const [value, setValue] = useState({});
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<div style={{ width: '200px' }}>
|
|
26
|
-
<PropertySelector
|
|
27
|
-
value={value}
|
|
28
|
-
onChange={(value) => setValue(value)}
|
|
29
|
-
/>
|
|
30
|
-
</div>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
```
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState, useRef } from "react";
|
|
2
|
-
import { Modal, Select, Tag } from "antd";
|
|
3
|
-
import "./index.less";
|
|
4
|
-
import { MockPropertyList } from "./mockData";
|
|
5
|
-
import PropertyGroup from "./propertyGroup";
|
|
6
|
-
import { CaretUpOutlined, CaretDownOutlined, CaretUpFilled, CaretDownFilled } from '@ant-design/icons';
|
|
7
|
-
import request from '@/utils/request';
|
|
8
|
-
import { judgeIsRequestError } from "@/utils";
|
|
9
|
-
|
|
10
|
-
interface propertyValueType {
|
|
11
|
-
propertyName: string;
|
|
12
|
-
propertyCode: string;
|
|
13
|
-
isCommonUse?: Boolean | String;
|
|
14
|
-
detailList: Array<{
|
|
15
|
-
name: string;
|
|
16
|
-
value: string;
|
|
17
|
-
isCommonUse?: Boolean | String;
|
|
18
|
-
}>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface valueType {
|
|
22
|
-
classifyCode: string;
|
|
23
|
-
classifyName: string;
|
|
24
|
-
propertyList: propertyValueType[];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface PropertyGroupValueType {
|
|
28
|
-
propertyCode: string;
|
|
29
|
-
propertyName: string;
|
|
30
|
-
detailList: Array<{
|
|
31
|
-
name: string;
|
|
32
|
-
value: string;
|
|
33
|
-
}>;
|
|
34
|
-
}
|
|
35
|
-
const PropertySelector = ({
|
|
36
|
-
value,
|
|
37
|
-
onChange,
|
|
38
|
-
width,
|
|
39
|
-
...restProps
|
|
40
|
-
}: { value: valueType, onChange: any, width: string }
|
|
41
|
-
) => {
|
|
42
|
-
const settingValue = useRef<valueType>({
|
|
43
|
-
classifyCode: '',
|
|
44
|
-
classifyName: '',
|
|
45
|
-
propertyList: []
|
|
46
|
-
});
|
|
47
|
-
const [choosedValues, setChoosedValues] = useState<any[]>([]);
|
|
48
|
-
const [choosedClassify, setChoosedClassify] = useState('');
|
|
49
|
-
const [commonProperty, setCommonUseProperty] = useState<any[]>([]);
|
|
50
|
-
const [notCommonProperty, setNotCommonProperty] = useState<any[]>([]);
|
|
51
|
-
|
|
52
|
-
const [visible, setVisible] = useState(false);
|
|
53
|
-
const [showNotCommon, setShowNotCommon] = useState(false); // 是否展示非常用属性
|
|
54
|
-
const [classifyOptionList, setClassifyOptionList] = useState<any[]>([]);
|
|
55
|
-
const [listKey, setListKey] = useState('1');
|
|
56
|
-
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
request({
|
|
59
|
-
url: '/items/class/withProperty?pageSize=500¤tPage=1',
|
|
60
|
-
method: 'GET',
|
|
61
|
-
})
|
|
62
|
-
.then(({data}: any) => {
|
|
63
|
-
if (judgeIsRequestError(data)) {
|
|
64
|
-
return
|
|
65
|
-
}
|
|
66
|
-
const items = data.data?.items || [];
|
|
67
|
-
setClassifyOptionList(items.map((item: any) => ({
|
|
68
|
-
label: item.name,
|
|
69
|
-
value: item.id,
|
|
70
|
-
})))
|
|
71
|
-
})
|
|
72
|
-
}, [])
|
|
73
|
-
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
if (!choosedClassify) return;
|
|
76
|
-
request({
|
|
77
|
-
url: `/items/classProperty/${choosedClassify}`,
|
|
78
|
-
method: 'GET',
|
|
79
|
-
})
|
|
80
|
-
.then(({data}: any) => {
|
|
81
|
-
if (judgeIsRequestError(data)) {
|
|
82
|
-
return
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const newArr = (data?.data || []).map((item: any) => {
|
|
86
|
-
return {
|
|
87
|
-
propertyCode: item.property.propertyCode,
|
|
88
|
-
propertyName: item.property.name,
|
|
89
|
-
propertyId: item.property.id,
|
|
90
|
-
isCommonUse: item.property.isCommonUse === 'commonUse',
|
|
91
|
-
detailList: item.propertyValueList.map((detail: any) => ({
|
|
92
|
-
name: detail.value,
|
|
93
|
-
value: detail.value,
|
|
94
|
-
isCommonUse: detail.isCommonUse === 'commonUse',
|
|
95
|
-
}))
|
|
96
|
-
}
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
setCommonUseProperty(newArr.filter((item: any) => item.isCommonUse))
|
|
100
|
-
setNotCommonProperty(newArr.filter((item: any) => !item.isCommonUse))
|
|
101
|
-
setListKey(listKey === '1' ? '2' : '1');
|
|
102
|
-
})
|
|
103
|
-
}, [choosedClassify])
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
useEffect(() => {
|
|
107
|
-
// 获取选中品类信息
|
|
108
|
-
setChoosedClassify(value?.classifyCode);
|
|
109
|
-
|
|
110
|
-
// 获取选中属性值展示
|
|
111
|
-
const choosedPropertyList = (value?.propertyList || []).map(item => (item.detailList || []).map(detail => detail.name)).flat();
|
|
112
|
-
if ((value?.propertyList || []).some(item => !item.isCommonUse)) {
|
|
113
|
-
setShowNotCommon(true);
|
|
114
|
-
}
|
|
115
|
-
setChoosedValues(choosedPropertyList);
|
|
116
|
-
settingValue.current = {...value};
|
|
117
|
-
}, [value])
|
|
118
|
-
|
|
119
|
-
// 关闭弹窗回传组件值
|
|
120
|
-
const handleConfirm = () => {
|
|
121
|
-
setVisible(false);
|
|
122
|
-
onChange(settingValue.current);
|
|
123
|
-
}
|
|
124
|
-
const onCancel = () => {
|
|
125
|
-
setVisible(false);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// 获取选中属性值信息
|
|
129
|
-
const handleProperyItemChange = (value: PropertyGroupValueType) => {
|
|
130
|
-
const newDetailList = settingValue.current?.propertyList || [];
|
|
131
|
-
const itemIndex = newDetailList.findIndex((item: any) => item.propertyCode === value.propertyCode);
|
|
132
|
-
if (itemIndex !== -1) {
|
|
133
|
-
newDetailList[itemIndex] = value;
|
|
134
|
-
} else {
|
|
135
|
-
newDetailList.push(value);
|
|
136
|
-
}
|
|
137
|
-
settingValue.current = {
|
|
138
|
-
...settingValue.current,
|
|
139
|
-
propertyList: newDetailList.filter(item => item.detailList && item.detailList.length),
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
//修改品类值
|
|
144
|
-
const onClassifyChange = (value: string, option: any) => {
|
|
145
|
-
setChoosedClassify(value);
|
|
146
|
-
settingValue.current = {
|
|
147
|
-
classifyCode: value,
|
|
148
|
-
classifyName: option.children,
|
|
149
|
-
propertyList: [],
|
|
150
|
-
};
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
const tagRender = (props: any) => {
|
|
154
|
-
const { label, value, closable, onClose } = props;
|
|
155
|
-
const onPreventMouseDown = (event: any) => {
|
|
156
|
-
event.preventDefault();
|
|
157
|
-
event.stopPropagation();
|
|
158
|
-
};
|
|
159
|
-
return (
|
|
160
|
-
<Tag
|
|
161
|
-
closable={false}
|
|
162
|
-
style={{ marginRight: 3, height: '20px', fontSize: '12px' }}
|
|
163
|
-
>
|
|
164
|
-
{label}
|
|
165
|
-
</Tag>
|
|
166
|
-
);
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
return (
|
|
170
|
-
<div>
|
|
171
|
-
<Select
|
|
172
|
-
maxTagCount={1}
|
|
173
|
-
tagRender={tagRender}
|
|
174
|
-
{...restProps}
|
|
175
|
-
mode="multiple"
|
|
176
|
-
value={choosedValues}
|
|
177
|
-
onClick={() => {
|
|
178
|
-
setVisible(true)
|
|
179
|
-
}}
|
|
180
|
-
style={{ width: width || '100%' }}
|
|
181
|
-
open={false}
|
|
182
|
-
/>
|
|
183
|
-
<Modal
|
|
184
|
-
title="属性设置"
|
|
185
|
-
width={700}
|
|
186
|
-
open={visible}
|
|
187
|
-
onOk={handleConfirm}
|
|
188
|
-
destroyOnClose
|
|
189
|
-
onCancel={onCancel}
|
|
190
|
-
cancelText={'取消'}
|
|
191
|
-
okText={'确定'}
|
|
192
|
-
>
|
|
193
|
-
<div>
|
|
194
|
-
<div className={'property_classify_content'}>
|
|
195
|
-
<span style={{ marginRight: '10px' }}>品类模板</span>
|
|
196
|
-
<Select
|
|
197
|
-
style={{ width: '200px' }}
|
|
198
|
-
value={choosedClassify}
|
|
199
|
-
options={classifyOptionList}
|
|
200
|
-
onChange={(value, option) => {
|
|
201
|
-
onClassifyChange(value, option);
|
|
202
|
-
}}
|
|
203
|
-
/>
|
|
204
|
-
</div>
|
|
205
|
-
<div className={'property_classify_content1'} key={listKey}>
|
|
206
|
-
<div>
|
|
207
|
-
{
|
|
208
|
-
commonProperty.map(item => (
|
|
209
|
-
<PropertyGroup
|
|
210
|
-
modalVisilbe={visible}
|
|
211
|
-
itemValue={settingValue.current}
|
|
212
|
-
propertyData={item}
|
|
213
|
-
handleProperyItemChange={handleProperyItemChange}
|
|
214
|
-
/>
|
|
215
|
-
))
|
|
216
|
-
}
|
|
217
|
-
</div>
|
|
218
|
-
<div>
|
|
219
|
-
{
|
|
220
|
-
showNotCommon && notCommonProperty.map(item => (
|
|
221
|
-
<PropertyGroup
|
|
222
|
-
modalVisilbe={visible}
|
|
223
|
-
itemValue={settingValue.current}
|
|
224
|
-
propertyData={item}
|
|
225
|
-
handleProperyItemChange={handleProperyItemChange}
|
|
226
|
-
/>
|
|
227
|
-
))
|
|
228
|
-
}
|
|
229
|
-
</div>
|
|
230
|
-
</div>
|
|
231
|
-
{
|
|
232
|
-
!!notCommonProperty.length && (
|
|
233
|
-
<div>
|
|
234
|
-
<div
|
|
235
|
-
style={{ width: '50px', cursor: 'pointer', color: '#005cff', fontSize: '10px' }}
|
|
236
|
-
onClick={() => setShowNotCommon(!showNotCommon)}
|
|
237
|
-
>
|
|
238
|
-
{
|
|
239
|
-
showNotCommon && (
|
|
240
|
-
<>
|
|
241
|
-
<CaretUpOutlined />
|
|
242
|
-
收起
|
|
243
|
-
</>
|
|
244
|
-
)
|
|
245
|
-
}
|
|
246
|
-
{
|
|
247
|
-
!showNotCommon && (
|
|
248
|
-
<>
|
|
249
|
-
<CaretDownOutlined />
|
|
250
|
-
展开
|
|
251
|
-
</>
|
|
252
|
-
)
|
|
253
|
-
}
|
|
254
|
-
</div>
|
|
255
|
-
</div>
|
|
256
|
-
)
|
|
257
|
-
}
|
|
258
|
-
</div>
|
|
259
|
-
|
|
260
|
-
</Modal>
|
|
261
|
-
</div>
|
|
262
|
-
)
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
export default PropertySelector;
|
|
266
|
-
|