import {
	Base
} from '../../static/util/base.js'
class SampleDetail extends Base {
	constructor() {
		super();
	}

	getAhSampleSheetDetail(id,callBack) {
		var params = {
			url: '/ah/ahSampleSheet/'+id,
			sCallBack: function(res) {
				callBack && callBack(res.data)
			}
		}
		this.serviceRequest(params);
	}

	getSubXzqList(xzqCode,callBack){
		var params = {
			url: '/jg/tZdXzq/list',
			type: 'get',
			data: {xzqCode},
			sCallBack: function(res) {
				callBack && callBack(res)
			}
		}
		this.jgRequest(params);
	}

	getEnterPriseList(param,callBack){
		var params = {
			url: '/jg/tEnterprises/list',
			type: 'get',
			data: param,
			sCallBack: function(res) {
				callBack && callBack(res)
			}
		}
		this.jgRequest(params);
	}

	updateAhSampleSheet(param,callBack){
		const params = {
			url: '/ah/ahSampleSheet/'+param.id,
			type: 'PUT',
			data: param,
			sCallBack: function(res) {
				callBack && callBack(res)
			}
		}
		this.serviceRequest(params);
	}

	uploadCheckPhoto(param,callBack){
		const params = {
			url: '/ah/ahSampleSheet/updateSampleSheet',
			type: 'post',
			data: param,
			sCallBack: function(res) {
				callBack && callBack(res.data)
			}
		}
		this.serviceRequest(params);
	}

	publishSampleSheet(id,callBack){
		const params = {
			url: '/ah/ahSampleSheet/publishSampleSheetByCheck',
			type: 'POST',
			data: {id},
			sCallBack: function(res) {
				callBack && callBack(res.data)
			}
		}
		this.serviceRequest(params);
	}
	submitSampleSheet(id,callBack){
		const params = {
			url: '/ah/ahSampleSheet/submitSampleSheet',
			type: 'POST',
			data: {id},
			sCallBack: function(res) {
				callBack && callBack(res)
			}
		}
		this.serviceRequest(params);
	}

	createAhSampleDetail(param,callBack){
		const params = {
			url: '/ah/ahSampleDetail/create',
			type: 'post',
			data: param,
			sCallBack: function(res) {
				callBack && callBack(res.data)
			}
		}
		this.serviceRequest(params);
	}
	updateAhSampleDetail(param,callBack){
		const params = {
			url: '/ah/ahSampleDetail/'+param.id,
			type: 'put',
			data: param,
			sCallBack: function(res) {
				callBack && callBack(res)
			}
		}
		this.serviceRequest(params);
	}
	getBaseByCheckList(qydm,callBack){
		const params = {
			url: '/jg/tBase/getBaseByCheckList',
			type: 'get',
			data: {qydm},
			sCallBack: function(res) {
				callBack && callBack(res)
			}
		}
		this.jgRequest(params);
	}

	/**
	 * 查询单位列表
	 */
	getDictTypeList(callBack){
		const params = {
			url: '/ah/ahDictType/list',
			type: 'get',
			sCallBack: function(res) {
				callBack && callBack(res.data)
			}
		}
		this.serviceRequest(params);
	}
	/**
	 * 根据主体和基地查询产品列表
	 */
	getProductBatchList({qydm,baseNumber},callBack){
		const params = {
			url: '/ahjg/tProductBatch/getProductBatchList?qydm='+qydm+"&base_number="+baseNumber,
			type: 'get',
			sCallBack: function(res) {
				callBack && callBack(res)
			}
		}
		this.jgRequest(params);
	}
	//获取本抽样单下面所有样品详细信息
	getSampleSheetDetailData(data,callBack){
		const params = {
			url: '/ah/ahSampleDetail/list',
			type: 'get',
			data:data,
			sCallBack: function(res) {
				callBack && callBack(res.data)
			}
		}
		this.serviceRequest(params);
	}

	/**
	 * 删除抽样样品
	 * @param id
	 * @param callBack
	 */
	delSampleDetail(id,callBack){
		const params = {
			url: '/ah/ahSampleDetail/'+id,
			type: 'delete',
			sCallBack: function(res) {
				callBack && callBack(res)
			}
		}
		this.serviceRequest(params);
	}
	
	/**
	 * 根据企业信息获取样品列表
	*/
	getSampleByCompany(data, callBack) {
		const params = {
			url: '/ahjg/tProductBatch/getProductBatchInfo',
			type: 'get',
			data:data,
			sCallBack: function(res) {
				callBack && callBack(res)
			}
		}
		this.jgRequest(params);
	}
	
	/**
	 * 获取胶体金检测类型
	 */
	getJTJTypeList(data, callBack) {
		const params = {
			url: '/ah/ah-colloid-dictionary/list',
			type: 'get',
			data:data,
			sCallBack: function(res) {
				callBack && callBack(res)
			}
		}
		this.serviceRequest(params);
	}
	
	/**
	 * 提交胶体金检测图片
	 */
	submitJTJImage(image, callBack){
		const params = {
			url: '/ah/ah-jtj-data/uploadImage',
			type: 'POST',
			name: 'image',
			filePath: image,
			sCallBack: function(res) {
				callBack && callBack(res)
			}
		}
		this.uploadFileByServer(params);
	}
	// 保存识别结果
	saveResult(param,callBack) {
		const params = {
			url: '/ah/ah-jtj-data/add',
			type: 'post',
			data: param,
			sCallBack: function(res) {
				callBack && callBack(res)
			}
		}
		this.serviceRequest(params);
	}
	// 查询胶体金检测列表
	getJTJList(data, callBack) {
		const params = {
			url: '/ah/ah-jtj-data/list',
			type: 'get',
			data:data,
			sCallBack: function(res) {
				callBack && callBack(res)
			}
		}
		this.serviceRequest(params);
	}
	
	// 查询胶体金检测列表
	getQuickList(data, callBack) {
		const params = {
			url: '/ah-check-station-record/list',
			type: 'get',
			data:data,
			sCallBack: function(res) {
				callBack && callBack(res)
			}
		}
		this.serviceRequest(params);
	}
	// 上传图片
	uploadPhoto(filePath, callBack) {
		var params = {
			url: '/ah/fileUpload/upload',
			type: 'POST',
			name: 'file',
			filePath: filePath,
			sCallBack: function (res) {
				callBack && callBack(res.data)
			}
		}
		this.uploadFileByServer(params,false,"file");
	}

	getCyUserList(data,callBack){
		const params = {
			url:"/cmu/cmUser/getUserListByRole",
			data:data,
			sCallBack: function(res) {
				callBack && callBack(res.data)
			}
		}
		this.request(params);
	}

}

const _sampleDetail = new SampleDetail();
export {
	_sampleDetail
}