@@ -219,8 +219,8 @@
< el-select v-model = "form.recipeId" filterable clearable
placeholder = "可选,也可在新增后在下方绑定"
style = "width:100%" @change ="onRecipeChange" >
< el -option v-for = "r in recipeOptions" :key="r.i d"
:label = "`${r.recipeNo}( ${r.alloyNo}) `" :value = "r.i d" / >
< el -option v-for = "r in recipeOptions" :key="r.recipeI d"
:label = "`${r.recipeNo}( ${r.alloyNo}) `" :value = "r.recipeI d" / >
< / el-select >
< / el-form-item >
< / el-col >
@@ -279,9 +279,9 @@
< el-form-item label = "工艺方案" >
< el-select v-model = "selectRecipeId" filterable clearable
placeholder = "输入方案号或合金号搜索" style = "width:100%" >
< el-option v-for = "r in recipeOptions" :key="r.i d"
< el-option v-for = "r in recipeOptions" :key="r.recipeI d"
:label = "`${r.recipeNo}( ${r.alloyNo}) ${r.inThick}→${r.outThick}mm`"
:value = "r.i d" / >
:value = "r.recipeI d" / >
< / el-select >
< / el-form-item >
< / el-form >
@@ -322,7 +322,7 @@ import { listPlan, addPlan, updatePlan, delPlan, moveUpPlan, moveDownPlan } from
import { listAllRecipe , getRecipeDetail , addRecipe } from '@/api/mill/recipe'
const emptyForm = ( ) => ( {
i d: null , inMatNo : '' , alloyNo : '' , recipeId : null , recipeNo : '' ,
planI d: null , planNo : '' , inMatNo : '' , alloyNo : '' , recipeId : null , recipeNo : '' ,
outThick : '' , inMatThick : '' , inMatWidth : '' , inMatLength : '' ,
inMatWeight : '' , inMatOd : '' , inMatId : '' , passCount : 0 , remark : ''
} )
@@ -375,11 +375,11 @@ export default {
} ,
computed : {
planDialogTitle ( ) { return this . isNew ? '新增钢卷' : '修改钢卷' } ,
currentCoil ( ) { return this . planList . find ( p => p . prodStatus === '1 ' ) || { } } ,
currentCoil ( ) { return this . planList . find ( p => p . prodStatus === 'Rolling ' ) || { } } ,
nextCoil ( ) {
const idx = this . planList . findIndex ( p => p . prodStatus === '1 ' )
const idx = this . planList . findIndex ( p => p . prodStatus === 'Rolling ' )
if ( idx >= 0 && idx + 1 < this . planList . length ) return this . planList [ idx + 1 ]
return this . planList . find ( p => p . prodStatus === '0 ' ) || { }
return this . planList . find ( p => p . prodStatus === 'Idle ' ) || { }
}
} ,
mounted ( ) {
@@ -392,10 +392,10 @@ export default {
} ,
loadList ( ) {
const params = { inMatNo : this . query . inMatNo }
if ( this . query . hideFinished ) params . hideProd Status = '2 '
if ( this . query . hideFinished ) params . plan Status = '0 '
if ( this . query . dateRange && this . query . dateRange . length === 2 ) {
params . beginDat e = this . query . dateRange [ 0 ]
params . endDat e = this . query . dateRange [ 1 ]
params . beginTim e = this . query . dateRange [ 0 ]
params . endTim e = this . query . dateRange [ 1 ]
}
listPlan ( params ) . then ( res => { this . planList = res . data || [ ] } )
} ,
@@ -455,7 +455,7 @@ export default {
return
}
// 创建隐藏方案( recipeNo 以 __ 开头表示私有,不展示在下拉列表中)
const autoNo = ` __ ${ this . selectedPlan . inMatNo || this . selectedPlan . i d} `
const autoNo = ` __ ${ this . selectedPlan . inMatNo || this . selectedPlan . planI d} `
const payload = {
recipeNo : autoNo ,
alloyNo : this . selectedPlan . alloyNo || '-' ,
@@ -502,7 +502,6 @@ export default {
_doSaveRecipeAndBindPlan ( recipePayload ) {
return addRecipe ( recipePayload ) . then ( res => {
const newId = res . data // controller 返回新 ID
const recipeNo = recipePayload . recipeNo . startsWith ( '__' ) ? '' : recipePayload . recipeNo
return updatePlan ( {
... this . selectedPlan ,
recipeId : newId ,
@@ -516,7 +515,7 @@ export default {
this . loadList ( )
// 刷新已选行数据
return listPlan ( { inMatNo : this . selectedPlan . inMatNo } ) . then ( res => {
const updated = ( res . data || [ ] ) . find ( p => p . i d === this . selectedPlan . i d)
const updated = ( res . data || [ ] ) . find ( p => p . planI d === this . selectedPlan . planI d)
if ( updated ) {
this . selectedPlan = updated
getRecipeDetail ( updated . recipeId ) . then ( r => {
@@ -537,7 +536,7 @@ export default {
this . $message . warning ( '请选择一个方案' )
return
}
const r = this . recipeOptions . find ( x => x . i d === this . selectRecipeId )
const r = this . recipeOptions . find ( x => x . recipeI d === this . selectRecipeId )
updatePlan ( {
... this . selectedPlan ,
recipeId : this . selectRecipeId ,
@@ -569,7 +568,7 @@ export default {
this . $refs . formRef . validate ( valid => {
if ( ! valid ) return
if ( this . form . recipeId ) {
const r = this . recipeOptions . find ( x => x . i d === this . form . recipeId )
const r = this . recipeOptions . find ( x => x . recipeI d === this . form . recipeId )
if ( r ) { this . form . recipeNo = r . recipeNo ; this . form . passCount = r . passCount }
}
const api = this . isNew ? addPlan : updatePlan
@@ -582,7 +581,7 @@ export default {
} ,
handleDelete ( ) {
this . $confirm ( ` 确定删除钢卷「 ${ this . selectedPlan . inMatNo } 」? ` , '提示' , { type : 'warning' } ) . then ( ( ) => {
delPlan ( this . selectedPlan . i d) . then ( ( ) => {
delPlan ( this . selectedPlan . planI d) . then ( ( ) => {
this . $message . success ( '删除成功' )
this . selectedPlan = null
this . passList = [ ]
@@ -591,11 +590,11 @@ export default {
} )
} )
} ,
handleMoveUp ( ) { moveUpPlan ( this . selectedPlan . i d) . then ( ( ) => this . loadList ( ) ) } ,
handleMoveDown ( ) { moveDownPlan ( this . selectedPlan . i d) . then ( ( ) => this . loadList ( ) ) } ,
handleMoveUp ( ) { moveUpPlan ( this . selectedPlan . planI d) . then ( ( ) => this . loadList ( ) ) } ,
handleMoveDown ( ) { moveDownPlan ( this . selectedPlan . planI d) . then ( ( ) => this . loadList ( ) ) } ,
onRecipeChange ( recipeId ) {
if ( ! recipeId ) return
const r = this . recipeOptions . find ( x => x . i d === recipeId )
const r = this . recipeOptions . find ( x => x . recipeI d === recipeId )
if ( r ) {
if ( ! this . form . alloyNo ) this . form . alloyNo = r . alloyNo
if ( ! this . form . inMatThick ) this . form . inMatThick = r . inThick
@@ -605,13 +604,13 @@ export default {
} ,
queueRowClass ( { row } ) {
if ( row . prodStatus === '1 ' ) return 'row-rolling'
if ( row . prodStatus === '0 ' && this . currentCoil . sortNo && row . sortNo === this . currentCoil . sortNo + 1 ) return 'row-next'
if ( row . prodStatus === 'Rolling ' ) return 'row-rolling'
if ( row . prodStatus === 'Idle ' && this . currentCoil . sortNo && row . sortNo === this . currentCoil . sortNo + 1 ) return 'row-next'
return ''
} ,
passRowClass ( { rowIndex } ) { return rowIndex % 2 === 0 ? '' : 'alt-row' } ,
prodStatusLabel ( s ) { return { '0' : '待轧' , '1' : '轧制中' , '2' : '已完成' , '9' : '异常' } [ s ] || s } ,
prodStatusClass ( s ) { return { '0' : 'status-wait' , '1' : 'status-rolling' , '2' : 'status-done' , '9' : 'status-err' } [ s ] || '' }
prodStatusLabel ( s ) { return { Idle : '待轧' , Rolling : '轧制中' , NextCoil : '下一卷' , Done : '已完成' , Error : '异常' } [ s ] || s } ,
prodStatusClass ( s ) { return { Idle : 'status-wait' , Rolling : 'status-rolling' , NextCoil : 'status-next' , Done : 'status-done' , Error : 'status-err' } [ s ] || '' }
}
}
< / script >