feat(产品/原材料): 添加规格字段支持

在产品和原材料相关组件中添加规格字段的显示和查询功能,包括:
1. 在详情弹窗中显示规格信息
2. 在列表页添加规格列和查询条件
3. 在表单中添加规格输入项
4. 优化选择器显示格式为"名称[规格](SKU)"
This commit is contained in:
砂糖
2025-11-04 16:45:30 +08:00
parent 9b2de46977
commit 1084f4b134
6 changed files with 47 additions and 8 deletions

View File

@@ -7,11 +7,12 @@
<div v-else style="padding: 10px;">未搜索到产品</div>
</template>
<el-option v-for="item in productOptions" :key="item.productId"
:label="`${item.productName}${getSku(item)}`" :value="item.productId">
<div>
:label="getLabel(item)" :value="item.productId">
<div>
<div class="option-label">
<span class="product-name">{{ item.productName }}</span>
<span class="product-code">{{ getSku(item) }}</span>
{{ getLabel(item) }}
<!-- <span class="product-name">{{ item.productName }}[{{ item.specification }}]</span>
<span class="product-code">{{ getSku(item) }}</span> -->
</div>
</div>
</el-option>
@@ -144,6 +145,13 @@ export default {
this.productOptions = res.rows || [];
});
},
getLabel(item) {
// 产品名称[规格](SKU),如果有则写,没有则省略
if (!item.specification) {
return `${item.productName}(${this.getSku(item)})`
}
return `${item.productName}[${item.specification}](${this.getSku(item)})`
},
getSku(item) {
const boms = item.bomItems || [];
console.log(boms, '产品BOM');