Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Lucky高
vue-vben-admin
提交
8d7d0835
V
vue-vben-admin
项目概览
Lucky高
/
vue-vben-admin
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-vben-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
8d7d0835
编写于
1月 05, 2021
作者:
V
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(table): add summaryData prop #163
上级
31ff0559
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
30 addition
and
12 deletion
+30
-12
src/components/Table/src/components/TableAction.vue
src/components/Table/src/components/TableAction.vue
+1
-1
src/components/Table/src/components/TableFooter.vue
src/components/Table/src/components/TableFooter.vue
+9
-2
src/components/Table/src/hooks/useDataSource.ts
src/components/Table/src/hooks/useDataSource.ts
+3
-3
src/components/Table/src/hooks/useTableFooter.ts
src/components/Table/src/hooks/useTableFooter.ts
+2
-2
src/components/Table/src/props.ts
src/components/Table/src/props.ts
+6
-1
src/components/Table/src/types/table.ts
src/components/Table/src/types/table.ts
+2
-0
src/layouts/default/header/MultipleHeader.vue
src/layouts/default/header/MultipleHeader.vue
+6
-2
src/views/demo/table/FooterTable.vue
src/views/demo/table/FooterTable.vue
+1
-1
未找到文件。
src/components/Table/src/components/TableAction.vue
浏览文件 @
8d7d0835
...
...
@@ -45,7 +45,7 @@
const
{
prefixCls
}
=
useDesign
(
'
basic-table-action
'
);
const
table
=
useTableContext
();
const
getActions
=
computed
(()
=>
{
return
props
.
actions
.
map
((
action
)
=>
{
return
(
props
.
actions
||
[])
.
map
((
action
)
=>
{
const
{
popConfirm
}
=
action
;
return
{
type
:
'
link
'
,
...
...
src/components/Table/src/components/TableFooter.vue
浏览文件 @
8d7d0835
<
template
>
<Table
v-if=
"summaryFunc"
v-if=
"summaryFunc
|| summaryData
"
:showHeader=
"false"
:bordered=
"false"
:pagination=
"false"
...
...
@@ -32,6 +32,9 @@
summaryFunc
:
{
type
:
Function
as
PropType
<
Fn
>
,
},
summaryData
:
{
type
:
Array
as
PropType
<
Recordable
[]
>
,
},
scroll
:
{
type
:
Object
as
PropType
<
Recordable
>
,
},
...
...
@@ -41,7 +44,11 @@
const
table
=
useTableContext
();
const
getDataSource
=
computed
(():
Recordable
[]
=>
{
const
{
summaryFunc
}
=
props
;
const
{
summaryFunc
,
summaryData
}
=
props
;
if
(
summaryData
?.
length
)
{
summaryData
.
forEach
((
item
,
i
)
=>
(
item
[
props
.
rowKey
]
=
`
${
i
}
`
));
return
summaryData
;
}
if
(
!
isFunction
(
summaryFunc
))
{
return
[];
}
...
...
src/components/Table/src/hooks/useDataSource.ts
浏览文件 @
8d7d0835
...
...
@@ -163,11 +163,11 @@ export function useDataSource(
...
pageParams
,
...(
useSearchForm
?
getFieldsValue
()
:
{}),
...
searchInfo
,
...(
opt
?
opt
.
searchInfo
:
{}),
...(
opt
?
opt
.
sortInfo
:
{}),
...(
opt
?
opt
.
filterInfo
:
{}),
...(
opt
?.
searchInfo
??
{}),
...
sortInfo
,
...
filterInfo
,
...(
opt
?.
sortInfo
??
{}),
...(
opt
?.
filterInfo
??
{}),
};
if
(
beforeFetch
&&
isFunction
(
beforeFetch
))
{
params
=
beforeFetch
(
params
)
||
params
;
...
...
src/components/Table/src/hooks/useTableFooter.ts
浏览文件 @
8d7d0835
...
...
@@ -19,9 +19,9 @@ export function useTableFooter(
});
const
getFooterProps
=
computed
(():
Recordable
|
undefined
=>
{
const
{
summaryFunc
,
showSummary
}
=
unref
(
propsRef
);
const
{
summaryFunc
,
showSummary
,
summaryData
}
=
unref
(
propsRef
);
return
showSummary
&&
!
unref
(
getIsEmptyData
)
?
()
=>
h
(
TableFooter
,
{
summaryFunc
,
scroll
:
unref
(
scrollRef
)
})
?
()
=>
h
(
TableFooter
,
{
summaryFunc
,
s
ummaryData
,
s
croll
:
unref
(
scrollRef
)
})
:
undefined
;
});
...
...
src/components/Table/src/props.ts
浏览文件 @
8d7d0835
...
...
@@ -44,6 +44,11 @@ export const basicProps = {
default
:
null
,
},
summaryData
:
{
type
:
Array
as
PropType
<
Recordable
[]
>
,
default
:
null
,
},
canColDrag
:
propTypes
.
bool
.
def
(
true
),
api
:
{
type
:
Function
as
PropType
<
(...
arg
:
any
[])
=>
Promise
<
any
>>
,
...
...
@@ -73,7 +78,7 @@ export const basicProps = {
emptyDataIsShowTable
:
propTypes
.
bool
.
def
(
true
),
// 额外的请求参数
searchInfo
:
{
type
:
Object
as
PropType
<
any
>
,
type
:
Object
as
PropType
<
Recordable
>
,
default
:
null
,
},
// 使用搜索表单
...
...
src/components/Table/src/types/table.ts
浏览文件 @
8d7d0835
...
...
@@ -143,6 +143,8 @@ export interface BasicTableProps<T = any> {
autoCreateKey
?:
boolean
;
// 计算合计行的方法
summaryFunc
?:
(...
arg
:
any
)
=>
Recordable
[];
// 自定义合计表格内容
summaryData
?:
Recordable
[];
// 是否显示合计行
showSummary
?:
boolean
;
// 是否可拖拽列
...
...
src/layouts/default/header/MultipleHeader.vue
浏览文件 @
8d7d0835
...
...
@@ -70,10 +70,14 @@
const
getPlaceholderDomStyle
=
computed
(
():
CSSProperties
=>
{
let
height
=
0
;
if
((
unref
(
getShowFullHeaderRef
)
||
!
unref
(
getSplit
))
&&
unref
(
getShowHeader
))
{
if
(
(
unref
(
getShowFullHeaderRef
)
||
!
unref
(
getSplit
))
&&
unref
(
getShowHeader
)
&&
!
unref
(
getFullContent
)
)
{
height
+=
HEADER_HEIGHT
;
}
if
(
unref
(
getShowMultipleTab
))
{
if
(
unref
(
getShowMultipleTab
)
&&
!
unref
(
getFullContent
)
)
{
height
+=
TABS_HEIGHT
;
}
headerHeightRef
.
value
=
height
;
...
...
src/views/demo/table/FooterTable.vue
浏览文件 @
8d7d0835
...
...
@@ -13,7 +13,7 @@
export
default
defineComponent
({
components
:
{
BasicTable
},
setup
()
{
function
handleSummary
(
tableData
:
any
[])
{
function
handleSummary
(
tableData
:
Recordable
[])
{
const
totalNo
=
tableData
.
reduce
((
prev
,
next
)
=>
{
prev
+=
next
.
no
;
return
prev
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录