feat: 添加产品与原材料BOM信息展示功能
- 新增listProductWithBom和listRawMaterialWithBom接口 - 在ProductSelect和RawMaterialSelect组件中展示BOM属性信息 - 优化物料状态显示条件及仓库过滤逻辑 - 更新统计组件查询参数
This commit is contained in:
@@ -51,3 +51,11 @@ export function delProduct(productId) {
|
|||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function listProductWithBom(query) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/product/listWithBom',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -41,4 +41,4 @@ export function delProductBom(bomId) {
|
|||||||
url: '/wms/productBom/' + bomId,
|
url: '/wms/productBom/' + bomId,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -59,3 +59,11 @@ export function listRawMaterialWithDemand(query) {
|
|||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function listRawMaterialWithBom(query) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/rawMaterial/listWithBom',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -120,8 +120,8 @@ export default {
|
|||||||
Promise.all([
|
Promise.all([
|
||||||
listProduct({ pageSise: 1, pageNum: 1 }),
|
listProduct({ pageSise: 1, pageNum: 1 }),
|
||||||
listRawMaterial({ pageSise: 1, pageNum: 1 }),
|
listRawMaterial({ pageSise: 1, pageNum: 1 }),
|
||||||
listMaterialCoil({ pageSise: 1, pageNum: 1 }),
|
listMaterialCoil({ pageSise: 1, pageNum: 1, dateType: '1' }),
|
||||||
listEquipmentManagement({ pageSise: 1, pageNum: 1 }),
|
listEquipmentManagement({ pageSise: 1, pageNum: 1, status: 'in_service' }),
|
||||||
listOrder({ pageSise: 1, pageNum: 1 }),
|
listOrder({ pageSise: 1, pageNum: 1 }),
|
||||||
listCustomer({ pageSise: 1, pageNum: 1 }),
|
listCustomer({ pageSise: 1, pageNum: 1 }),
|
||||||
listSupplier({ pageSise: 1, pageNum: 1 })
|
listSupplier({ pageSise: 1, pageNum: 1 })
|
||||||
|
|||||||
@@ -8,9 +8,14 @@
|
|||||||
</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}(${item.productCode})`" :value="item.productId">
|
||||||
<div class="option-label">
|
<div>
|
||||||
<span class="product-name">{{ item.productName }}</span>
|
<div class="option-label">
|
||||||
|
<span class="product-name">{{ item.productName }}</span>
|
||||||
<span class="product-code">{{ item.productCode }}</span>
|
<span class="product-code">{{ item.productCode }}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span class="product-sku">{{ getSku(item) }}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
@@ -124,6 +129,33 @@ export default {
|
|||||||
this.productOptions = res.rows || [];
|
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) {
|
onChange(val) {
|
||||||
// 通过val找到item
|
// 通过val找到item
|
||||||
const product = this.productOptions.find(p => p.productId === val);
|
const product = this.productOptions.find(p => p.productId === val);
|
||||||
|
|||||||
@@ -8,9 +8,11 @@
|
|||||||
</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}(${item.rawMaterialCode})`" :value="item.rawMaterialId">
|
||||||
<div class="option-label">
|
<div>
|
||||||
<span class="material-name">{{ item.rawMaterialName }}</span>
|
<div class="option-label">
|
||||||
<span class="material-code">{{ item.rawMaterialCode }}</span>
|
<span class="material-name">{{ item.rawMaterialName }}</span>
|
||||||
|
<span class="material-code">{{ getSku(item) }}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
@@ -61,6 +63,7 @@
|
|||||||
import { mapGetters } from "vuex";
|
import { mapGetters } from "vuex";
|
||||||
import { addRawMaterial } from '@/api/wms/rawMaterial';
|
import { addRawMaterial } from '@/api/wms/rawMaterial';
|
||||||
import BomPanel from '../BomPanel/index.vue';
|
import BomPanel from '../BomPanel/index.vue';
|
||||||
|
import { findItemWithBom } from '@/api/wms/bom';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "RawMaterialSelect",
|
name: "RawMaterialSelect",
|
||||||
@@ -130,6 +133,35 @@ export default {
|
|||||||
const rawMaterial = this.options.find(p => p.rawMaterialId === val);
|
const rawMaterial = this.options.find(p => p.rawMaterialId === val);
|
||||||
this.$emit('change', rawMaterial);
|
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() {
|
add() {
|
||||||
this.addDialogVisible = true;
|
this.addDialogVisible = true;
|
||||||
this.addForm = {
|
this.addForm = {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { listCategory } from '@/api/wms/category';
|
import { listCategory } from '@/api/wms/category';
|
||||||
import { listProduct } from '@/api/wms/product';
|
import { listProductWithBom } from '@/api/wms/product';
|
||||||
import { listRawMaterial } from '@/api/wms/rawMaterial';
|
import { listRawMaterialWithBom } from '@/api/wms/rawMaterial';
|
||||||
import { listBomItem } from '@/api/wms/bomItem';
|
import { listBomItem } from '@/api/wms/bomItem';
|
||||||
|
|
||||||
// 目前存在一个问题,当新增或删除,修改分类、产品、物料时,需要刷新整个页面,才能看到最新的数据
|
// 目前存在一个问题,当新增或删除,修改分类、产品、物料时,需要刷新整个页面,才能看到最新的数据
|
||||||
@@ -51,7 +51,7 @@ const actions = {
|
|||||||
if (Object.keys(state.productMap).length > 0) {
|
if (Object.keys(state.productMap).length > 0) {
|
||||||
return Promise.resolve(state.productMap);
|
return Promise.resolve(state.productMap);
|
||||||
}
|
}
|
||||||
return listProduct({ pageNum: 1, pageSize: 10000 }).then(res => {
|
return listProductWithBom({ pageNum: 1, pageSize: 10000 }).then(res => {
|
||||||
const map = {};
|
const map = {};
|
||||||
res.rows.forEach(item => {
|
res.rows.forEach(item => {
|
||||||
map[item.productId] = item;
|
map[item.productId] = item;
|
||||||
@@ -65,7 +65,7 @@ const actions = {
|
|||||||
if (Object.keys(state.rawMaterialMap).length > 0) {
|
if (Object.keys(state.rawMaterialMap).length > 0) {
|
||||||
return Promise.resolve(state.rawMaterialMap);
|
return Promise.resolve(state.rawMaterialMap);
|
||||||
}
|
}
|
||||||
return listRawMaterial({ pageNum: 1, pageSize: 10000 }).then(res => {
|
return listRawMaterialWithBom({ pageNum: 1, pageSize: 10000 }).then(res => {
|
||||||
const map = {};
|
const map = {};
|
||||||
res.rows.forEach(item => {
|
res.rows.forEach(item => {
|
||||||
map[item.rawMaterialId] = item;
|
map[item.rawMaterialId] = item;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
<QRCode :content="scope.row.qrcodeRecordId" :size="50" />
|
<QRCode :content="scope.row.qrcodeRecordId" :size="50" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="状态" align="center" prop="status">
|
<el-table-column label="状态" v-if="showStatus" align="center" prop="status">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-model="scope.row.status" placeholder="请选择状态" @change="handleStatusChange(scope.row)">
|
<el-select v-model="scope.row.status" placeholder="请选择状态" @change="handleStatusChange(scope.row)">
|
||||||
<el-option v-for="item in dict.type.product_coil_status" :key="item.value" :value="parseInt(item.value)" :label="item.label" />
|
<el-option v-for="item in dict.type.product_coil_status" :key="item.value" :value="parseInt(item.value)" :label="item.label" />
|
||||||
@@ -307,7 +307,12 @@ export default {
|
|||||||
endTime: this.queryParams.updateTime?.[1],
|
endTime: this.queryParams.updateTime?.[1],
|
||||||
}
|
}
|
||||||
listMaterialCoil(query).then(response => {
|
listMaterialCoil(query).then(response => {
|
||||||
this.materialCoilList = response.rows;
|
if (this.querys.warehouseId != 111) {
|
||||||
|
// 排除掉111仓库的
|
||||||
|
this.materialCoilList = response.rows.filter(item => item.warehouseId != 111)
|
||||||
|
} else {
|
||||||
|
this.materialCoilList = response.rows;
|
||||||
|
}
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user