CN-1388 fix: 调整实体列表等待交互和接口请求顺序等

1.调整接口请求顺序为list > 左侧筛选 > 顶部统计;
2.优化左侧筛选loading交互;
3.将默认每页条数改为10,可选条数由20,30,50改为10,20,50
This commit is contained in:
chenjinsong
2023-10-14 15:22:38 +08:00
parent b44a99f354
commit cdd3557bbe
7 changed files with 178 additions and 105 deletions

View File

@@ -58,13 +58,24 @@ export default {
*/
setup (props) {
const { query } = useRoute()
const pageSize = ref(defaultPageSize)
// pageSize取值顺序1.url2.缓存3.pageObj4.默认值
const urlPageSize = parseInt(query.pageSize)
const cachePageSize = parseInt(localStorage.getItem(storageKey.pageSize + '-' + localStorage.getItem(storageKey.username) + '-' + props.tableId))
const pageObjPageSize = props.pageObj.pageSize
const pageSize = ref(urlPageSize || cachePageSize || pageObjPageSize || defaultPageSize)
const currentPageNo = ref(props.storePageNoOnUrl ? (query.pageNo || (props.pageObj.pageNo || 1)) : (props.pageObj.pageNo || 1))
return {
pageSize,
currentPageNo
}
},
mounted () {
if (this.postPageSizes && this.postPageSizes.length > 0) {
this.resetPageSizes()
}
this.currentPageNo = parseInt(this.currentPageNo)
this.current(this.currentPageNo)
},
data () {
return {
// pageSize: defaultPageSize,
@@ -147,6 +158,7 @@ export default {
size (val) {
// eslint-disable-next-line vue/no-mutating-props
// this.pageObj.pageNo = 1
this.$emit('scrollbarToTop')
this.$emit('pageSize', val)
this.backgroundColor()
@@ -163,11 +175,12 @@ export default {
wrap.scrollTop = 0
}
})
this.$emit('scrollbarToTop')
})
},
resetPageSizes: function () {
if (this.postPageSizes) {
this.pageSizes = this.postPageSizes.map((item) => {
this.pageSizes = this.postPageSizes.map(item => {
return {
label: item + this.$t('pageSize'),
value: item
@@ -183,20 +196,6 @@ export default {
// }
}
},
mounted () {
if (this.postPageSizes && this.postPageSizes.length > 0) {
this.pageSize = this.postPageSizes[0]
this.resetPageSizes()
} else {
const pageSize = localStorage.getItem(storageKey.pageSize + '-' + localStorage.getItem(storageKey.username) + '-' + this.tableId)
if (pageSize != 'undefined' && pageSize != null) {
this.pageSize = parseInt(pageSize)
}
}
this.currentPageNo = parseInt(this.currentPageNo)
this.current(this.currentPageNo)
},
watch: {
postPageSizes: {
immediate: true,