import request from '@/utils/request'

// 查询字典数据列表
export function listData(query) {
  return request({
    url: '/admin-api/system/dict/data/list',
    method: 'get',
    params: query
  })
}

// 查询字典数据详细
export function getData(dictCode) {
  return request({
    url: '/admin-api/system/dict/data/' + dictCode,
    method: 'get'
  })
}

// 根据字典类型查询字典数据信息
export function getDicts(dictType) {
  return request({
    url: '/admin-api/system/dict/data/type/' + dictType,
    method: 'get'
  })
}

// 新增字典数据
export function addData(data) {
  return request({
    url: '/admin-api/system/dict/data',
    method: 'post',
    data: data
  })
}

// 修改字典数据
export function updateData(data) {
  return request({
    url: '/admin-api/system/dict/data',
    method: 'put',
    data: data
  })
}

// 删除字典数据
export function delData(dictCode) {
  return request({
    url: '/admin-api/system/dict/data/' + dictCode,
    method: 'delete'
  })
}
//
export const processTypes = [
  {text: '制浆', value: 'zhijiang'}, {text: '成型', value: 'chengxing'},
  {text: '烘干', value: 'honggan'}, {text: '转移', value: 'zhuanyi'},
  {text: '加湿', value: 'jiashi'}, {text: '热压', value: 'reya'},
  {text: '切边', value: 'qiebian'}, {text: '品检', value: 'pinjian'},
  {text: '打包', value: 'dabao'}, {text: '贴标', value: 'tiebiao'},
  {text: '塑封', value: 'sufeng'}, {text: '品印', value: 'pinyin'}
]
export const groupTypes = [
  {text: '白班', value: 1}, {text: '夜班', value: 2},
  {text: '长白班', value: 3}
]
export const pipelineTypes = [
  {text: '2立方制浆', value: 'zhijiang2'}, {text: '5立方制浆', value: 'zhijiang5'}
]
export const feedingTypes = [
  {text: '领料', value: 'org'}, {text: '干废品', value: 'dry'}, {text: '湿废品', value: 'wet'}
]
export function findTextByValue(enums,value){
  const foundItem = enums.find(item => item.value === value);
  return foundItem ? foundItem.text : null;
}