feat(i18n): 实现多语言支持并更新相关组件

refactor: 重构组件以使用i18n动态文本
style: 调整代码格式和结构
docs: 更新多语言翻译文件
This commit is contained in:
砂糖
2025-12-29 11:16:35 +08:00
parent 4fa6a1f59a
commit fa37b697e6
20 changed files with 1645 additions and 619 deletions

View File

@@ -14,7 +14,7 @@
<el-row :gutter="5" style="padding: 0 20px 20px;">
<el-col :span="10">
<el-card>
<div slot="header"><span>系统告警信息</span></div>
<div slot="header"><span>{{ $t('dashboard.alarmInfo') }}</span></div>
<!-- 第一个表格绑定API获取的数据和列配置 -->
<MiniTable
v-loading="tableLoading"
@@ -27,7 +27,7 @@
</el-col>
<el-col :span="14">
<el-card>
<div slot="header"><span>换辊信息</span></div>
<div slot="header"><span>{{ $t('dashboard.rollChangeInfo') }}</span></div>
<MiniTable
v-loading="rollHistoryLoading"
:columns="rollHistoryColumns"
@@ -38,7 +38,7 @@
</el-col>
<el-col :span="24">
<el-card>
<div slot="header"><span>生产计划</span></div>
<div slot="header"><span>{{ $t('dashboard.productionPlan') }}</span></div>
<MiniTable
v-loading="planLoading"
:columns="planColumns"
@@ -49,7 +49,7 @@
</el-col>
<el-col :span="24">
<el-card>
<div slot="header"><span>过程跟踪</span></div>
<div slot="header"><span>{{ $t('dashboard.processTracking') }}</span></div>
<TrackMeasure
v-loading="measureLoading"
:columns="measureColumns"
@@ -77,47 +77,6 @@ export default {
components: { CurrentTime, HomeMain, MiniTable, TrackMeasure },
data() {
return {
featureCards: [
{ title: "生产计划", desc: "生产计划管理...", icon: "table", path: "/plan" },
{ title: "日志记录", desc: "日志记录管理...", icon: "log", path: "/log" },
{ title: "轧辊管理", desc: "轧辊管理...", icon: "redis", path: "/roller" },
{ title: "停机管理", desc: "停机管理...", icon: "bug", path: "/stop" },
],
// 表格列配置(与日志字段对应)
alarmColumns: [
{ label: "发生时间", prop: "timestamp", width: "200px" },
{ label: "报警模块", prop: "module", width: "60px" },
{ label: "报警类型", prop: "logtype" },
],
rollHistoryColumns: [
{ label: "换辊号", prop: "changeid" },
{ label: "轧辊号", prop: "rollid" },
{ label: "机组", prop: "seton", width: "80px" },
{ label: "班次", prop: "shift", width: "60px" },
{ label: "班组", prop: "crew", width: "60px" },
{ label: "机架号", prop: "standid", width: "80px" },
{ label: "位置", prop: "position", width: "50px" },
{ label: '直径', prop: 'diameter', width: '100px' },
{ label: '粗糙度', prop: 'rough', width: '100px' },
{ label: '凸度', prop: 'crown', width: '100px' },
{ label: '成分', prop: 'composition', width: '100px' },
],
planColumns: [
{ label: '顺序号', prop: 'seqid', width: '80px' },
{ label: '钢卷号', prop: 'coilid', width: '120px' },
{ label: '机组号', prop: 'unitCode', width: '100px' },
{ label: '计划号', prop: 'planid', width: '120px' },
{ label: '计划类型', prop: 'planType', width: '80px' },
{ label: '钢种', prop: 'steelGrade', width: '120px' },
{ label: '出口卷号', prop: 'exitCoilid', width: '100px' },
{ label: '订单号', prop: 'orderNo', width: '100px' },
{ label: '客户代码', prop: 'custommerCode', width: '100px' },
{ label: '上线时间', prop: 'onlineDate' },
{ label: '开始时间', prop: 'startDate' },
{ label: '结束时间', prop: 'endDate' },
{ label: '进炉时间', prop: 'furInDate' },
{ label: '出炉时间', prop: 'furOutDate' },
],
alarmData: [], // 表格数据从API获取
queryForm: { pageNum: 1, pageSize: 10 }, // 分页参数
tableLoading: false, // 加载状态
@@ -127,6 +86,58 @@ export default {
planLoading: false, // 生产计划数据加载状态
};
},
computed: {
// 功能卡片配置
featureCards() {
return [
{ title: this.$t('dashboard.productionPlan'), desc: this.$t('dashboard.productionPlanDesc'), icon: "table", path: "/plan" },
{ title: this.$t('dashboard.logRecord'), desc: this.$t('dashboard.logRecordDesc'), icon: "log", path: "/log" },
{ title: this.$t('dashboard.rollManagement'), desc: this.$t('dashboard.rollManagementDesc'), icon: "redis", path: "/roller" },
{ title: this.$t('dashboard.shutdownManagement'), desc: this.$t('dashboard.shutdownManagementDesc'), icon: "bug", path: "/stop" },
];
},
// 表格列配置(与日志字段对应)
alarmColumns() {
return [
{ label: this.$t('dashboard.occurTime'), prop: "timestamp", width: "200px" },
{ label: this.$t('dashboard.alarmModule'), prop: "module", width: "60px" },
{ label: this.$t('dashboard.alarmType'), prop: "logtype" },
];
},
rollHistoryColumns() {
return [
{ label: this.$t('dashboard.rollChangeId'), prop: "changeid" },
{ label: this.$t('dashboard.rollId'), prop: "rollid" },
{ label: this.$t('dashboard.unit'), prop: "seton", width: "80px" },
{ label: this.$t('dashboard.shift'), prop: "shift", width: "60px" },
{ label: this.$t('dashboard.crew'), prop: "crew", width: "60px" },
{ label: this.$t('dashboard.standId'), prop: "standid", width: "80px" },
{ label: this.$t('dashboard.position'), prop: "position", width: "50px" },
{ label: this.$t('dashboard.diameter'), prop: 'diameter', width: '100px' },
{ label: this.$t('dashboard.roughness'), prop: 'rough', width: '100px' },
{ label: this.$t('dashboard.crown'), prop: 'crown', width: '100px' },
{ label: this.$t('dashboard.composition'), prop: 'composition', width: '100px' },
];
},
planColumns() {
return [
{ label: this.$t('dashboard.seqId'), prop: 'seqid', width: '80px' },
{ label: this.$t('dashboard.coilId'), prop: 'coilid', width: '120px' },
{ label: this.$t('dashboard.unitCode'), prop: 'unitCode', width: '100px' },
{ label: this.$t('dashboard.planId'), prop: 'planid', width: '120px' },
{ label: this.$t('dashboard.planType'), prop: 'planType', width: '80px' },
{ label: this.$t('dashboard.steelGrade'), prop: 'steelGrade', width: '120px' },
{ label: this.$t('dashboard.exitCoilId'), prop: 'exitCoilid', width: '100px' },
{ label: this.$t('dashboard.orderNo'), prop: 'orderNo', width: '100px' },
{ label: this.$t('dashboard.customerCode'), prop: 'custommerCode', width: '100px' },
{ label: this.$t('dashboard.onlineDate'), prop: 'onlineDate' },
{ label: this.$t('dashboard.startDate'), prop: 'startDate' },
{ label: this.$t('dashboard.endDate'), prop: 'endDate' },
{ label: this.$t('dashboard.furInDate'), prop: 'furInDate' },
{ label: this.$t('dashboard.furOutDate'), prop: 'furOutDate' },
];
},
},
created() {
// 页面加载时调用API获取数据
this.getLogData();
@@ -144,7 +155,7 @@ export default {
.catch((error) => {
this.tableLoading = false;
console.error("获取日志数据失败:", error);
this.$message.error("获取日志数据失败,请稍后重试");
this.$message.error(this.$t('dashboard.getLogDataFailed'));
});
},
getRollHistorytList() {