fix(wms): 修复异常表单和报表导出功能
修正异常表单中的产线字段名从line改为productionLine 优化报表导出功能,使用actionIds替代coilIds 为异常管理添加程度字典显示和产线字段 移除冗余代码并统一报表模板中的导出逻辑
This commit is contained in:
@@ -117,10 +117,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listCoilWithIds } from "@/api/wms/coil";
|
||||
import {
|
||||
listPendingAction,
|
||||
} from '@/api/wms/pendingAction';
|
||||
import ProductInfo from "@/components/KLPService/Renderer/ProductInfo";
|
||||
import RawMaterialInfo from "@/components/KLPService/Renderer/RawMaterialInfo";
|
||||
import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
|
||||
@@ -216,6 +212,7 @@ export default {
|
||||
|
||||
lossColumns: [],
|
||||
outputColumns: [],
|
||||
actionIds: '',
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -260,8 +257,8 @@ export default {
|
||||
Promise.all([
|
||||
fetchLossList(this.actionTypes, {
|
||||
...this.queryParams,
|
||||
...this.actionQueryParams
|
||||
}),
|
||||
...this.actionQueryParams,
|
||||
}, (ids) => { this.actionIds = ids }),
|
||||
fetchOutputList({
|
||||
...this.queryParams,
|
||||
...this.baseQueryParams,
|
||||
@@ -289,7 +286,7 @@ export default {
|
||||
return
|
||||
}
|
||||
this.download('wms/materialCoil/export', {
|
||||
coilIds: this.lossList.map(item => item.coilId).join(',')
|
||||
actionIds: this.actionIds
|
||||
}, `materialCoil_${this.queryParams.date}_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
},
|
||||
|
||||
@@ -151,6 +151,8 @@ export default {
|
||||
loading: false,
|
||||
|
||||
lossColumns: [],
|
||||
|
||||
actionIds: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -185,7 +187,7 @@ export default {
|
||||
fetchLossList(this.actionTypes, {
|
||||
...this.queryParams,
|
||||
...this.actionQueryParams,
|
||||
}).then(res => {
|
||||
}, (ids) => { this.actionIds = ids }).then(res => {
|
||||
this.list = res
|
||||
this.loading = false
|
||||
})
|
||||
@@ -193,7 +195,8 @@ export default {
|
||||
// 导出
|
||||
exportData() {
|
||||
this.download('wms/materialCoil/export', {
|
||||
coilIds: this.list.map(item => item.coilId).join(',')
|
||||
// coilIds: this.list.map(item => item.coilId).join(',')
|
||||
actionIds: this.actionIds
|
||||
}, `materialCoil_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
},
|
||||
|
||||
@@ -246,6 +246,8 @@ export default {
|
||||
|
||||
lossColumns: [],
|
||||
outputColumns: [],
|
||||
|
||||
actionIds: '',
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -288,86 +290,6 @@ export default {
|
||||
handleQuery() {
|
||||
this.fetchData()
|
||||
},
|
||||
// 核心查询逻辑
|
||||
async getList() {
|
||||
this.loading = true
|
||||
const resList = await Promise.all([
|
||||
listCoilWithIds({
|
||||
selectType: 'raw_material',
|
||||
itemType: 'raw_material',
|
||||
warehouseIds: this.warehouseIds.join(','),
|
||||
...this.queryParams,
|
||||
...this.baseQueryParams,
|
||||
}),
|
||||
listCoilWithIds({
|
||||
selectType: 'product',
|
||||
itemType: 'product',
|
||||
warehouseIds: this.warehouseIds.join(','),
|
||||
...this.queryParams,
|
||||
...this.baseQueryParams,
|
||||
}),
|
||||
])
|
||||
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
|
||||
const resultList = await Promise.all(this.actionTypes.map(actionType => {
|
||||
return listPendingAction({
|
||||
actionStatus: 2,
|
||||
warehouseId: this.queryParams.planId,
|
||||
actionType,
|
||||
pageSize: 9999,
|
||||
pageNum: 1,
|
||||
startTime: this.queryParams.byCreateTimeStart,
|
||||
endTime: this.queryParams.byCreateTimeEnd,
|
||||
...this.actionQueryParams,
|
||||
})
|
||||
}))
|
||||
const actions = resultList.flatMap(item => item.rows)
|
||||
const coilIds = actions.map(item => item.coilId).join(',')
|
||||
console.log(coilIds)
|
||||
if (!coilIds) {
|
||||
this.$message({
|
||||
message: '暂无数据',
|
||||
type: 'warning',
|
||||
})
|
||||
this.lossList = []
|
||||
this.loading = false
|
||||
return
|
||||
}
|
||||
const res = await listCoilWithIds({
|
||||
...this.queryParams,
|
||||
byCreateTimeStart: undefined,
|
||||
byCreateTimeEnd: undefined,
|
||||
coilIds: coilIds,
|
||||
})
|
||||
this.lossList = res.rows.map(item => {
|
||||
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
|
||||
const [thickness, width] = item.specification.split('*')
|
||||
return {
|
||||
...item,
|
||||
computedThickness: parseFloat(thickness),
|
||||
computedWidth: parseFloat(width),
|
||||
}
|
||||
})
|
||||
this.loading = false
|
||||
},
|
||||
// 导出
|
||||
exportData() {
|
||||
if (this.list.length === 0) {
|
||||
@@ -384,7 +306,8 @@ export default {
|
||||
return
|
||||
}
|
||||
this.download('wms/materialCoil/export', {
|
||||
coilIds: this.lossList.map(item => item.coilId).join(',')
|
||||
// coilIds: this.lossList.map(item => item.coilId).join(',')
|
||||
actionIds: this.actionIds
|
||||
}, `materialCoil_${this.queryParams.date}_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
fetchData() {
|
||||
@@ -393,7 +316,7 @@ export default {
|
||||
fetchLossList(this.actionTypes, {
|
||||
...this.queryParams,
|
||||
...this.actionQueryParams
|
||||
}),
|
||||
}, (ids) => { this.actionIds = ids }),
|
||||
fetchOutputList({
|
||||
...this.queryParams,
|
||||
...this.baseQueryParams,
|
||||
|
||||
@@ -124,8 +124,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listCoilWithIds } from "@/api/wms/coil";
|
||||
import { listPendingAction } from '@/api/wms/pendingAction';
|
||||
import ProductInfo from "@/components/KLPService/Renderer/ProductInfo";
|
||||
import RawMaterialInfo from "@/components/KLPService/Renderer/RawMaterialInfo";
|
||||
import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
|
||||
@@ -218,6 +216,8 @@ export default {
|
||||
|
||||
lossColumns: [],
|
||||
outputColumns: [],
|
||||
|
||||
actionIds: ''
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
@@ -271,7 +271,7 @@ export default {
|
||||
fetchLossList(this.actionTypes, {
|
||||
...this.queryParams,
|
||||
...this.actionQueryParams
|
||||
}),
|
||||
}, (ids) => { this.actionIds = ids }),
|
||||
fetchOutputList({
|
||||
...this.queryParams,
|
||||
...this.baseQueryParams,
|
||||
@@ -298,7 +298,8 @@ export default {
|
||||
return;
|
||||
}
|
||||
this.download('wms/materialCoil/export', {
|
||||
coilIds: this.lossList.map(item => item.coilId).join(',')
|
||||
// coilIds: this.lossList.map(item => item.coilId).join(',')
|
||||
actionIds: this.actionIds
|
||||
}, `materialCoil_${this.queryParams.date}_${new Date().getTime()}.xlsx`);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -225,6 +225,8 @@ export default {
|
||||
|
||||
lossColumns: [],
|
||||
outputColumns: [],
|
||||
|
||||
actionIds: '',
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -270,7 +272,7 @@ export default {
|
||||
fetchLossList(this.actionTypes, {
|
||||
...this.queryParams,
|
||||
...this.actionQueryParams
|
||||
}),
|
||||
}, (ids) => { this.actionIds = ids }),
|
||||
fetchOutputList({
|
||||
...this.queryParams,
|
||||
...this.baseQueryParams,
|
||||
@@ -298,7 +300,8 @@ export default {
|
||||
return
|
||||
}
|
||||
this.download('wms/materialCoil/export', {
|
||||
coilIds: this.lossList.map(item => item.coilId).join(',')
|
||||
// coilIds: this.lossList.map(item => item.coilId).join(',')
|
||||
actionIds: this.actionIds
|
||||
}, `materialCoil_${this.queryParams.date}_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user