轧辊提交
This commit is contained in:
@@ -1,23 +1,23 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function listPlan(query) {
|
||||
return request({ url: '/mill/plan/list', method: 'get', params: query })
|
||||
return request({ url: '/mill/production-plan/list', method: 'get', params: query })
|
||||
}
|
||||
export function getPlan(id) {
|
||||
return request({ url: `/mill/plan/${id}`, method: 'get' })
|
||||
return request({ url: `/mill/production-plan/${id}`, method: 'get' })
|
||||
}
|
||||
export function addPlan(data) {
|
||||
return request({ url: '/mill/plan', method: 'post', data })
|
||||
return request({ url: '/mill/production-plan', method: 'post', data })
|
||||
}
|
||||
export function updatePlan(data) {
|
||||
return request({ url: '/mill/plan', method: 'put', data })
|
||||
return request({ url: '/mill/production-plan', method: 'put', data })
|
||||
}
|
||||
export function delPlan(id) {
|
||||
return request({ url: `/mill/plan/${id}`, method: 'delete' })
|
||||
return request({ url: `/mill/production-plan/${id}`, method: 'delete' })
|
||||
}
|
||||
export function moveUpPlan(id) {
|
||||
return request({ url: `/mill/plan/moveUp/${id}`, method: 'put' })
|
||||
return request({ url: `/mill/production-plan/moveUp/${id}`, method: 'put' })
|
||||
}
|
||||
export function moveDownPlan(id) {
|
||||
return request({ url: `/mill/plan/moveDown/${id}`, method: 'put' })
|
||||
return request({ url: `/mill/production-plan/moveDown/${id}`, method: 'put' })
|
||||
}
|
||||
|
||||
@@ -73,8 +73,8 @@ export default {
|
||||
title: process.env.VUE_APP_TITLE,
|
||||
codeUrl: "",
|
||||
loginForm: {
|
||||
username: "tony",
|
||||
password: "123456",
|
||||
username: "admin",
|
||||
password: "admin123",
|
||||
rememberMe: false,
|
||||
code: "",
|
||||
uuid: ""
|
||||
|
||||
@@ -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.id"
|
||||
:label="`${r.recipeNo}(${r.alloyNo})`" :value="r.id" />
|
||||
<el-option v-for="r in recipeOptions" :key="r.recipeId"
|
||||
:label="`${r.recipeNo}(${r.alloyNo})`" :value="r.recipeId" />
|
||||
</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.id"
|
||||
<el-option v-for="r in recipeOptions" :key="r.recipeId"
|
||||
:label="`${r.recipeNo}(${r.alloyNo})${r.inThick}→${r.outThick}mm`"
|
||||
:value="r.id" />
|
||||
:value="r.recipeId" />
|
||||
</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 = () => ({
|
||||
id: null, inMatNo: '', alloyNo: '', recipeId: null, recipeNo: '',
|
||||
planId: 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.hideProdStatus = '2'
|
||||
if (this.query.hideFinished) params.planStatus = '0'
|
||||
if (this.query.dateRange && this.query.dateRange.length === 2) {
|
||||
params.beginDate = this.query.dateRange[0]
|
||||
params.endDate = this.query.dateRange[1]
|
||||
params.beginTime = this.query.dateRange[0]
|
||||
params.endTime = 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.id}`
|
||||
const autoNo = `__${this.selectedPlan.inMatNo || this.selectedPlan.planId}`
|
||||
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.id === this.selectedPlan.id)
|
||||
const updated = (res.data || []).find(p => p.planId === this.selectedPlan.planId)
|
||||
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.id === this.selectRecipeId)
|
||||
const r = this.recipeOptions.find(x => x.recipeId === 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.id === this.form.recipeId)
|
||||
const r = this.recipeOptions.find(x => x.recipeId === 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.id).then(() => {
|
||||
delPlan(this.selectedPlan.planId).then(() => {
|
||||
this.$message.success('删除成功')
|
||||
this.selectedPlan = null
|
||||
this.passList = []
|
||||
@@ -591,11 +590,11 @@ export default {
|
||||
})
|
||||
})
|
||||
},
|
||||
handleMoveUp() { moveUpPlan(this.selectedPlan.id).then(() => this.loadList()) },
|
||||
handleMoveDown() { moveDownPlan(this.selectedPlan.id).then(() => this.loadList()) },
|
||||
handleMoveUp() { moveUpPlan(this.selectedPlan.planId).then(() => this.loadList()) },
|
||||
handleMoveDown() { moveDownPlan(this.selectedPlan.planId).then(() => this.loadList()) },
|
||||
onRecipeChange(recipeId) {
|
||||
if (!recipeId) return
|
||||
const r = this.recipeOptions.find(x => x.id === recipeId)
|
||||
const r = this.recipeOptions.find(x => x.recipeId === 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>
|
||||
|
||||
Reference in New Issue
Block a user