🐞 fix: 部分位置需要判空
This commit is contained in:
@@ -48,7 +48,7 @@
|
||||
},
|
||||
_itemId: {
|
||||
get() {
|
||||
return this.itemId;
|
||||
return this.itemId.toString();
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('update:itemId', val);
|
||||
|
||||
@@ -63,9 +63,9 @@ export default {
|
||||
let bomId = this.bomId;
|
||||
if (!bomId) {
|
||||
if (this.itemType === 'product') {
|
||||
bomId = this.productMap[this.itemId].bomId;
|
||||
bomId = this.productMap[this.itemId]?.bomId;
|
||||
} else if (this.itemType === 'raw_material') {
|
||||
bomId = this.rawMaterialMap[this.itemId].bomId;
|
||||
bomId = this.rawMaterialMap[this.itemId]?.bomId;
|
||||
}
|
||||
}
|
||||
if (!bomId) {
|
||||
|
||||
@@ -63,12 +63,13 @@ export default {
|
||||
let bomId = this.bomId;
|
||||
if (!bomId) {
|
||||
if (this.itemType === 'product') {
|
||||
bomId = this.productMap[this.itemId].bomId;
|
||||
bomId = this.productMap[this.itemId]?.bomId;
|
||||
} else if (this.itemType === 'raw_material') {
|
||||
bomId = this.rawMaterialMap[this.itemId].bomId;
|
||||
bomId = this.rawMaterialMap[this.itemId]?.bomId;
|
||||
}
|
||||
}
|
||||
if (!bomId) {
|
||||
this.bomInfo = [];
|
||||
return;
|
||||
}
|
||||
if (bomMap[bomId]) {
|
||||
|
||||
@@ -62,9 +62,9 @@ export default {
|
||||
watch: {
|
||||
productId: {
|
||||
handler(newVal) {
|
||||
this.product = this.productMap && this.productMap[this.productId]
|
||||
? { ...this.productMap[this.productId] }
|
||||
: {};
|
||||
const res = this.productMap[this.productId] ? this.productMap[this.productId] : {};
|
||||
console.log(res)
|
||||
this.product = res;
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!-- 作用域插槽 -->
|
||||
<span class="material-name" @click="showDetail = true">
|
||||
<slot name="default" :material="material">
|
||||
{{ material.rawMaterialName ? material.rawMaterialName : '--' }}
|
||||
{{ material.rawMaterialName ? material.rawMaterialName : '-' }}
|
||||
</slot>
|
||||
</span>
|
||||
<el-dialog :visible="showDetail" @close="showDetail = false" :title="material.rawMaterialName" width="600px"
|
||||
@@ -47,7 +47,8 @@ export default {
|
||||
watch: {
|
||||
materialId: {
|
||||
handler: function (newVal) {
|
||||
const res = this.materialMap ? this.materialMap[this.materialId] : {};
|
||||
const res = this.materialMap[this.materialId] ? this.materialMap[this.materialId] : {};
|
||||
console.log(res)
|
||||
this.material = res;
|
||||
},
|
||||
immediate: true
|
||||
|
||||
Reference in New Issue
Block a user