fix(wms): 修复异常表单和报表导出功能

修正异常表单中的产线字段名从line改为productionLine
优化报表导出功能,使用actionIds替代coilIds
为异常管理添加程度字典显示和产线字段
移除冗余代码并统一报表模板中的导出逻辑
This commit is contained in:
砂糖
2026-03-30 14:34:51 +08:00
parent ca176de4ef
commit 070b0aea8d
9 changed files with 39 additions and 105 deletions

View File

@@ -35,8 +35,8 @@
dict.label }}</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="产线" prop="line">
<el-select v-model="formData.line" placeholder="请选择产线">
<el-form-item label="产线" prop="productionLine">
<el-select v-model="formData.productionLine" placeholder="请选择产线">
<el-option v-for="dict in dict.type.sys_lines" :key="dict.value" :label="dict.label"
:value="dict.value"></el-option>
</el-select>

View File

@@ -9,10 +9,15 @@
<el-table-column label="缺陷位置" prop="position"></el-table-column>
<el-table-column label="缺陷代码" prop="defectCode">
<template slot-scope="scope">
<dict-tag :dict-type="dict.type.defectCode" :dict-value="scope.row.defectCode" />
<dict-tag :options="dict.type.coil_abnormal_code" :value="scope.row.defectCode" />
</template>
</el-table-column>
<el-table-column label="程度" prop="degree"></el-table-column>
<el-table-column label="程度" prop="degree">
<template slot-scope="scope">
<dict-tag :options="dict.type.coil_abnormal_degree" :value="scope.row.degree" />
</template>
</el-table-column>
<el-table-column label="产线" prop="productionLine"></el-table-column>
<el-table-column label="备注" prop="remark"></el-table-column>
<el-table-column label="操作" width="120">
<template slot-scope="scope">
@@ -43,7 +48,7 @@ export default {
components: {
AbnormalForm
},
dicts: ['coil_abnormal_code'],
dicts: ['coil_abnormal_code', 'coil_abnormal_degree'],
props: {
coilId: {
type: String,
@@ -60,7 +65,8 @@ export default {
endPosition: 0,
defectCode: null,
degree: null,
remark: null
remark: null,
productionLine: null
},
abnormalList: [],
abnormalLoading: false,

View File

@@ -104,7 +104,7 @@
<el-table-column label="实际库区" align="center" prop="actualWarehouseName"
v-if="!hideWarehouseQuery && !showExportTime" />
<!-- <el-table-column label="物料类型" align="center" prop="materialType" /> -->
<el-table-column label="产品类型" align="center" width="250">
<el-table-column label="产品类型" align="center" width="180">
<template slot-scope="scope">
<ProductInfo v-if="scope.row.itemType == 'product'" :product="scope.row" />
<RawMaterialInfo v-else-if="scope.row.itemType === 'raw_material'" :material="scope.row" />

View File

@@ -37,7 +37,7 @@ export async function fetchOutputList(queryParams) {
return sortedList
}
export async function fetchLossList(actionTypes, queryParams) {
export async function fetchLossList(actionTypes, queryParams, callback) {
const resultList = await Promise.all(actionTypes.map(actionType => {
return listPendingAction({
actionStatus: 2,
@@ -77,5 +77,6 @@ export async function fetchLossList(actionTypes, queryParams) {
computedWidth: parseFloat(width),
}
})
callback(actionIds)
return lossList
}

View File

@@ -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`)
},
},

View File

@@ -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`)
},
},

View File

@@ -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,

View File

@@ -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`);
}
},

View File

@@ -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`)
},
},