更正前端内容

This commit is contained in:
2026-01-07 20:15:34 +08:00
parent 9bba1a4dad
commit f65a4439ae
7 changed files with 217 additions and 585 deletions

View File

@@ -1,16 +1,17 @@
<template>
<div class="plan-recommend-panel">
<!-- 钢种推荐 -->
<div class="recommend-section steel-panel">
<div class="section-header">
<div>
<div class="section-title">钢种推荐</div>
<div class="section-subtitle">锁定钢种后自动调取面板库中的典型工艺主数据</div>
<div class="section-subtitle">根据钢种查询历史工艺参数组合</div>
</div>
<el-tag v-if="steelGradeName" size="mini" effect="dark">{{ steelGradeName }}</el-tag>
</div>
<div class="section-body" v-loading="loadingSteel">
<template v-if="steelRecommendations.length">
<div class="card-list two-cols">
<div class="card-list">
<div
class="recommend-card"
v-for="item in steelRecommendations"
@@ -18,27 +19,13 @@
@click="emitSteelGrade(item)"
>
<div class="card-header">
<div class="card-title">
{{ item.steelGradeLabel || '钢种' }}
</div>
<el-tag size="mini" type="info">
厚度 {{ formatNumber(item.entryThick) }} mm
</el-tag>
<div class="card-title">{{ item.steelGradeLabel || '钢种' }}</div>
<el-tag size="mini" type="info">厚度 {{ formatNumber(item.thick) }} mm</el-tag>
</div>
<div class="card-meta">
<div>
<span class="label">屈服</span>
<span class="value">{{ formatNumber(item.yieldPoint) }}</span>
</div>
<div>
<span class="label">延伸率</span>
<span class="value">{{ formatNumber(item.spmElongation) }}</span>
</div>
</div>
<div class="card-meta">
<div>
<span class="label">轧制力</span>
<span class="value">{{ formatNumber(item.spmRollforce) }}</span>
<span class="label">屈服强度</span>
<span class="value">{{ formatNumber(item.yieldStren) }}</span>
</div>
<div>
<span class="label">更新时间</span>
@@ -46,169 +33,13 @@
</div>
</div>
<div class="card-footer">
<span>点击写入钢种及主键</span>
<span>点击应用此组合</span>
<i class="el-icon-top-right" />
</div>
</div>
</div>
</template>
<el-empty
v-else
description="选择钢种后即可联动查询"
:image-size="100"
/>
</div>
</div>
<div class="recommend-section thickness-panel">
<div class="section-header">
<div>
<div class="section-title">厚度/屈服点联动</div>
<div class="section-subtitle">输入厚度后自动搜集多面板库对应的屈服点档案</div>
</div>
<el-tag v-if="entryThick" size="mini" effect="plain">{{ formatNumber(entryThick) }} mm</el-tag>
</div>
<div class="section-body" v-loading="loadingThickness">
<template v-if="thicknessRecommendations.length">
<div class="card-list">
<div
class="recommend-card"
v-for="item in thicknessRecommendations"
:key="item._id"
@click="emitThickness(item)"
>
<div class="card-header">
<div class="card-title">
{{ formatNumber(item.entryThick) }} mm
</div>
<el-tag size="mini" type="success">
屈服点 {{ formatNumber(item.yieldPoint) }}
</el-tag>
</div>
<div class="card-meta">
<div>
<span class="label">钢种</span>
<span class="value">{{ item.steelGradeLabel || '-' }}</span>
</div>
<div>
<span class="label">数据来源</span>
<span class="value">{{ item.sourceLabel }}</span>
</div>
</div>
<div class="card-footer">
<span>{{ item.updateTime ? '最近更新 ' + formatDate(item.updateTime) : '点击写入厚度/屈服点' }}</span>
<i class="el-icon-top-right" />
</div>
</div>
</div>
</template>
<el-empty
v-else
description="填写厚度后可获取推荐屈服点"
:image-size="100"
/>
</div>
</div>
<div class="recommend-section width-panel">
<div class="section-header">
<div>
<div class="section-title">宽度/弯辊力联动</div>
<div class="section-subtitle">根据宽度&轧制力匹配弯辊力与宽度组合</div>
</div>
<el-tag v-if="entryWidth" size="mini" type="info">{{ formatNumber(entryWidth) }} mm</el-tag>
</div>
<div class="section-body" v-loading="loadingWidth">
<template v-if="widthRecommendations.length">
<div class="card-list">
<div
class="recommend-card"
v-for="item in widthRecommendations"
:key="item._id"
@click="emitWidth(item)"
>
<div class="card-header">
<div class="card-title">{{ formatNumber(item.width) }} mm</div>
<el-tag size="mini" effect="plain">轧制力 {{ formatNumber(item.rollForce) }}</el-tag>
</div>
<div class="card-meta">
<div>
<span class="label">弯辊力</span>
<span class="value">{{ formatNumber(item.bendForce) }}</span>
</div>
<div>
<span class="label">数据来源</span>
<span class="value">{{ item.sourceLabel }}</span>
</div>
</div>
<div class="card-footer">
<span>点击写入宽度/轧制力</span>
<i class="el-icon-top-right" />
</div>
</div>
</div>
</template>
<el-empty
v-else
description="填写宽度后可获取推荐数据"
:image-size="100"
/>
</div>
</div>
<div class="recommend-section rollforce-panel">
<div class="section-header">
<div>
<div class="section-title">轧制力反查</div>
<div class="section-subtitle">输入轧制力后反查对应厚度/屈服点组合</div>
</div>
<el-tag v-if="spmRollforce" size="mini" type="warning">{{ formatNumber(spmRollforce) }}</el-tag>
</div>
<div class="section-body" v-loading="loadingRollforce">
<template v-if="rollforceFocusRecommendations.length">
<div class="card-list">
<div
class="recommend-card"
v-for="item in rollforceFocusRecommendations"
:key="item._id"
@click="emitRollforce(item)"
>
<div class="card-header">
<div class="card-title">{{ formatNumber(item.spmRollforce) }}</div>
<el-tag size="mini" type="success">{{ item.sourceLabel }}</el-tag>
</div>
<div class="card-meta">
<div>
<span class="label">厚度</span>
<span class="value">{{ formatNumber(item.entryThick) }} mm</span>
</div>
<div>
<span class="label">屈服点</span>
<span class="value">{{ formatNumber(item.yieldPoint) }}</span>
</div>
</div>
<div class="card-meta">
<div>
<span class="label">延伸率</span>
<span class="value">{{ formatNumber(item.spmElongation) }}</span>
</div>
<div>
<span class="label">钢种</span>
<span class="value">{{ item.steelGradeLabel || '-' }}</span>
</div>
</div>
<div class="card-footer">
<span>点击写入相关字段</span>
<i class="el-icon-top-right" />
</div>
</div>
</div>
</template>
<el-empty
v-else
description="填写轧制力后可获取推荐数据"
:image-size="100"
/>
<el-empty v-else description="选择钢种后即可联动查询" :image-size="100" />
</div>
</div>
</div>
@@ -216,9 +47,10 @@
<script>
import { parseTime } from '@/utils/ruoyi'
import { listRollforce } from '@/api/business/rollforce'
import { listTension } from '@/api/business/tension'
import { listBendforce } from '@/api/business/bendforce'
import { listTensionAllLine } from '@/api/business/fullLineTension'
import { listTensionLeveler } from '@/api/business/levelerTension'
import { listTensionStraightener } from '@/api/business/straightenerTension'
import { listTensionAnnealingFurnace } from '@/api/business/annealingFurnaceTension'
let uid = 0
const createId = () => ++uid
@@ -226,45 +58,20 @@ const createId = () => ++uid
export default {
name: 'PlanRecommendPanel',
props: {
steelGrade: {
type: [String, Number],
default: null
},
entryThick: {
type: [String, Number],
default: null
},
entryWidth: {
type: [String, Number],
default: null
},
spmRollforce: {
type: [String, Number],
default: null
},
steelGradeList: {
type: Array,
default: () => []
}
steelGrade: { type: [String, Number], default: null },
entryThick: { type: [String, Number], default: null },
steelGradeList: { type: Array, default: () => [] }
},
data() {
return {
steelRecommendations: [],
thicknessRecommendations: [],
widthRecommendations: [],
rollforceFocusRecommendations: [],
loadingSteel: false,
loadingThickness: false,
loadingWidth: false,
loadingRollforce: false,
steelFetchToken: 0,
thicknessFetchToken: 0,
widthFetchToken: 0,
rollforceFetchToken: 0,
steelDebounceTimer: null,
thicknessDebounceTimer: null,
widthDebounceTimer: null,
rollforceDebounceTimer: null
thicknessDebounceTimer: null
}
},
computed: {
@@ -276,92 +83,85 @@ export default {
steelGrade: {
immediate: true,
handler(val) {
if (val === undefined || val === null || val === '') {
if (!val) {
this.steelRecommendations = []
return
}
clearTimeout(this.steelDebounceTimer)
this.steelDebounceTimer = setTimeout(() => {
this.fetchSteelRecommendations()
}, 200)
this.steelDebounceTimer = setTimeout(() => this.fetchSteelRecommendations(), 200)
}
},
entryThick: {
immediate: true,
handler(val) {
if (val === undefined || val === null || val === '') {
if (!val) {
this.thicknessRecommendations = []
return
}
clearTimeout(this.thicknessDebounceTimer)
this.thicknessDebounceTimer = setTimeout(() => {
this.fetchThicknessRecommendations()
}, 200)
}
},
entryWidth: {
immediate: true,
handler(val) {
if (val === undefined || val === null || val === '') {
this.widthRecommendations = []
return
}
clearTimeout(this.widthDebounceTimer)
this.widthDebounceTimer = setTimeout(() => {
this.fetchWidthRecommendations()
}, 200)
}
},
spmRollforce: {
immediate: true,
handler(val) {
if (val === undefined || val === null || val === '') {
this.rollforceFocusRecommendations = []
return
}
clearTimeout(this.rollforceDebounceTimer)
this.rollforceDebounceTimer = setTimeout(() => {
this.fetchRollforceFocus()
}, 200)
this.thicknessDebounceTimer = setTimeout(() => this.fetchThicknessRecommendations(), 200)
}
}
},
beforeDestroy() {
clearTimeout(this.steelDebounceTimer)
clearTimeout(this.thicknessDebounceTimer)
clearTimeout(this.widthDebounceTimer)
clearTimeout(this.rollforceDebounceTimer)
},
methods: {
getSteelGradeLabel(gradeId) {
if (gradeId === undefined || gradeId === null) return ''
const gid = String(gradeId)
getSteelGradeLabel(grade) {
if (grade === undefined || grade === null) return ''
const gradeStr = String(grade)
const match = this.steelGradeList.find(
item =>
String(item.gradeid) === gid ||
String(item.gradeId) === gid ||
String(item.name) === gid ||
String(item.gradeName || '') === gid
(item) => String(item.gradeid) === gradeStr ||
String(item.gradeId) === gradeStr ||
String(item.name || '') === gradeStr ||
String(item.gradeName || '') === gradeStr
)
return match ? (match.name || match.gradeName || gid) : gid
return match ? match.name || match.gradeName : gradeStr
},
async fetchAllTensionData(query) {
const [allLineRes, levelerRes, straightenerRes, furnaceRes] = await Promise.allSettled([
listTensionAllLine(query),
listTensionLeveler(query),
listTensionStraightener(query),
listTensionAnnealingFurnace(query)
])
const records = []
if (allLineRes.status === 'fulfilled') {
records.push(...(allLineRes.value.rows || []).map(r => ({ ...r, sourceLabel: '全线张力' })))
}
if (levelerRes.status === 'fulfilled') {
records.push(...(levelerRes.value.rows || []).map(r => ({ ...r, sourceLabel: '平整机张力' })))
}
if (straightenerRes.status === 'fulfilled') {
records.push(...(straightenerRes.value.rows || []).map(r => ({ ...r, sourceLabel: '矫直机张力' })))
}
if (furnaceRes.status === 'fulfilled') {
records.push(...(furnaceRes.value.rows || []).map(r => ({ ...r, sourceLabel: '退火炉张力' })))
}
return records
},
async fetchSteelRecommendations() {
const token = ++this.steelFetchToken
this.loadingSteel = true
try {
const gradeLabel = this.getSteelGradeLabel(this.steelGrade)
const response = await listRollforce({
const allRecords = await this.fetchAllTensionData({
pageNum: 1,
pageSize: 8,
steelGrade: gradeLabel || this.steelGrade,
gradeId: this.steelGrade
pageSize: 50, // Fetch more to get variety
steelGrade: gradeLabel || this.steelGrade
})
if (token !== this.steelFetchToken) return
const rows = Array.isArray(response.rows) ? response.rows : []
this.steelRecommendations = rows.map(row => this.mapRollforceRow(row))
const mapped = allRecords.map(row => this.mapTensionRow(row))
this.steelRecommendations = this.uniqueRecords(mapped, ['steelGrade', 'thick', 'yieldStren']).slice(0, 8)
} catch (error) {
console.error('fetchSteelRecommendations error:', error)
this.$message?.error('钢种推荐获取失败,请稍后重试')
this.$message?.error('钢种推荐获取失败')
this.steelRecommendations = []
} finally {
if (token === this.steelFetchToken) {
@@ -369,38 +169,24 @@ export default {
}
}
},
async fetchThicknessRecommendations() {
const rawValue = this.entryThick
if (rawValue === undefined || rawValue === null || rawValue === '') {
this.thicknessRecommendations = []
return
}
const token = ++this.thicknessFetchToken
this.loadingThickness = true
try {
const query = {
const allRecords = await this.fetchAllTensionData({
pageNum: 1,
pageSize: 8,
thick: rawValue
}
const [rollforceRes, tensionRes] = await Promise.allSettled([
listRollforce(query),
listTension(query)
])
pageSize: 50,
thick: this.entryThick
})
if (token !== this.thicknessFetchToken) return
const records = []
if (rollforceRes.status === 'fulfilled') {
const rows = Array.isArray(rollforceRes.value.rows) ? rollforceRes.value.rows : []
records.push(...rows.map(row => this.mapRollforceRow(row, '光整机轧制力')))
}
if (tensionRes.status === 'fulfilled') {
const rows = Array.isArray(tensionRes.value.rows) ? tensionRes.value.rows : []
records.push(...rows.map(row => this.mapTensionRow(row)))
}
this.thicknessRecommendations = this.uniqueRecords(records).slice(0, 8)
const mapped = allRecords.map(row => this.mapTensionRow(row))
this.thicknessRecommendations = this.uniqueRecords(mapped, ['steelGrade', 'thick', 'yieldStren']).slice(0, 8)
} catch (error) {
console.error('fetchThicknessRecommendations error:', error)
this.$message?.error('厚度推荐获取失败,请稍后重试')
this.$message?.error('厚度推荐获取失败')
this.thicknessRecommendations = []
} finally {
if (token === this.thicknessFetchToken) {
@@ -408,173 +194,53 @@ export default {
}
}
},
async fetchWidthRecommendations() {
const widthVal = Number(this.entryWidth)
if (Number.isNaN(widthVal)) {
this.widthRecommendations = []
return
}
const token = ++this.widthFetchToken
this.loadingWidth = true
try {
const response = await listBendforce({
pageNum: 1,
pageSize: 50,
width: widthVal
})
if (token !== this.widthFetchToken) return
const rows = Array.isArray(response.rows) ? response.rows : []
const tolerance = Math.max(2, widthVal * 0.01)
const matches = rows
.filter(row => {
const value = Number(row.width)
return !Number.isNaN(value) && Math.abs(value - widthVal) <= tolerance
})
.map(row => this.mapBendforceRow(row))
this.widthRecommendations = matches.slice(0, 6)
} catch (error) {
console.error('fetchWidthRecommendations error:', error)
this.$message?.error('宽度推荐获取失败,请稍后重试')
this.widthRecommendations = []
} finally {
if (token === this.widthFetchToken) {
this.loadingWidth = false
}
}
},
async fetchRollforceFocus() {
const rollforceVal = Number(this.spmRollforce)
if (Number.isNaN(rollforceVal)) {
this.rollforceFocusRecommendations = []
return
}
const token = ++this.rollforceFetchToken
this.loadingRollforce = true
try {
const response = await listRollforce({
pageNum: 1,
pageSize: 50,
value1: rollforceVal
})
if (token !== this.rollforceFetchToken) return
const rows = Array.isArray(response.rows) ? response.rows : []
const tolerance = Math.max(5, rollforceVal * 0.02)
const matches = rows
.filter(row => {
const value = Number(row.value1)
return !Number.isNaN(value) && Math.abs(value - rollforceVal) <= tolerance
})
.map(row => this.mapRollforceByValueRow(row))
this.rollforceFocusRecommendations = matches.slice(0, 6)
} catch (error) {
console.error('fetchRollforceFocus error:', error)
this.$message?.error('轧制力推荐获取失败,请稍后重试')
this.rollforceFocusRecommendations = []
} finally {
if (token === this.rollforceFetchToken) {
this.loadingRollforce = false
}
}
},
mapRollforceRow(row, sourceLabel = '光整机轧制力') {
const gradeLabel =
row.steelGradeName ||
row.steelGradeLabel ||
this.getSteelGradeLabel(row.steelGrade) ||
row.steelGrade
return {
_id: `rollforce-${row.id || createId()}`,
sourceLabel,
steelGrade: row.steelGrade,
steelGradeLabel: gradeLabel,
entryThick: row.thick,
yieldPoint: row.yieldStren,
spmElongation: row.elong,
spmRollforce: row.value1,
updateTime: row.updateTime || row.createTime
}
},
mapRollforceByValueRow(row) {
return {
...this.mapRollforceRow(row, '轧制力面板'),
_id: `rollforce-focus-${row.id || createId()}`,
spmRollforce: row.value1
}
},
mapTensionRow(row) {
const gradeLabel = row.steelGradeName || this.getSteelGradeLabel(row.steelGrade) || row.steelGrade
const gradeLabel = this.getSteelGradeLabel(row.steelGrade)
return {
_id: `tension-${row.id || createId()}`,
sourceLabel: '全线张力',
sourceLabel: row.sourceLabel,
steelGrade: row.steelGrade,
steelGradeLabel: gradeLabel || '',
entryThick: row.thick,
yieldPoint: row.yieldStren,
spmElongation: row.elong,
spmRollforce: row.value1,
steelGradeLabel: gradeLabel,
thick: row.thick,
yieldStren: row.yieldStren,
updateTime: row.updateTime || row.createTime
}
},
mapBendforceRow(row) {
return {
_id: `bendforce-${row.id || createId()}`,
sourceLabel: '弯辊力面板',
width: row.width,
rollForce: row.rollForce,
bendForce: row.value1,
updateTime: row.updateTime || row.createTime
}
},
uniqueRecords(records) {
uniqueRecords(records, keys) {
const seen = new Set()
return records.filter(item => {
const key = [
item.steelGrade || '',
item.entryThick || '',
item.yieldPoint || '',
item.sourceLabel
].join('|')
const key = keys.map(k => item[k] || '').join('|')
if (seen.has(key)) return false
seen.add(key)
return true
})
},
emitSteelGrade(item) {
this.$emit('apply-steel-grade', {
this.$emit('apply-recommendation', {
steelGrade: item.steelGrade,
entryThick: item.entryThick,
yieldPoint: item.yieldPoint,
spmElongation: item.spmElongation,
spmRollforce: item.spmRollforce
entryThick: item.thick,
yieldPoint: item.yieldStren
})
},
emitThickness(item) {
this.$emit('apply-thickness', {
entryThick: item.entryThick,
yieldPoint: item.yieldPoint
})
},
emitWidth(item) {
this.$emit('apply-width', {
entryWidth: item.width,
spmRollforce: item.rollForce
})
},
emitRollforce(item) {
this.$emit('apply-rollforce', {
spmRollforce: item.spmRollforce,
entryThick: item.entryThick,
yieldPoint: item.yieldPoint,
spmElongation: item.spmElongation,
steelGrade: item.steelGrade
this.$emit('apply-recommendation', {
steelGrade: item.steelGrade,
entryThick: item.thick,
yieldPoint: item.yieldStren
})
},
formatNumber(value) {
if (value === null || value === undefined || value === '') return '-'
const num = Number(value)
if (Number.isNaN(num)) return value
return Number.isInteger(num) ? num.toString() : num.toFixed(2)
},
formatDate(value) {
if (!value) return '-'
return parseTime(value, '{y}-{m}-{d}')
@@ -586,7 +252,7 @@ export default {
<style scoped>
.plan-recommend-panel {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
gap: 16px;
height: 100%;
padding-left: 16px;
@@ -599,9 +265,6 @@ export default {
border: 1px solid #e4e7ed;
border-radius: 6px;
padding: 12px;
flex: 1;
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
}
@@ -631,14 +294,8 @@ export default {
}
.card-list {
display: flex;
flex-direction: column;
gap: 10px;
}
.card-list.two-cols {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
gap: 10px;
}
@@ -671,31 +328,21 @@ export default {
.card-title {
font-weight: 600;
color: #303133;
flex: 1 1 100%;
line-height: 1.4;
word-break: break-all;
}
.card-header .el-tag {
margin-top: 2px;
}
.card-meta {
display: flex;
flex-direction: column;
gap: 4px;
justify-content: space-between;
font-size: 12px;
}
.card-meta .label {
color: #909399;
margin-right: 4px;
min-width: 54px;
}
.card-meta .value {
color: #303133;
font-weight: 600;
word-break: break-all;
}
.card-footer {
@@ -703,17 +350,7 @@ export default {
color: #606266;
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 6px;
flex-wrap: wrap;
align-items: center;
margin-top: 4px;
}
.steel-panel .card-list.two-cols {
grid-template-columns: 1fr;
}
.thickness-panel .card-list {
display: flex;
flex-direction: column;
}
</style>
</style>

View File

@@ -12,9 +12,9 @@
</div>
<el-row v-else :gutter="16">
<el-col :span="14">
<el-form :model="form" label-width="150px" v-loading="loading">
<el-row>
<el-col>
<el-form :model="form" v-loading="loading">
<el-row :gutter="16">
<el-col :span="8">
<el-form-item label="开卷机张力">
<el-input v-model="form.porTension" @change="syncModal" />
@@ -48,7 +48,7 @@
</el-col>
</el-row>
<el-row>
<el-row :gutter="16">
<el-col :span="8">
<el-form-item label="平整机入口张力">
<el-input v-model="form.levelerEntryTension" @change="syncModal" />
@@ -66,7 +66,7 @@
</el-col>
</el-row>
<el-row>
<el-row :gutter="16">
<el-col :span="8">
<el-form-item label="炉区张力">
<el-input v-model="form.furTension" @change="syncModal" />
@@ -130,11 +130,14 @@ const REQUIRED_FIELDS = ['entryThick', 'yieldPoint', 'steelGrade']
const FIELD_LABEL_MAP = {
entryThick: '入口厚度',
yieldPoint: '屈服',
yieldPoint: '屈服强度',
steelGrade: '钢种'
}
const createDefaultForm = () => ({
// 关键基础字段(用于后端入库/关联;同时不影响推荐计算)
steelGrade: undefined,
// 全线张力
porTension: undefined,
celTension: undefined,
@@ -217,7 +220,10 @@ export default {
},
generateSignature() {
// 只要这些字段变化,就重新推荐
return REQUIRED_FIELDS.map((key) => (this.income && this.income[key]) ?? '').join('|')
return REQUIRED_FIELDS.map((key) => {
const v = this.income && this.income[key]
return v === null || v === undefined ? '' : v
}).join('|')
},
async handleIncomeChange() {
if (!this.canGenerate) {
@@ -234,11 +240,11 @@ export default {
// 评分排序:优先 steelGrade 匹配,其次厚度差、屈服差、最后按更新时间
scoreRow(row, cond) {
const rowSteel = (row.steelGrade ?? row.steel_grade ?? '').toString()
const rowSteel = ((row.steelGrade !== undefined && row.steelGrade !== null) ? row.steelGrade : (row.steel_grade !== undefined && row.steel_grade !== null ? row.steel_grade : '')).toString()
const rowThick = Number(row.thick)
const rowYield = Number(row.yieldStren ?? row.yield_stren)
const rowYield = Number((row.yieldStren !== undefined && row.yieldStren !== null) ? row.yieldStren : row.yield_stren)
const condSteel = (cond.steelGrade ?? '').toString()
const condSteel = ((cond.steelGrade === null || cond.steelGrade === undefined) ? '' : cond.steelGrade).toString()
const condThick = Number(cond.thick)
const condYield = Number(cond.yieldStren)
@@ -280,9 +286,7 @@ export default {
// list 接口支持条件过滤的话会减少数据量(后端已支持三字段)
steelGrade,
thick: entryThick,
yieldStren: yieldPoint,
pageNum: 1,
pageSize: 10
yieldStren: yieldPoint
}
const [allLineRes, levelerRes, straightenerRes, furnaceRes] = await Promise.allSettled([

View File

@@ -3,22 +3,22 @@
<el-tab-pane label="全线张力">
<el-descriptions :column="2">
<el-descriptions-item label="开卷机张力">
{{ setupForm.porTension ?? '-' }}
{{ setupForm.porTension == null ? '-' : setupForm.porTension }}
</el-descriptions-item>
<el-descriptions-item label="入口活套张力">
{{ setupForm.celTension ?? '-' }}
{{ setupForm.celTension == null ? '-' : setupForm.celTension }}
</el-descriptions-item>
<el-descriptions-item label="清洗段张力">
{{ setupForm.cleanTension ?? '-' }}
{{ setupForm.cleanTension == null ? '-' : setupForm.cleanTension }}
</el-descriptions-item>
<el-descriptions-item label="钝化段张力">
{{ setupForm.passivationTension ?? '-' }}
{{ setupForm.passivationTension == null ? '-' : setupForm.passivationTension }}
</el-descriptions-item>
<el-descriptions-item label="出口活套张力">
{{ setupForm.cxlTension ?? '-' }}
{{ setupForm.cxlTension == null ? '-' : setupForm.cxlTension }}
</el-descriptions-item>
<el-descriptions-item label="卷取机张力">
{{ setupForm.trTension ?? '-' }}
{{ setupForm.trTension == null ? '-' : setupForm.trTension }}
</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
@@ -26,10 +26,10 @@
<el-tab-pane label="平整机张力">
<el-descriptions :column="1">
<el-descriptions-item label="平整机入口张力">
{{ setupForm.levelerEntryTension ?? '-' }}
{{ setupForm.levelerEntryTension == null ? '-' : setupForm.levelerEntryTension }}
</el-descriptions-item>
<el-descriptions-item label="平整机出口张力">
{{ setupForm.levelerExitTension ?? '-' }}
{{ setupForm.levelerExitTension == null ? '-' : setupForm.levelerExitTension }}
</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
@@ -37,7 +37,7 @@
<el-tab-pane label="矫直机张力">
<el-descriptions :column="1">
<el-descriptions-item label="矫直机出口张力">
{{ setupForm.straightenerExitTension ?? '-' }}
{{ setupForm.straightenerExitTension == null ? '-' : setupForm.straightenerExitTension }}
</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
@@ -45,10 +45,10 @@
<el-tab-pane label="退火炉张力">
<el-descriptions :column="1">
<el-descriptions-item label="炉区张力">
{{ setupForm.furTension ?? '-' }}
{{ setupForm.furTension == null ? '-' : setupForm.furTension }}
</el-descriptions-item>
<el-descriptions-item label="冷却塔张力">
{{ setupForm.towerTension ?? '-' }}
{{ setupForm.towerTension == null ? '-' : setupForm.towerTension }}
</el-descriptions-item>
</el-descriptions>
</el-tab-pane>

View File

@@ -249,7 +249,7 @@
<el-form-item label="钢种" prop="steelGrade">
<el-select v-model="form.steelGrade" placeholder="请选择钢种">
<el-option v-for="item in steelGradeList" :key="item.gradeid" :label="item.name"
:value="item.gradeid"></el-option>
:value="item.name"></el-option>
</el-select>
</el-form-item>
</el-col>
@@ -331,10 +331,13 @@
<div class="plan-dialog-right">
<process-recommend-panel v-if="spmFlag" :recommendation="processRecommendation"
@apply-one="handleProcessApplyOne" @apply-all="handleProcessApplyAll" />
<plan-recommend-panel v-else :steel-grade="form.steelGrade" :entry-thick="form.entryThick"
:entry-width="form.entryWidth" :spm-rollforce="form.spmRollforce" :steel-grade-list="steelGradeList"
@apply-steel-grade="handleApplySteelGrade" @apply-thickness="handleApplyThickness"
@apply-width="handleApplyWidth" @apply-rollforce="handleApplyRollforce" />
<plan-recommend-panel
v-else
:steel-grade="form.steelGrade"
:entry-thick="form.entryThick"
:steel-grade-list="steelGradeList"
@apply-recommendation="handleApplyRecommendation"
/>
</div>
</div>
<!-- 弹窗底部按钮 -->
@@ -602,9 +605,11 @@ export default {
this.steelGradeList = res.data
})
},
handleApplySteelGrade(payload) {
handleApplyRecommendation(payload) {
if (!payload) return
if (payload.steelGrade) {
// PlanRecommendPanel 传回 steelGrade 可能是钢种名,也可能是 gradeid
if (payload.steelGrade !== undefined && payload.steelGrade !== null && payload.steelGrade !== '') {
const gid = String(payload.steelGrade)
const match = this.steelGradeList.find(item =>
String(item.gradeid) === gid ||
@@ -613,31 +618,15 @@ export default {
String(item.gradeName || '') === gid
)
// 下拉选择器以 gradeid 为 value确保回填 id 以显示名称
this.form.steelGrade = match ? match.gradeid : payload.steelGrade
this.form.steelGrade = match ? (match.name || match.gradeName || payload.steelGrade) : payload.steelGrade
}
if (payload.entryThick !== undefined && payload.entryThick !== null && payload.entryThick !== '') {
this.form.entryThick = payload.entryThick
}
if (payload.yieldPoint !== undefined && payload.yieldPoint !== null && payload.yieldPoint !== '') {
this.form.yieldPoint = payload.yieldPoint
}
if (payload.entryThick) this.form.entryThick = payload.entryThick
if (payload.entryWidth) this.form.entryWidth = payload.entryWidth
if (payload.yieldPoint) this.form.yieldPoint = payload.yieldPoint
if (payload.spmElongation) this.form.spmElongation = payload.spmElongation
if (payload.spmRollforce) this.form.spmRollforce = payload.spmRollforce
},
handleApplyThickness(payload) {
if (!payload) return
if (payload.entryThick) this.form.entryThick = payload.entryThick
if (payload.yieldPoint) this.form.yieldPoint = payload.yieldPoint
},
handleApplyWidth(payload) {
if (!payload) return
if (payload.entryWidth) this.form.entryWidth = payload.entryWidth
if (payload.spmRollforce) this.form.spmRollforce = payload.spmRollforce
},
handleApplyRollforce(payload) {
if (!payload) return
if (payload.spmRollforce) this.form.spmRollforce = payload.spmRollforce
if (payload.entryThick) this.form.entryThick = payload.entryThick
if (payload.yieldPoint) this.form.yieldPoint = payload.yieldPoint
if (payload.spmElongation) this.form.spmElongation = payload.spmElongation
if (payload.steelGrade) this.form.steelGrade = payload.steelGrade
},
handleProcessRecommendation(payload) {
this.processRecommendation = payload
@@ -914,6 +903,14 @@ export default {
this.dialogTitle = "编辑计划"; // 设置弹窗标题
// 深拷贝行数据(避免修改原表格数据)
this.form = JSON.parse(JSON.stringify(row));
// 确保回显时form.steelGrade 始终是钢种名称,以便 el-select 正确显示
if (this.form.steelGrade) {
const gradeId = String(this.form.steelGrade);
const match = this.steelGradeList.find(item => String(item.gradeid) === gradeId);
if (match) {
this.form.steelGrade = match.name;
}
}
this.spmFlag = false
// 1. ID转字符串避免精度丢失
@@ -1057,9 +1054,12 @@ export default {
},
generateSpmParams() {
console.log(this.form)
console.log(this.form.steelGrade)
addSetup({
coilid: this.form.coilid,
planid: this.form.planid,
steelGrade: this.form.steelGrade,
...this.setupForm
}).then(res => {
this.$message.success("工艺参数创建成功");

View File

@@ -142,35 +142,35 @@ export default {
// 字段schema表格列/表单)
schemaAllLine: [
{ prop: 'steelGrade', label: '钢种', required: true },
{ prop: 'thick', label: '厚度', required: true },
{ prop: 'yieldStren', label: '屈服强度', required: true },
{ prop: 'value1', label: '开卷机张力' },
{ prop: 'value2', label: '入口活套张力' },
{ prop: 'value3', label: '清洗段张力' },
{ prop: 'value4', label: '钝化段张力' },
{ prop: 'value5', label: '出口活套张力' },
{ prop: 'value6', label: '卷取机张力' }
{ prop: 'steelGrade', label: '钢种', required: true, minWidth: 65 },
{ prop: 'thick', label: '厚度', required: true, minWidth: 65 },
{ prop: 'yieldStren', label: '屈服强度', required: true, minWidth: 90 },
{ prop: 'value1', label: '开卷机张力', minWidth: 120 },
{ prop: 'value2', label: '入口活套张力', minWidth: 120 },
{ prop: 'value3', label: '清洗段张力', minWidth: 120 },
{ prop: 'value4', label: '钝化段张力', minWidth: 120 },
{ prop: 'value5', label: '出口活套张力', minWidth: 120 },
{ prop: 'value6', label: '卷取机张力', minWidth: 120 }
],
schemaLeveler: [
{ prop: 'steelGrade', label: '钢种', required: true },
{ prop: 'thick', label: '厚度', required: true },
{ prop: 'yieldStren', label: '屈服强度', required: true },
{ prop: 'value1', label: '平整机入口张力' },
{ prop: 'value2', label: '平整机出口张力' }
{ prop: 'steelGrade', label: '钢种', required: true, minWidth: 65 },
{ prop: 'thick', label: '厚度', required: true, minWidth: 65 },
{ prop: 'yieldStren', label: '屈服强度', required: true, minWidth: 90 },
{ prop: 'value1', label: '平整机入口张力', minWidth: 120 },
{ prop: 'value2', label: '平整机出口张力', minWidth: 120 }
],
schemaStraightener: [
{ prop: 'steelGrade', label: '钢种', required: true },
{ prop: 'thick', label: '厚度', required: true },
{ prop: 'yieldStren', label: '屈服强度', required: true },
{ prop: 'value1', label: '矫直机出口张力' }
{ prop: 'steelGrade', label: '钢种', required: true, minWidth: 65 },
{ prop: 'thick', label: '厚度', required: true, minWidth: 65 },
{ prop: 'yieldStren', label: '屈服强度', required: true, minWidth: 90 },
{ prop: 'value1', label: '矫直机出口张力', minWidth: 120 }
],
schemaAnnealingFurnace: [
{ prop: 'steelGrade', label: '钢种', required: true },
{ prop: 'thick', label: '厚度', required: true },
{ prop: 'yieldStren', label: '屈服强度', required: true },
{ prop: 'value1', label: '炉区张力' },
{ prop: 'value2', label: '冷却塔张力' }
{ prop: 'steelGrade', label: '钢种', required: true, minWidth: 65 },
{ prop: 'thick', label: '厚度', required: true, minWidth: 65 },
{ prop: 'yieldStren', label: '屈服强度', required: true, minWidth: 90 },
{ prop: 'value1', label: '炉区张力', minWidth: 120 },
{ prop: 'value2', label: '冷却塔张力', minWidth: 120 }
]
}
},

View File

@@ -1,5 +1,6 @@
<template>
<div class="tension-table-container">
<div class="table-body">
<!-- 查询区域 -->
<el-form :inline="true" size="mini" class="query-form" @submit.native.prevent>
<el-form-item v-for="k in acceptKeys" :key="k" :label="getLabel(k)">
@@ -26,19 +27,17 @@
</div>
<!-- 表格 -->
<el-table v-loading="loading" :data="list" border stripe height="calc(100% - 148px)">
<el-table-column type="index" label="#" width="50" />
<el-table v-loading="loading" :data="list" border stripe height="100%">
<el-table-column
v-for="col in schema"
:key="col.prop"
:prop="col.prop"
:label="col.label"
:min-width="col.minWidth || 120"
:min-width="col.minWidth || 85"
show-overflow-tooltip
/>
<el-table-column label="操作" width="180" fixed="right">
<el-table-column label="操作" width="130">
<template slot-scope="scope">
<el-button type="text" size="mini" icon="el-icon-edit" @click="handleEdit(scope.row)">编辑</el-button>
<el-button type="text" size="mini" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
@@ -46,6 +45,8 @@
</el-table-column>
</el-table>
</div>
<!-- 分页 -->
<pagination
v-show="total > 0"
@@ -217,6 +218,22 @@ export default {
display: flex;
flex-direction: column;
}
.table-body {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
}
/* 让 el-table 真正占满剩余高度,避免出现大量空白行/操作列重复显示 */
.table-body ::v-deep .el-table {
flex: 1;
}
.table-body ::v-deep .el-table__body-wrapper {
flex: 1;
}
.query-form {
padding: 10px 10px 0;
border: 1px solid #ebeef5;

View File

@@ -74,29 +74,29 @@
<div class="param-row">
<div class="param-item">
<span class="param-label">开卷机张力:</span>
<span class="param-value">{{ currentRow.porTension ?? '-' }}</span>
<span class="param-value">{{ currentRow.porTension == null ? '-' : currentRow.porTension }}</span>
</div>
<div class="param-item">
<span class="param-label">入口活套张力:</span>
<span class="param-value">{{ currentRow.celTension ?? '-' }}</span>
<span class="param-value">{{ currentRow.celTension == null ? '-' : currentRow.celTension }}</span>
</div>
<div class="param-item">
<span class="param-label">清洗段张力:</span>
<span class="param-value">{{ currentRow.cleanTension ?? '-' }}</span>
<span class="param-value">{{ currentRow.cleanTension == null ? '-' : currentRow.cleanTension }}</span>
</div>
<div class="param-item">
<span class="param-label">钝化段张力:</span>
<span class="param-value">{{ currentRow.passivationTension ?? '-' }}</span>
<span class="param-value">{{ currentRow.passivationTension == null ? '-' : currentRow.passivationTension }}</span>
</div>
</div>
<div class="param-row">
<div class="param-item">
<span class="param-label">出口活套张力:</span>
<span class="param-value">{{ currentRow.cxlTension ?? '-' }}</span>
<span class="param-value">{{ currentRow.cxlTension == null ? '-' : currentRow.cxlTension }}</span>
</div>
<div class="param-item">
<span class="param-label">卷取机张力:</span>
<span class="param-value">{{ currentRow.trTension ?? '-' }}</span>
<span class="param-value">{{ currentRow.trTension == null ? '-' : currentRow.trTension }}</span>
</div>
<div class="param-item"></div>
<div class="param-item"></div>
@@ -109,11 +109,11 @@
<div class="param-row">
<div class="param-item">
<span class="param-label">平整机入口张力:</span>
<span class="param-value">{{ currentRow.levelerEntryTension ?? '-' }}</span>
<span class="param-value">{{ currentRow.levelerEntryTension == null ? '-' : currentRow.levelerEntryTension }}</span>
</div>
<div class="param-item">
<span class="param-label">平整机出口张力:</span>
<span class="param-value">{{ currentRow.levelerExitTension ?? '-' }}</span>
<span class="param-value">{{ currentRow.levelerExitTension == null ? '-' : currentRow.levelerExitTension }}</span>
</div>
<div class="param-item"></div>
<div class="param-item"></div>
@@ -126,7 +126,7 @@
<div class="param-row">
<div class="param-item">
<span class="param-label">矫直机出口张力:</span>
<span class="param-value">{{ currentRow.straightenerExitTension ?? '-' }}</span>
<span class="param-value">{{ currentRow.straightenerExitTension == null ? '-' : currentRow.straightenerExitTension }}</span>
</div>
<div class="param-item"></div>
<div class="param-item"></div>
@@ -140,11 +140,11 @@
<div class="param-row">
<div class="param-item">
<span class="param-label">炉区张力:</span>
<span class="param-value">{{ currentRow.furTension ?? '-' }}</span>
<span class="param-value">{{ currentRow.furTension == null ? '-' : currentRow.furTension }}</span>
</div>
<div class="param-item">
<span class="param-label">冷却塔张力:</span>
<span class="param-value">{{ currentRow.towerTension ?? '-' }}</span>
<span class="param-value">{{ currentRow.towerTension == null ? '-' : currentRow.towerTension }}</span>
</div>
<div class="param-item"></div>
<div class="param-item"></div>
@@ -223,25 +223,12 @@ export default {
cleanTension: null,
furTension: null,
towerTension: null,
tmNoneTension: null,
tmEntryTension: null,
tmExitTension: null,
tmRollforce: null,
tmBendforce: null,
tmAcrMesh: null,
tmBrMesh: null,
tlNoneTension: null,
tlExitTension: null,
tlElong: null,
tlLvlMesh1: null,
tlLvlMesh2: null,
tlAcbMesh: null,
coatTension: null,
// 已废弃的旧字段
cxlTension: null,
trTension: null,
createTime: null,
updateTime: null,
TYPE: null
// TYPE: null旧字段
},
// 表单参数
form: {},
@@ -281,25 +268,12 @@ export default {
cleanTension: null,
furTension: null,
towerTension: null,
tmNoneTension: null,
tmEntryTension: null,
tmExitTension: null,
tmRollforce: null,
tmBendforce: null,
tmAcrMesh: null,
tmBrMesh: null,
tlNoneTension: null,
tlExitTension: null,
tlElong: null,
tlLvlMesh1: null,
tlLvlMesh2: null,
tlAcbMesh: null,
coatTension: null,
// 已废弃的旧字段
cxlTension: null,
trTension: null,
createTime: null,
updateTime: null,
TYPE: null
// TYPE: null旧字段
};
this.resetForm("form");
},