Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
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
najiu-frontend
najiu-admin-template
Commits
f2b8bb43
Commit
f2b8bb43
authored
Jul 29, 2021
by
无木
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(table): fix `getSelectRows` for treeTable
修复getSelectRows不支持树形表格子级数据的问题 fixed: #1003
parent
d2c36180
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
+14
-9
CHANGELOG.zh_CN.md
CHANGELOG.zh_CN.md
+1
-0
useRowSelection.ts
src/components/Table/src/hooks/useRowSelection.ts
+13
-9
No files found.
CHANGELOG.zh_CN.md
View file @
f2b8bb43
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
-
修复全屏模式下看不到子组件弹出层(popconfirm 以及 select、treeSelect 等编辑组件)的问题
-
修复全屏模式下看不到子组件弹出层(popconfirm 以及 select、treeSelect 等编辑组件)的问题
-
修复启用
`expandRowByClick`
时,点击不可展开的行可能会导致样式错误的问题
-
修复启用
`expandRowByClick`
时,点击不可展开的行可能会导致样式错误的问题
-
修复
`pagination`
属性动态改变不生效的问题
-
修复
`pagination`
属性动态改变不生效的问题
-
修复
`getSelectRows`
不支持树形表格子级数据的问题
-
**Dark Theme**
黑暗主题下的配色问题修正
-
**Dark Theme**
黑暗主题下的配色问题修正
-
修复
`Tree`
组件被选中节点的背景颜色
-
修复
`Tree`
组件被选中节点的背景颜色
-
修复
`Alert`
组件的颜色配置
-
修复
`Alert`
组件的颜色配置
...
...
src/components/Table/src/hooks/useRowSelection.ts
View file @
f2b8bb43
import
{
isFunction
}
from
'
/@/utils/is
'
;
import
{
isFunction
}
from
'
/@/utils/is
'
;
import
type
{
BasicTableProps
,
TableRowSelection
}
from
'
../types/table
'
;
import
type
{
BasicTableProps
,
TableRowSelection
}
from
'
../types/table
'
;
import
{
computed
,
ref
,
unref
,
ComputedRef
,
Ref
,
toRaw
,
watch
,
nextTick
}
from
'
vue
'
;
import
{
computed
,
ComputedRef
,
nextTick
,
Ref
,
ref
,
toRaw
,
unref
,
watch
}
from
'
vue
'
;
import
{
ROW_KEY
}
from
'
../const
'
;
import
{
ROW_KEY
}
from
'
../const
'
;
import
{
omit
}
from
'
lodash-es
'
;
import
{
omit
}
from
'
lodash-es
'
;
import
{
findNodeAll
}
from
'
/@/utils/helper/treeHelper
'
;
export
function
useRowSelection
(
export
function
useRowSelection
(
propsRef
:
ComputedRef
<
BasicTableProps
>
,
propsRef
:
ComputedRef
<
BasicTableProps
>
,
...
@@ -21,11 +22,12 @@ export function useRowSelection(
...
@@ -21,11 +22,12 @@ export function useRowSelection(
return
{
return
{
selectedRowKeys
:
unref
(
selectedRowKeysRef
),
selectedRowKeys
:
unref
(
selectedRowKeysRef
),
hideDefaultSelections
:
false
,
hideDefaultSelections
:
false
,
onChange
:
(
selectedRowKeys
:
string
[],
selectedRows
:
Recordable
[])
=>
{
onChange
:
(
selectedRowKeys
:
string
[])
=>
{
selectedRowKeysRef
.
value
=
selectedRowKeys
;
setSelectedRowKeys
(
selectedRowKeys
);
selectedRowRef
.
value
=
selectedRows
;
// selectedRowKeysRef.value = selectedRowKeys;
// selectedRowRef.value = selectedRows;
},
},
...
omit
(
rowSelection
===
undefined
?
{}
:
rowSelection
,
[
'
onChange
'
]),
...
omit
(
rowSelection
,
[
'
onChange
'
]),
};
};
});
});
...
@@ -64,11 +66,13 @@ export function useRowSelection(
...
@@ -64,11 +66,13 @@ export function useRowSelection(
function
setSelectedRowKeys
(
rowKeys
:
string
[])
{
function
setSelectedRowKeys
(
rowKeys
:
string
[])
{
selectedRowKeysRef
.
value
=
rowKeys
;
selectedRowKeysRef
.
value
=
rowKeys
;
selectedRowRef
.
value
=
findNodeAll
(
const
rows
=
toRaw
(
unref
(
tableData
)).
filter
((
item
)
=>
toRaw
(
unref
(
tableData
)),
rowKeys
.
includes
(
item
[
unref
(
getRowKey
)
as
string
])
(
item
)
=>
rowKeys
.
includes
(
item
[
unref
(
getRowKey
)
as
string
]),
{
children
:
propsRef
.
value
.
childrenColumnName
??
'
children
'
,
}
);
);
selectedRowRef
.
value
=
rows
;
}
}
function
setSelectedRows
(
rows
:
Recordable
[])
{
function
setSelectedRows
(
rows
:
Recordable
[])
{
...
...
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