refactor(wms): 移除调试代码和注释,优化规格分割逻辑

移除console.log调试语句和已注释的代码
为specification.split添加空值保护,防止undefined错误
简化标签类型判断逻辑
This commit is contained in:
砂糖
2026-03-24 14:05:07 +08:00
parent ae68b40ee6
commit cbc4334db9
2 changed files with 4 additions and 15 deletions

View File

@@ -44,9 +44,6 @@
:paperWidthMm="180"
:paperHeightMm="100"
/>
<!-- <SampleTagPreview v-if="labelType === '4'" :content="content" />
<ForgeTagPreview v-if="labelType === '5'" :content="content" />
<SaltSprayTagPreview v-if="labelType === '6'" :content="content" /> -->
</div>
<div class="action-buttons" v-if="!hideActions">
<el-button type="primary" @click="downloadLabelAsImage">下载标签图片</el-button>
@@ -70,10 +67,6 @@ import DuGeTag from './DuGeTag.vue';
import TuoZhiTag from './TuoZhiTag.vue';
// import SampleTagPreview from './SampleTagPreview.vue';
// import ForgeTagPreview from './ForgeTagPreview.vue';
// import SaltSprayTagPreview from './SaltSprayTagPreview.vue';
export default {
name: 'LabelRender',
components: {
@@ -132,10 +125,6 @@ export default {
}
},
props: {
// labelType: {
// type: String,
// required: true,
// },
forceSpecialTag: {
type: String,
required: false,
@@ -162,6 +151,8 @@ export default {
this.labelType = '6';
} else if (itemType == 'raw_material') {
this.labelType = '2';
} else if (itemType == 'product') {
this.labelType = 'where';
} else if (itemType == 'product' && itemName == '冷硬卷') {
this.labelType = '3';
} else if (itemType == 'product' && itemName == '热轧卷板') {

View File

@@ -287,14 +287,13 @@ export default {
...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('*')
const [thickness, width] = item.specification?.split('*') || [0, 0]
return {
...item,
computedThickness: parseFloat(thickness),
@@ -320,7 +319,6 @@ export default {
}))
const actions = resultList.flatMap(item => item.rows)
const coilIds = actions.map(item => item.coilId).join(',')
console.log(coilIds)
if (!coilIds) {
this.$message({
message: '暂无数据',
@@ -338,7 +336,7 @@ export default {
}).then(res => {
this.lossList = res.rows.map(item => {
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
const [thickness, width] = item.specification.split('*')
const [thickness, width] = item.specification?.split('*') || [0, 0]
return {
...item,
computedThickness: parseFloat(thickness),