feat: 添加产品与原材料BOM信息展示功能

- 新增listProductWithBom和listRawMaterialWithBom接口
- 在ProductSelect和RawMaterialSelect组件中展示BOM属性信息
- 优化物料状态显示条件及仓库过滤逻辑
- 更新统计组件查询参数
This commit is contained in:
砂糖
2025-10-31 16:20:03 +08:00
parent 5bd8769a7b
commit d5aaf4e84d
8 changed files with 99 additions and 14 deletions

View File

@@ -120,8 +120,8 @@ export default {
Promise.all([
listProduct({ pageSise: 1, pageNum: 1 }),
listRawMaterial({ pageSise: 1, pageNum: 1 }),
listMaterialCoil({ pageSise: 1, pageNum: 1 }),
listEquipmentManagement({ pageSise: 1, pageNum: 1 }),
listMaterialCoil({ pageSise: 1, pageNum: 1, dateType: '1' }),
listEquipmentManagement({ pageSise: 1, pageNum: 1, status: 'in_service' }),
listOrder({ pageSise: 1, pageNum: 1 }),
listCustomer({ pageSise: 1, pageNum: 1 }),
listSupplier({ pageSise: 1, pageNum: 1 })

View File

@@ -8,9 +8,14 @@
</template>
<el-option v-for="item in productOptions" :key="item.productId"
:label="`${item.productName}${item.productCode}`" :value="item.productId">
<div class="option-label">
<span class="product-name">{{ item.productName }}</span>
<div>
<div class="option-label">
<span class="product-name">{{ item.productName }}</span>
<span class="product-code">{{ item.productCode }}</span>
</div>
<div>
<span class="product-sku">{{ getSku(item) }}</span>
</div>
</div>
</el-option>
</el-select>
@@ -124,6 +129,33 @@ export default {
this.productOptions = res.rows || [];
});
},
getSku(item) {
const boms = item.bomItems || [];
if (!boms.length) {
return '暂无BOM信息';
}
// 查找attrKey为'规格'的attrvalue
const specification = boms.find(p => p.attrKey === '规格');
// 查找attrKey为'表面处理'的attrvalue
const factory = boms.find(p => p.attrKey === '表面处理');
// 查找attrKey为'材质'的attrvalue
const material = boms.find(p => p.attrKey === '材质');
// 组合sku:
let sku = '';
if (specification) {
sku += '规格:' + specification.attrValue + '';
}
if (factory) {
sku += '表面处理:' + factory.attrValue + '';
}
if (material) {
sku += '材质:' + material.attrValue + '';
}
return sku;
},
onChange(val) {
// 通过val找到item
const product = this.productOptions.find(p => p.productId === val);

View File

@@ -8,9 +8,11 @@
</template>
<el-option v-for="item in rawMaterialList" :key="item.rawMaterialId"
:label="`${item.rawMaterialName}${item.rawMaterialCode}`" :value="item.rawMaterialId">
<div class="option-label">
<span class="material-name">{{ item.rawMaterialName }}</span>
<span class="material-code">{{ item.rawMaterialCode }}</span>
<div>
<div class="option-label">
<span class="material-name">{{ item.rawMaterialName }}</span>
<span class="material-code">{{ getSku(item) }}</span>
</div>
</div>
</el-option>
</el-select>
@@ -61,6 +63,7 @@
import { mapGetters } from "vuex";
import { addRawMaterial } from '@/api/wms/rawMaterial';
import BomPanel from '../BomPanel/index.vue';
import { findItemWithBom } from '@/api/wms/bom';
export default {
name: "RawMaterialSelect",
@@ -130,6 +133,35 @@ export default {
const rawMaterial = this.options.find(p => p.rawMaterialId === val);
this.$emit('change', rawMaterial);
},
getSku(item) {
const boms = item.bomItems;
if (!boms || boms.length === 0) {
return '暂无BOM信息';
}
// 查找attrKey为'规格'的attrvalue
const specification = boms.find(p => p.attrKey === '规格');
// 查找attrKey为'厂家'的attrvalue
const factory = boms.find(p => p.attrKey === '厂家');
// 查找attrKey为'材质'的attrvalue
const material = boms.find(p => p.attrKey === '材质');
console.log(boms, item, '查找bomItems');
// 组合sku:
let sku = '';
if (specification) {
sku += '规格:' + specification.attrValue + '';
}
if (factory) {
sku += '厂家:' + factory.attrValue + '';
}
if (material) {
sku += '材质:' + material.attrValue;
}
console.log(sku, '组合sku');
return sku;
},
add() {
this.addDialogVisible = true;
this.addForm = {