feat(钢卷管理): 添加成品钢卷的质量状态、切边要求等字段

在钢卷管理的分条、合卷和基础信息页面中,为成品类型的钢卷新增质量状态、切边要求、打包状态和包装要求字段
同时移除未使用的采购计划相关代码
This commit is contained in:
砂糖
2025-11-14 09:49:33 +08:00
parent 6f448faa45
commit bbbe7cefd8
6 changed files with 266 additions and 346 deletions

View File

@@ -94,12 +94,8 @@
</el-form-item>
<el-form-item label="材料类型" prop="materialType">
<el-select
v-model="updateForm.materialType"
placeholder="请选择材料类型"
style="width: 100%"
:disabled="readonly"
@change="handleMaterialTypeChange">
<el-select v-model="updateForm.materialType" placeholder="请选择材料类型" style="width: 100%"
:disabled="readonly" @change="handleMaterialTypeChange">
<el-option label="原料" value="原料" />
<el-option label="成品" value="成品" />
<el-option label="废品" value="废品" />
@@ -107,19 +103,35 @@
</el-form-item>
<!-- 物品类型由材料类型自动决定不显示选择框 -->
<el-form-item
:label="getItemLabel"
:prop="updateForm.materialType === '废品' ? '' : 'itemId'"
<el-form-item v-if="updateForm.materialType === '成品'" label="质量状态" prop="qualityStatus">
<el-input v-model="updateForm.qualityStatus" placeholder="请输入质量状态"
:disabled="readonly">
</el-input>
</el-form-item>
<el-form-item v-if="updateForm.materialType === '成品'" label="切边要求" prop="qualityStatus">
<el-input v-model="updateForm.trimmingRequirement" placeholder="请输入切边要求"
:disabled="readonly">
</el-input>
</el-form-item>
<el-form-item v-if="updateForm.materialType === '成品'" label="打包状态" prop="qualityStatus">
<el-input v-model="updateForm.packingStatus" placeholder="请输入打包状态"
:disabled="readonly">
</el-input>
</el-form-item>
<el-form-item v-if="updateForm.materialType === '成品'" label="包装要求" prop="qualityStatus">
<el-input v-model="updateForm.packagingRequirement" placeholder="请输入包装要求"
:disabled="readonly">
</el-input>
</el-form-item>
<el-form-item :label="getItemLabel" :prop="updateForm.materialType === '废品' ? '' : 'itemId'"
:rules="updateForm.materialType === '废品' ? [] : rules.itemId">
<el-select
v-model="updateForm.itemId"
:placeholder="getItemPlaceholder"
filterable
remote
:remote-method="searchItems"
:loading="itemSearchLoading"
style="width: 100%"
<el-select v-model="updateForm.itemId" :placeholder="getItemPlaceholder" filterable remote
:remote-method="searchItems" :loading="itemSearchLoading" style="width: 100%"
:disabled="readonly || !updateForm.materialType">
<el-option v-for="item in currentItemList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
@@ -365,7 +377,7 @@ export default {
handleMaterialTypeChange(value) {
// 清空物品选择
this.$set(this.updateForm, 'itemId', null);
// 根据材料类型设置物品类型
if (value === '成品') {
this.$set(this.updateForm, 'itemType', 'product');
@@ -377,7 +389,7 @@ export default {
this.rawMaterialList = [...this.allRawMaterials];
}
},
// 加载钢卷信息
async loadCoilInfo(coilId) {
try {
@@ -451,35 +463,35 @@ export default {
// 格式化物品名称(添加规格和参数信息)
formatItemName(item) {
if (!item) return '';
// 获取名称(原材料或产品)
const name = item.rawMaterialName || item.productName || '';
if (!name) return '';
let displayName = name;
const specs = [];
// 1. 优先显示规格从对象的specification字段
if (item.specification) {
specs.push(item.specification);
}
// 2. 添加参数参数最多2个
if (item.bomItems && item.bomItems.length > 0) {
const bomParams = item.bomItems
.filter(bomItem => bomItem.attrKey && bomItem.attrValue)
.slice(0, 2); // 最多2个参数参数
bomParams.forEach(param => {
specs.push(`${param.attrKey}:${param.attrValue}`);
});
}
// 3. 拼接成最终格式
if (specs.length > 0) {
displayName += `${specs.join(' ')}`;
}
return displayName;
},
@@ -523,13 +535,13 @@ export default {
if (!itemType) {
return;
}
try {
this.itemSearchLoading = true;
if (itemType === 'raw_material') {
// 使用带参数的接口
const response = await listRawMaterial({
pageNum: 1,
const response = await listRawMaterial({
pageNum: 1,
pageSize: 100,
withBom: true // 请求包含参数信息
});
@@ -538,8 +550,8 @@ export default {
}
} else if (itemType === 'product') {
// 使用带参数的接口
const response = await listProduct({
pageNum: 1,
const response = await listProduct({
pageNum: 1,
pageSize: 100,
withBom: true // 请求包含参数信息
});
@@ -560,7 +572,7 @@ export default {
this.$message.warning('请先选择材料类型');
return;
}
// 如果没有输入,恢复完整列表
if (!query || query.trim() === '') {
if (this.updateForm.itemType === 'raw_material') {
@@ -570,10 +582,10 @@ export default {
}
return;
}
// 前端过滤:在已加载的数据中搜索
const searchQuery = query.toLowerCase().trim();
if (this.updateForm.itemType === 'raw_material') {
// 从备份列表中过滤原材料
this.rawMaterialList = this.allRawMaterials.filter(item => {
@@ -582,11 +594,11 @@ export default {
// 搜索规格
const specMatch = item.specification && item.specification.toLowerCase().includes(searchQuery);
// 搜索 参数 参数
const bomMatch = item.bomItems && item.bomItems.some(bom =>
const bomMatch = item.bomItems && item.bomItems.some(bom =>
(bom.attrKey && bom.attrKey.toLowerCase().includes(searchQuery)) ||
(bom.attrValue && bom.attrValue.toLowerCase().includes(searchQuery))
);
return nameMatch || specMatch || bomMatch;
});
} else if (this.updateForm.itemType === 'product') {
@@ -597,11 +609,11 @@ export default {
// 搜索规格
const specMatch = item.specification && item.specification.toLowerCase().includes(searchQuery);
// 搜索 参数 参数
const bomMatch = item.bomItems && item.bomItems.some(bom =>
const bomMatch = item.bomItems && item.bomItems.some(bom =>
(bom.attrKey && bom.attrKey.toLowerCase().includes(searchQuery)) ||
(bom.attrValue && bom.attrValue.toLowerCase().includes(searchQuery))
);
return nameMatch || specMatch || bomMatch;
});
}