月工资计算,产品详情页补充

This commit is contained in:
朱昊天
2026-04-20 18:47:36 +08:00
parent 3ae6403bd3
commit 2e7a50bf64
15 changed files with 660 additions and 20 deletions

View File

@@ -25,6 +25,11 @@
<raw :data="scope.row" :materialId="scope.row.materialId" />
</template>
</el-table-column>
<el-table-column label="物料类型" width="100" align="center">
<template #default="scope">
{{ scope.row.material?.materialType === 1 ? '辅料' : scope.row.material?.materialType === 2 ? '主材' : '-' }}
</template>
</el-table-column>
<el-table-column label="所需数量" align="center" prop="materialNum">
<template #default="scope">
{{ formatDecimal(scope.row.materialNum) }}
@@ -75,6 +80,7 @@
<script setup name="ProductMaterialRelation">
import { listProductMaterialRelation, getProductMaterialRelation, delProductMaterialRelation, addProductMaterialRelation, updateProductMaterialRelation } from "@/api/mat/productMaterialRelation";
import { getMaterial } from "@/api/mat/material";
import RawSelector from '@/components/RawSelector/index.vue'
import Raw from '@/components/Renderer/Raw.vue'
import { formatDecimal } from '@/utils/gear'
@@ -128,8 +134,21 @@ watch(() => props.productId, (newVal, oldVal) => {
function getList() {
loading.value = true;
listProductMaterialRelation(queryParams.value).then(response => {
productMaterialRelationList.value = response.rows;
total.value = response.total;
const relations = response.rows;
// 为每个配方项获取物料详细信息,包括物料类型
const promises = relations.map(item => {
return getMaterial(item.materialId).then(materialResponse => {
item.material = materialResponse.data;
return item;
});
});
return Promise.all(promises);
}).then(relationsWithMaterial => {
productMaterialRelationList.value = relationsWithMaterial;
total.value = relationsWithMaterial.length;
loading.value = false;
}).catch(error => {
console.error('获取数据失败:', error);
loading.value = false;
});
}