分页缓存

dev_2022-04-07
yujialong 3 years ago
parent b0e4161523
commit 9ccbec3875
  1. 11
      src/views/serve/backstage/model.vue
  2. 9
      src/views/serve/backstage/modelType.vue
  3. 11
      src/views/serve/backstage/sourceModel.vue
  4. 9
      src/views/serve/backstage/sourceType.vue

@ -1,7 +1,7 @@
<template> <template>
<div class="wrap"> <div class="wrap">
<div class="side"> <div class="side">
<org ref="tree" @initData="initData"></org> <org ref="tree" @initData="initData" @getData="getData"></org>
</div> </div>
<div class="right"> <div class="right">
@ -70,7 +70,7 @@ export default {
isTopLevel: true, // isTopLevel: true, //
listData: [], listData: [],
keyword: '', keyword: '',
page: 1, page: +this.$route.query.page || 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0,
multipleSelection: [], multipleSelection: [],
@ -234,6 +234,13 @@ export default {
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.page = val this.page = val
this.$router.push({
path: 'backstage',
query: {
...this.$route.query,
page: val
}
})
this.getData() this.getData()
}, },
// //

@ -95,7 +95,14 @@ export default {
data.length && this.$nextTick(() => { data.length && this.$nextTick(() => {
const categoryId = this.$route.query.categoryId const categoryId = this.$route.query.categoryId
this.$refs.tree.setCurrentKey(categoryId || data[0].id) this.$refs.tree.setCurrentKey(categoryId || data[0].id)
this.getSingle() this.$router.push({
path: 'backstage',
query: {
...this.$route.query,
categoryId: this.$refs.tree.getCurrentKey()
}
}).catch(err => {})
this.$emit('getData')
}) })
}).catch(res => {}) }).catch(res => {})
}, },

@ -1,7 +1,7 @@
<template> <template>
<div class="wrap"> <div class="wrap">
<div class="side"> <div class="side">
<org ref="tree" @initData="initData"></org> <org ref="tree" @initData="initData" @getData="getData"></org>
</div> </div>
<div class="right"> <div class="right">
@ -55,7 +55,7 @@ export default {
isTopLevel: true, // isTopLevel: true, //
listData: [], listData: [],
keyword: "", keyword: "",
page: 1, page: +this.$route.query.page || 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0,
multipleSelection: [] multipleSelection: []
@ -174,6 +174,13 @@ export default {
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.page = val this.page = val
this.$router.push({
path: 'backstage',
query: {
...this.$route.query,
page: val
}
})
this.getData() this.getData()
} }
} }

@ -85,7 +85,14 @@ export default {
data.length && this.$nextTick(() => { data.length && this.$nextTick(() => {
const categoryId = this.$route.query.categoryId const categoryId = this.$route.query.categoryId
this.$refs.tree.setCurrentKey(categoryId || data[0].id) this.$refs.tree.setCurrentKey(categoryId || data[0].id)
this.getSingle() this.$router.push({
path: 'backstage',
query: {
...this.$route.query,
categoryId: this.$refs.tree.getCurrentKey()
}
}).catch(err => {})
this.$emit('getData')
}) })
}).catch(res => {}) }).catch(res => {})
}, },

Loading…
Cancel
Save