提交酸扎串联内容以及磨辊间
This commit is contained in:
@@ -48,3 +48,38 @@ export function getTimingRealtimeData(matId) {
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 轧辊数据,type/status 可选过滤
|
||||
export function getRollData(type, status) {
|
||||
return request({
|
||||
url: '/sql-server-api/rolls',
|
||||
method: 'get',
|
||||
params: { type, status }
|
||||
})
|
||||
}
|
||||
|
||||
// 换辊历史(按轧辊号,配辊页用)
|
||||
export function getRollHistory(rollId) {
|
||||
return request({
|
||||
url: '/sql-server-api/rolls/' + rollId + '/history',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 换辊历史列表(分页 + 过滤,历史页用)
|
||||
export function getRollHistoryList(page = 1, pageSize = 50, rollId, standId) {
|
||||
return request({
|
||||
url: '/sql-server-api/rolls/history',
|
||||
method: 'get',
|
||||
params: { page, pageSize, rollId, standId }
|
||||
})
|
||||
}
|
||||
|
||||
// 换辊历史总条数
|
||||
export function getRollHistoryCount(rollId, standId) {
|
||||
return request({
|
||||
url: '/sql-server-api/rolls/history/count',
|
||||
method: 'get',
|
||||
params: { rollId, standId }
|
||||
})
|
||||
}
|
||||
|
||||
26
klp-ui/src/api/mes/roll/rollGrind.js
Normal file
26
klp-ui/src/api/mes/roll/rollGrind.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询轧辊磨削记录列表
|
||||
export function listRollGrind(rollId) {
|
||||
return request({ url: '/mes/rollGrind/list', method: 'get', params: { rollId } })
|
||||
}
|
||||
|
||||
// 查询月度汇总
|
||||
export function getMonthlyStats(rollId, year) {
|
||||
return request({ url: '/mes/rollGrind/monthlyStats', method: 'get', params: { rollId, year } })
|
||||
}
|
||||
|
||||
// 新增磨削记录
|
||||
export function addRollGrind(data) {
|
||||
return request({ url: '/mes/rollGrind', method: 'post', data })
|
||||
}
|
||||
|
||||
// 修改磨削记录
|
||||
export function updateRollGrind(data) {
|
||||
return request({ url: '/mes/rollGrind', method: 'put', data })
|
||||
}
|
||||
|
||||
// 删除磨削记录
|
||||
export function delRollGrind(grindId) {
|
||||
return request({ url: '/mes/rollGrind/' + grindId, method: 'delete' })
|
||||
}
|
||||
490
klp-ui/src/views/mes/roll/grind/index.vue
Normal file
490
klp-ui/src/views/mes/roll/grind/index.vue
Normal file
@@ -0,0 +1,490 @@
|
||||
<template>
|
||||
<div class="app-container grind-page">
|
||||
<div class="grind-layout">
|
||||
|
||||
<!-- ── 左侧:轧辊选择 ── -->
|
||||
<div class="grind-left">
|
||||
<el-card shadow="never" class="grind-card h-full">
|
||||
<div slot="header" class="card-header">
|
||||
<span class="card-title"><i class="el-icon-s-order" /> 轧辊列表</span>
|
||||
</div>
|
||||
|
||||
<!-- 搜索过滤 -->
|
||||
<div class="roll-filter">
|
||||
<!-- 产线筛选(暂时写死双机架) -->
|
||||
<el-select v-model="filterLine" size="small" placeholder="选择产线"
|
||||
style="width:100%;margin-bottom:8px" @change="filterRolls">
|
||||
<el-option label="全部产线" value="" />
|
||||
<el-option label="双机架产线" value="双机架" />
|
||||
</el-select>
|
||||
<el-input v-model="filterNo" size="small" placeholder="编号搜索" prefix-icon="el-icon-search"
|
||||
clearable @input="filterRolls" style="margin-bottom:8px" />
|
||||
<el-radio-group v-model="filterType" size="small" @change="filterRolls" style="margin-bottom:8px">
|
||||
<el-radio-button label="">全部</el-radio-button>
|
||||
<el-radio-button label="WR">WR</el-radio-button>
|
||||
<el-radio-button label="BR">BR</el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
|
||||
<div v-loading="rollLoading" class="roll-list">
|
||||
<div
|
||||
v-for="r in filteredRolls"
|
||||
:key="r.rollId"
|
||||
:class="['roll-item', selectedRollId === r.rollId ? 'roll-item--active' : '']"
|
||||
@click="selectRoll(r)"
|
||||
>
|
||||
<div class="ri-no">{{ r.rollNo }}</div>
|
||||
<div class="ri-meta">
|
||||
<el-tag size="mini" :type="r.rollType === 'WR' ? 'primary' : 'warning'">{{ r.rollType }}</el-tag>
|
||||
<span :class="['ri-status', 'st-' + r.status]">{{ statusLabel(r.status) }}</span>
|
||||
<span class="ri-dia">φ{{ r.currentDia != null ? r.currentDia : r.initialDia }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!rollLoading && filteredRolls.length === 0" class="roll-empty">暂无数据</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
<!-- ── 右侧:台账 ── -->
|
||||
<div class="grind-right">
|
||||
<template v-if="!selectedRoll">
|
||||
<div class="grind-empty"><i class="el-icon-arrow-left" /> 请从左侧选择一个轧辊</div>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<!-- 轧辊基本信息头 -->
|
||||
<el-card shadow="never" class="grind-card" style="margin-bottom:12px">
|
||||
<div class="roll-header-grid">
|
||||
<div class="rh-item"><span class="rh-k">轧辊编号</span><span class="rh-v bold">{{ selectedRoll.rollNo }}</span></div>
|
||||
<div class="rh-item"><span class="rh-k">辊型</span><span class="rh-v">{{ selectedRoll.rollType === 'WR' ? '工作辊' : '支撑辊' }}</span></div>
|
||||
<div class="rh-item"><span class="rh-k">材质</span><span class="rh-v">{{ selectedRoll.material || '—' }}</span></div>
|
||||
<div class="rh-item"><span class="rh-k">初始辊径</span><span class="rh-v">{{ selectedRoll.initialDia != null ? selectedRoll.initialDia + ' mm' : '—' }}</span></div>
|
||||
<div class="rh-item"><span class="rh-k">当前辊径</span><span class="rh-v bold accent">{{ selectedRoll.currentDia != null ? selectedRoll.currentDia + ' mm' : '—' }}</span></div>
|
||||
<div class="rh-item"><span class="rh-k">最小辊径</span><span class="rh-v">{{ selectedRoll.minDia != null ? selectedRoll.minDia + ' mm' : '—' }}</span></div>
|
||||
<div class="rh-item"><span class="rh-k">磨削次数</span><span class="rh-v">{{ selectedRoll.grindCount != null ? selectedRoll.grindCount + ' 次' : '0 次' }}</span></div>
|
||||
<div class="rh-item"><span class="rh-k">粗糙度</span><span class="rh-v">{{ selectedRoll.roughness != null ? selectedRoll.roughness + ' μm' : '—' }}</span></div>
|
||||
<div class="rh-item"><span class="rh-k">凸度</span><span class="rh-v">{{ selectedRoll.crown != null ? selectedRoll.crown + ' mm' : '—' }}</span></div>
|
||||
<div class="rh-item"><span class="rh-k">状态</span>
|
||||
<span :class="['rh-v', 'st-' + selectedRoll.status]">{{ statusLabel(selectedRoll.status) }}</span>
|
||||
</div>
|
||||
<div class="rh-item"><span class="rh-k">制造日期</span><span class="rh-v">{{ selectedRoll.manufactureDate || '—' }}</span></div>
|
||||
<div class="rh-item"><span class="rh-k">备注</span><span class="rh-v">{{ selectedRoll.remark || '—' }}</span></div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- 磨削台账:行内编辑 -->
|
||||
<el-card shadow="never" class="grind-card">
|
||||
<div slot="header" class="card-header">
|
||||
<span class="card-title"><i class="el-icon-document" /> 磨削台账</span>
|
||||
<el-button type="primary" size="mini" icon="el-icon-plus"
|
||||
style="margin-left:auto" :disabled="!!editRow" @click="startAdd">新增磨削记录</el-button>
|
||||
</div>
|
||||
|
||||
<el-table v-loading="grindLoading" :data="tableData" size="small" border
|
||||
style="width:100%" :row-class-name="rowClassName">
|
||||
<el-table-column label="序号" type="index" width="46" align="center" />
|
||||
|
||||
<!-- 磨削时间 -->
|
||||
<el-table-column label="磨削时间" align="center" width="200">
|
||||
<template slot-scope="{row}">
|
||||
<el-date-picker v-if="isEditing(row)" v-model="editRow.grindTime"
|
||||
type="datetime" size="mini" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
style="width:182px" placeholder="请选择" />
|
||||
<span v-else>{{ row.grindTime }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 班组 -->
|
||||
<el-table-column label="班组" align="center" width="80">
|
||||
<template slot-scope="{row}">
|
||||
<el-input v-if="isEditing(row)" v-model="editRow.team"
|
||||
size="mini" placeholder="甲班" style="width:64px" />
|
||||
<span v-else>{{ row.team || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 磨前直径 -->
|
||||
<el-table-column label="磨前径(mm)" align="center" width="100">
|
||||
<template slot-scope="{row}">
|
||||
<el-input v-if="isEditing(row)" v-model.number="editRow.diaBefore"
|
||||
type="number" size="mini" style="width:80px" />
|
||||
<span v-else>{{ row.diaBefore }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 磨后直径 -->
|
||||
<el-table-column label="磨后径(mm)" align="center" width="100">
|
||||
<template slot-scope="{row}">
|
||||
<el-input v-if="isEditing(row)" v-model.number="editRow.diaAfter"
|
||||
type="number" size="mini" style="width:80px" />
|
||||
<span v-else>{{ row.diaAfter }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 磨削量(只读计算) -->
|
||||
<el-table-column label="磨削量(mm)" align="center" width="88">
|
||||
<template slot-scope="{row}">
|
||||
<span v-if="isEditing(row)" class="computed-val">
|
||||
{{ grindAmountOf(editRow) }}
|
||||
</span>
|
||||
<span v-else>{{ row.grindAmount }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 辊型 -->
|
||||
<el-table-column label="辊型" align="center" width="100">
|
||||
<template slot-scope="{row}">
|
||||
<el-select v-if="isEditing(row)" v-model="editRow.rollShape"
|
||||
size="mini" style="width:84px">
|
||||
<el-option label="平" value="平" />
|
||||
<el-option label="凸" value="凸" />
|
||||
<el-option label="凹" value="凹" />
|
||||
</el-select>
|
||||
<span v-else>{{ row.rollShape || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 探伤结果 -->
|
||||
<el-table-column label="探伤结果" align="center" width="110">
|
||||
<template slot-scope="{row}">
|
||||
<el-select v-if="isEditing(row)" v-model="editRow.flawResult"
|
||||
size="mini" style="width:94px">
|
||||
<el-option label="合格" value="合格" />
|
||||
<el-option label="不合格" value="不合格" />
|
||||
</el-select>
|
||||
<el-tag v-else size="mini" :type="row.flawResult === '合格' ? 'success' : 'danger'">
|
||||
{{ row.flawResult || '—' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 硬度 -->
|
||||
<el-table-column label="硬度" align="center" width="80">
|
||||
<template slot-scope="{row}">
|
||||
<el-input v-if="isEditing(row)" v-model.number="editRow.hardness"
|
||||
type="number" size="mini" style="width:64px" />
|
||||
<span v-else>{{ row.hardness || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 操作者(自动填入,仅展示) -->
|
||||
<el-table-column label="操作者" align="center" width="72">
|
||||
<template slot-scope="{row}">
|
||||
<span :class="isEditing(row) ? 'auto-operator' : ''">
|
||||
{{ isEditing(row) ? currentUserName : (row.operator || '—') }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 备注 -->
|
||||
<el-table-column label="备注" align="left" width="120">
|
||||
<template slot-scope="{row}">
|
||||
<el-input v-if="isEditing(row)" v-model="editRow.remark"
|
||||
size="mini" placeholder="选填" />
|
||||
<span v-else class="remark-text">{{ row.remark || '' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 操作列 -->
|
||||
<el-table-column label="操作" align="center" width="100" fixed="right">
|
||||
<template slot-scope="{row}">
|
||||
<template v-if="isEditing(row)">
|
||||
<el-button size="mini" type="text" icon="el-icon-check"
|
||||
:loading="grindSaving" @click="saveRow">保存</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-close"
|
||||
style="color:#909399" @click="cancelEdit">取消</el-button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit"
|
||||
:disabled="!!editRow" @click="startEdit(row)">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete"
|
||||
style="color:#c5221f" :disabled="!!editRow" @click="handleDelete(row)">删除</el-button>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 月度汇总 -->
|
||||
<div class="monthly-wrap" v-if="grindList.length > 0">
|
||||
<div class="monthly-title">
|
||||
<span>{{ currentYear }} 年月度汇总</span>
|
||||
<el-button-group size="mini" style="margin-left:8px">
|
||||
<el-button icon="el-icon-arrow-left" @click="changeYear(-1)" />
|
||||
<el-button icon="el-icon-arrow-right" @click="changeYear(1)" />
|
||||
</el-button-group>
|
||||
</div>
|
||||
<el-table :data="monthlyList" size="mini" border style="width:100%;margin-top:8px">
|
||||
<el-table-column label="月份" prop="month" align="center" width="90" />
|
||||
<el-table-column label="磨削次数" prop="grindCount" align="center" width="90" />
|
||||
<el-table-column label="累计磨削量(mm)" prop="totalGrindAmount" align="center" min-width="120" />
|
||||
</el-table>
|
||||
</div>
|
||||
</el-card>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listRollInfo, getRollInfo } from '@/api/mes/roll/rollInfo'
|
||||
import { listRollGrind, addRollGrind, updateRollGrind, delRollGrind, getMonthlyStats } from '@/api/mes/roll/rollGrind'
|
||||
|
||||
export default {
|
||||
name: 'GrindRoom',
|
||||
data() {
|
||||
return {
|
||||
// 产线定义(暂写死,后续接后端)
|
||||
LINES: [{ label: '双机架产线', value: '双机架' }],
|
||||
|
||||
// 左侧辊列表
|
||||
rollLoading: false,
|
||||
allRolls: [],
|
||||
filteredRolls: [],
|
||||
filterNo: '',
|
||||
filterType: '',
|
||||
filterLine: '',
|
||||
|
||||
// 右侧选中辊
|
||||
selectedRollId: null,
|
||||
selectedRoll: null,
|
||||
|
||||
// 磨削记录
|
||||
grindLoading: false,
|
||||
grindList: [],
|
||||
|
||||
// 月度汇总
|
||||
currentYear: new Date().getFullYear(),
|
||||
monthlyList: [],
|
||||
|
||||
// 行内编辑:editRow 不为 null 时表示当前正在编辑/新增的行数据
|
||||
// __isNew: true → 新增行;存在 grindId → 修改行
|
||||
editRow: null,
|
||||
grindSaving: false
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
// 当前登录用户名(RuoYi Plus 的 store 路径)
|
||||
currentUserName() {
|
||||
return this.$store.state.user.name || this.$store.getters.name || ''
|
||||
},
|
||||
|
||||
// 表格数据:新增时在顶部插入一个编辑行占位
|
||||
tableData() {
|
||||
if (this.editRow && this.editRow.__isNew) {
|
||||
return [this.editRow, ...this.grindList]
|
||||
}
|
||||
return this.grindList
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.loadRolls()
|
||||
},
|
||||
|
||||
methods: {
|
||||
// ── 轧辊列表 ──────────────────────────────────────
|
||||
loadRolls() {
|
||||
this.rollLoading = true
|
||||
listRollInfo({ pageNum: 1, pageSize: 500 }).then(res => {
|
||||
this.allRolls = res.rows || []
|
||||
this.filterRolls()
|
||||
}).finally(() => { this.rollLoading = false })
|
||||
},
|
||||
filterRolls() {
|
||||
this.filteredRolls = this.allRolls.filter(r => {
|
||||
const matchNo = !this.filterNo || r.rollNo.includes(this.filterNo)
|
||||
const matchType = !this.filterType || r.rollType === this.filterType
|
||||
// 后续 mes_roll_info 增加 line_code 字段后改为 r.lineCode === this.filterLine
|
||||
const matchLine = !this.filterLine || this.filterLine === '双机架'
|
||||
return matchNo && matchType && matchLine
|
||||
})
|
||||
},
|
||||
selectRoll(r) {
|
||||
if (this.editRow) this.cancelEdit()
|
||||
this.selectedRollId = r.rollId
|
||||
getRollInfo(r.rollId).then(res => {
|
||||
this.selectedRoll = res.data || r
|
||||
const idx = this.allRolls.findIndex(x => x.rollId === r.rollId)
|
||||
if (idx !== -1) this.$set(this.allRolls, idx, { ...this.allRolls[idx], ...res.data })
|
||||
}).catch(() => { this.selectedRoll = r })
|
||||
this.loadGrindList(r.rollId)
|
||||
},
|
||||
|
||||
// ── 磨削记录 ──────────────────────────────────────
|
||||
loadGrindList(rollId) {
|
||||
this.grindLoading = true
|
||||
listRollGrind(rollId).then(res => {
|
||||
this.grindList = res.data || []
|
||||
}).finally(() => {
|
||||
this.grindLoading = false
|
||||
this.loadMonthlyStats()
|
||||
})
|
||||
},
|
||||
loadMonthlyStats() {
|
||||
if (!this.selectedRollId) return
|
||||
getMonthlyStats(this.selectedRollId, this.currentYear).then(res => {
|
||||
this.monthlyList = (res.data || []).map(r => ({
|
||||
month: r.month, grindCount: r.grindCount, totalGrindAmount: r.totalGrindAmount
|
||||
}))
|
||||
})
|
||||
},
|
||||
changeYear(delta) {
|
||||
this.currentYear += delta
|
||||
this.loadMonthlyStats()
|
||||
},
|
||||
|
||||
// ── 行内编辑 ──────────────────────────────────────
|
||||
isEditing(row) {
|
||||
if (!this.editRow) return false
|
||||
if (row.__isNew && this.editRow.__isNew) return true
|
||||
return !!row.grindId && row.grindId === this.editRow.grindId
|
||||
},
|
||||
rowClassName({ row }) {
|
||||
return this.isEditing(row) ? 'editing-row' : ''
|
||||
},
|
||||
|
||||
startAdd() {
|
||||
const now = new Date()
|
||||
const pad = n => String(n).padStart(2, '0')
|
||||
const grindTime = `${now.getFullYear()}-${pad(now.getMonth()+1)}-${pad(now.getDate())} ` +
|
||||
`${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`
|
||||
this.editRow = {
|
||||
__isNew: true,
|
||||
rollId: this.selectedRollId,
|
||||
grindTime,
|
||||
team: undefined,
|
||||
diaBefore: this.selectedRoll && this.selectedRoll.currentDia != null
|
||||
? parseFloat(this.selectedRoll.currentDia) : undefined,
|
||||
diaAfter: undefined,
|
||||
rollShape: '平',
|
||||
flawResult: '合格',
|
||||
hardness: undefined,
|
||||
operator: this.currentUserName,
|
||||
remark: undefined
|
||||
}
|
||||
},
|
||||
startEdit(row) {
|
||||
this.editRow = { ...row, operator: row.operator || this.currentUserName }
|
||||
},
|
||||
cancelEdit() {
|
||||
this.editRow = null
|
||||
},
|
||||
|
||||
saveRow() {
|
||||
const r = this.editRow
|
||||
if (!r.grindTime) { this.$modal.msgWarning('请填写磨削时间'); return }
|
||||
if (r.diaBefore == null) { this.$modal.msgWarning('请填写磨前直径'); return }
|
||||
if (r.diaAfter == null) { this.$modal.msgWarning('请填写磨后直径'); return }
|
||||
|
||||
// 自动带入操作人
|
||||
r.operator = this.currentUserName
|
||||
|
||||
this.grindSaving = true
|
||||
const isNew = !!r.__isNew
|
||||
const payload = { ...r }
|
||||
delete payload.__isNew
|
||||
|
||||
const api = isNew ? addRollGrind : updateRollGrind
|
||||
api(payload).then(() => {
|
||||
this.$modal.msgSuccess(isNew ? '新增成功' : '修改成功')
|
||||
this.editRow = null
|
||||
this.loadGrindList(this.selectedRollId)
|
||||
getRollInfo(this.selectedRollId).then(res => {
|
||||
this.selectedRoll = res.data
|
||||
const idx = this.allRolls.findIndex(x => x.rollId === this.selectedRollId)
|
||||
if (idx !== -1) this.$set(this.allRolls, idx, { ...this.allRolls[idx], ...res.data })
|
||||
})
|
||||
}).finally(() => { this.grindSaving = false })
|
||||
},
|
||||
|
||||
handleDelete(row) {
|
||||
this.$modal.confirm('确认删除该磨削记录?').then(() => {
|
||||
return delRollGrind(row.grindId)
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess('已删除')
|
||||
this.loadGrindList(this.selectedRollId)
|
||||
})
|
||||
},
|
||||
|
||||
// ── 计算磨削量 ──────────────────────────────────────
|
||||
grindAmountOf(row) {
|
||||
const b = parseFloat(row.diaBefore)
|
||||
const a = parseFloat(row.diaAfter)
|
||||
if (!isNaN(b) && !isNaN(a)) return (b - a).toFixed(2)
|
||||
return '—'
|
||||
},
|
||||
|
||||
// 辅助
|
||||
statusLabel(s) {
|
||||
return { Online: '在线', Standby: '备用', Offline: '离线', Scrapped: '报废' }[s] || s
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.grind-page { background: #f4f5f7; height: 100%; }
|
||||
.grind-layout { display: flex; gap: 12px; height: 100%; align-items: flex-start; }
|
||||
|
||||
/* 左侧 */
|
||||
.grind-left { width: 240px; flex-shrink: 0; }
|
||||
.grind-right { flex: 1; min-width: 0; }
|
||||
|
||||
.grind-card { border: 1px solid #dcdee0; border-radius: 4px; }
|
||||
.h-full { height: calc(100vh - 120px); display: flex; flex-direction: column; }
|
||||
|
||||
.card-header { display: flex; align-items: center; gap: 8px; }
|
||||
.card-title { font-size: 13px; font-weight: 600; color: #3d4b5c; }
|
||||
|
||||
/* 辊列表 */
|
||||
.roll-filter { padding: 0 0 4px; }
|
||||
.roll-list { overflow-y: auto; flex: 1; margin: 0 -12px; }
|
||||
.roll-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #f0f2f5; }
|
||||
.roll-item:hover { background: #f5f7fa; }
|
||||
.roll-item--active { background: #e8f4ff !important; border-left: 3px solid #409eff; }
|
||||
.ri-no { font-family: 'Consolas', monospace; font-size: 13px; font-weight: 600; color: #1f2329; }
|
||||
.ri-meta { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
|
||||
.ri-dia { font-size: 11px; color: #9aa0a6; }
|
||||
.ri-status { font-size: 11px; }
|
||||
.roll-empty { text-align: center; color: #c0c4cc; padding: 20px 0; font-size: 12px; }
|
||||
|
||||
/* 状态色 */
|
||||
.st-Online { color: #0a7c42; }
|
||||
.st-Standby { color: #d4860a; }
|
||||
.st-Offline { color: #9aa0a6; }
|
||||
.st-Scrapped { color: #c5221f; }
|
||||
|
||||
/* 空状态 */
|
||||
.grind-empty { display: flex; align-items: center; justify-content: center;
|
||||
height: 300px; color: #c0c4cc; font-size: 14px; gap: 6px; }
|
||||
|
||||
/* 辊头信息格 */
|
||||
.roll-header-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 16px; }
|
||||
.rh-item { display: flex; flex-direction: column; gap: 2px; }
|
||||
.rh-k { font-size: 11px; color: #9aa0a6; }
|
||||
.rh-v { font-size: 13px; color: #3d4b5c; }
|
||||
.rh-v.bold { font-weight: 600; }
|
||||
.rh-v.accent { color: #0a7c42; }
|
||||
|
||||
/* 月度汇总 */
|
||||
.monthly-wrap { margin-top: 16px; border-top: 1px solid #f0f2f5; padding-top: 12px; }
|
||||
.monthly-title { font-size: 12px; color: #5f6368; display: flex; align-items: center; }
|
||||
|
||||
/* 行内编辑 */
|
||||
.computed-val { color: #409eff; font-weight: 600; font-size: 13px; }
|
||||
.auto-operator { color: #0a7c42; font-size: 12px; }
|
||||
.remark-text { font-size: 12px; color: #5f6368; }
|
||||
|
||||
/* 去掉 number input 的默认上下箭头,保持表格整洁 */
|
||||
.el-table :deep(input[type=number]::-webkit-inner-spin-button),
|
||||
.el-table :deep(input[type=number]::-webkit-outer-spin-button) { -webkit-appearance: none; }
|
||||
.el-table :deep(input[type=number]) { -moz-appearance: textfield; }
|
||||
</style>
|
||||
|
||||
<!-- 编辑行高亮(非 scoped,作用于 el-table 的 row-class-name) -->
|
||||
<style>
|
||||
.el-table .editing-row { background: #fffbf0 !important; }
|
||||
.el-table .editing-row:hover > td { background: #fffbf0 !important; }
|
||||
</style>
|
||||
@@ -46,6 +46,12 @@
|
||||
|
||||
<!-- 搜索栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="所属产线">
|
||||
<!-- 暂时写死双机架,后续接后端 line_code 字段 -->
|
||||
<el-select v-model="queryParams.lineCode" placeholder="全部产线" clearable style="width:130px" @change="handleQuery">
|
||||
<el-option label="双机架产线" value="双机架" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="轧辊编号" prop="rollNo">
|
||||
<el-input v-model="queryParams.rollNo" placeholder="请输入轧辊编号" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
@@ -236,6 +242,7 @@ export default {
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
lineCode: undefined, // 产线筛选(暂写死双机架,后续接字段)
|
||||
rollNo: undefined,
|
||||
rollType: undefined,
|
||||
status: undefined
|
||||
@@ -269,6 +276,7 @@ export default {
|
||||
this.getList()
|
||||
},
|
||||
resetQuery() {
|
||||
this.queryParams.lineCode = undefined
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
|
||||
@@ -30,6 +30,14 @@
|
||||
<i class="el-icon-coin"></i>
|
||||
<span slot="title">实绩</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="rollConfig">
|
||||
<i class="el-icon-s-tools"></i>
|
||||
<span slot="title">配辊</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="rollHistory">
|
||||
<i class="el-icon-time"></i>
|
||||
<span slot="title">换辊历史</span>
|
||||
</el-menu-item>
|
||||
<!-- <el-menu-item index="realTime">
|
||||
<i class="el-icon-time"></i>
|
||||
<span slot="title">实时</span>
|
||||
@@ -50,6 +58,8 @@ import Shipping from './components/Shipping.vue';
|
||||
import Quality from './components/Quality.vue';
|
||||
import Performance from './components/Performance.vue';
|
||||
import RealTime from './components/RealTime.vue';
|
||||
import RollConfig from '@/views/timing/roll/index.vue';
|
||||
import RollHistory from '@/views/timing/roll/history.vue';
|
||||
|
||||
export default {
|
||||
name: 'AcidSystem',
|
||||
@@ -60,7 +70,9 @@ export default {
|
||||
Shipping,
|
||||
Quality,
|
||||
Performance,
|
||||
RealTime
|
||||
RealTime,
|
||||
RollConfig,
|
||||
RollHistory
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -77,6 +89,8 @@ export default {
|
||||
quality: 'Quality',
|
||||
performance: 'Performance',
|
||||
realTime: 'RealTime',
|
||||
rollConfig: 'RollConfig',
|
||||
rollHistory: 'RollHistory',
|
||||
};
|
||||
return componentMap[this.activeMenu];
|
||||
},
|
||||
|
||||
222
klp-ui/src/views/timing/roll/history.vue
Normal file
222
klp-ui/src/views/timing/roll/history.vue
Normal file
@@ -0,0 +1,222 @@
|
||||
<template>
|
||||
<div class="roll-history-view">
|
||||
<el-form :inline="true" :model="query" size="small" class="filter-bar">
|
||||
<el-form-item label="轧辊号">
|
||||
<el-input v-model="query.rollId" placeholder="输入轧辊号" clearable style="width: 180px" @keyup.enter.native="handleSearch" />
|
||||
</el-form-item>
|
||||
<el-form-item label="机架">
|
||||
<el-select v-model="query.standId" placeholder="全部" clearable style="width: 110px">
|
||||
<el-option v-for="s in standOptions" :key="s.value" :label="s.label" :value="s.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="换辊类型">
|
||||
<el-select v-model="query.changeType" placeholder="全部" clearable style="width: 120px">
|
||||
<el-option label="换辊" value="CHANGE" />
|
||||
<el-option label="磨辊" value="GRIND" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" :loading="loading" @click="handleSearch">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table
|
||||
:data="filteredRows"
|
||||
size="mini"
|
||||
border
|
||||
stripe
|
||||
:height="tableHeight"
|
||||
v-loading="loading"
|
||||
highlight-current-row
|
||||
>
|
||||
<el-table-column type="index" width="50" label="序" fixed />
|
||||
<el-table-column prop="rollid" label="轧辊号" width="120" fixed show-overflow-tooltip />
|
||||
<el-table-column label="机架" width="64">
|
||||
<template slot-scope="{ row }">{{ standName(row.standid) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="位置" width="52">
|
||||
<template slot-scope="{ row }">{{ dispPos(row.position) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="类型" width="72">
|
||||
<template slot-scope="{ row }">{{ dispType(row.type) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="change_type" label="换辊类型" width="82">
|
||||
<template slot-scope="{ row }">
|
||||
<el-tag :type="changeTypeTag(row.change_type)" size="mini">{{ row.change_type || '—' }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="diameter" label="直径(mm)" width="90" :formatter="fmtNum" />
|
||||
<el-table-column prop="crown" label="凸度" width="72" :formatter="fmtNum" />
|
||||
<el-table-column prop="rough" label="粗糙度" width="72" :formatter="fmtNum" />
|
||||
<el-table-column prop="rolled_length" label="本次长度" width="90" :formatter="fmtInt" />
|
||||
<el-table-column prop="rolled_weight" label="本次重量" width="90" :formatter="fmtInt" />
|
||||
<el-table-column prop="total_rolled_length" label="累计长度" width="90" :formatter="fmtInt" />
|
||||
<el-table-column prop="total_rolled_weight" label="累计重量" width="90" :formatter="fmtInt" />
|
||||
<el-table-column prop="grind_count" label="磨削次数" width="80" />
|
||||
<el-table-column label="安装时间" width="148">
|
||||
<template slot-scope="{ row }">{{ fmtDate(row.instal_time) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="卸辊时间" width="148">
|
||||
<template slot-scope="{ row }">{{ fmtDate(row.deinstal_time) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="换辊时间" width="148">
|
||||
<template slot-scope="{ row }">{{ fmtDate(row.change_time) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="shift" label="班次" width="52" />
|
||||
<el-table-column prop="crew" label="班组" width="52" />
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-bar">
|
||||
<el-pagination
|
||||
small
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="pagination.total"
|
||||
:page-size="pagination.pageSize"
|
||||
:page-sizes="[50, 100, 200]"
|
||||
:current-page="pagination.page"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getRollHistoryList, getRollHistoryCount } from '@/api/l2/timing'
|
||||
|
||||
const STAND_NAMES = ['一机架', '二机架', '三机架', '四机架', '五机架', '六机架']
|
||||
|
||||
const POS_NORM = {
|
||||
TOP: '上', UPPER: '上', UP: '上', '上': '上',
|
||||
BOTTOM: '下', LOWER: '下', DOWN: '下', '下': '下'
|
||||
}
|
||||
const TYPE_NORM = {
|
||||
WORK: '工作辊', WORK_ROLL: '工作辊', WR: '工作辊', '工作辊': '工作辊',
|
||||
BACKUP: '支撑辊', BUR: '支撑辊', SUPPORT: '支撑辊', BACK_UP: '支撑辊', '支撑辊': '支撑辊',
|
||||
INTERMEDIATE: '中间辊', IMR: '中间辊', INTER: '中间辊', '中间辊': '中间辊'
|
||||
}
|
||||
|
||||
function fmtDateStr(val) {
|
||||
if (!val) return '—'
|
||||
const s = String(val)
|
||||
const m = s.match(/(\d{4})-(\d{2})-(\d{2})[ T](\d{2}):(\d{2}):(\d{2})/)
|
||||
if (m) return `${m[1]}-${m[2]}-${m[3]} ${m[4]}:${m[5]}:${m[6]}`
|
||||
const d = new Date(val)
|
||||
if (isNaN(d.getTime())) return s
|
||||
const pad = n => String(n).padStart(2, '0')
|
||||
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'TimingRollHistoryPage',
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
query: { rollId: '', standId: null, changeType: '' },
|
||||
rows: [],
|
||||
pagination: { page: 1, pageSize: 50, total: 0 },
|
||||
tableHeight: 'calc(100vh - 196px)',
|
||||
standOptions: STAND_NAMES.map((label, i) => ({ label, value: i + 1 }))
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
filteredRows() {
|
||||
if (!this.query.changeType) return this.rows
|
||||
return this.rows.filter(r => String(r.change_type || '').toUpperCase() === this.query.changeType)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadCount()
|
||||
this.loadRows()
|
||||
},
|
||||
methods: {
|
||||
async loadCount() {
|
||||
try {
|
||||
const res = await getRollHistoryCount(
|
||||
this.query.rollId || undefined,
|
||||
this.query.standId || undefined
|
||||
)
|
||||
this.pagination.total = res?.data?.total ?? 0
|
||||
} catch (_) {}
|
||||
},
|
||||
async loadRows() {
|
||||
this.loading = true
|
||||
try {
|
||||
const { page, pageSize } = this.pagination
|
||||
const res = await getRollHistoryList(
|
||||
page, pageSize,
|
||||
this.query.rollId || undefined,
|
||||
this.query.standId || undefined
|
||||
)
|
||||
this.rows = res?.data?.rows || []
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
handleSearch() {
|
||||
this.pagination.page = 1
|
||||
this.loadCount()
|
||||
this.loadRows()
|
||||
},
|
||||
handleReset() {
|
||||
this.query = { rollId: '', standId: null, changeType: '' }
|
||||
this.pagination.page = 1
|
||||
this.loadCount()
|
||||
this.loadRows()
|
||||
},
|
||||
handlePageChange(page) {
|
||||
this.pagination.page = page
|
||||
this.loadRows()
|
||||
},
|
||||
handleSizeChange(size) {
|
||||
this.pagination.pageSize = size
|
||||
this.pagination.page = 1
|
||||
this.loadCount()
|
||||
this.loadRows()
|
||||
},
|
||||
standName(val) {
|
||||
const idx = Number(val) - 1
|
||||
return STAND_NAMES[idx] || (val != null ? String(val) : '—')
|
||||
},
|
||||
dispPos(v) { return POS_NORM[String(v || '').toUpperCase()] || v || '—' },
|
||||
dispType(v) { return TYPE_NORM[String(v || '').toUpperCase()] || v || '—' },
|
||||
changeTypeTag(type) {
|
||||
const map = { CHANGE: 'primary', GRIND: 'warning' }
|
||||
return map[String(type || '').toUpperCase()] || 'info'
|
||||
},
|
||||
fmtNum(row, col, val) {
|
||||
if (val == null || val === '') return '—'
|
||||
const n = parseFloat(val)
|
||||
return isNaN(n) ? String(val) : n.toFixed(2)
|
||||
},
|
||||
fmtInt(row, col, val) {
|
||||
if (val == null || val === '') return '—'
|
||||
const n = parseFloat(val)
|
||||
return isNaN(n) ? String(val) : Math.round(n).toString()
|
||||
},
|
||||
fmtDate(val) { return fmtDateStr(val) }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.roll-history-view {
|
||||
padding: 12px;
|
||||
background: #fff;
|
||||
min-height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.filter-bar {
|
||||
margin-bottom: 8px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.pagination-bar {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
padding: 8px 0 0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
</style>
|
||||
299
klp-ui/src/views/timing/roll/index.vue
Normal file
299
klp-ui/src/views/timing/roll/index.vue
Normal file
@@ -0,0 +1,299 @@
|
||||
<template>
|
||||
<div class="roll-view">
|
||||
<div class="toolbar">
|
||||
<el-button size="small" type="primary" :loading="loading" icon="el-icon-refresh" @click="loadData">刷新</el-button>
|
||||
<el-button size="small" icon="el-icon-search" @click="handleCheck">检查</el-button>
|
||||
<span v-if="lastRefresh" class="refresh-time">上次刷新:{{ lastRefresh }}</span>
|
||||
</div>
|
||||
|
||||
<div class="table-wrap" v-loading="loading">
|
||||
<table class="roll-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2" class="th-stand">机架</th>
|
||||
<th rowspan="2" class="th-pos">位置</th>
|
||||
<th colspan="4" class="th-section th-standby">准备辊</th>
|
||||
<th colspan="9" class="th-section th-online">在线辊</th>
|
||||
<th colspan="4" class="th-section th-standard">换辊标准</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="th-sub">轧辊号</th>
|
||||
<th class="th-sub">外径</th>
|
||||
<th class="th-sub">凸度</th>
|
||||
<th class="th-sub">粗糙度</th>
|
||||
<th class="th-sub">轧辊号</th>
|
||||
<th class="th-sub">位置</th>
|
||||
<th class="th-sub">类型</th>
|
||||
<th class="th-sub">直径</th>
|
||||
<th class="th-sub">凸度</th>
|
||||
<th class="th-sub">粗糙度</th>
|
||||
<th class="th-sub">长度</th>
|
||||
<th class="th-sub">重量</th>
|
||||
<th class="th-sub">安装时间</th>
|
||||
<th class="th-sub">本次长度</th>
|
||||
<th class="th-sub">累计长度</th>
|
||||
<th class="th-sub">本次重量</th>
|
||||
<th class="th-sub">累计重量</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-for="(stand, si) in tableData">
|
||||
<tr
|
||||
v-for="(pos, pi) in stand.positions"
|
||||
:key="stand.id + '-' + pi"
|
||||
:class="rowCls(pos)"
|
||||
>
|
||||
<td v-if="pi === 0" :rowspan="stand.positions.length" class="td-stand">
|
||||
{{ stand.name }}
|
||||
</td>
|
||||
<td class="td-pos">{{ pos.label }}</td>
|
||||
|
||||
<!-- 准备辊 -->
|
||||
<td class="td-standby">{{ sv(pos.standby, 'rollid') }}</td>
|
||||
<td class="td-standby">{{ nv(pos.standby, 'diameter') }}</td>
|
||||
<td class="td-standby">{{ nv(pos.standby, 'crown') }}</td>
|
||||
<td class="td-standby">{{ nv(pos.standby, 'rough') }}</td>
|
||||
|
||||
<!-- 在线辊 -->
|
||||
<td class="td-online td-bold">{{ sv(pos.online, 'rollid') }}</td>
|
||||
<td class="td-online">{{ dispPos(pos.online && pos.online.position) }}</td>
|
||||
<td class="td-online">{{ dispType(pos.online && pos.online.type) }}</td>
|
||||
<td class="td-online">{{ nv(pos.online, 'diameter') }}</td>
|
||||
<td class="td-online">{{ nv(pos.online, 'crown') }}</td>
|
||||
<td class="td-online">{{ nv(pos.online, 'rough') }}</td>
|
||||
<td class="td-online">{{ iv(pos.online, 'rolled_length') }}</td>
|
||||
<td class="td-online">{{ iv(pos.online, 'rolled_weight') }}</td>
|
||||
<td class="td-online td-time">{{ dv(pos.online, 'instal_time') }}</td>
|
||||
|
||||
<!-- 换辊标准 -->
|
||||
<td class="td-std">{{ iv(pos.online, 'rolled_length') }}</td>
|
||||
<td class="td-std">{{ iv(pos.online, 'total_rolled_length') }}</td>
|
||||
<td class="td-std">{{ iv(pos.online, 'rolled_weight') }}</td>
|
||||
<td class="td-std">{{ iv(pos.online, 'total_rolled_weight') }}</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getRollData } from '@/api/l2/timing'
|
||||
|
||||
const STAND_NAMES = ['一机架', '二机架', '三机架', '四机架', '五机架', '六机架']
|
||||
|
||||
// 归一化:英文 → 中文,兼容已是中文的情况
|
||||
const POS_NORM = {
|
||||
TOP: '上', UPPER: '上', UP: '上', '上': '上',
|
||||
BOTTOM: '下', LOWER: '下', DOWN: '下', '下': '下'
|
||||
}
|
||||
const TYPE_NORM = {
|
||||
WORK: '工作辊', WORK_ROLL: '工作辊', WR: '工作辊', '工作辊': '工作辊',
|
||||
BACKUP: '支撑辊', BUR: '支撑辊', SUPPORT: '支撑辊', BACK_UP: '支撑辊', '支撑辊': '支撑辊',
|
||||
INTERMEDIATE: '中间辊', IMR: '中间辊', INTER: '中间辊', '中间辊': '中间辊'
|
||||
}
|
||||
|
||||
function normPos(v) { return POS_NORM[String(v || '').toUpperCase()] || String(v || '').trim() }
|
||||
function normType(v) { return TYPE_NORM[String(v || '').toUpperCase()] || String(v || '').trim() }
|
||||
|
||||
const POSITIONS = [
|
||||
{ label: '上支撑辊', position: '上', type: '支撑辊' },
|
||||
{ label: '上中间辊', position: '上', type: '中间辊' },
|
||||
{ label: '上工作辊', position: '上', type: '工作辊' },
|
||||
{ label: '下工作辊', position: '下', type: '工作辊' },
|
||||
{ label: '下中间辊', position: '下', type: '中间辊' },
|
||||
{ label: '下支撑辊', position: '下', type: '支撑辊' }
|
||||
]
|
||||
|
||||
function fmtDateStr(val) {
|
||||
if (!val) return '—'
|
||||
const s = String(val)
|
||||
const m = s.match(/(\d{4})-(\d{2})-(\d{2})[ T](\d{2}):(\d{2}):(\d{2})/)
|
||||
if (m) return `${m[1]}-${m[2]}-${m[3]} ${m[4]}:${m[5]}:${m[6]}`
|
||||
const d = new Date(val)
|
||||
if (isNaN(d.getTime())) return s
|
||||
const pad = n => String(n).padStart(2, '0')
|
||||
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'TimingRollPage',
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
lastRefresh: '',
|
||||
tableData: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadData()
|
||||
},
|
||||
methods: {
|
||||
async loadData() {
|
||||
this.loading = true
|
||||
try {
|
||||
const res = await getRollData()
|
||||
const rows = res?.data?.rows || []
|
||||
this.buildTableData(rows)
|
||||
const now = new Date()
|
||||
const pad = n => String(n).padStart(2, '0')
|
||||
this.lastRefresh = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
buildTableData(rows) {
|
||||
this.tableData = STAND_NAMES.map((name, idx) => {
|
||||
const standId = idx + 1
|
||||
const standRows = rows.filter(r => Number(r.standid) === standId)
|
||||
const positions = POSITIONS.map(p => {
|
||||
// 同位置下所有 ONLINE 辊,按安装时间升序排列
|
||||
const matches = standRows
|
||||
.filter(r =>
|
||||
normPos(r.position) === p.position &&
|
||||
normType(r.type) === p.type
|
||||
)
|
||||
.sort((a, b) => {
|
||||
const ta = a.instal_time ? new Date(a.instal_time).getTime() : 0
|
||||
const tb = b.instal_time ? new Date(b.instal_time).getTime() : 0
|
||||
return ta - tb
|
||||
})
|
||||
// 安装最早的是当前在线辊,后装的是准备辊(等待换入)
|
||||
const online = matches[0] || null
|
||||
const standby = matches[1] || null
|
||||
return { ...p, online, standby }
|
||||
})
|
||||
return { id: standId, name, positions }
|
||||
})
|
||||
},
|
||||
rowCls(pos) {
|
||||
return pos.online ? '' : 'row-empty'
|
||||
},
|
||||
// 字符串值
|
||||
sv(row, key) {
|
||||
if (!row) return '—'
|
||||
const v = row[key]
|
||||
return v != null && v !== '' ? String(v) : '—'
|
||||
},
|
||||
// 数值(保留两位小数)
|
||||
nv(row, key) {
|
||||
if (!row) return '—'
|
||||
const v = row[key]
|
||||
if (v == null || v === '') return '—'
|
||||
const n = parseFloat(v)
|
||||
return isNaN(n) ? String(v) : n.toFixed(2)
|
||||
},
|
||||
// 整数
|
||||
iv(row, key) {
|
||||
if (!row) return '—'
|
||||
const v = row[key]
|
||||
if (v == null || v === '') return '—'
|
||||
const n = parseFloat(v)
|
||||
return isNaN(n) ? String(v) : Math.round(n).toString()
|
||||
},
|
||||
// 日期
|
||||
dv(row, key) {
|
||||
return row ? fmtDateStr(row[key]) : '—'
|
||||
},
|
||||
dispPos(v) { return POS_NORM[String(v || '').toUpperCase()] || v || '—' },
|
||||
dispType(v) { return TYPE_NORM[String(v || '').toUpperCase()] || v || '—' },
|
||||
handleCheck() {
|
||||
const missing = []
|
||||
this.tableData.forEach(stand => {
|
||||
stand.positions.forEach(pos => {
|
||||
if (pos.online && !pos.standby) missing.push(`${stand.name} ${pos.label}`)
|
||||
})
|
||||
})
|
||||
if (missing.length === 0) {
|
||||
this.$message.success('检查通过,各机架备辊配置正常')
|
||||
} else {
|
||||
this.$alert(missing.join('\n'), '以下位置缺少备辊', { type: 'warning', confirmButtonText: '知道了' })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.roll-view {
|
||||
padding: 12px;
|
||||
background: #fff;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 10px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.refresh-time {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
margin-left: 6px;
|
||||
}
|
||||
.table-wrap {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 3px;
|
||||
min-height: 0;
|
||||
}
|
||||
.roll-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 12px;
|
||||
color: #303133;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.roll-table th,
|
||||
.roll-table td {
|
||||
border: 1px solid #dcdfe6;
|
||||
padding: 5px 8px;
|
||||
text-align: center;
|
||||
}
|
||||
.roll-table thead tr:first-child th {
|
||||
background: #eef0f3;
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
}
|
||||
.th-section { border-bottom: 2px solid #c0c4cc !important; }
|
||||
.th-standby { background: #f5f7fa !important; }
|
||||
.th-online { background: #ecf5ff !important; color: #1a5276; }
|
||||
.th-standard { background: #fdf6ec !important; color: #7b5c1e; }
|
||||
.th-stand, .th-pos { background: #eef0f3; font-weight: 600; }
|
||||
.th-sub {
|
||||
background: #fafafa;
|
||||
font-weight: normal;
|
||||
font-size: 11px;
|
||||
color: #606266;
|
||||
}
|
||||
.td-stand {
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
background: #f5f7fa;
|
||||
writing-mode: vertical-rl;
|
||||
text-orientation: mixed;
|
||||
letter-spacing: 2px;
|
||||
width: 32px;
|
||||
min-width: 32px;
|
||||
}
|
||||
.td-pos {
|
||||
background: #fafafa;
|
||||
font-weight: 500;
|
||||
width: 62px;
|
||||
text-align: left;
|
||||
padding-left: 6px;
|
||||
}
|
||||
.td-bold { font-weight: 500; }
|
||||
.td-standby { color: #606266; }
|
||||
.td-online { color: #303133; }
|
||||
.td-std { color: #606266; }
|
||||
.td-time { font-size: 11px; color: #606266; }
|
||||
.row-empty td { color: #c0c4cc; background: #fafafa; }
|
||||
.roll-table tbody tr:hover td { background: #f0f7ff; }
|
||||
</style>
|
||||
Reference in New Issue
Block a user