refactor(wms): 移除调试代码和注释,优化规格分割逻辑
移除console.log调试语句和已注释的代码 为specification.split添加空值保护,防止undefined错误 简化标签类型判断逻辑
This commit is contained in:
@@ -44,9 +44,6 @@
|
|||||||
:paperWidthMm="180"
|
:paperWidthMm="180"
|
||||||
:paperHeightMm="100"
|
: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>
|
||||||
<div class="action-buttons" v-if="!hideActions">
|
<div class="action-buttons" v-if="!hideActions">
|
||||||
<el-button type="primary" @click="downloadLabelAsImage">下载标签图片</el-button>
|
<el-button type="primary" @click="downloadLabelAsImage">下载标签图片</el-button>
|
||||||
@@ -70,10 +67,6 @@ import DuGeTag from './DuGeTag.vue';
|
|||||||
import TuoZhiTag from './TuoZhiTag.vue';
|
import TuoZhiTag from './TuoZhiTag.vue';
|
||||||
|
|
||||||
|
|
||||||
// import SampleTagPreview from './SampleTagPreview.vue';
|
|
||||||
// import ForgeTagPreview from './ForgeTagPreview.vue';
|
|
||||||
// import SaltSprayTagPreview from './SaltSprayTagPreview.vue';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'LabelRender',
|
name: 'LabelRender',
|
||||||
components: {
|
components: {
|
||||||
@@ -132,10 +125,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
// labelType: {
|
|
||||||
// type: String,
|
|
||||||
// required: true,
|
|
||||||
// },
|
|
||||||
forceSpecialTag: {
|
forceSpecialTag: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: false,
|
||||||
@@ -162,6 +151,8 @@ export default {
|
|||||||
this.labelType = '6';
|
this.labelType = '6';
|
||||||
} else if (itemType == 'raw_material') {
|
} else if (itemType == 'raw_material') {
|
||||||
this.labelType = '2';
|
this.labelType = '2';
|
||||||
|
} else if (itemType == 'product') {
|
||||||
|
this.labelType = 'where';
|
||||||
} else if (itemType == 'product' && itemName == '冷硬卷') {
|
} else if (itemType == 'product' && itemName == '冷硬卷') {
|
||||||
this.labelType = '3';
|
this.labelType = '3';
|
||||||
} else if (itemType == 'product' && itemName == '热轧卷板') {
|
} else if (itemType == 'product' && itemName == '热轧卷板') {
|
||||||
|
|||||||
@@ -287,14 +287,13 @@ export default {
|
|||||||
...this.baseQueryParams,
|
...this.baseQueryParams,
|
||||||
}),
|
}),
|
||||||
]).then((resList) => {
|
]).then((resList) => {
|
||||||
console.log(resList)
|
|
||||||
const list = resList.flatMap(res => res.rows)
|
const list = resList.flatMap(res => res.rows)
|
||||||
// 按照createTime 降序排序
|
// 按照createTime 降序排序
|
||||||
this.list = list.sort(
|
this.list = list.sort(
|
||||||
(a, b) => new Date(b.createTime) - new Date(a.createTime)
|
(a, b) => new Date(b.createTime) - new Date(a.createTime)
|
||||||
).map(item => {
|
).map(item => {
|
||||||
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
|
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
|
||||||
const [thickness, width] = item.specification.split('*')
|
const [thickness, width] = item.specification?.split('*') || [0, 0]
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
computedThickness: parseFloat(thickness),
|
computedThickness: parseFloat(thickness),
|
||||||
@@ -320,7 +319,6 @@ export default {
|
|||||||
}))
|
}))
|
||||||
const actions = resultList.flatMap(item => item.rows)
|
const actions = resultList.flatMap(item => item.rows)
|
||||||
const coilIds = actions.map(item => item.coilId).join(',')
|
const coilIds = actions.map(item => item.coilId).join(',')
|
||||||
console.log(coilIds)
|
|
||||||
if (!coilIds) {
|
if (!coilIds) {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '暂无数据',
|
message: '暂无数据',
|
||||||
@@ -338,7 +336,7 @@ export default {
|
|||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.lossList = res.rows.map(item => {
|
this.lossList = res.rows.map(item => {
|
||||||
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
|
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
|
||||||
const [thickness, width] = item.specification.split('*')
|
const [thickness, width] = item.specification?.split('*') || [0, 0]
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
computedThickness: parseFloat(thickness),
|
computedThickness: parseFloat(thickness),
|
||||||
|
|||||||
Reference in New Issue
Block a user