fix: 修复规格分割可能导致的undefined错误
处理多处规格(specification)分割时的空值情况,添加可选链操作符和默认值 修改wms报表合并查询参数,清空时间条件 调整acid页面容器样式
This commit is contained in:
@@ -221,7 +221,7 @@ export default {
|
||||
let list = res.rows
|
||||
// 处理数据,添加宽度、厚度和数量字段
|
||||
list = list.map(item => {
|
||||
const parts = item.specification ? item.specification.split('*') : [];
|
||||
const parts = item.specification ? item.specification?.split('*') : [];
|
||||
return {
|
||||
...item,
|
||||
thickness: parts[0] || '',
|
||||
@@ -240,7 +240,7 @@ export default {
|
||||
let list = res.rows
|
||||
// 处理数据,添加宽度、厚度和数量字段
|
||||
list = list.map(item => {
|
||||
const parts = item.specification ? item.specification.split('*') : [];
|
||||
const parts = item.specification ? item.specification?.split('*') : [];
|
||||
return {
|
||||
...item,
|
||||
thickness: parts[0] || '',
|
||||
@@ -302,13 +302,13 @@ export default {
|
||||
/** 格式化厚度 */
|
||||
formatterThickness(row) {
|
||||
if (!row.specification) return '';
|
||||
const parts = row.specification.split('*');
|
||||
const parts = row.specification?.split('*') || [];
|
||||
return parts[0] || '';
|
||||
},
|
||||
/** 格式化宽度 */
|
||||
formatterWidth(row) {
|
||||
if (!row.specification) return '';
|
||||
const parts = row.specification.split('*');
|
||||
const parts = row.specification?.split('*') || [];
|
||||
return parts[1] || '';
|
||||
},
|
||||
/** 计算总数量和总重量 */
|
||||
|
||||
@@ -267,7 +267,7 @@ export default {
|
||||
});
|
||||
},
|
||||
handleCoilChange(coil) {
|
||||
const [thickness, width] = coil.specification.split('*')
|
||||
const [thickness, width] = coil.specification?.split('*') || []
|
||||
console.log(thickness, width, coil.netWeight)
|
||||
this.form.verifyTarget = {
|
||||
coilId: coil.coilId,
|
||||
|
||||
@@ -76,6 +76,10 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.app-container {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.acid-container {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="开始时间" align="center" prop="actualStartTime" width="160">
|
||||
<template slot-scope="scope">
|
||||
{{ parseTime(scope.row.actualStartTime || scope.row.planStartTime, '{y}-{m}-{d} {h}:{i}') }}
|
||||
{{ parseTime(scope.row.actualStartTime, '{y}-{m}-{d} {h}:{i}') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结束时间" align="center" prop="endTime" width="160">
|
||||
|
||||
@@ -251,8 +251,8 @@ export default {
|
||||
}
|
||||
|
||||
const [lossRes, outRes] = await Promise.all([
|
||||
listCoilWithIds({ ...this.queryParams, coilIds: lossIds.join(',') || '' }),
|
||||
listCoilWithIds({ ...this.queryParams, coilIds: outIds.join(',') || '' }),
|
||||
listCoilWithIds({ ...this.queryParams, coilIds: lossIds.join(',') || '', startTime: '', endTime: '' }),
|
||||
listCoilWithIds({ ...this.queryParams, coilIds: outIds.join(',') || '', startTime: '', endTime: '' }),
|
||||
]);
|
||||
this.lossList = lossRes.rows.map(item => {
|
||||
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
|
||||
@@ -265,7 +265,7 @@ export default {
|
||||
});
|
||||
this.outList = outRes.rows.map(item => {
|
||||
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
|
||||
const [thickness, width] = item.specification.split('*')
|
||||
const [thickness, width] = item.specification?.split('*') || []
|
||||
return {
|
||||
...item,
|
||||
computedThickness: parseFloat(thickness),
|
||||
|
||||
@@ -253,12 +253,12 @@ export default {
|
||||
}
|
||||
|
||||
const [lossRes, outRes] = await Promise.all([
|
||||
listCoilWithIds({ ...this.queryParams, coilIds: lossIds.join(',') || '' }),
|
||||
listCoilWithIds({ ...this.queryParams, coilIds: outIds.join(',') || '' }),
|
||||
listCoilWithIds({ ...this.queryParams, coilIds: lossIds.join(',') || '', startTime: '', endTime: '' }),
|
||||
listCoilWithIds({ ...this.queryParams, coilIds: outIds.join(',') || '', startTime: '', endTime: '' }),
|
||||
]);
|
||||
this.lossList = lossRes.rows.map(item => {
|
||||
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
|
||||
const [thickness, width] = item.specification.split('*')
|
||||
const [thickness, width] = item.specification?.split('*') || []
|
||||
return {
|
||||
...item,
|
||||
computedThickness: parseFloat(thickness),
|
||||
|
||||
Reference in New Issue
Block a user