import request from '@/utils/request'

// 查询维修工单列表
export function listRepairOrder(query) {
    return request({
        url: '/repairOrder/repairOrder/list',
        method: 'get',
        params: query
    })
}

// 查询维修工单详细
export function getRepairOrder(id) {
    return request({
        url: '/repairOrder/repairOrder/' + id,
        method: 'get'
    })
}

// 新增维修工单
export function addRepairOrder(data) {
    return request({
        url: '/repairOrder/repairOrder',
        method: 'post',
        data: data
    })
}

// 修改维修工单
export function updateRepairOrder(data) {
    return request({
        url: '/repairOrder/repairOrder',
        method: 'put',
        data: data
    })
}

// 删除维修工单
export function delRepairOrder(id) {
    return request({
        url: '/repairOrder/repairOrder/' + id,
        method: 'delete'
    })
}

// 导出维修工单
export function exportRepairOrder(query) {
    return request({
        url: '/repairOrder/repairOrder/export',
        method: 'get',
        params: query
    })
}

// 删除文件
export function deleteFile(filePath) {
    return request({
        url: '/common/deleteFile',
        method: 'post',
        data: { filePath }
    })
}

// 获取工单统计数据
export function getRepairOrderStatistics(isMe) {
    return request({
        url: '/repairOrder/repairOrder/statistics' + (isMe ? '?isMe=true' : ''),
        method: 'get'
    })
}

// 获取工单操作日志
export function getRepairOrderLogs(orderId) {
    return request({
        url: '/repairOrder/repairOrder/logs/' + orderId,
        method: 'get'
    })
}

// 生成工单编号
export function generateOrderNo() {
    return request({
        url: '/repairOrder/repairOrder/generateOrderNo',
        method: 'get'
    })
}
