fix(wms): 修复异常表单和报表导出功能
修正异常表单中的产线字段名从line改为productionLine 优化报表导出功能,使用actionIds替代coilIds 为异常管理添加程度字典显示和产线字段 移除冗余代码并统一报表模板中的导出逻辑
This commit is contained in:
@@ -35,8 +35,8 @@
|
|||||||
dict.label }}</el-radio-button>
|
dict.label }}</el-radio-button>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="产线" prop="line">
|
<el-form-item label="产线" prop="productionLine">
|
||||||
<el-select v-model="formData.line" placeholder="请选择产线">
|
<el-select v-model="formData.productionLine" placeholder="请选择产线">
|
||||||
<el-option v-for="dict in dict.type.sys_lines" :key="dict.value" :label="dict.label"
|
<el-option v-for="dict in dict.type.sys_lines" :key="dict.value" :label="dict.label"
|
||||||
:value="dict.value"></el-option>
|
:value="dict.value"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
|||||||
@@ -9,10 +9,15 @@
|
|||||||
<el-table-column label="缺陷位置" prop="position"></el-table-column>
|
<el-table-column label="缺陷位置" prop="position"></el-table-column>
|
||||||
<el-table-column label="缺陷代码" prop="defectCode">
|
<el-table-column label="缺陷代码" prop="defectCode">
|
||||||
<template slot-scope="scope">
|
<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>
|
</template>
|
||||||
</el-table-column>
|
</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="备注" prop="remark"></el-table-column>
|
||||||
<el-table-column label="操作" width="120">
|
<el-table-column label="操作" width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
@@ -43,7 +48,7 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
AbnormalForm
|
AbnormalForm
|
||||||
},
|
},
|
||||||
dicts: ['coil_abnormal_code'],
|
dicts: ['coil_abnormal_code', 'coil_abnormal_degree'],
|
||||||
props: {
|
props: {
|
||||||
coilId: {
|
coilId: {
|
||||||
type: String,
|
type: String,
|
||||||
@@ -60,7 +65,8 @@ export default {
|
|||||||
endPosition: 0,
|
endPosition: 0,
|
||||||
defectCode: null,
|
defectCode: null,
|
||||||
degree: null,
|
degree: null,
|
||||||
remark: null
|
remark: null,
|
||||||
|
productionLine: null
|
||||||
},
|
},
|
||||||
abnormalList: [],
|
abnormalList: [],
|
||||||
abnormalLoading: false,
|
abnormalLoading: false,
|
||||||
|
|||||||
@@ -104,7 +104,7 @@
|
|||||||
<el-table-column label="实际库区" align="center" prop="actualWarehouseName"
|
<el-table-column label="实际库区" align="center" prop="actualWarehouseName"
|
||||||
v-if="!hideWarehouseQuery && !showExportTime" />
|
v-if="!hideWarehouseQuery && !showExportTime" />
|
||||||
<!-- <el-table-column label="物料类型" align="center" prop="materialType" /> -->
|
<!-- <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">
|
<template slot-scope="scope">
|
||||||
<ProductInfo v-if="scope.row.itemType == 'product'" :product="scope.row" />
|
<ProductInfo v-if="scope.row.itemType == 'product'" :product="scope.row" />
|
||||||
<RawMaterialInfo v-else-if="scope.row.itemType === 'raw_material'" :material="scope.row" />
|
<RawMaterialInfo v-else-if="scope.row.itemType === 'raw_material'" :material="scope.row" />
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export async function fetchOutputList(queryParams) {
|
|||||||
return sortedList
|
return sortedList
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchLossList(actionTypes, queryParams) {
|
export async function fetchLossList(actionTypes, queryParams, callback) {
|
||||||
const resultList = await Promise.all(actionTypes.map(actionType => {
|
const resultList = await Promise.all(actionTypes.map(actionType => {
|
||||||
return listPendingAction({
|
return listPendingAction({
|
||||||
actionStatus: 2,
|
actionStatus: 2,
|
||||||
@@ -77,5 +77,6 @@ export async function fetchLossList(actionTypes, queryParams) {
|
|||||||
computedWidth: parseFloat(width),
|
computedWidth: parseFloat(width),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
callback(actionIds)
|
||||||
return lossList
|
return lossList
|
||||||
}
|
}
|
||||||
@@ -117,10 +117,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listCoilWithIds } from "@/api/wms/coil";
|
|
||||||
import {
|
|
||||||
listPendingAction,
|
|
||||||
} from '@/api/wms/pendingAction';
|
|
||||||
import ProductInfo from "@/components/KLPService/Renderer/ProductInfo";
|
import ProductInfo from "@/components/KLPService/Renderer/ProductInfo";
|
||||||
import RawMaterialInfo from "@/components/KLPService/Renderer/RawMaterialInfo";
|
import RawMaterialInfo from "@/components/KLPService/Renderer/RawMaterialInfo";
|
||||||
import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
|
import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
|
||||||
@@ -216,6 +212,7 @@ export default {
|
|||||||
|
|
||||||
lossColumns: [],
|
lossColumns: [],
|
||||||
outputColumns: [],
|
outputColumns: [],
|
||||||
|
actionIds: '',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -260,8 +257,8 @@ export default {
|
|||||||
Promise.all([
|
Promise.all([
|
||||||
fetchLossList(this.actionTypes, {
|
fetchLossList(this.actionTypes, {
|
||||||
...this.queryParams,
|
...this.queryParams,
|
||||||
...this.actionQueryParams
|
...this.actionQueryParams,
|
||||||
}),
|
}, (ids) => { this.actionIds = ids }),
|
||||||
fetchOutputList({
|
fetchOutputList({
|
||||||
...this.queryParams,
|
...this.queryParams,
|
||||||
...this.baseQueryParams,
|
...this.baseQueryParams,
|
||||||
@@ -289,7 +286,7 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.download('wms/materialCoil/export', {
|
this.download('wms/materialCoil/export', {
|
||||||
coilIds: this.lossList.map(item => item.coilId).join(',')
|
actionIds: this.actionIds
|
||||||
}, `materialCoil_${this.queryParams.date}_${new Date().getTime()}.xlsx`)
|
}, `materialCoil_${this.queryParams.date}_${new Date().getTime()}.xlsx`)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -151,6 +151,8 @@ export default {
|
|||||||
loading: false,
|
loading: false,
|
||||||
|
|
||||||
lossColumns: [],
|
lossColumns: [],
|
||||||
|
|
||||||
|
actionIds: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -185,7 +187,7 @@ export default {
|
|||||||
fetchLossList(this.actionTypes, {
|
fetchLossList(this.actionTypes, {
|
||||||
...this.queryParams,
|
...this.queryParams,
|
||||||
...this.actionQueryParams,
|
...this.actionQueryParams,
|
||||||
}).then(res => {
|
}, (ids) => { this.actionIds = ids }).then(res => {
|
||||||
this.list = res
|
this.list = res
|
||||||
this.loading = false
|
this.loading = false
|
||||||
})
|
})
|
||||||
@@ -193,7 +195,8 @@ export default {
|
|||||||
// 导出
|
// 导出
|
||||||
exportData() {
|
exportData() {
|
||||||
this.download('wms/materialCoil/export', {
|
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`)
|
}, `materialCoil_${new Date().getTime()}.xlsx`)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -246,6 +246,8 @@ export default {
|
|||||||
|
|
||||||
lossColumns: [],
|
lossColumns: [],
|
||||||
outputColumns: [],
|
outputColumns: [],
|
||||||
|
|
||||||
|
actionIds: '',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -288,86 +290,6 @@ export default {
|
|||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.fetchData()
|
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() {
|
exportData() {
|
||||||
if (this.list.length === 0) {
|
if (this.list.length === 0) {
|
||||||
@@ -384,7 +306,8 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.download('wms/materialCoil/export', {
|
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`)
|
}, `materialCoil_${this.queryParams.date}_${new Date().getTime()}.xlsx`)
|
||||||
},
|
},
|
||||||
fetchData() {
|
fetchData() {
|
||||||
@@ -393,7 +316,7 @@ export default {
|
|||||||
fetchLossList(this.actionTypes, {
|
fetchLossList(this.actionTypes, {
|
||||||
...this.queryParams,
|
...this.queryParams,
|
||||||
...this.actionQueryParams
|
...this.actionQueryParams
|
||||||
}),
|
}, (ids) => { this.actionIds = ids }),
|
||||||
fetchOutputList({
|
fetchOutputList({
|
||||||
...this.queryParams,
|
...this.queryParams,
|
||||||
...this.baseQueryParams,
|
...this.baseQueryParams,
|
||||||
|
|||||||
@@ -124,8 +124,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listCoilWithIds } from "@/api/wms/coil";
|
|
||||||
import { listPendingAction } from '@/api/wms/pendingAction';
|
|
||||||
import ProductInfo from "@/components/KLPService/Renderer/ProductInfo";
|
import ProductInfo from "@/components/KLPService/Renderer/ProductInfo";
|
||||||
import RawMaterialInfo from "@/components/KLPService/Renderer/RawMaterialInfo";
|
import RawMaterialInfo from "@/components/KLPService/Renderer/RawMaterialInfo";
|
||||||
import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
|
import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
|
||||||
@@ -218,6 +216,8 @@ export default {
|
|||||||
|
|
||||||
lossColumns: [],
|
lossColumns: [],
|
||||||
outputColumns: [],
|
outputColumns: [],
|
||||||
|
|
||||||
|
actionIds: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -271,7 +271,7 @@ export default {
|
|||||||
fetchLossList(this.actionTypes, {
|
fetchLossList(this.actionTypes, {
|
||||||
...this.queryParams,
|
...this.queryParams,
|
||||||
...this.actionQueryParams
|
...this.actionQueryParams
|
||||||
}),
|
}, (ids) => { this.actionIds = ids }),
|
||||||
fetchOutputList({
|
fetchOutputList({
|
||||||
...this.queryParams,
|
...this.queryParams,
|
||||||
...this.baseQueryParams,
|
...this.baseQueryParams,
|
||||||
@@ -298,7 +298,8 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.download('wms/materialCoil/export', {
|
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`);
|
}, `materialCoil_${this.queryParams.date}_${new Date().getTime()}.xlsx`);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -225,6 +225,8 @@ export default {
|
|||||||
|
|
||||||
lossColumns: [],
|
lossColumns: [],
|
||||||
outputColumns: [],
|
outputColumns: [],
|
||||||
|
|
||||||
|
actionIds: '',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -270,7 +272,7 @@ export default {
|
|||||||
fetchLossList(this.actionTypes, {
|
fetchLossList(this.actionTypes, {
|
||||||
...this.queryParams,
|
...this.queryParams,
|
||||||
...this.actionQueryParams
|
...this.actionQueryParams
|
||||||
}),
|
}, (ids) => { this.actionIds = ids }),
|
||||||
fetchOutputList({
|
fetchOutputList({
|
||||||
...this.queryParams,
|
...this.queryParams,
|
||||||
...this.baseQueryParams,
|
...this.baseQueryParams,
|
||||||
@@ -298,7 +300,8 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.download('wms/materialCoil/export', {
|
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`)
|
}, `materialCoil_${this.queryParams.date}_${new Date().getTime()}.xlsx`)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user