This commit is contained in:
2021-05-28 08:53:19 +08:00
36 changed files with 229 additions and 218 deletions

View File

@@ -1,6 +1,6 @@
export default {
props: {
pageNo: {
pageIndex: {
default: 1,
type: Number,
},
@@ -21,7 +21,7 @@ export default {
data: [],
pagination: {
current: this.pageNo,
current: this.pageIndex,
pageSize: this.pageSize,
total: 0,
size: 'small',
@@ -52,38 +52,41 @@ export default {
this.onLoading()
this.loadData({
pageNo: this.pagination.current,
pageIndex: this.pagination.current,
pageSize: this.pagination.pageSize,
...this.sorter
}).then((res) => {
this.data = res.rows
this.pagination.total = res.totalRows
this.data = res.rows || res.data || res.items
this.pagination.total = res.totalCount
this.onLoaded()
})
},
onReloadData(refresh = false) {
if (refresh && refresh.constructor === Boolean && this.pagination.constructor === Object) {
this.pagination.current = this.pageNo
this.pagination.current = this.pageIndex
this.pagination.pageSize = this.pageSize
}
this.onLoadData()
},
onListChange(current, pageSize) {
this.pagination.current = current
this.pagination.pageSize = pageSize
this.onLoadData()
}
},
render() {
const props = {
loading: this.loading,
pagination: this.pagination,
dataSource: this.data,
rowKey: record => record.id,
...this.$attrs
}
const on = {
//change: this.onTableChange
}
const on = {}
return (
<section>
<div class="yo-action-bar">
@@ -101,6 +104,7 @@ export default {
<template slot={name}>{this.$slots[name]}</template>
))}
</a-list>
<a-pagination size="small" {... { props: this.pagination }} onChange={this.onListChange} onShowSizeChange={this.onListChange} />
</section>
)
},

View File

@@ -3,7 +3,7 @@ import ColumnSetting from './column'
export default {
props: {
pageNo: {
pageIndex: {
default: 1,
type: Number,
},
@@ -33,7 +33,7 @@ export default {
data: [],
pagination: {
current: this.pageNo,
current: this.pageIndex,
pageSize: this.pageSize,
total: 0,
size: 'small',
@@ -102,15 +102,15 @@ export default {
this.onLoading()
this.loadData({
pageNo: this.pagination.current,
pageIndex: this.pagination.current,
pageSize: this.pagination.pageSize,
...this.sorter
}).then((res) => {
if (res.rows) {
if (res.rows || res.data || res.items) {
// 普通表格
this.type = 'table'
this.data = res.rows
this.pagination.total = res.totalRows
this.data = res.rows || res.data || res.items
this.pagination.total = res.totalCount
} else if (res) {
// 树形表格
this.type = 'tree'
@@ -124,7 +124,7 @@ export default {
onReloadData(refresh = false) {
if (refresh && refresh.constructor === Boolean && this.pagination.constructor === Object) {
this.pagination.current = this.pageNo
this.pagination.current = this.pageIndex
this.pagination.pageSize = this.pageSize
}
this.onLoadData()