Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
merchant-manage-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
merchant-manage-ui
Commits
7fbd131f
Commit
7fbd131f
authored
Mar 28, 2022
by
luoxiaodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
三级联动
parent
90658caf
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
48 deletions
+51
-48
index.jsx
src/pages/GoodsManage/SearchForm/index.jsx
+4
-3
index.jsx
src/pages/GoodsManage/TempleatModal/index.jsx
+3
-1
index.jsx
src/pages/GoodsManage/createModal/index.jsx
+6
-8
index.jsx
src/pages/distributionArea/addArea/index.jsx
+38
-36
No files found.
src/pages/GoodsManage/SearchForm/index.jsx
View file @
7fbd131f
// import { Form } from '@ant-design/compatible';
// import '@ant-design/compatible/assets/index.css';
import
{
Form
,
Button
,
Input
,
Select
,
notification
,
Upload
,
Cascader
,
InputNumber
}
from
'
antd
'
;
import
{
Form
,
Button
,
Input
,
Select
,
notification
,
Upload
,
Cascader
,
InputNumber
}
from
'
antd
'
;
import
'
@ant-design/compatible/assets/index.css
'
;
import
React
,
{
Component
}
from
'
react
'
;
import
React
,
{
Component
}
from
'
react
'
;
import
{
connect
}
from
'
dva
'
;
import
{
connect
}
from
'
dva
'
;
import
styles
from
'
../style.less
'
;
import
styles
from
'
../style.less
'
;
...
@@ -14,6 +11,7 @@ const { Option } = Select;
...
@@ -14,6 +11,7 @@ const { Option } = Select;
}))
}))
class
goodsManage
extends
Component
{
class
goodsManage
extends
Component
{
formRef
=
React
.
createRef
();
formRef
=
React
.
createRef
();
componentDidMount
()
{
componentDidMount
()
{
this
.
props
.
onRef
(
this
);
this
.
props
.
onRef
(
this
);
this
.
handleSearch
();
this
.
handleSearch
();
...
@@ -27,6 +25,7 @@ class goodsManage extends Component {
...
@@ -27,6 +25,7 @@ class goodsManage extends Component {
handleSearch
=
()
=>
{
handleSearch
=
()
=>
{
this
.
props
.
handleSearch
(
1
);
this
.
props
.
handleSearch
(
1
);
};
};
valueMin
=
value
=>
{
valueMin
=
value
=>
{
const
{
getFieldValue
,
setFieldsValue
}
=
this
.
formRef
.
current
;
const
{
getFieldValue
,
setFieldsValue
}
=
this
.
formRef
.
current
;
const
minVal
=
getFieldValue
(
'
supplyPriceMin
'
);
const
minVal
=
getFieldValue
(
'
supplyPriceMin
'
);
...
@@ -34,11 +33,13 @@ class goodsManage extends Component {
...
@@ -34,11 +33,13 @@ class goodsManage extends Component {
setFieldsValue
({
supplyPriceMax
:
minVal
});
setFieldsValue
({
supplyPriceMax
:
minVal
});
}
}
};
};
onReset
=
()
=>
{
onReset
=
()
=>
{
const
form
=
this
.
formRef
.
current
;
const
form
=
this
.
formRef
.
current
;
form
.
resetFields
();
form
.
resetFields
();
this
.
props
.
onReset
();
this
.
props
.
onReset
();
};
};
addSpu
=
()
=>
{
addSpu
=
()
=>
{
this
.
props
.
addSpu
();
this
.
props
.
addSpu
();
};
};
...
...
src/pages/GoodsManage/TempleatModal/index.jsx
View file @
7fbd131f
import
{
Form
,
Modal
,
Input
,
Select
,
Cascader
,
Tag
,
notification
}
from
'
antd
'
;
import
{
Form
}
from
'
@ant-design/compatible
'
;
import
'
@ant-design/compatible/assets/index.css
'
;
import
{
Modal
,
Input
,
Select
,
Cascader
,
Tag
,
notification
}
from
'
antd
'
;
import
{
da
}
from
'
date-fns/locale
'
;
import
{
da
}
from
'
date-fns/locale
'
;
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
getTemplate
}
from
'
../service
'
;
import
{
getTemplate
}
from
'
../service
'
;
...
...
src/pages/GoodsManage/createModal/index.jsx
View file @
7fbd131f
...
@@ -2,13 +2,13 @@
...
@@ -2,13 +2,13 @@
import
{
Form
}
from
'
@ant-design/compatible
'
;
import
{
Form
}
from
'
@ant-design/compatible
'
;
import
'
@ant-design/compatible/assets/index.css
'
;
import
'
@ant-design/compatible/assets/index.css
'
;
import
{
MinusCircleOutlined
,
PlusOutlined
,
RestOutlined
}
from
'
@ant-design/icons
'
;
import
{
import
{
Modal
,
Modal
,
Table
,
Table
,
Button
,
Button
,
Select
,
Select
,
Input
,
Input
,
Icon
,
Row
,
Row
,
Col
,
Col
,
Checkbox
,
Checkbox
,
...
@@ -680,9 +680,8 @@ class goodsManage extends Component {
...
@@ -680,9 +680,8 @@ class goodsManage extends Component {
/>,
/>,
)
}
)
}
{
firstKeys
.
length
>
0
?
(
{
firstKeys
.
length
>
0
?
(
<
Icon
<
MinusCircleOutlined
className=
"dynamic-delete-button"
className=
"dynamic-delete-button"
type=
"minus-circle-o"
onClick=
{
()
=>
this
.
remove
(
'
firstKeys
'
,
k
)
}
onClick=
{
()
=>
this
.
remove
(
'
firstKeys
'
,
k
)
}
/>
/>
)
:
null
}
)
:
null
}
...
@@ -695,7 +694,7 @@ class goodsManage extends Component {
...
@@ -695,7 +694,7 @@ class goodsManage extends Component {
onClick=
{
()
=>
this
.
add
(
'
firstKeys
'
)
}
onClick=
{
()
=>
this
.
add
(
'
firstKeys
'
)
}
style=
{
{
textAlign
:
'
center
'
}
}
style=
{
{
textAlign
:
'
center
'
}
}
>
>
<
Icon
type=
"plus"
/>
<
PlusOutlined
/>
</
Button
>
</
Button
>
</
FormItem
>
</
FormItem
>
</
Row
>
</
Row
>
...
@@ -744,9 +743,8 @@ class goodsManage extends Component {
...
@@ -744,9 +743,8 @@ class goodsManage extends Component {
validateTrigger
:
[
'
onChange
'
,
'
onBlur
'
],
validateTrigger
:
[
'
onChange
'
,
'
onBlur
'
],
})(<
Input
key=
{
k
}
style=
{
{
width
:
'
60%
'
,
marginRight
:
8
}
}
/>)
}
})(<
Input
key=
{
k
}
style=
{
{
width
:
'
60%
'
,
marginRight
:
8
}
}
/>)
}
{
secondKeys
.
length
>
0
?
(
{
secondKeys
.
length
>
0
?
(
<
Icon
<
MinusCircleOutlined
className=
"dynamic-delete-button"
className=
"dynamic-delete-button"
type=
"minus-circle-o"
onClick=
{
()
=>
this
.
remove
(
'
secondKeys
'
,
k
)
}
onClick=
{
()
=>
this
.
remove
(
'
secondKeys
'
,
k
)
}
/>
/>
)
:
null
}
)
:
null
}
...
@@ -759,7 +757,7 @@ class goodsManage extends Component {
...
@@ -759,7 +757,7 @@ class goodsManage extends Component {
style=
{
{
textAlign
:
'
center
'
}
}
style=
{
{
textAlign
:
'
center
'
}
}
disabled=
{
isJDGoods
}
disabled=
{
isJDGoods
}
>
>
<
Icon
type=
"plus"
/>
<
PlusOutlined
/>
</
Button
>
</
Button
>
</
FormItem
>
</
FormItem
>
</
Row
>
</
Row
>
...
@@ -815,7 +813,7 @@ class goodsManage extends Component {
...
@@ -815,7 +813,7 @@ class goodsManage extends Component {
size=
"small"
size=
"small"
onClick=
{
this
.
deleteImg
}
onClick=
{
this
.
deleteImg
}
style=
{
{
marginTop
:
'
10px
'
}
}
style=
{
{
marginTop
:
'
10px
'
}
}
icon=
"rest"
icon=
{
<
RestOutlined
/>
}
>
>
图片批量删除
图片批量删除
</
Button
>
</
Button
>
...
...
src/pages/distributionArea/addArea/index.jsx
View file @
7fbd131f
import
{
Form
,
Modal
,
Input
,
Select
,
Cascader
,
Tag
,
notification
}
from
'
antd
'
;
import
{
Form
}
from
'
@ant-design/compatible
'
;
import
'
@ant-design/compatible/assets/index.css
'
;
import
{
Modal
,
Input
,
Select
,
Cascader
,
Tag
,
notification
}
from
'
antd
'
;
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
RcTreeSelect
from
'
rc-tree-select
'
;
import
{
el
}
from
'
date-fns/locale
'
;
import
{
el
}
from
'
date-fns/locale
'
;
import
{
areaList
,
getAddTemplate
,
forbiddenAddress
}
from
'
../services
'
;
import
{
areaList
,
getAddTemplate
,
forbiddenAddress
}
from
'
../services
'
;
...
@@ -9,10 +10,11 @@ const { Option } = Select;
...
@@ -9,10 +10,11 @@ const { Option } = Select;
const
AddAreaModal
=
props
=>
{
const
AddAreaModal
=
props
=>
{
const
{
const
{
visible
,
visible
,
form
:
{
getFieldDecorator
,
validateFields
,
resetFields
},
form
:
{
getFieldDecorator
,
validateFields
,
resetFields
,
setFieldsValue
},
templateData
,
templateData
,
}
=
props
;
}
=
props
;
const
[
addList
,
setAddList
]
=
useState
([]);
const
[
addList
,
setAddList
]
=
useState
([]);
const
[
initList
,
setInitList
]
=
useState
([]);
const
[
selectedList
,
setSelectedList
]
=
useState
([]);
const
[
selectedList
,
setSelectedList
]
=
useState
([]);
const
[
selected
,
setSelect
]
=
useState
([]);
const
[
selected
,
setSelect
]
=
useState
([]);
const
a
=
[];
const
a
=
[];
...
@@ -38,6 +40,7 @@ const AddAreaModal = props => {
...
@@ -38,6 +40,7 @@ const AddAreaModal = props => {
}),
}),
);
);
setAddList
(
newData
);
setAddList
(
newData
);
setInitList
(
newData
);
}
}
};
};
...
@@ -59,14 +62,19 @@ const AddAreaModal = props => {
...
@@ -59,14 +62,19 @@ const AddAreaModal = props => {
value
:
itemData
.
addrId
,
value
:
itemData
.
addrId
,
addressId
:
itemData
.
addrId
,
addressId
:
itemData
.
addrId
,
addressLevel
:
itemData
.
addrLevel
,
addressLevel
:
itemData
.
addrLevel
,
// isLeaf: itemData.addrLevel === 4,
isLeaf
:
false
,
isLeaf
:
false
,
}),
}),
);
);
targetOption
.
children
=
newData
;
targetOption
.
children
=
newData
;
let
checkedData
=
[];
if
(
targetOption
.
addressLevel
>
1
)
{
checkedData
=
initList
.
concat
(
targetOption
).
concat
(
newData
);
}
else
{
checkedData
=
initList
.
concat
(
newData
);
}
}
targetOption
.
loading
=
false
;
targetOption
.
loading
=
false
;
setAddList
([...
addList
]);
setAddList
([...
addList
]);
}
};
};
// 限制区域删除
// 限制区域删除
const
preventDefault
=
val
=>
{
const
preventDefault
=
val
=>
{
...
@@ -119,45 +127,40 @@ const AddAreaModal = props => {
...
@@ -119,45 +127,40 @@ const AddAreaModal = props => {
});
});
};
};
// 判断是否重复
// 判断是否重复
const
getChilds
=
(
data
,
{
addressId
})
=>
{
const
getChilds
=
(
data
,
address
)
=>
{
let
flag
=
true
;
const
arr
=
[];
const
arr
=
[];
function
judgeChildren
(
dat
)
{
const
reslutData
=
[];
// eslint-disable-next-line no-plusplus
for
(
let
i
=
0
;
i
<
data
.
length
;
i
+=
1
)
{
for
(
let
i
=
0
;
i
<
dat
.
length
;
i
++
)
{
const
item
=
data
[
i
];
const
item
=
dat
[
i
];
if
(
!
item
.
addressName
.
includes
(
address
.
addressName
))
{
if
(
!
flag
)
{
arr
.
push
(
item
);
return
;
}
}
if
(
+
item
.
addressId
===
+
addressId
)
{
flag
=
false
;
}
}
// if (item.children && item.children.length) {
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
+=
1
)
{
// judgeChildren(item.children);
const
item
=
arr
[
i
];
// }
if
(
!
address
.
addressName
.
includes
(
item
.
addressName
))
{
reslutData
.
push
(
item
);
}
}
}
}
judgeChildren
(
data
);
return
reslutData
;
return
flag
;
};
};
const
onPopupVisibleChange
=
labels
=>
{
const
onPopupVisibleChange
=
labels
=>
{
if
(
!
labels
&&
selected
?.
length
)
{
if
(
!
labels
&&
selected
?.
length
)
{
let
data
=
selectedList
;
const
select
=
selected
.
slice
(
-
1
)[
0
];
const
select
=
selected
.
slice
(
-
1
)[
0
];
const
arr
=
selected
.
map
(
x
=>
x
.
label
);
const
arr
=
selected
.
map
(
x
=>
x
.
label
);
select
.
addressName
=
arr
.
join
(
'
/
'
);
select
.
addressName
=
arr
.
join
(
'
/
'
);
const
staust
=
getChilds
(
selectedList
,
select
);
const
staust
=
getChilds
(
data
,
select
);
if
(
staust
)
{
staust
.
push
(
select
);
selectedList
.
push
(
select
)
;
data
=
staust
;
// 用中文字符排序
// 用中文字符排序
const
resultArray
=
selectedList
.
sort
((
param1
,
param2
)
=>
const
resultArray
=
data
.
sort
((
param1
,
param2
)
=>
param1
.
addressName
.
localeCompare
(
param2
.
addressName
,
'
zh
'
),
param1
.
addressName
.
localeCompare
(
param2
.
addressName
,
'
zh
'
),
);
);
setSelectedList
([...
resultArray
]);
setSelectedList
([...
resultArray
]);
setSelect
([]);
setSelect
([]);
}
}
}
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
getAreaList
();
getAreaList
();
if
(
props
.
templateData
)
{
if
(
props
.
templateData
)
{
...
@@ -189,9 +192,8 @@ const AddAreaModal = props => {
...
@@ -189,9 +192,8 @@ const AddAreaModal = props => {
loadData=
{
loadData
}
loadData=
{
loadData
}
onChange=
{
(
val
,
label
)
=>
onChange
(
val
,
label
)
}
onChange=
{
(
val
,
label
)
=>
onChange
(
val
,
label
)
}
allowClear=
{
false
}
allowClear=
{
false
}
// expandTrigger="hover"
changeOnSelect
changeOnSelect
on
Popup
VisibleChange=
{
onPopupVisibleChange
}
on
Dropdown
VisibleChange=
{
onPopupVisibleChange
}
/>,
/>,
)
}
)
}
{
selectedList
?.
map
((
selItem
,
selIndex
)
=>
(
{
selectedList
?.
map
((
selItem
,
selIndex
)
=>
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment