|
|
@@ -13,7 +13,7 @@
|
|
|
<div class="device-info-section" :style="{width: (activeTab === 'compo' || activeTab === 'record') ? '70%' : '400px'}">
|
|
|
<div class="info-panel">
|
|
|
<div class="panel-header">
|
|
|
- <h3>设备信息</h3>
|
|
|
+ <h3>{{ deviceInfo ? deviceInfo.devName : '设备信息' }}</h3>
|
|
|
<el-button type="text" @click="goBack">
|
|
|
<i class="el-icon-back"></i> 返回
|
|
|
</el-button>
|
|
|
@@ -29,9 +29,6 @@
|
|
|
<el-descriptions-item label="设备位号">
|
|
|
{{ deviceInfo.devTag }}
|
|
|
</el-descriptions-item>
|
|
|
- <el-descriptions-item label="装置">
|
|
|
- {{ deviceInfo.plant }}
|
|
|
- </el-descriptions-item>
|
|
|
<el-descriptions-item label="位置">
|
|
|
{{ deviceInfo.devLoc }}
|
|
|
</el-descriptions-item>
|
|
|
@@ -73,7 +70,11 @@
|
|
|
<!-- 关联部件标签页 -->
|
|
|
<el-tab-pane label="关联部件" name="compo" v-if="deviceInfo.compoList && deviceInfo.compoList.length > 0">
|
|
|
<el-table :data="deviceInfo.compoList" border size="small" :height="clientHeight" style="margin-top: 10px;">
|
|
|
- <el-table-column label="部件名称" align="center" prop="compoName" width="120" :show-overflow-tooltip="true"/>
|
|
|
+ <el-table-column label="部件名称" align="center" prop="compoName" width="120" :show-overflow-tooltip="true">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="text" @click="handleCompoClick(scope.row)">{{ scope.row.compoName }}</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="检查频率" align="center" prop="inspFreq" width="110" :show-overflow-tooltip="true">
|
|
|
<template slot-scope="scope">
|
|
|
{{ translateFrequency(scope.row.inspFreq) }}
|
|
|
@@ -112,7 +113,7 @@
|
|
|
|
|
|
<!-- 维修记录标签页 -->
|
|
|
<el-tab-pane label="维修记录" name="record">
|
|
|
- <el-table v-loading="maintRecordLoading" :data="maintRecordList" border size="small" :height="clientHeight" style="margin-top: 10px; width: 100%;">
|
|
|
+ <el-table v-loading="maintRecordLoading" :data="maintRecordList" border size="small" :height="clientHeight - 50" style="width: 100%;">
|
|
|
<el-table-column label="部件名称" align="center" prop="compoName" width="120" :show-overflow-tooltip="true"/>
|
|
|
<el-table-column label="维修类型" align="center" width="100">
|
|
|
<template slot-scope="scope">
|
|
|
@@ -140,6 +141,16 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
+ <el-pagination
|
|
|
+ style="margin-top: 10px; text-align: right;"
|
|
|
+ @size-change="handleMaintRecordSizeChange"
|
|
|
+ @current-change="handleMaintRecordCurrentChange"
|
|
|
+ :current-page="maintRecordQuery.pageNum"
|
|
|
+ :page-sizes="[10, 20, 50, 100]"
|
|
|
+ :page-size="maintRecordQuery.pageSize"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ :total="maintRecordTotal">
|
|
|
+ </el-pagination>
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
|
|
|
@@ -150,19 +161,71 @@
|
|
|
</div>
|
|
|
|
|
|
<!-- 部件详情对话框 -->
|
|
|
- <el-dialog :title="selectedCompo ? selectedCompo.compoName : '部件信息'" :visible.sync="compoDialogVisible" width="600px" append-to-body>
|
|
|
- <el-descriptions v-if="selectedCompo" :column="2" border>
|
|
|
- <el-descriptions-item label="检查频率">{{ translateFrequency(selectedCompo.inspFreq) }}</el-descriptions-item>
|
|
|
- <el-descriptions-item label="上次检查日期">{{ parseTime(selectedCompo.lastInspDate, '{y}-{m}-{d}') || '-' }}</el-descriptions-item>
|
|
|
- <el-descriptions-item label="检查内容" :span="2">{{ selectedCompo.inspContent || '-' }}</el-descriptions-item>
|
|
|
- <el-descriptions-item label="维修频率">{{ translateFrequency(selectedCompo.fixFreq) }}</el-descriptions-item>
|
|
|
- <el-descriptions-item label="上次维修日期">{{ parseTime(selectedCompo.lastFixDate, '{y}-{m}-{d}') || '-' }}</el-descriptions-item>
|
|
|
- <el-descriptions-item label="维修内容" :span="2">{{ selectedCompo.fixContent || '-' }}</el-descriptions-item>
|
|
|
- <el-descriptions-item label="更换频率">{{ translateFrequency(selectedCompo.replaceFreq) }}</el-descriptions-item>
|
|
|
- <el-descriptions-item label="上次更换日期">{{ parseTime(selectedCompo.lastReplaceDate, '{y}-{m}-{d}') || '-' }}</el-descriptions-item>
|
|
|
- <el-descriptions-item label="更换内容" :span="2">{{ selectedCompo.replaceContent || '-' }}</el-descriptions-item>
|
|
|
- <el-descriptions-item label="备注" :span="2">{{ selectedCompo.remarks || '-' }}</el-descriptions-item>
|
|
|
- </el-descriptions>
|
|
|
+ <el-dialog :title="selectedCompo ? selectedCompo.compoName : '部件信息'" :visible.sync="compoDialogVisible" width="900px" append-to-body class="compo-detail-dialog">
|
|
|
+ <div v-if="selectedCompo" class="compo-detail-content">
|
|
|
+ <!-- 部件图片 -->
|
|
|
+ <div v-if="selectedCompo.compoPhoto" class="compo-photo-section">
|
|
|
+ <el-image
|
|
|
+ :src="getPhotoUrl(selectedCompo.compoPhoto)"
|
|
|
+ :preview-src-list="[getPhotoUrl(selectedCompo.compoPhoto)]"
|
|
|
+ fit="contain"
|
|
|
+ class="compo-photo">
|
|
|
+ <div slot="error" class="image-error">
|
|
|
+ <i class="el-icon-picture-outline"></i>
|
|
|
+ <span>图片加载失败</span>
|
|
|
+ </div>
|
|
|
+ </el-image>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 部件基本信息 -->
|
|
|
+ <el-descriptions :column="2" border size="small" class="compo-info">
|
|
|
+ <el-descriptions-item label="检查频率">{{ translateFrequency(selectedCompo.inspFreq) }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="上次检查日期">{{ parseTime(selectedCompo.lastInspDate, '{y}-{m}-{d}') || '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="检查内容" :span="2">{{ selectedCompo.inspContent || '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="维修频率">{{ translateFrequency(selectedCompo.fixFreq) }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="上次维修日期">{{ parseTime(selectedCompo.lastFixDate, '{y}-{m}-{d}') || '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="维修内容" :span="2">{{ selectedCompo.fixContent || '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="更换频率">{{ translateFrequency(selectedCompo.replaceFreq) }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="上次更换日期">{{ parseTime(selectedCompo.lastReplaceDate, '{y}-{m}-{d}') || '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="更换内容" :span="2">{{ selectedCompo.replaceContent || '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="备注" :span="2">{{ selectedCompo.remarks || '-' }}</el-descriptions-item>
|
|
|
+ </el-descriptions>
|
|
|
+
|
|
|
+ <!-- 维修记录 -->
|
|
|
+ <div class="compo-maint-record-section">
|
|
|
+ <h4 class="section-title">维修记录</h4>
|
|
|
+ <el-table v-loading="compoMaintRecordLoading" :data="compoMaintRecordList" border size="small" max-height="250">
|
|
|
+ <el-table-column label="维修类型" align="center" width="80">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span v-if="scope.row.maintType === '1'">检查</span>
|
|
|
+ <span v-else-if="scope.row.maintType === '2'">维修</span>
|
|
|
+ <span v-else-if="scope.row.maintType === '3'">更换</span>
|
|
|
+ <span v-else>{{ scope.row.maintType || '-' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="责任人" align="center" width="80">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ getStaffNameById(scope.row.responsible) || '-' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="检查内容" align="center" prop="inspectContent" :show-overflow-tooltip="true"/>
|
|
|
+ <el-table-column label="检查时间" align="center" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ parseTime(scope.row.inspectTime, '{y}-{m}-{d}') || '-' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="维修内容" align="center" prop="maintContent" :show-overflow-tooltip="true"/>
|
|
|
+ <el-table-column label="维修时间" align="center" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ parseTime(scope.row.maintTime, '{y}-{m}-{d}') || '-' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div v-if="compoMaintRecordList.length === 0 && !compoMaintRecordLoading" class="no-record-tip">
|
|
|
+ 暂无维修记录
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<div v-else class="no-compo-tip">
|
|
|
<el-empty description="未找到对应的部件信息"></el-empty>
|
|
|
</div>
|
|
|
@@ -191,11 +254,18 @@ export default {
|
|
|
activeTab: 'info',
|
|
|
maintRecordList: [],
|
|
|
maintRecordLoading: false,
|
|
|
+ maintRecordTotal: 0,
|
|
|
+ maintRecordQuery: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 20
|
|
|
+ },
|
|
|
clientHeight: 0,
|
|
|
staffOptions: [],
|
|
|
// 部件详情对话框
|
|
|
compoDialogVisible: false,
|
|
|
- selectedCompo: null
|
|
|
+ selectedCompo: null,
|
|
|
+ compoMaintRecordList: [],
|
|
|
+ compoMaintRecordLoading: false
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
@@ -242,10 +312,43 @@ export default {
|
|
|
if (!compoName || !this.deviceInfo || !this.deviceInfo.compoList) {
|
|
|
return;
|
|
|
}
|
|
|
+ // 去掉 .xxx 后缀(如 "部件名.123" -> "部件名")
|
|
|
+ const cleanName = compoName.replace(/\.[^.]+$/, '');
|
|
|
// 在部件列表中查找匹配的部件
|
|
|
- const compo = this.deviceInfo.compoList.find(c => c.compoName === compoName);
|
|
|
- this.selectedCompo = compo || null;
|
|
|
+ const compo = this.deviceInfo.compoList.find(c => c.compoName === cleanName);
|
|
|
+ // 只有找到对应部件时才显示弹框
|
|
|
+ if (compo) {
|
|
|
+ this.handleCompoClick(compo);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 处理部件点击(表格或流程图)
|
|
|
+ handleCompoClick(compo) {
|
|
|
+ this.selectedCompo = compo;
|
|
|
this.compoDialogVisible = true;
|
|
|
+ // 加载该部件的维修记录
|
|
|
+ this.loadCompoMaintRecords(compo.compoName);
|
|
|
+ },
|
|
|
+
|
|
|
+ // 加载部件维修记录
|
|
|
+ async loadCompoMaintRecords(compoName) {
|
|
|
+ try {
|
|
|
+ this.compoMaintRecordLoading = true;
|
|
|
+ const response = await listRel_maint_record({
|
|
|
+ plant: this.deviceInfo?.plant,
|
|
|
+ devTag: this.deviceInfo?.devTag,
|
|
|
+ compoName: compoName,
|
|
|
+ recordStatus: '2',
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 50
|
|
|
+ });
|
|
|
+ this.compoMaintRecordList = response.rows || [];
|
|
|
+ } catch (error) {
|
|
|
+ console.error('加载部件维修记录失败:', error);
|
|
|
+ this.compoMaintRecordList = [];
|
|
|
+ } finally {
|
|
|
+ this.compoMaintRecordLoading = false;
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
// 返回上一页
|
|
|
@@ -292,12 +395,14 @@ export default {
|
|
|
try {
|
|
|
this.maintRecordLoading = true;
|
|
|
const response = await listRel_maint_record({
|
|
|
- devId: this.deviceId,
|
|
|
+ plant: this.deviceInfo?.plant,
|
|
|
+ devTag: this.deviceInfo?.devTag,
|
|
|
recordStatus: '2', // 只查询已完成的维修记录
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 1000
|
|
|
+ pageNum: this.maintRecordQuery.pageNum,
|
|
|
+ pageSize: this.maintRecordQuery.pageSize
|
|
|
});
|
|
|
this.maintRecordList = response.rows || [];
|
|
|
+ this.maintRecordTotal = response.total || 0;
|
|
|
} catch (error) {
|
|
|
console.error('加载维修记录失败:', error);
|
|
|
this.$message.error('加载维修记录失败');
|
|
|
@@ -306,6 +411,18 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ // 维修记录分页大小改变
|
|
|
+ handleMaintRecordSizeChange(val) {
|
|
|
+ this.maintRecordQuery.pageSize = val;
|
|
|
+ this.loadMaintRecords();
|
|
|
+ },
|
|
|
+
|
|
|
+ // 维修记录页码改变
|
|
|
+ handleMaintRecordCurrentChange(val) {
|
|
|
+ this.maintRecordQuery.pageNum = val;
|
|
|
+ this.loadMaintRecords();
|
|
|
+ },
|
|
|
+
|
|
|
// 获取维修状态标签类型
|
|
|
getRecordStatusTagType(status) {
|
|
|
const statusMap = {
|
|
|
@@ -406,9 +523,10 @@ export default {
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
|
- padding: 20px;
|
|
|
+ padding: 10px 20px;
|
|
|
border-bottom: 1px solid #e5e7eb;
|
|
|
- background: #f8fafc;
|
|
|
+ background: #ffffff;
|
|
|
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
|
}
|
|
|
|
|
|
.panel-header h3 {
|
|
|
@@ -430,6 +548,10 @@ export default {
|
|
|
flex-direction: column;
|
|
|
}
|
|
|
|
|
|
+.panel-tabs /deep/ .el-tabs__header {
|
|
|
+ margin-bottom: 5px;
|
|
|
+}
|
|
|
+
|
|
|
.panel-tabs /deep/ .el-tabs__content {
|
|
|
flex: 1;
|
|
|
overflow: hidden;
|
|
|
@@ -437,7 +559,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
.panel-tabs /deep/ .el-tab-pane {
|
|
|
- padding: 20px;
|
|
|
+ padding: 5px 15px;
|
|
|
}
|
|
|
|
|
|
.panel-tabs /deep/ .el-table {
|
|
|
@@ -505,4 +627,68 @@ export default {
|
|
|
font-size: 16px;
|
|
|
font-weight: 600;
|
|
|
}
|
|
|
+
|
|
|
+/* 部件详情对话框样式 */
|
|
|
+.compo-detail-dialog /deep/ .el-dialog__body {
|
|
|
+ padding: 15px 20px;
|
|
|
+ max-height: 70vh;
|
|
|
+ overflow-y: auto;
|
|
|
+}
|
|
|
+
|
|
|
+.compo-detail-content {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ gap: 15px;
|
|
|
+}
|
|
|
+
|
|
|
+.compo-photo-section {
|
|
|
+ text-align: center;
|
|
|
+ background: #f9fafb;
|
|
|
+ padding: 15px;
|
|
|
+ border-radius: 8px;
|
|
|
+}
|
|
|
+
|
|
|
+.compo-photo {
|
|
|
+ max-width: 100%;
|
|
|
+ max-height: 200px;
|
|
|
+ border-radius: 4px;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
+
|
|
|
+.image-error {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ height: 120px;
|
|
|
+ color: #909399;
|
|
|
+}
|
|
|
+
|
|
|
+.image-error i {
|
|
|
+ font-size: 36px;
|
|
|
+ margin-bottom: 8px;
|
|
|
+}
|
|
|
+
|
|
|
+.compo-info {
|
|
|
+ margin-bottom: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.compo-maint-record-section {
|
|
|
+ border-top: 1px solid #e5e7eb;
|
|
|
+ padding-top: 15px;
|
|
|
+}
|
|
|
+
|
|
|
+.section-title {
|
|
|
+ margin: 0 0 10px 0;
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: 600;
|
|
|
+ color: #1f2937;
|
|
|
+}
|
|
|
+
|
|
|
+.no-record-tip {
|
|
|
+ text-align: center;
|
|
|
+ color: #909399;
|
|
|
+ padding: 20px 0;
|
|
|
+ font-size: 14px;
|
|
|
+}
|
|
|
</style>
|