import request from '@/utils/request'
// 粮情检查接口

// 获取最新粮情信息
export function getNewGrainInfo(data) {
    return request({
      url: `csc-szls-business/grainConditionRecord/authority/getByRoleTime`,
      method: 'post',
      data
    })
  }

//  获取最全粮情信息
export function getAllPages(data) {
    return request({
      url: `csc-szls-business/grainConditionRecord/authority/getPage`,
      method: 'post',
      data
    })
  }

// 新增时初始化页面数据
export function getAddInfo(data) {
  return request({
    url: `csc-szls-business/grainManageDictionary/authority/getPage`,
    method: 'post',
    data
  })
}

// 新增页面保存(暂存)
export function addInfo(data) {
  return request({
    url: `csc-szls-business/grainConditionRecord/authority_button/add`,
    method: 'post',
    data
  })
}

  //查询
export function queryGrainInfo(data) {
  return request({
    url: `csc-szls-business/grainConditionRecord/authority/getPage`,
    method: 'post',
    data
  })
}



//删除
export function deleteGrainInfo(id) {
  return request({
    url: `csc-szls-business/grainConditionRecord/authority_button/deleteById/${id}`,
    method: 'delete',
    // id
  })
}

//修改
export function editGrainInfo(data) {
  return request({
    url: `csc-szls-business/grainConditionRecord/authority_button/update`,
    method: 'post',
    data
  })
}

//查看
export function checkGrainInfo(id) {
  return request({
    url: `csc-szls-business/grainConditionRecord/authority/getById/${id}`,
    method: 'get'
  })
}

//获取当前时间
export function getDateTimeNow(){
  var time = new Date();
  var day = ("0" + time.getDate()).slice(-2)
  var month = ("0" + (time.getMonth()+1)).slice(-2)

  var hour = ("0" + time.getHours()).slice(-2)
  var minute = ("0" + time.getMinutes()).slice(-2)
  var second = ("0" + time.getSeconds()).slice(-2)

  var today = time.getFullYear() + "-" + (month) + "-" + (day) + " " + (hour) + ":" + (minute) + ":" + second
  return today
}

//根据id查询(更多纪录)
/* export function getAllGrainInfo(params) {
  return request({
    url: `/grainConditionRecord/authority/getPage`,
    method: 'post',
    params
  })
} */
//根据角色和时间查询
// 新增页面获取数据
/* export function getCheckItems(params) {
  return request({
    url: `/grainManageDictionary/authority/getPage`,
    method: 'post',
    params
  })
} */
