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

// 查询备件列列表列表
export function listSparePart(query) {
    return request({
        url: '/tongzhou/sparePart/sparePart/list',
        method: 'get',
        params: query
    })
}

// 查询备件列列表详细
export function getSparePart(sparePartId) {
    return request({
        url: '/tongzhou/sparePart/sparePart/' + sparePartId,
        method: 'get'
    })
}

// 新增备件列列表
export function addSparePart(data) {
    return request({
        url: '/tongzhou/sparePart/sparePart',
        method: 'post',
        data: data
    })
}

// 修改备件列列表
export function updateSparePart(data) {
    return request({
        url: '/tongzhou/sparePart/sparePart',
        method: 'put',
        data: data
    })
}

// 删除备件列列表
export function delSparePart(sparePartId) {
    return request({
        url: '/tongzhou/sparePart/sparePart/' + sparePartId,
        method: 'delete'
    })
}

// 导出备件列列表
export function downloadSparePart(data) {
    download(
        '/tongzhou/sparePart/sparePart/export',
        data,
        `sparePart_${new Date().getTime()}.xlsx`)
}


// 验证修改密码
export function judgeSparePartEditPassword(password) {
    return request({
        url: '/tongzhou/sparePart/sparePart/judgePwd',
        method: 'get',
        params: { password }
    })
}