import { main, dict, loginUrl, file } from '@/api'
import request from '@/utils/require'

// 列表页
export function selectList(data) {
	return request({
		url: `${main}/client/nmrotationPlanApply/select?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
		method: 'post',
		data: data
	})
}
// 下拉状态  
export function getStatus(data) {
	return request({
		url: `${main}/client/nmrotationPlanApply/getStatus`,
		method: 'post',
		data: data
	})
}
// 通过
export function complete(data) {
	return request({
		url: `${main}/client/nmrotationPlanApply/complete?jhbm=${data.jhbm}&taskId=${data.taskId}`,
		method: 'post',
		data: {
			processId: data.processId,
			message: data.message,
			status: data.status, // 1通过, 2 驳回
			statusKey: 'status',
			userId: data.userId
		}
	})
}
// 详情
export function info(jhbm) {
	return request({
		url: `${main}/client/nmrotationPlanApply/info/${jhbm}`,
		method: 'get'
	})
}
// 储备规模
export function getReserveScale(code) {
	return request({
		url: `${main}/manager/reservePlan/selectLastestById`,
		method: 'post',
		data: { jsms: code }
	})
}
//获取仓号信息列表
export function selectTyLskcxxList(data) {
	return request({
		url: `${main}/client/integratedQuery/selectTyLskcxxList`,
		method: 'post',
		data: data
	})
}

//////////////////////////////////////

export function selectOwnList(data) {
	return request({
		url: `${main}/manager/reservePlan/selectOwnerPageByEntity?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
		method: 'post',
		data: data
	})
}
//列表页 删除
export function deleteListItem(jhbm) {
	return request({
		url: `${main}/manager/reservePlan/deleteByEntity?jhbm=${jhbm}`,
		method: 'get'
	})
}

//获取盟市 旗县 下拉数据
export function getScalePlanCityOptions(data) {
	return request({
		url: `${loginUrl}/org/findByPid?parentCode=${data.parentCode}`,
		method: 'post',
		data: data
	})
}

//详情页 保存
export function getScalePlanInsert(data) {
	return request({
		url: `${main}/manager/reservePlan/insertEntitySelective`,
		method: 'post',
		data: data
	})
}

//详情页 修改
export function getScalePlanUpdate(data) {
	return request({
		url: `${main}/manager/reservePlan/updateByEntitySelective`,
		method: 'post',
		data: data
	})
}

//详情页   下发
export function getScalePlanIssued(data) {
	return request({
		url: `${main}/manager/reservePlan/updateStatusByEntity`,
		method: 'post',
		data: data
	})
}

//详情页  获取详情
export function getScalePlanDetails(jhbm) {
	return request({
		url: `${main}/manager/reservePlan/selectById?jhbm=${jhbm}`,
		method: 'get'
	})
}

//详情页  初始化显示的数据
export function getScalePlanInitDetails(data) {
	return request({
		url: `${main}/manager/reservePlan/selectInitData`,
		method: 'post',
		data: data
	})
}

//计划制定新增  获取品种质量详情
export function getScalePlanDrawUpDetail(data) {
	return request({
		url: `${main}/foodqualitysupervision/getFoodQuality/${data.zlbm}`,
		method: 'get'
	})
}
//计划制定新增  品种质量保存
export function getScalePlanDrawUpAdd(data) {
	return request({
		url: `${main}/manager/reserveQuality/insertEntitySelective`,
		method: 'post',
		data: data
	})
}
//品种下拉框
export function findByPid(pid) {
	//alert(111);
	return request({
		url: `${dict}/dataDictionaryGroup/findByPidList/${pid}`,
		method: 'get'
	})
}
//等级下拉框
export function findByGroupId(groupId) {
	return request({
		url: `${dict}/dataDictionary/findByGroupId/${groupId}`,
		method: 'get'
	})
}
//获取质量和品质
export function getDataGroups(data) {
	return request({
		url: `${dict}/dataDictionary/getDataGroup/${data.groupId}/${data.pdictCode}`,
		method: 'get'
	})
}

//获取本单位名称
export function findByCode(orgCode) {
	return request({
		url: `${dict}/org/findByCode/${orgCode}`,
		method: 'get'
	})
}
//文件回显
export function fileInfo(data) {
	return request({
		url: `${file}/file/findByIds?ids=${data}`,
		method: 'get'
	})
}

// 粮食性质
export function foodNature() {
	return request({
		url: `${dict}/dataDictionary/findByGroupId/LSXZ`,
		method: 'get'
	})
}
