|
|
|
|
@ -49,10 +49,27 @@
|
|
|
|
|
:title="`${selectedEquipmentCode} 维修记录`"
|
|
|
|
|
width="80%"
|
|
|
|
|
:before-close="handleRepairRecordsClose">
|
|
|
|
|
<!-- 故障名称筛选 -->
|
|
|
|
|
<div class="breakdown-filter-container">
|
|
|
|
|
<span class="filter-label">故障名称:</span>
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="selectedBreakdownName"
|
|
|
|
|
placeholder="全部故障"
|
|
|
|
|
clearable
|
|
|
|
|
@change="filterRecordsByBreakdownName"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="name in uniqueBreakdownNames"
|
|
|
|
|
:key="name"
|
|
|
|
|
:label="name"
|
|
|
|
|
:value="name"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-loading="repairRecordsLoading" class="repair-records-container">
|
|
|
|
|
<div v-if="selectedRepairRecords.length > 0">
|
|
|
|
|
<el-table
|
|
|
|
|
:data="selectedRepairRecords"
|
|
|
|
|
:data="filteredRepairRecords"
|
|
|
|
|
stripe
|
|
|
|
|
border
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
@ -121,7 +138,10 @@ const repairSummaryList = ref([])
|
|
|
|
|
const repairRecordsDialogVisible = ref(false)
|
|
|
|
|
const repairRecordsLoading = ref(false)
|
|
|
|
|
const selectedRepairRecords = ref([])
|
|
|
|
|
const filteredRepairRecords = ref([])
|
|
|
|
|
const selectedEquipmentCode = ref('')
|
|
|
|
|
const selectedBreakdownName = ref('')
|
|
|
|
|
const uniqueBreakdownNames = ref([])
|
|
|
|
|
|
|
|
|
|
// 监听设备类型变化
|
|
|
|
|
watch(() => props.selectedEquipmentType, (newVal, oldVal) => {
|
|
|
|
|
@ -203,19 +223,41 @@ const fetchRepairRecords = (equipmentCode) => {
|
|
|
|
|
.then(data => {
|
|
|
|
|
if (data.code === 200 && data.data) {
|
|
|
|
|
selectedRepairRecords.value = data.data
|
|
|
|
|
filteredRepairRecords.value = data.data
|
|
|
|
|
|
|
|
|
|
// 提取所有唯一的故障名称
|
|
|
|
|
const breakdownNames = [...new Set(data.data.map(record => record.breakdown_name).filter(Boolean))]
|
|
|
|
|
uniqueBreakdownNames.value = breakdownNames
|
|
|
|
|
} else {
|
|
|
|
|
selectedRepairRecords.value = []
|
|
|
|
|
filteredRepairRecords.value = []
|
|
|
|
|
uniqueBreakdownNames.value = []
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(error => {
|
|
|
|
|
console.error('维修记录API调用失败:', error)
|
|
|
|
|
selectedRepairRecords.value = []
|
|
|
|
|
filteredRepairRecords.value = []
|
|
|
|
|
uniqueBreakdownNames.value = []
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
repairRecordsLoading.value = false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 根据故障名称筛选维修记录
|
|
|
|
|
const filterRecordsByBreakdownName = () => {
|
|
|
|
|
if (!selectedBreakdownName.value) {
|
|
|
|
|
// 如果没有选择故障名称,显示所有记录
|
|
|
|
|
filteredRepairRecords.value = [...selectedRepairRecords.value]
|
|
|
|
|
} else {
|
|
|
|
|
// 根据选择的故障名称筛选
|
|
|
|
|
filteredRepairRecords.value = selectedRepairRecords.value.filter(
|
|
|
|
|
record => record.breakdown_name === selectedBreakdownName.value
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 关闭维修记录对话框
|
|
|
|
|
const handleRepairRecordsClose = () => {
|
|
|
|
|
repairRecordsDialogVisible.value = false
|
|
|
|
|
@ -286,6 +328,19 @@ const calculateRepairDuration = (applyTime, repairTime) => {
|
|
|
|
|
color: #66b1ff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 故障名称筛选区域样式 */
|
|
|
|
|
.breakdown-filter-container {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
margin-bottom: 15px;
|
|
|
|
|
padding: 0 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.filter-label {
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 维修记录对话框样式 */
|
|
|
|
|
.repair-records-container {
|
|
|
|
|
padding: 10px 0;
|
|
|
|
|
|