refactor(wms): 优化报表查询逻辑和界面显示

- 将查询参数中的 updateBy 改为 createBy 以匹配实际业务需求
- 移除不再使用的 selectType 参数
- 优化员工信息页面显示,调整离职时间展示
- 提取公共的 fetch 逻辑到单独文件
- 重构报表查询逻辑,使用 Promise.all 并行请求
- 调整钢卷文档页面,增加创建人选择功能
This commit is contained in:
砂糖
2026-03-25 09:04:48 +08:00
parent 45f58a7d3e
commit bb79b02ee4
15 changed files with 164 additions and 236 deletions

View File

@@ -92,7 +92,7 @@
<!-- 异常统计 -->
<el-descriptions title="异常统计" :column="4" border>
<el-descriptions-item v-for="item in abSummary" :key="item.label" :label="item.label">{{ item.value
}}</el-descriptions-item>
}}</el-descriptions-item>
</el-descriptions>
<el-descriptions title="明细信息" :column="3" border>
@@ -222,7 +222,6 @@ export default {
date: currentDate, // 绑定日期选择器的默认值(当天)
byCreateTimeStart: start, // 默认当天0点
byCreateTimeEnd: end, // 默认当天23:59:59
selectType: 'product',
enterCoilNo: '',
currentCoilNo: '',
warehouseId: '',
@@ -286,13 +285,12 @@ export default {
},
// 统一查询入口(兼容回车和按钮点击)
handleQuery() {
this.getList()
// this.getLossList()
this.fetchData()
},
// 核心查询逻辑
getList() {
async getList() {
this.loading = true
Promise.all([
const resList = await Promise.all([
listCoilWithIds({
selectType: 'raw_material',
itemType: 'raw_material',
@@ -307,25 +305,24 @@ export default {
...this.queryParams,
...this.baseQueryParams,
}),
]).then((resList) => {
console.log(resList)
const list = resList.flatMap(res => res.rows)
// 按照createTime 降序排序
this.list = list.sort(
(a, b) => new Date(b.createTime) - new Date(a.createTime)
).map(item => {
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
const [thickness, width] = item.specification.split('*')
return {
...item,
computedThickness: parseFloat(thickness),
computedWidth: parseFloat(width),
}
})
// this.loading = false
this.getLossList()
// this.loading = false
])
console.log(resList)
const list = resList.flatMap(res => res.rows)
// 按照createTime 降序排序
this.list = list.sort(
(a, b) => new Date(b.createTime) - new Date(a.createTime)
).map(item => {
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
const [thickness, width] = item.specification.split('*')
return {
...item,
computedThickness: parseFloat(thickness),
computedWidth: parseFloat(width),
}
})
// this.loading = false
// this.getLossList()
// this.loading = false
},
async getLossList() {
this.loading = true
@@ -353,23 +350,22 @@ export default {
this.loading = false
return
}
listCoilWithIds({
const res = await listCoilWithIds({
...this.queryParams,
byCreateTimeStart: undefined,
byCreateTimeEnd: undefined,
coilIds: coilIds,
}).then(res => {
this.lossList = res.rows.map(item => {
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
const [thickness, width] = item.specification.split('*')
return {
...item,
computedThickness: parseFloat(thickness),
computedWidth: parseFloat(width),
}
})
this.loading = false
})
this.lossList = res.rows.map(item => {
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
const [thickness, width] = item.specification.split('*')
return {
...item,
computedThickness: parseFloat(thickness),
computedWidth: parseFloat(width),
}
})
this.loading = false
},
// 导出
exportData() {
@@ -390,11 +386,19 @@ export default {
coilIds: this.lossList.map(item => item.coilId).join(',')
}, `materialCoil_${this.queryParams.date}_${new Date().getTime()}.xlsx`)
},
fetchData() {
this.loading = true
Promise.all([
this.getList(),
this.getLossList()
]).then(() => {
this.loading = false
})
},
},
mounted() {
this.getList()
// this.getLossList()
this.loadColumns()
this.fetchData()
}
}
</script>