import request from '@/utils/request'
import upload from '@/utils/upload'

export function uploadImage(data) {
	return upload({
		url: '/common/upload',
		filePath: data.filePath
	})
}

// 查询质检单列表
export function listQualityBill(query) {
	return request({
		url: '/quality/qualityBill/list',
		method: 'get',
		params: query
	})
}

// 查询质检单详细
export function getQualityBill(id) {
	return request({
		url: '/quality/qualityBill/' + id,
		method: 'get'
	})
}

// 新增质检单
export function addQualityBill(data) {
	return request({
		url: '/quality/qualityBill',
		method: 'post',
		data: data
	})
}

// 修改质检单
export function updateQualityBill(data) {
	return request({
		url: '/quality/qualityBill',
		method: 'put',
		data: data
	})
}

// 删除质检单
export function delQualityBill(id) {
	return request({
		url: '/quality/qualityBill/' + id,
		method: 'delete'
	})
}

export function listQualityBillByBatchNo(batchNo) {
	return request({
		url: '/quality/qualityBill/listByBatchNo/' + batchNo,
		method: 'get',
	})
}

// 查询质检记录单列表
export function listQualityHistory(query) {
	return request({
		url: '/quality/qualityHistory/list',
		method: 'get',
		params: query
	})
}

// 查询质检记录单详细
export function getQualityHistory(id) {
	return request({
		url: '/quality/qualityHistory/' + id,
		method: 'get'
	})
}

// 新增质检记录单
export function addQualityHistory(data) {
	return request({
		url: '/quality/qualityHistory',
		method: 'post',
		data: data
	})
}

// 修改质检记录单
export function updateQualityHistory(data) {
	return request({
		url: '/quality/qualityHistory',
		method: 'put',
		data: data
	})
}

// 删除质检记录单
export function delQualityHistory(id) {
	return request({
		url: '/quality/qualityHistory/' + id,
		method: 'delete'
	})
}

// export function addQualityHistoryList(data) {
// 	return request({
// 		url: '/quality/qualityHistory/detail',
// 		method: 'post',
// 		data: data
// 	})
// }
export function addQualityHistoryList(data, detailId) {
	return request({
		url: '/quality/qualityHistory/detail',
		method: 'post',
		data: data,
		params: {
			detailId: detailId
		}
	})
}
// 查询质检标准列列表
export function listStandardList(query) {
	return request({
		url: '/quality/standardList/list',
		method: 'get',
		params: query
	})
}

// 查询质检标准列详细
export function getStandardList(id) {
	return request({
		url: '/quality/standardList/' + id,
		method: 'get'
	})
}

// 新增质检标准列
export function addStandardList(data) {
	return request({
		url: '/quality/standardList',
		method: 'post',
		data: data
	})
}

// 修改质检标准列
export function updateStandardList(data) {
	return request({
		url: '/quality/standardList',
		method: 'put',
		data: data
	})
}

// 删除质检标准列
export function delStandardList(id) {
	return request({
		url: '/quality/standardList/' + id,
		method: 'delete'
	})
}

// 查询质检标准应用列表
export function listStandardApply(query) {
	return request({
		url: '/quality/standardApply/list',
		method: 'get',
		params: query
	})
}