Commit d110184e authored by 胡小根's avatar 胡小根

完成table组件的翻页功能

parent c4500330
module.exports = { module.exports = {
NODE_ENV: '"production"', NODE_ENV: '"production"',
ENV_CONFIG: '"prod"', ENV_CONFIG: '"prod"',
BASE_API: '"http://haomo-studio.com:28086/org"' BASE_API: '"/org/api"'
} }
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
<!-- 翻页 --> <!-- 翻页 -->
<div class="pagination-container"> <div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.page" <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.page_no"
:page-sizes="[10,20,50]" :page-size="listQuery.limit" layout="total, sizes, prev, pager, next, jumper" :total="total"> :page-sizes="[10,20,50]" :page-size="listQuery.page_size" layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination> </el-pagination>
</div> </div>
<!-- end翻页 --> <!-- end翻页 -->
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
}, },
downloadLoading: false, downloadLoading: false,
showColumns: [] showColumns: [] // 要显示的列数据
} }
}, },
created() { created() {
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
init() { init() {
const self = this const self = this
if (!self.columns || !self.columns.length) { if (!self.columns || !self.columns.length) {
_.each(self.schema['columns'], function(column){ _.each(self.schema['columns'], function(column) {
const tmp = JSON.parse(JSON.stringify(column)) const tmp = JSON.parse(JSON.stringify(column))
self.$set(tmp, 'code', tmp.code.toLowerCase()) self.$set(tmp, 'code', tmp.code.toLowerCase())
self.showColumns.push(tmp) self.showColumns.push(tmp)
...@@ -140,7 +140,9 @@ ...@@ -140,7 +140,9 @@
getList() { getList() {
const self = this const self = this
self.listLoading = true self.listLoading = true
request(self.schema.modelUnderscorePlural).then(resp => { request(self.schema.modelUnderscorePlural, {
params: self.listQuery
}).then(resp => {
console.log(resp) console.log(resp)
self.list = resp.data self.list = resp.data
self.total = parseInt(resp.headers.total) self.total = parseInt(resp.headers.total)
...@@ -148,7 +150,7 @@ ...@@ -148,7 +150,7 @@
}) })
}, },
handleFilter() { handleFilter() {
this.listQuery.page = 1 this.listQuery.page_no = 1
this.getList() this.getList()
}, },
handleSizeChange(val) { handleSizeChange(val) {
...@@ -156,7 +158,7 @@ ...@@ -156,7 +158,7 @@
this.getList() this.getList()
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.listQuery.page = val this.listQuery.page_no = val
this.getList() this.getList()
}, },
handleDelete(row) { handleDelete(row) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment