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

// 列表页
export function selectParentList(data) {
  return request({
    url: `${main}/manager/rotateplannm/rotatePlanMake/selectParentPageByEntity?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
    method: 'post',
    data: data
  })
}
//下载
export function downLoads(id) {
  return request({
    url: `${FileApi}/file/download?id=${id}`,
    method: 'get'
  })
}
export function selectOwnList(data) {
  return request({
    url: `${main}/manager/rotateplannm/rotatePlanMake/selectOwnerPageByEntity?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
    method: 'post',
    data: data
  })
}
export function selectCityPageByEntity(data) {
  return request({
    url: `${main}/manager/rotateplannm/rotatePlanMake/selectCityPageByEntity?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
    method: 'post',
    data: data
  })
}
export function selectCountyPageByEntity(data) {
  return request({
    url: `${main}/manager/rotateplannm/rotatePlanMake/selectCountyPageByEntity?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
    method: 'post',
    data: data
  })
}

//列表页 删除
export function deleteListItem(data) {
  return request({
    url: `${main}/manager/rotateplannm/rotatePlanMake/deleteByEntity`,
    method: 'post',
    data: data
  })
}

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

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

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

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

//详情页  获取详情
export function getScalePlanDetails(data) {
  return request({
    url: `${main}/manager/rotateplannm/rotatePlanMake/selectById`,
    method: 'post',
    data: data
  })
}

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

//计划制定新增  获取品种质量详情
export function getScalePlanDrawUpDetail(data) {
  return request({
    url: `${main}/manager/reserveQuality/selectById?lsdjbm=${data.lsdjbm}&lspzbm=${data.lspzbm}&zlbm=${data.zlbm}`,
    method: 'get'
  })
}
//计划制定新增  品种质量保存
export function getScalePlanDrawUpAdd(data) {
  return request({
    url: `${main}/manager/reserveQuality/insertEntitySelective`,
    method: 'post',
    data: data
  })
}
//品种下拉框
export function findByPid(pid) {
  //114
  return request({
    url: `${dict}/dataDictionaryGroup/findByPidList/${pid}`,
    method: 'get'
  })
}
export function foodVariety() {
  return request({
    // url: `${dict}/dataDictionary/findByPDictCode/11`,
    url: `${dict}/dataDictionary/getDataGroup?groupId=PM001&pdictCode=22`,
    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: `${loginUrl}/org/findByCode?orgCode=${orgCode}`,
    method: 'get'
  })
}
//文件回显
export function fileInfo(data) {
  return request({
    url: `${file}/file/findByIds?ids=${data}`,
    method: 'get'
  })
}

//库区列表
export function getKddmListByQyjgdm(data) {
  return request({
    url: `${main}/base-server/client/getKddmListByQyjgdm`,
    method: 'post',
    data: data
  })
}
// 库区列表
export function sinkpointList(tyshxydm) {
  return request({
    url: `${baseServer}/sinkpointList/${tyshxydm}`,
    method: 'get'
  })
}
// 仓房信息-根据库点代码获取仓房列表
export function warehouseListByKddm(kddm) {
  return request({
    url: `${baseServer}/warehouseListByKddm/${kddm}`,
    method: 'post'
  })
}
//获取仓号信息列表
export function selectTyLskcxxList(data) {
  return request({
    url: `${main}/client/integratedQuery/selectTyLskcxxList`,
    method: 'post',
    data: data
  })
}
// 根据企业名称获取企业信息
export function companyList(data) {
  return request({
    url: `${baseServer}/companyList`,
    method: 'post',
    data: data
  })
}

//计划制定新增  获取品种质量详情
export function getFoodQuality(data) {
  return request({
    url: `${main}/foodqualitysupervision/getFoodQuality/${data.zlbm}`,
    method: 'get'
  })
}
//计划制定新增  品种质量保存
export function insertFoodQuality(data) {
  return request({
    url: `${main}/foodqualitysupervision/insertFoodQuality`,
    method: 'post',
    data: data
  })
}

export function updateFoodQuality(data) {
  return request({
    url: `${main}/foodqualitysupervision/updateFoodQuality`,
    method: 'post',
    data: data
  })
}
