feat(产品/原材料): 添加规格字段支持
在产品和原材料相关组件中添加规格字段的显示和查询功能,包括: 1. 在详情弹窗中显示规格信息 2. 在列表页添加规格列和查询条件 3. 在表单中添加规格输入项 4. 优化选择器显示格式为"名称[规格](SKU)"
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -7,11 +7,12 @@
|
||||
<div v-else style="padding: 10px;">未搜索到原材料</div>
|
||||
</template>
|
||||
<el-option v-for="item in rawMaterialList" :key="item.rawMaterialId"
|
||||
:label="`${item.rawMaterialName}(${getSku(item)})`" :value="item.rawMaterialId">
|
||||
:label="getLabel(item)" :value="item.rawMaterialId">
|
||||
<div>
|
||||
<div class="option-label">
|
||||
<span class="material-name">{{ item.rawMaterialName }}</span>
|
||||
<span class="material-code">{{ getSku(item) }}</span>
|
||||
{{ getLabel(item) }}
|
||||
<!-- <span class="material-name">{{ item.rawMaterialName }}[{{ item.specification }}]</span>
|
||||
<span class="material-code">({{ getSku(item) }})</span> -->
|
||||
</div>
|
||||
</div>
|
||||
</el-option>
|
||||
@@ -148,6 +149,13 @@ export default {
|
||||
const rawMaterial = this.options.find(p => p.rawMaterialId === val);
|
||||
this.$emit('change', rawMaterial);
|
||||
},
|
||||
getLabel(item) {
|
||||
// 原材料名称[规格](SKU),如果有则写,没有则省略
|
||||
if (!item.specification) {
|
||||
return `${item.rawMaterialName}(${this.getSku(item)})`
|
||||
}
|
||||
return `${item.rawMaterialName}[${item.specification}](${this.getSku(item)})`
|
||||
},
|
||||
getSku(item) {
|
||||
const boms = item.bomItems;
|
||||
if (!boms || boms.length === 0) {
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
<el-descriptions-item label="产品编码">
|
||||
{{ product.productCode || '--' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="规格">
|
||||
{{ product.specification || '--' }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<BomInfo :bomId="product.bomId" />
|
||||
</el-dialog>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<el-descriptions-item label="原材料ID">{{ material.rawMaterialId }}</el-descriptions-item>
|
||||
<el-descriptions-item label="原材料名称">{{ material.rawMaterialName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="原材料编码">{{ material.rawMaterialCode }}</el-descriptions-item>
|
||||
<el-descriptions-item label="规格">{{ material.specification }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<BomInfo :bomId="material.bomId" />
|
||||
</el-dialog>
|
||||
|
||||
Reference in New Issue
Block a user