From 76a7be9f48c6e1421a0cd79859f01768c827d674 Mon Sep 17 00:00:00 2001 From: guoyue Date: Mon, 31 Oct 2022 14:56:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E9=97=A8=E7=AE=A1=E7=90=86=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=88=86=E9=A1=B5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/src/views/modules/sys/dept.vue | 69 ++++++++++++++++++++++------- 1 file changed, 53 insertions(+), 16 deletions(-) diff --git a/back/src/views/modules/sys/dept.vue b/back/src/views/modules/sys/dept.vue index b2c3d076..56fe60cc 100644 --- a/back/src/views/modules/sys/dept.vue +++ b/back/src/views/modules/sys/dept.vue @@ -3,22 +3,36 @@
- {{ $t('add') }} + {{ $t('add') }} + - - + + + + + +
@@ -31,12 +45,16 @@ import AddOrUpdate from './dept-add-or-update' import qs from 'qs' export default { mixins: [mixinViewModule], - data () { + data() { return { mixinViewModuleOptions: { getDataListURL: '/sys/dept/list', deleteURL: '/sys/dept' - } + }, + total: 0, + limit: 10, + page: 1, + dataList: [] } }, components: { @@ -45,16 +63,35 @@ export default { watch: { dataList: { handler: function () { - this.init() + this.getData() } } }, methods: { - init () { - debugger - this.$http.get('/sys/dept/list').then((res) => { - res.data.data.map((item, index) => { - if (item.district != null || item.children.length > 0) { + // 分页, 每页条数 + pageSizeChangeHandle (val) { + this.page = 1 + this.limit = val + this.getData() + }, + // 分页, 当前页 + pageCurrentChangeHandle (val) { + this.page = val + this.getData() + }, + getData() { + // debugger + let _data = { + limt: this.limit, + page: this.page, + } + this.$http.get('sys/dept/page', { + params: _data + }).then((res) => { + this.total = res.data.data.total; + res.data.data.list.map((item, index) => { + console.log('item, index------------>', item, index); + if (item.district != null || item.children.length >= 0) { this.$http.get('/sys/region/' + item.district).then((data) => { this.dataList[index].district = data.data.data.name console.log('datafrom', this.dataList) @@ -72,10 +109,10 @@ export default { } }) }) - } + }, }, - created () { - this.init() + created() { + this.getData() } }