feat(wms/report): 优化发货报表页面,实现分页查询和统计功能

1. 新增轻量钢卷列表接口用于全量数据统计
2. 拆分接口为分页明细查询和全量统计查询
3. 为表格组件添加服务端分页支持
4. 移除默认的全量查询配置,新增分页状态管理
5. 注释掉表格的筛选排序功能暂时隐藏
This commit is contained in:
2026-05-20 13:57:09 +08:00
parent cd7ca23f28
commit 724dd272ca
4 changed files with 129 additions and 26 deletions

View File

@@ -55,7 +55,8 @@
<el-descriptions title="明细信息" :column="3" border>
</el-descriptions>
<coil-table :columns="deliveryColumns" :data="list"></coil-table>
<coil-table :columns="deliveryColumns" :data="list" :total="total" :page-size="pageSize"
@current-change="handlePageChange" @size-change="handleSizeChange"></coil-table>
<el-dialog title="列设置" :visible.sync="settingVisible" width="50%">
<el-radio-group v-model="activeColumnConfig">
@@ -67,7 +68,7 @@
</template>
<script>
import { listCoilWithIds, listWithBindInfoCoil } from "@/api/wms/coil";
import { listWithBindInfoCoil, listLightCoil } from "@/api/wms/coil";
import ProductInfo from "@/components/KLPService/Renderer/ProductInfo";
import RawMaterialInfo from "@/components/KLPService/Renderer/RawMaterialInfo";
import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
@@ -118,11 +119,10 @@ export default {
activeColumnConfig: 'coil-report-delivery',
settingVisible: false,
list: [],
lightList: [],
defaultStartTime: startTime,
defaultEndTime: endTime,
queryParams: {
pageNum: 1,
pageSize: 99999,
status: 1,
dataType: 1,
selectType: 'product',
@@ -133,8 +133,10 @@ export default {
itemSpecification: '',
itemMaterial: '',
itemManufacturer: '',
includeBindInfo: true,
},
pageNum: 1,
pageSize: 100,
total: 0,
loading: false,
deliveryColumns: [],
@@ -142,9 +144,9 @@ export default {
},
computed: {
summary() {
// 总钢卷数量、总重、均重
const totalCount = this.list.length
const totalWeight = this.list.reduce((acc, cur) => acc + parseFloat(cur.netWeight), 0)
// 总钢卷数量、总重、均重(基于轻量全量列表)
const totalCount = this.lightList.length
const totalWeight = this.lightList.reduce((acc, cur) => acc + parseFloat(cur.netWeight), 0)
const avgWeight = totalCount > 0 ? (totalWeight / totalCount).toFixed(2) : 0
return {
totalCount,
@@ -153,7 +155,7 @@ export default {
}
},
coilIds() {
return this.list.map(item => item.coilId).join(',')
return this.lightList.map(item => item.coilId).join(',')
},
},
methods: {
@@ -167,11 +169,20 @@ export default {
},
getList() {
this.loading = true
listWithBindInfoCoil({
this.pageNum = 1
Promise.all([
this.fetchLightList(),
this.fetchDetailList()
]).finally(() => {
this.loading = false
})
},
// 轻量全量接口,用于统计计算
fetchLightList() {
return listLightCoil({
...this.queryParams
}).then(res => {
this.list = res.rows.map(item => {
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
this.lightList = (res || []).map(item => {
const [thickness, width] = item.specification?.split('*') || []
return {
...item,
@@ -179,6 +190,41 @@ export default {
computedWidth: parseFloat(width),
}
})
})
},
// 分页明细接口,用于表格展示
fetchDetailList() {
return listWithBindInfoCoil({
...this.queryParams,
includeBindInfo: true,
pageNum: this.pageNum,
pageSize: this.pageSize,
}).then(res => {
this.total = res.total || 0
this.list = (res.rows || []).map(item => {
const [thickness, width] = item.specification?.split('*') || []
return {
...item,
computedThickness: parseFloat(thickness),
computedWidth: parseFloat(width),
}
})
})
},
// 切换页码
handlePageChange(pageNum) {
this.pageNum = pageNum
this.loading = true
this.fetchDetailList().finally(() => {
this.loading = false
})
},
// 切换每页条数
handleSizeChange(pageSize) {
this.pageSize = pageSize
this.pageNum = 1
this.loading = true
this.fetchDetailList().finally(() => {
this.loading = false
})
},