import request from '@/utils/request'
import {download} from '@/utils/request'

// 查询维保记录列表
export function listMaintenanceRecord(query) {
    return request({
        url: '/tongzhou/maintenanceRecord/maintenanceRecord/list',
        method: 'get',
        params: query
    })
}

// 查询维保记录详细
export function getMaintenanceRecord(maintenanceRecordId) {
    return request({
        url: '/tongzhou/maintenanceRecord/maintenanceRecord/' + maintenanceRecordId,
        method: 'get'
    })
}

// 新增维保记录
export function addMaintenanceRecord(data) {
    return request({
        url: '/tongzhou/maintenanceRecord/maintenanceRecord',
        method: 'post',
        data: data
    })
}

// 修改维保记录
export function updateMaintenanceRecord(data) {
    return request({
        url: '/tongzhou/maintenanceRecord/maintenanceRecord',
        method: 'put',
        data: data
    })
}

export function updateMaintenanceRecordDetails(data) {
    return request({
        url: '/tongzhou/maintenanceRecord/maintenanceRecord/updateMaintenanceRecordDetails',
        method: 'post',
        data: data
    })
}

// 删除维保记录
export function delMaintenanceRecord(maintenanceRecordId) {
    return request({
        url: '/tongzhou/maintenanceRecord/maintenanceRecord/' + maintenanceRecordId,
        method: 'delete'
    })
}

// 导出维保记录
export function downloadMaintenanceRecord(data) {
    download(
        '/tongzhou/maintenanceRecord/maintenanceRecord/export',
        data,
        `maintenanceRecord_${new Date().getTime()}.xlsx`)
}
