2026-07-08 13:38:03 +08:00
|
|
|
<template>
|
2026-07-08 14:45:43 +08:00
|
|
|
<div class="model-page" v-loading="loading && !data">
|
|
|
|
|
<el-alert v-if="errorMsg" :title="errorMsg" type="error" show-icon :closable="false" class="error-alert" />
|
|
|
|
|
<el-alert v-else-if="data && data.error" :title="data.error" type="warning" show-icon :closable="false" />
|
|
|
|
|
|
|
|
|
|
<div v-else-if="data" class="model-layout">
|
|
|
|
|
<div class="left-panel">
|
|
|
|
|
<coil-model-table title="当前卷对比" :coil="data.current" />
|
|
|
|
|
<coil-model-table title="下一卷对比" :coil="data.next" />
|
2026-07-08 13:38:03 +08:00
|
|
|
</div>
|
2026-07-08 14:45:43 +08:00
|
|
|
<div class="right-panel">
|
|
|
|
|
<coil-info-card title="当前卷" :coil="data.current" />
|
|
|
|
|
<coil-info-card title="下一卷" :coil="data.next" />
|
2026-07-08 13:38:03 +08:00
|
|
|
</div>
|
2026-07-08 14:45:43 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div v-else-if="!loading" class="empty-tip">暂无数据</div>
|
2026-07-08 13:38:03 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { getLatestMillData } from '@/api/l2/mill'
|
2026-07-08 14:45:43 +08:00
|
|
|
import CoilModelTable from './CoilModelTable.vue'
|
|
|
|
|
import CoilInfoCard from './CoilInfoCard.vue'
|
2026-07-08 13:38:03 +08:00
|
|
|
|
2026-07-08 14:45:43 +08:00
|
|
|
const REFRESH_INTERVAL = 15000
|
2026-07-08 13:38:03 +08:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'AcidModel',
|
2026-07-08 14:45:43 +08:00
|
|
|
components: { CoilModelTable, CoilInfoCard },
|
2026-07-08 13:38:03 +08:00
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
loading: false,
|
|
|
|
|
data: null,
|
|
|
|
|
errorMsg: '',
|
|
|
|
|
timer: null,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.fetchData()
|
2026-07-08 14:45:43 +08:00
|
|
|
this.timer = setInterval(this.fetchData, REFRESH_INTERVAL)
|
2026-07-08 13:38:03 +08:00
|
|
|
},
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
if (this.timer) clearInterval(this.timer)
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
async fetchData() {
|
|
|
|
|
this.loading = true
|
|
|
|
|
try {
|
2026-07-08 14:45:43 +08:00
|
|
|
const res = await getLatestMillData()
|
|
|
|
|
this.data = res
|
|
|
|
|
this.errorMsg = ''
|
2026-07-08 13:38:03 +08:00
|
|
|
} catch (e) {
|
|
|
|
|
this.errorMsg = (e && e.response && e.response.data && e.response.data.detail) || '获取模型数据失败'
|
|
|
|
|
} finally {
|
|
|
|
|
this.loading = false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.model-page {
|
|
|
|
|
padding: 16px;
|
|
|
|
|
height: calc(100% - 32px);
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-08 14:45:43 +08:00
|
|
|
.error-alert {
|
|
|
|
|
margin-bottom: 12px;
|
2026-07-08 13:38:03 +08:00
|
|
|
}
|
|
|
|
|
|
2026-07-08 14:45:43 +08:00
|
|
|
.model-layout {
|
2026-07-08 13:38:03 +08:00
|
|
|
display: flex;
|
2026-07-08 14:45:43 +08:00
|
|
|
gap: 16px;
|
|
|
|
|
align-items: flex-start;
|
2026-07-08 13:38:03 +08:00
|
|
|
}
|
|
|
|
|
|
2026-07-08 14:45:43 +08:00
|
|
|
.left-panel {
|
|
|
|
|
flex: 1;
|
|
|
|
|
min-width: 0;
|
|
|
|
|
overflow-x: auto;
|
2026-07-08 13:38:03 +08:00
|
|
|
}
|
|
|
|
|
|
2026-07-08 14:45:43 +08:00
|
|
|
.right-panel {
|
|
|
|
|
width: 260px;
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
}
|
2026-07-08 13:38:03 +08:00
|
|
|
|
2026-07-08 14:45:43 +08:00
|
|
|
.empty-tip {
|
|
|
|
|
color: #c0c4cc;
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
padding: 40px 0;
|
|
|
|
|
text-align: center;
|
2026-07-08 13:38:03 +08:00
|
|
|
}
|
|
|
|
|
</style>
|