import { http } from '@/utils/http/axios'
import type { PageParam } from '/#/api'

/**
 * 获取地区列表
 * @param params
 * @returns
 */
export async function getRegionList(params: PageParam = { pageNo: 1, pageSize: 10 }): Promise<any> {
  const res = await http.request({
    url: `/ocr/ocrarea/listall`,
    method: 'get',
    params,
  })

  const { data } = res
  return data
}

/**
 * 获取图片类型列表
 * @returns
 */
export async function getPictureTypeList(): Promise<any> {
  const res = await http.request({
    url: `/ocr/ocrPicturetype/rootList`,
    method: 'get',
  })

  const { data } = res
  return data
}

/**
 * 获取提报人列表
 * @param params
 * @returns
 */
export async function getPersonList(params: PageParam = { pageNo: 1, pageSize: 10 }) {
  const res = await http.request({
    url: `/ocr/ocrUpuser/listall`,
    method: 'get',
    params,
  })

  const { data } = res
  return data
}

/**
 * 获取计划列表
 * @param params
 * @returns
 */
export async function getPlanList(params: PageParam = { pageNo: 1, pageSize: 10 }) {
  const res = await http.request({
    url: `/ocr/ocrPlan/listall`,
    method: 'get',
    params,
  })

  const { data } = res
  return data
}

/**
 * 获取图片真假原因字典
 * @returns
 */
export async function getTFList() {
  const res = await http.request({
    url: `/static/admin/web/distionary/bytypecode/imagetrueorfalse`,
    method: 'get',
  })

  const list = res.data[0].distionaryList
  return list
}

/**
 * 获取分类列表
 * @returns
 */
export async function getIzShowList(): Promise<any> {
  const res = await http.request({
    url: `/ocr/ocrPictureclass/rootList`,
    method: 'get',
  })

  const { data } = res
  return data
}

/**
 * 获取izsearch列表
 * @returns
 */
export async function getIzSearchList(): Promise<any> {
  const res = await http.request({
    url: `/ocr/ocrPictureclass/todo`,
    method: 'get',
  })

  const { data } = res
  return data
}

/**
 * 获取izsearchmanager列表
 * @returns
 */
export async function getIzsSearchManager(): Promise<any> {
  const res = await http.request({
    url: `/ocr/ocrPictureclass/todo`,
    method: 'get',
  })

  const { data } = res
  return data
}

/**
 * 获取项目列表
 * @returns
 */
export async function getIzProjectList(): Promise<any> {
  const res = await http.request({
    url: `/backstage/oa/category/listall`,
    method: 'get',
  })

  const { data } = res
  return data
}

/**
 * 获取任务来源
 * @param enabled
 * @returns
 */
export async function getIztaskrromList(enabled: string) {
  const res = await http.request({
    url: `/static/admin/web/distionary/bytypecode/IZTASKRROM`,
    method: 'get',
    params: { enabled },
  })

  const list = res.data[0].distionaryList
  return list
}

/**
 * 获取任务状态
 * @param enabled
 * @returns
 */
export async function getIztaskstatusList(enabled: string) {
  const res = await http.request({
    url: `/static/admin/web/distionary/bytypecode/IZTASKSTATUS`,
    method: 'get',
    params: { enabled },
  })

  const list = res.data[0].distionaryList
  return list
}

/**
 * 获取省份
 * @returns
 */
export async function getIzvisitproList(): Promise<any> {
  const res = await http.request({
    url: `/backstage/ocrnewtest/ocrprovince/listall`,
    method: 'get',
  })

  const { data } = res
  return data
}

/**
 * 获取厂商
 * @param enabled
 * @returns
 */
export async function getIzfirmList(enabled: string) {
  const res = await http.request({
    url: `/static/admin/web/distionary/bytypecode/IZFIRM`,
    method: 'get',
    params: { enabled },
  })

  const list = res.data[0].distionaryList
  return list
}

/**
 * 获取产品名称
 * @param enabled
 * @returns
 */
export async function getIzproductnameList(enabled: string) {
  const res = await http.request({
    url: `/static/admin/web/distionary/bytypecode/IZPRODUCTNAME`,
    method: 'get',
    params: { enabled },
  })

  const list = res.data[0].distionaryList
  return list
}

/**
 * 获取客户名称
 * @param enabled
 * @returns
 */
export async function getizcustomnameList(enabled: string) {
  const res = await http.request({
    url: `/static/admin/web/distionary/bytypecode/IZCUSTOMNAME`,
    method: 'get',
    params: { enabled },
  })

  const list = res.data[0].distionaryList
  return list
}

/**
 * 获取izcustomtype列表
 * @returns
 */
export async function getIzCustomtypeList(): Promise<any> {
  const res = await http.request({
    url: `/static/admin/web/distionary/bytypecode/IZCUSTOMTYPE`,
    method: 'get',
  })

  const list = res.data[0].distionaryList
  return list
}

/**
 * 获取客户级别
 * @param enabled
 * @returns
 */
export async function getIzcustomlevel(enabled: string) {
  const res = await http.request({
    url: `/static/admin/web/distionary/bytypecode/IZCUSTOMLEVEL`,
    method: 'get',
    params: { enabled },
  })

  const list = res.data[0].distionaryList
  return list
}

/**
 * 获取项目类别
 * @param enabled
 * @returns
 */
export async function getIzprojecttypeList(enabled: string) {
  const res = await http.request({
    url: `/static/admin/web/distionary/bytypecode/IZPROJECTTYPE`,
    method: 'get',
    params: { enabled },
  })

  const list = res.data[0].distionaryList
  return list
}

/**
 * 获取发布地区
 * @param enabled
 * @returns
 */
export async function getIzvisitcityList() {
  const res = await http.request({
    url: `/ocr/ocrarea/listall`,
    method: 'get',
  })

  const { data } = res
  return data
}
