feat(wms): 添加酸连轧最近记录展示功能

- 在钢卷录入界面添加酸连轧最近10条记录表格展示
- 实现酸连轧数据回填到表单的功能
- 支持数组格式和单个对象格式的数据兼容处理
- 添加毛重、净重、长度和班组信息的自动填充
- 优化界面布局增加卡片间距提升用户体验
- 修复多个表单项的代码格式缩进问题
This commit is contained in:
2026-02-07 16:59:28 +08:00
parent afd5b0479d
commit 64b4d6e5e4

View File

@@ -214,6 +214,29 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
<!-- 酸连轧最近10条记录展示 -->
<el-card class="recent-records-card" v-if="acidRecentRecords && acidRecentRecords.length > 0">
<div slot="header" class="card-header">
<span><i class="el-icon-time"></i> 酸连轧最近记录</span>
</div>
<el-table :data="acidRecentRecords" stripe size="small">
<el-table-column prop="currentCoilNo" label="当前钢卷号" width="150" show-overflow-tooltip></el-table-column>
<el-table-column prop="excoilId" label="出口卷号" width="150" show-overflow-tooltip></el-table-column>
<el-table-column prop="exitWeight" label="出口重量(t)" width="100">
<template slot-scope="scope">
{{ scope.row.exitWeight ? scope.row.exitWeight + ' t' : '—' }}
</template>
</el-table-column>
<el-table-column prop="exitLength" label="出口长度(m)" width="120">
<template slot-scope="scope">
{{ scope.row.exitLength ? scope.row.exitLength + ' m' : '—' }}
</template>
</el-table-column>
<el-table-column prop="team" label="班组" width="80"></el-table-column>
</el-table>
</el-card>
</div> </div>
</div> </div>
@@ -379,7 +402,9 @@ export default {
productList: [], productList: [],
itemSearchLoading: false, itemSearchLoading: false,
// 只读模式 // 只读模式
readonly: false readonly: false,
// 酸连轧最近记录
acidRecentRecords: []
}; };
}, },
computed: { computed: {
@@ -457,6 +482,34 @@ export default {
this.acidPrefill.type = 'info' this.acidPrefill.type = 'info'
this.acidPrefill.title = '未在二级系统中查找到对应信息,请自行填写' this.acidPrefill.title = '未在二级系统中查找到对应信息,请自行填写'
} else { } else {
// 处理返回的列表数据
if (Array.isArray(prefill)) {
this.acidRecentRecords = prefill;
// 使用第一条记录填充表单(保持原有逻辑)
const firstRecord = prefill[0];
if (firstRecord) {
if (firstRecord.exitWeight != null && firstRecord.exitWeight !== '') {
const w = Number(firstRecord.exitWeight)
if (!Number.isNaN(w)) {
this.$set(this.updateForm, 'grossWeight', w)
this.$set(this.updateForm, 'netWeight', w)
}
}
if (firstRecord.exitLength != null && firstRecord.exitLength !== '') {
const len = Number(firstRecord.exitLength)
if (!Number.isNaN(len)) {
this.$set(this.updateForm, 'length', len)
}
}
if (firstRecord.team) {
this.$set(this.updateForm, 'team', firstRecord.team)
}
}
} else {
// 为了兼容旧版本的单个对象返回格式
if (prefill.exitWeight != null && prefill.exitWeight !== '') { if (prefill.exitWeight != null && prefill.exitWeight !== '') {
const w = Number(prefill.exitWeight) const w = Number(prefill.exitWeight)
if (!Number.isNaN(w)) { if (!Number.isNaN(w)) {
@@ -475,10 +528,10 @@ export default {
if (prefill.team) { if (prefill.team) {
this.$set(this.updateForm, 'team', prefill.team) this.$set(this.updateForm, 'team', prefill.team)
} }
}
this.acidPrefill.type = 'success' this.acidPrefill.type = 'success'
this.acidPrefill.title = '已结合酸轧二级系统完成部分信息填写' this.acidPrefill.title = '已结合酸轧二级系统完成部分信息填写'
console.log('[typing] acid rolling prefill applied:', prefill) console.log('[typing] acid rolling prefill applied:', prefill)
} }
} catch (e) { } catch (e) {
@@ -833,6 +886,7 @@ export default {
min-width: 0; min-width: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 20px; // 添加间距
} }
/* 确保两侧卡片高度一致 */ /* 确保两侧卡片高度一致 */
@@ -849,6 +903,11 @@ export default {
} }
} }
// 新增:最近记录卡片样式
.recent-records-card {
flex: none; // 不伸缩,只占据内容所需空间
}
/* 变更历史区域(占满整行) */ /* 变更历史区域(占满整行) */
.history-section { .history-section {
margin-top: 20px; margin-top: 20px;