fix(consignment): 修复寄卖层级树默认展开不生效
This commit is contained in:
@@ -127,7 +127,9 @@ function resolveGiftEvidenceEmptyText(record: {
|
||||
}
|
||||
|
||||
type InventoryFilterTreeNode = {
|
||||
key: string
|
||||
// rc-tree 以节点的 value 作为内部 key(fieldNames.key 默认指向 value),
|
||||
// 自定义 key 必须与 value 完全一致,否则 treeExpandedKeys 无法命中。
|
||||
key: number
|
||||
value: number
|
||||
title: string
|
||||
selectable: boolean
|
||||
@@ -217,7 +219,7 @@ export default function ConsignmentInventoryPanel() {
|
||||
const root = group.root
|
||||
const rootLabel = root?.name || group.groupName || '未命名分类'
|
||||
const childNodes: InventoryFilterTreeNode[] = group.children.map((item) => ({
|
||||
key: `child-${item.categoryId}`,
|
||||
key: item.categoryId,
|
||||
value: item.categoryId,
|
||||
title: item.name,
|
||||
selectable: true,
|
||||
@@ -227,7 +229,7 @@ export default function ConsignmentInventoryPanel() {
|
||||
if (root && childNodes.length === 0) {
|
||||
return [
|
||||
{
|
||||
key: `root-${root.categoryId}`,
|
||||
key: root.categoryId,
|
||||
value: root.categoryId,
|
||||
title: rootLabel,
|
||||
selectable: true,
|
||||
@@ -239,7 +241,7 @@ export default function ConsignmentInventoryPanel() {
|
||||
if (!root) {
|
||||
if (childNodes.length === 0) return []
|
||||
const groupNode: InventoryFilterTreeNode = {
|
||||
key: `group-${group.groupCategoryId}`,
|
||||
key: -group.groupCategoryId,
|
||||
value: -group.groupCategoryId,
|
||||
title: rootLabel,
|
||||
selectable: false,
|
||||
@@ -251,7 +253,7 @@ export default function ConsignmentInventoryPanel() {
|
||||
}
|
||||
return [
|
||||
{
|
||||
key: `group-${group.groupCategoryId}`,
|
||||
key: root.categoryId,
|
||||
value: root.categoryId,
|
||||
title: rootLabel,
|
||||
selectable: true,
|
||||
@@ -264,7 +266,7 @@ export default function ConsignmentInventoryPanel() {
|
||||
})
|
||||
}, [filterCategories])
|
||||
const categoryGroupKeys = useMemo(
|
||||
() => categoryTreeData.filter((node) => node.children?.length).map((node) => node.key),
|
||||
() => categoryTreeData.filter((node) => node.children?.length).map((node) => node.value),
|
||||
[categoryTreeData],
|
||||
)
|
||||
useEffect(() => {
|
||||
|
||||
@@ -154,7 +154,7 @@ function orderWorkerProfiles(profiles: WorkerConsignmentProfile[]): WorkerConsig
|
||||
}
|
||||
|
||||
type WorkerProfileTreeNode = {
|
||||
key: string
|
||||
key: number
|
||||
value: number
|
||||
title: string
|
||||
selectable: boolean
|
||||
@@ -271,7 +271,7 @@ export default function WorkerConsignmentPage() {
|
||||
? root.tabTitle || root.categoryName || root.name
|
||||
: group.groupName || '未命名分类'
|
||||
const childNodes: WorkerProfileTreeNode[] = group.children.map((child) => ({
|
||||
key: `child-${child.profileId}`,
|
||||
key: child.profileId,
|
||||
value: child.profileId,
|
||||
title: child.tabTitle || child.categoryName || child.name,
|
||||
selectable: true,
|
||||
@@ -281,7 +281,7 @@ export default function WorkerConsignmentPage() {
|
||||
if (root && childNodes.length === 0) {
|
||||
return [
|
||||
{
|
||||
key: `root-${root.profileId}`,
|
||||
key: root.profileId,
|
||||
value: root.profileId,
|
||||
title: rootLabel,
|
||||
selectable: true,
|
||||
@@ -293,7 +293,7 @@ export default function WorkerConsignmentPage() {
|
||||
if (!root) {
|
||||
if (childNodes.length === 0) return []
|
||||
const groupNode: WorkerProfileTreeNode = {
|
||||
key: `group-${group.groupCategoryId}`,
|
||||
key: -group.groupCategoryId,
|
||||
value: -group.groupCategoryId,
|
||||
title: rootLabel,
|
||||
selectable: false,
|
||||
@@ -305,7 +305,7 @@ export default function WorkerConsignmentPage() {
|
||||
}
|
||||
return [
|
||||
{
|
||||
key: `group-${group.groupCategoryId}`,
|
||||
key: root.profileId,
|
||||
value: root.profileId,
|
||||
title: rootLabel,
|
||||
selectable: true,
|
||||
@@ -318,7 +318,7 @@ export default function WorkerConsignmentPage() {
|
||||
})
|
||||
}, [orderedConsignmentProfiles])
|
||||
const profileGroupKeys = useMemo(
|
||||
() => profileTreeData.filter((node) => node.children?.length).map((node) => node.key),
|
||||
() => profileTreeData.filter((node) => node.children?.length).map((node) => node.value),
|
||||
[profileTreeData],
|
||||
)
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user