pull/3445/head
ruibaby 2019-11-23 11:57:29 +08:00
parent 1e11a81f6a
commit 606b84fa79
2 changed files with 36 additions and 2 deletions

View File

@ -4,9 +4,10 @@ const baseUrl = '/api/admin/sheets'
const sheetApi = {} const sheetApi = {}
sheetApi.list = () => { sheetApi.list = params => {
return service({ return service({
url: baseUrl, url: baseUrl,
params: params,
method: 'get' method: 'get'
}) })
} }

View File

@ -462,6 +462,16 @@
</a-dropdown> </a-dropdown>
</span> </span>
</a-table> </a-table>
<div class="page-wrapper">
<a-pagination
class="pagination"
:total="pagination.total"
:pageSizeOptions="['1', '2', '5', '10', '20', '50', '100']"
showSizeChanger
@showSizeChange="handlePaginationChange"
@change="handlePaginationChange"
/>
</div>
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
</div> </div>
@ -557,6 +567,19 @@ export default {
}, },
data() { data() {
return { return {
pagination: {
current: 1,
pageSize: 10,
sort: null
},
queryParam: {
page: 0,
size: 10,
sort: null,
keyword: null,
categoryId: null,
status: null
},
sheetsLoading: false, sheetsLoading: false,
sheetStatus: sheetApi.sheetStatus, sheetStatus: sheetApi.sheetStatus,
internalColumns, internalColumns,
@ -597,8 +620,12 @@ export default {
methods: { methods: {
loadSheets() { loadSheets() {
this.sheetsLoading = true this.sheetsLoading = true
sheetApi.list().then(response => { this.queryParam.page = this.pagination.current - 1
this.queryParam.size = this.pagination.pageSize
this.queryParam.sort = this.pagination.sort
sheetApi.list(this.queryParam).then(response => {
this.sheets = response.data.data.content this.sheets = response.data.data.content
this.pagination.total = response.data.data.total
this.sheetsLoading = false this.sheetsLoading = false
}) })
}, },
@ -647,6 +674,12 @@ export default {
window.open(response.data, '_blank') window.open(response.data, '_blank')
}) })
}, },
handlePaginationChange(page, pageSize) {
this.$log.debug(`Current: ${page}, PageSize: ${pageSize}`)
this.pagination.current = page
this.pagination.pageSize = pageSize
this.loadSheets()
},
onSheetSettingsClose() { onSheetSettingsClose() {
this.sheetSettingVisible = false this.sheetSettingVisible = false
this.selectedSheet = {} this.selectedSheet = {}