fix: 修复产品选择和原材料选择组件中默认值设置问题

将空值时的默认值从数组改为空字符串,并统一使用getSku方法显示产品编码
This commit is contained in:
砂糖
2025-11-04 16:03:53 +08:00
parent 132c3c726b
commit da73d23bfd
2 changed files with 4 additions and 4 deletions

View File

@@ -7,7 +7,7 @@
<div v-else style="padding: 10px;">未搜索到产品</div> <div v-else style="padding: 10px;">未搜索到产品</div>
</template> </template>
<el-option v-for="item in productOptions" :key="item.productId" <el-option v-for="item in productOptions" :key="item.productId"
:label="`${item.productName}${item.productCode}`" :value="item.productId"> :label="`${item.productName}${getSku(item)}`" :value="item.productId">
<div> <div>
<div class="option-label"> <div class="option-label">
<span class="product-name">{{ item.productName }}</span> <span class="product-name">{{ item.productName }}</span>
@@ -117,7 +117,7 @@ export default {
value(val) { value(val) {
console.log(val, 'value'); console.log(val, 'value');
if (!val) { if (!val) {
this.selected = []; this.selected = '';
return; return;
} }
if (this.multiple) { if (this.multiple) {

View File

@@ -7,7 +7,7 @@
<div v-else style="padding: 10px;">未搜索到原材料</div> <div v-else style="padding: 10px;">未搜索到原材料</div>
</template> </template>
<el-option v-for="item in rawMaterialList" :key="item.rawMaterialId" <el-option v-for="item in rawMaterialList" :key="item.rawMaterialId"
:label="`${item.rawMaterialName}${item.rawMaterialCode}`" :value="item.rawMaterialId"> :label="`${item.rawMaterialName}${getSku(item)}`" :value="item.rawMaterialId">
<div> <div>
<div class="option-label"> <div class="option-label">
<span class="material-name">{{ item.rawMaterialName }}</span> <span class="material-name">{{ item.rawMaterialName }}</span>
@@ -117,7 +117,7 @@ export default {
watch: { watch: {
value(val) { value(val) {
if (!val) { if (!val) {
this.selected = []; this.selected = '';
return; return;
} }
if (this.multiple) { if (this.multiple) {