feat(合同管理): 新增钢卷与合同关联功能

- 添加钢卷与合同关联的API接口
- 在合卷、分条、打字等操作中增加合同选择组件
- 创建合同选择组件ContractSelect
- 在合同详情页新增生产成果展示页签
- 实现合同列表的本地存储功能
This commit is contained in:
2026-04-18 16:18:22 +08:00
parent 143764f7f8
commit af002b84d3
9 changed files with 414 additions and 109 deletions

View File

@@ -94,7 +94,7 @@
</div>
<div class="info-row">
<span class="info-label">逻辑库区</span>
<span class="info-value">{{ currentInfo.nextWarehouseName || '—' }}</span>
<span class="info-value">{{ currentInfo.warehouseName || '—' }}</span>
</div>
<div class="info-row" v-if="currentInfo.remark">
<span class="info-label">备注</span>
@@ -195,7 +195,7 @@
<el-form-item label="实测厚度(m)" prop="actualThickness" class="form-item-half">
<el-input-number :controls="false" v-model="updateForm.actualThickness" placeholder="请输入实测厚度"
type="number" :step="0.01" :disabled="readonly">
type="number" :step="0.01">
<template slot="append"></template>
</el-input-number>
</el-form-item>
@@ -251,6 +251,10 @@
show-word-limit />
</el-form-item>
<el-form-item label="关联合同" prop="contractId">
<ContractSelect v-model="updateForm.contractId" placeholder="请选择合同" />
</el-form-item>
<el-form-item label="异常信息">
<div class="abnormal-container">
<div
@@ -335,6 +339,8 @@ import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
import TimeInput from "@/components/TimeInput";
import AbnormalForm from './components/AbnormalForm';
import { generateCoilNoPrefix } from "@/utils/coil/coilNo";
import { addCoilContractRel } from "@/api/wms/coilContractRel";
import ContractSelect from "@/components/KLPService/ContractSelect";
export default {
name: 'TypingCoil',
@@ -344,7 +350,8 @@ export default {
ProductSelect,
WarehouseSelect,
TimeInput,
AbnormalForm
AbnormalForm,
ContractSelect
},
dicts: ['coil_quality_status', 'coil_abnormal_position', 'coil_abnormal_code', 'coil_abnormal_degree', 'coil_business_purpose'],
data() {
@@ -365,7 +372,6 @@ export default {
netWeight: undefined,
warehouseId: null,
warehouseId: null,
nextWarehouseName: '',
status: 0,
remark: '',
length: undefined,
@@ -449,8 +455,6 @@ export default {
{ required: true, message: '请选择逻辑库区', trigger: 'change' }
],
},
warehouseList: [],
historySteps: [],
actionId: null,
acidPrefill: {
visible: false,
@@ -458,10 +462,6 @@ export default {
title: ''
},
isAcidRolling: false,
// 原材料和产品列表(实时搜索,不再保存完整备份)
rawMaterialList: [],
productList: [],
itemSearchLoading: false,
// 酸连轧最近记录
acidRecentRecords: [],
// 异常信息
@@ -480,7 +480,8 @@ export default {
defectCode: null,
degree: null,
remark: null
}
},
contractList: [],
};
},
computed: {
@@ -502,26 +503,8 @@ export default {
}
return '请先选择材料类型';
},
// 当前物品列表(根据物品类型动态切换)
currentItemList() {
if (this.updateForm.itemType === 'raw_material') {
return this.rawMaterialList.map(item => ({
id: item.rawMaterialId,
name: this.formatItemName(item)
}));
} else if (this.updateForm.itemType === 'product') {
return this.productList.map(item => ({
id: item.productId,
name: this.formatItemName(item)
}));
}
return [];
}
},
async created() {
// 先加载库区列表
await this.loadWarehouses();
// 从路由参数获取coilId和actionId
const coilId = this.$route.query.coilId;
const actionId = this.$route.query.actionId;
@@ -645,12 +628,9 @@ export default {
// 根据材料类型设置物品类型
if (value === '成品') {
this.$set(this.updateForm, 'itemType', 'product');
// 清空列表,等待用户搜索
this.productList = [];
} else if (value === '原料') {
this.$set(this.updateForm, 'itemType', 'raw_material');
// 清空列表,等待用户搜索
this.rawMaterialList = [];
}
},
@@ -675,8 +655,6 @@ export default {
// 填充当前信息(左侧)
this.currentInfo = {
...data,
itemName: this.getItemName(data),
nextWarehouseName: this.getWarehouseName(data.warehouseId),
};
// 填充时间相关字段
@@ -698,14 +676,6 @@ export default {
}
},
// 获取物料名称
getItemName(data) {
if (data.itemName) {
return data.itemName;
}
return '';
},
// 获取物品类型文本
getItemTypeText(itemType) {
if (itemType === 'raw_material') return '原材料';
@@ -713,13 +683,6 @@ export default {
return '—';
},
// 获取库区名称
getWarehouseName(warehouseId) {
if (!warehouseId) return '';
const warehouse = this.warehouseList.find(w => w.warehouseId === warehouseId);
return warehouse ? warehouse.warehouseName : '';
},
// 格式化物品名称(添加规格和参数信息)
formatItemName(item) {
if (!item) return '';
@@ -754,41 +717,7 @@ export default {
return displayName;
},
// 加载库区列表
async loadWarehouses() {
try {
const response = await listWarehouse({ pageNum: 1, pageSize: 1000 });
if (response.code === 200) {
this.warehouseList = response.rows || response.data || [];
}
} catch (error) {
console.error('加载库区列表失败', error);
}
},
// 加载变更历史
async loadHistory() {
if (!this.currentInfo.enterCoilNo) {
return;
}
try {
this.historyLoading = true;
const response = await getMaterialCoilTrace({
enterCoilNo: this.currentInfo.enterCoilNo,
currentCoilNo: this.currentInfo.currentCoilNo || undefined
});
if (response.code === 200 && response.data) {
this.historySteps = response.data.steps || [];
}
} catch (error) {
console.error('加载变更历史失败', error);
} finally {
this.historyLoading = false;
}
},
// 复制当前信息到更新表单
copyFromCurrent() {
@@ -872,6 +801,15 @@ export default {
const response = await updateMaterialCoil(updateData);
// 更新完成后如果选定了合同,需要增加与合同的绑定关系
const coilId = response.msg;
if (this.updateForm.contractId) {
await addCoilContractRel({
coilId: coilId,
contractId: this.updateForm.contractId,
});
}
if (response.code === 200) {
this.$message.success('钢卷信息更新成功');
@@ -880,6 +818,8 @@ export default {
await completeAction(this.actionId, response.msg);
}
// 延迟返回
setTimeout(() => {
this.$router.back();