import request from '@/config/axios'
import { pa } from 'element-plus/es/locale'

// shp名 VO
export interface GisNameVO {
  shpName: string // 图层名
  description: string // 描述
  id: number // 序号
  shpType: number // shp类型数据标识，0表示用户上传，1表示系统配置
  showitem: string // 需要显示为文本的字段
  symbolizeModel: string // 符号化模型
  textDisplay: string // 文本显示
}

// shp名 API
export const GisNameApi = {
  // 查询shp名分页
  getGisNamePage: async (params: any) => {
    return await request.get({ url: `/layer/gis-name/page`, params })
  },

  // 查询shp名详情
  getGisName: async (id: number) => {
    return await request.get({ url: `/layer/gis-name/get?id=` + id })
  },

  // 新增shp名
  createGisName: async (data: GisNameVO) => {
    return await request.post({ url: `/layer/gis-name/create`, data })
  },

  // 修改shp名
  updateGisName: async (data: GisNameVO) => {
    return await request.put({ url: `/layer/gis-name/update`, data })
  },

  // 删除shp名
  deleteGisName: async (id: number) => {
    return await request.delete({ url: `/layer/gis-name/delete?id=` + id })
  },

  // 导出shp名 Excel
  exportGisName: async (params) => {
    return await request.download({ url: `/layer/gis-name/export-excel`, params })
  },

  // getSimpleGisNameList: async () => {
  //   return await request.get({ url: '/layer/gis-name/simple-list' })
  // }
}

// // 查询图层（精简)列表
  export const getSimpleGisNameList = async (): Promise<GisNameVO[]>  => {
  return await request.get({ url: '/layer/gis-name/simple-list' })
}

export const getgisAttr = async (shpName): Promise<GisNameVO[]>  => {
  return await request.get({ url: '/layer/ltygis/getgisAttr?tableName='+shpName ,ltyNotent:true})
}
