-
+
+
+
@@ -107,13 +107,23 @@ export default {
// 自定义高亮样式
style: {}
})
+ },
+ // 服务端分页总数(>0 时开启服务端分页模式)
+ total: {
+ type: Number,
+ default: 0
+ },
+ // 服务端分页每页条数
+ pageSize: {
+ type: Number,
+ default: 0
}
},
dicts: ['coil_quality_status', 'coil_abnormal_code', 'coil_abnormal_degree'],
data() {
return {
pageNum: 1,
- pageSize: 1000,
+ innerPageSize: 1000,
// 排序相关
sortField: '',
sortDirection: 'asc',
@@ -133,8 +143,17 @@ export default {
this.filterColumn = this.columns.map(column => column.prop)
},
computed: {
- // 处理排序和筛选后的数据
+ isServerPagination() {
+ return this.total > 0
+ },
+ effectivePageSize() {
+ return this.pageSize > 0 ? this.pageSize : this.innerPageSize
+ },
+ // 处理排序和筛选后的数据(服务端分页模式下跳过筛选排序)
processedData() {
+ if (this.isServerPagination) {
+ return this.data
+ }
let result = [...this.data]
// 筛选逻辑
@@ -183,32 +202,48 @@ export default {
return result
},
- // 内部实现前端分页逻辑
+ // 内部实现前端分页逻辑(服务端分页模式下直接返回数据)
tableData() {
- return this.processedData.slice((this.pageNum - 1) * this.pageSize, this.pageNum * this.pageSize)
+ if (this.isServerPagination) {
+ return this.data
+ }
+ return this.processedData.slice((this.pageNum - 1) * this.effectivePageSize, this.pageNum * this.effectivePageSize)
},
// 计算总页数
totalPage() {
- return Math.ceil(this.processedData.length / this.pageSize)
+ const total = this.isServerPagination ? this.total : this.processedData.length
+ return Math.ceil(total / this.effectivePageSize)
},
// 计算总条数
- total() {
+ pageTotal() {
return this.processedData.length
},
+ // 分页总条数(服务端优先)
+ paginationTotal() {
+ return this.isServerPagination ? this.total : this.pageTotal
+ },
// 是否展示分页组件
showPagination() {
+ if (this.isServerPagination) return true
return this.totalPage > 1
}
},
methods: {
// 分页大小改变时触发
handleSizeChange(val) {
- this.pageSize = val
+ if (this.isServerPagination) {
+ this.$emit('size-change', val)
+ } else {
+ this.innerPageSize = val
+ }
this.pageNum = 1
},
// 分页当前页改变时触发
handleCurrentChange(val) {
this.pageNum = val
+ if (this.isServerPagination) {
+ this.$emit('current-change', val)
+ }
},
// 生产耗时,单位分钟,渲染为xx天xx小时xx分钟
formatProductionDuration(duration) {
diff --git a/klp-ui/src/views/wms/report/delivery.vue b/klp-ui/src/views/wms/report/delivery.vue
index d3fb6ba6..6f863dbb 100644
--- a/klp-ui/src/views/wms/report/delivery.vue
+++ b/klp-ui/src/views/wms/report/delivery.vue
@@ -55,7 +55,8 @@
-
+
@@ -67,7 +68,7 @@