2025-07-11 12:00:00 +08:00
|
|
|
<template>
|
|
|
|
<div class="app-container">
|
|
|
|
<!-- 基本信息 -->
|
2025-07-18 18:07:31 +08:00
|
|
|
<basic-info :form="form" />
|
2025-07-11 12:00:00 +08:00
|
|
|
|
2025-07-18 18:07:31 +08:00
|
|
|
<!-- 维护记录 -->
|
|
|
|
<maintenance-record
|
|
|
|
:data="maintenanceData"
|
|
|
|
:page="maintenancePage"
|
|
|
|
@size-change="handleMaintenanceSizeChange"
|
|
|
|
@current-change="handleMaintenanceCurrentChange"
|
|
|
|
/>
|
2025-07-11 12:00:00 +08:00
|
|
|
|
2025-07-18 18:07:31 +08:00
|
|
|
<!-- 保险记录 -->
|
|
|
|
<insurance-record
|
|
|
|
:data="insuranceData"
|
|
|
|
:page="insurancePage"
|
|
|
|
:aircraft-id="Number($route.query.id)"
|
|
|
|
@size-change="handleInsuranceSizeChange"
|
|
|
|
@current-change="handleInsuranceCurrentChange"
|
|
|
|
@view="handleInsuranceView"
|
|
|
|
@edit="handleInsuranceEdit"
|
|
|
|
@delete="handleInsuranceDelete"
|
|
|
|
@refresh="loadInsuranceRecords"
|
|
|
|
/>
|
2025-07-11 12:00:00 +08:00
|
|
|
|
|
|
|
<!-- API模块入口 -->
|
2025-07-18 18:07:31 +08:00
|
|
|
<api-links @click="handleApiClick" />
|
2025-07-11 12:00:00 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2025-07-18 18:07:31 +08:00
|
|
|
import { mapGetters } from 'vuex'
|
|
|
|
import { getMaintenanceRecords, getInsuranceRecords } from '@/api/aircraft'
|
|
|
|
import BasicInfo from './components/BasicInfo'
|
|
|
|
import MaintenanceRecord from './components/MaintenanceRecord'
|
|
|
|
import InsuranceRecord from './components/InsuranceRecord'
|
|
|
|
import ApiLinks from './components/ApiLinks'
|
2025-07-11 12:00:00 +08:00
|
|
|
export default {
|
|
|
|
name: 'aircraftDetail',
|
2025-07-18 18:07:31 +08:00
|
|
|
components: {
|
|
|
|
BasicInfo,
|
|
|
|
MaintenanceRecord,
|
|
|
|
InsuranceRecord,
|
|
|
|
ApiLinks
|
|
|
|
},
|
2025-07-11 12:00:00 +08:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
form: {
|
|
|
|
name: '大疆',
|
|
|
|
model: 'T100',
|
|
|
|
type: '载人飞行',
|
|
|
|
region: '北京',
|
|
|
|
scenicArea: '白云山',
|
|
|
|
manager: '小明',
|
|
|
|
remarks: '设备状态良好',
|
2025-07-18 18:07:31 +08:00
|
|
|
imageUrls: Array(6).fill('https://axure-file.lanhuapp.com/md5__f344f816278c2a3f5164e4571c580ad9.png')
|
2025-07-11 12:00:00 +08:00
|
|
|
},
|
2025-07-18 18:07:31 +08:00
|
|
|
maintenanceData: [],
|
|
|
|
insuranceData: [],
|
2025-07-11 12:00:00 +08:00
|
|
|
maintenancePage: {
|
2025-07-18 18:07:31 +08:00
|
|
|
current: 1,
|
2025-07-11 12:00:00 +08:00
|
|
|
size: 10,
|
2025-07-18 18:07:31 +08:00
|
|
|
total: 0
|
2025-07-11 12:00:00 +08:00
|
|
|
},
|
|
|
|
insurancePage: {
|
2025-07-18 18:07:31 +08:00
|
|
|
current: 1,
|
2025-07-11 12:00:00 +08:00
|
|
|
size: 10,
|
2025-07-18 18:07:31 +08:00
|
|
|
total: 0
|
|
|
|
}
|
2025-07-11 12:00:00 +08:00
|
|
|
}
|
|
|
|
},
|
2025-07-18 18:07:31 +08:00
|
|
|
computed: {
|
|
|
|
...mapGetters([
|
|
|
|
'fileUploadApi',
|
|
|
|
'baseApi'
|
|
|
|
])
|
|
|
|
},
|
2025-07-11 12:00:00 +08:00
|
|
|
created() {
|
|
|
|
const id = this.$route.query.id
|
|
|
|
if (id) {
|
|
|
|
this.getDetail(id)
|
|
|
|
}
|
2025-07-18 18:07:31 +08:00
|
|
|
this.loadMaintenanceRecords()
|
|
|
|
this.loadInsuranceRecords()
|
2025-07-11 12:00:00 +08:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
getDetail(id) {
|
|
|
|
console.log('获取详情:', id)
|
2025-07-18 18:07:31 +08:00
|
|
|
// this.loadInsuranceRecords()
|
|
|
|
},
|
|
|
|
async loadInsuranceRecords() {
|
|
|
|
try {
|
|
|
|
const params = {
|
|
|
|
aircraftId: this.$route.query.id || 0,// 0只是暂时测试用
|
|
|
|
current: this.insurancePage.current,
|
|
|
|
size: this.insurancePage.size
|
|
|
|
}
|
|
|
|
const response = await getInsuranceRecords(params)
|
|
|
|
console.log('保险记录:', response)
|
|
|
|
this.insuranceData = response.records
|
|
|
|
this.insurancePage.total = response.total
|
|
|
|
} catch (error) {
|
|
|
|
console.error('Failed to load insurance records:', error)
|
|
|
|
this.$message.error('获取保险记录失败')
|
|
|
|
}
|
2025-07-11 12:00:00 +08:00
|
|
|
},
|
2025-07-18 18:07:31 +08:00
|
|
|
async loadMaintenanceRecords() {
|
|
|
|
try {
|
|
|
|
const params = {
|
|
|
|
aircraftId: this.$route.query.id,
|
|
|
|
current: this.maintenancePage.current,
|
|
|
|
size: this.maintenancePage.size
|
|
|
|
}
|
|
|
|
const response = await getMaintenanceRecords(params)
|
|
|
|
this.maintenanceData = response.records
|
|
|
|
this.maintenancePage.total = response.total
|
|
|
|
} catch (error) {
|
|
|
|
console.error('Failed to load maintenance records:', error)
|
|
|
|
this.$message.error('获取维护记录失败')
|
|
|
|
}
|
2025-07-11 12:00:00 +08:00
|
|
|
},
|
|
|
|
handleMaintenanceSizeChange(val) {
|
|
|
|
this.maintenancePage.size = val
|
2025-07-18 18:07:31 +08:00
|
|
|
this.loadMaintenanceRecords()
|
2025-07-11 12:00:00 +08:00
|
|
|
},
|
|
|
|
handleMaintenanceCurrentChange(val) {
|
2025-07-18 18:07:31 +08:00
|
|
|
this.maintenancePage.current = val
|
|
|
|
this.loadMaintenanceRecords()
|
2025-07-11 12:00:00 +08:00
|
|
|
},
|
|
|
|
handleInsuranceSizeChange(val) {
|
|
|
|
this.insurancePage.size = val
|
2025-07-18 18:07:31 +08:00
|
|
|
this.loadInsuranceRecords()
|
2025-07-11 12:00:00 +08:00
|
|
|
},
|
|
|
|
handleInsuranceCurrentChange(val) {
|
2025-07-18 18:07:31 +08:00
|
|
|
this.insurancePage.current = val
|
|
|
|
this.loadInsuranceRecords()
|
2025-07-11 12:00:00 +08:00
|
|
|
},
|
|
|
|
handleInsuranceView(row) {
|
|
|
|
console.log('查看保险详情:', row)
|
|
|
|
},
|
|
|
|
handleInsuranceEdit(row) {
|
2025-07-18 18:07:31 +08:00
|
|
|
this.handleAdd()
|
|
|
|
this.dialogTitle = '编辑保险'
|
|
|
|
this.form = {
|
|
|
|
name: row.name,
|
|
|
|
insuranceType: row.insuranceType,
|
|
|
|
deadlineTime: row.deadlineTime ? row.deadlineTime.split('T')[0] : '',
|
|
|
|
files: row.insuranceAttachment ? row.insuranceAttachment.map(attachment => ({
|
|
|
|
name: attachment.sourceFileName,
|
|
|
|
url: attachment.fileFullPath
|
|
|
|
})) : []
|
|
|
|
}
|
2025-07-11 12:00:00 +08:00
|
|
|
},
|
|
|
|
handleInsuranceDelete(row) {
|
|
|
|
console.log('删除保险记录:', row)
|
|
|
|
},
|
2025-07-18 18:07:31 +08:00
|
|
|
handleInsuranceSubmit(form) {
|
|
|
|
console.log('保存保险记录:', {
|
|
|
|
...form,
|
|
|
|
aircraftId: this.$route.query.id
|
|
|
|
})
|
|
|
|
this.$message.success('保存成功')
|
|
|
|
this.loadInsuranceRecords()
|
|
|
|
},
|
2025-07-11 12:00:00 +08:00
|
|
|
handleApiClick(type) {
|
|
|
|
console.log('跳转到API模块:', type)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.app-container {
|
|
|
|
padding: 0;
|
|
|
|
margin-bottom: 33px;
|
|
|
|
}
|
|
|
|
</style>
|