Commit 395f7058 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix: 处理品类属性树切换会调用两次接口的问题

parent 012d1d52
......@@ -86,6 +86,7 @@ const CategoryAttributes: React.FC<{}> = () => {
const [selectedTableRowKeys, setSelectedTableRowKeys] = useState<Array<number>>([]) //表格选择
const [linkTableRowData, setLinkTableRowData] = useState<any[]>([])
const [attributeRowSelection, attributeRowCtl] = useRowSelectionTable()
const flag = useRef<boolean>(false)
const {
treeStatus,
......@@ -105,9 +106,13 @@ 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) => {
......
......@@ -26,6 +26,7 @@ const PropertyValue: React.FC<{}> = () => {
const [selectKey, setSelectKey] = useState(undefined)
const [selectNode, setSelectNode] = useState<any>()
const [customExpandkeys, setCustomExpandkeys] = useState<any>()
const flag = useRef<boolean>(false)
const {
treeStatus,
......@@ -58,9 +59,13 @@ const PropertyValue: React.FC<{}> = () => {
}, [])
useEffect(() => {
if (selectKey)
if (selectKey && flag.current) {
ref.current.reload()
// ref.current.reload({current: 1, pageSize: 10, name: '', attributeId: selectKey})
} else if(!selectKey) {
flag.current = false
} else {
flag.current = true
}
}, [selectKey])
const onHandleSelect = (key, node) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment