Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
shenshaokai
jinfa-platform
Commits
2f6c837d
Commit
2f6c837d
authored
Jan 13, 2022
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 处理品类属性树切换会调用两次接口的问题
parent
57d0f452
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
index.tsx
src/pages/classAndProperty/categoryAttributes/index.tsx
+9
-2
index.tsx
src/pages/classAndProperty/propertyValue/index.tsx
+7
-2
No files found.
src/pages/classAndProperty/categoryAttributes/index.tsx
View file @
2f6c837d
...
...
@@ -88,6 +88,7 @@ const CategoryAttributes: React.FC<{}> = () => {
const
[
selectedTableRowKeys
,
setSelectedTableRowKeys
]
=
useState
<
Array
<
number
>>
([])
//表格选择
const
[
linkTableRowData
,
setLinkTableRowData
]
=
useState
<
any
[]
>
([])
const
[
goodsRowSelection
,
goodsRowCtl
]
=
useRowSelectionTable
()
const
flag
=
useRef
<
boolean
>
(
false
)
// 标识 初始点击品类不执行effect的重载表格
const
{
treeStatus
,
...
...
@@ -107,12 +108,17 @@ const CategoryAttributes: React.FC<{}> = () => {
// 获取选中项的关联属性列表
useEffect
(()
=>
{
if
(
selectKey
)
if
(
selectKey
&&
flag
.
current
)
{
ref
.
current
.
reload
()
// ref.current.reload({ current: 1, pageSize: 10, name: '', categoryId: selectKey, isByCategory: true })
}
else
if
(
!
selectKey
)
{
flag
.
current
=
false
}
else
{
flag
.
current
=
true
}
},
[
selectKey
])
const
fetchLinkAttributeData
=
(
params
:
any
)
=>
{
console
.
log
(
1
)
return
new
Promise
((
resolve
,
reject
)
=>
{
getProductCustomerGetCustomerCategoryAttributeList
({
...
params
,
...
...
@@ -128,6 +134,7 @@ const CategoryAttributes: React.FC<{}> = () => {
// 获取所有属性列表
const
fetchAttributeData
=
(
params
:
any
)
=>
{
console
.
log
(
2
)
return
new
Promise
((
resolve
,
reject
)
=>
{
getProductCustomerGetCustomerCategoryAttributeList
({
...
params
,
...
...
src/pages/classAndProperty/propertyValue/index.tsx
View file @
2f6c837d
...
...
@@ -95,6 +95,7 @@ const PropertyValue: React.FC<{}> = () => {
// const [selectRow, setSelectRow] = useState<any[]>([]) // 模态框选择的行数据
// const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
const
[
rowSelection
,
rowSelectionCtl
]
=
useRowSelectionTable
({
customKey
:
'id'
})
const
flag
=
useRef
<
boolean
>
(
false
)
// 标识 初始点击品类不执行effect的重载表格
const
{
treeData
,
...
...
@@ -119,8 +120,12 @@ const PropertyValue: React.FC<{}> = () => {
},
[])
useEffect
(()
=>
{
if
(
selectKey
)
{
if
(
selectKey
&&
flag
.
current
)
{
ref
.
current
.
reload
({
current
:
1
,
pageSize
:
10
,
name
:
''
,
customerAttributeId
:
selectKey
})
}
else
if
(
!
selectKey
)
{
flag
.
current
=
false
}
else
{
flag
.
current
=
true
}
},
[
selectKey
])
...
...
@@ -217,7 +222,7 @@ const PropertyValue: React.FC<{}> = () => {
type=
'link'
onClick=
{
()
=>
history
.
push
(
`/memberCenter/commodityAbility/classAndProperty/propertyValue/edit?attrId=${selectKey}&attrName=${record.customerAttribute.name}&attrValueId=${record.id}`
)
}
>
{
intl
.
formatMessage
({
id
:
'classAndProperty.propertyValue.columns.
option.
button.1'
})
}
{
intl
.
formatMessage
({
id
:
'classAndProperty.propertyValue.columns.button.1'
})
}
</
Button
>
<
Popconfirm
title=
{
intl
.
formatMessage
({
id
:
'classAndProperty.propertyValue.columns.button.2.popconfirm.title'
})
}
...
...
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