import { ColItem } from '@/api/common'
import { elTableAlignLeft } from '@/utils/constant'
import { IDataQuery } from './api/common'

export const dataQueryCols: ColItem[] = [
  // { type: 'selection', width: '50px' },
  { type: 'index', label: '序号', width: '60px' },
  { prop: 'partitionName', label: '排水分区', minWidth: '110px', ...elTableAlignLeft() },
  { prop: 'groupName', label: '监测分组', minWidth: '110px', ...elTableAlignLeft() },
  { prop: 'siteName', label: '监测站点', minWidth: '110px', ...elTableAlignLeft() },
  { prop: 'siteAddress', label: '地址', minWidth: '170px', ...elTableAlignLeft() },
  { prop: 'collectTime', label: '数据时间', width: '170px' },
  { prop: 'checkTargetName', label: '监测指标', minWidth: '140px', ...elTableAlignLeft() },
  { prop: 'checkValue', label: '监测值', minWidth: '110px', ...elTableAlignLeft() },
  { prop: 'unit', label: '单位', width: '80px' },
  { prop: 'checkResult', label: '判定结果', minWidth: '120px' },
  {
    prop: 'thresholdScope',
    label: '监测阈值',
    minWidth: '130px',
    formatter: ({ thresholdScope }: IDataQuery) => {
      const text = String(thresholdScope || '')
        .replace('-', ' ~ ')
        .replace('~ .', '~ 0.')
      return text.startsWith('.') ? `0${text}` : text
    },
    ...elTableAlignLeft()
  },
  {
    prop: 'iscancel',
    label: '数据有效性',
    width: '100px',
    formatter: ({ iscancel }: IDataQuery) => (iscancel ? '作废' : '正常')
  }
]

export const assessmentCols: ColItem[] = [
  { type: 'index', label: '序号', width: '60px' },
  { prop: 'pipeNo', label: '管道编号', minWidth: '170px', ...elTableAlignLeft() },
  { prop: 'roadName', label: '所在道路', width: '140px', ...elTableAlignLeft() },
  { prop: 'drainageType', label: '排水类型', minWidth: '90px' },
  { prop: 'pipelineLevel', label: '管道级别', minWidth: '90px' },
  { prop: 'pipeDiameter', label: '管径(mm)', minWidth: '90px' },
  { prop: 'texture', label: '材质', minWidth: '90px' },
  { prop: 'pipeLength', label: '长度(m)', minWidth: '90px' },
  { prop: 'healthLever', label: '健康等级', minWidth: '90px' },
  { prop: 'networkBroken', label: '管网破损', minWidth: '90px' },
  { prop: 'groundwaterIntrusion', label: '地下水入侵', minWidth: '90px' },
  { prop: 'sewageStraightLine', label: '污水直排', minWidth: '90px' },
  { prop: 'rainSewageHybrid', label: '雨污混接', minWidth: '90px' }
]
