import { h } from 'vue';
import { FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table';
import { Tag } from 'ant-design-vue';
import { options } from '../../monitor/mynews/XssWhiteList';

const goafAlarmOptions = [
  { value: 'ch4Val', label: '甲烷' },
  { value: 'o2Val', label: '氧气' },
  { value: 'coVal', label: '一氧化碳' },
  { value: 'co2Val', label: '二氧化碳' },
  { value: 'c2h4Val', label: '乙烯' },
  { value: 'c2h2Val', label: '乙炔' },
  { value: 'sourcePressure', label: '压差' },
  { value: 'temperature', label: '温度' },
];

/** 煤层预警参数 表格配置 */
export const columnsCoalAlarm: BasicColumn[] = [
  {
    title: '煤矿名称',
    dataIndex: 'mineName',
    width: 400,
  },
  {
    title: '煤层名称',
    dataIndex: 'coalSeamName',
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
  },
  /*  {
    title: '职务',
    dataIndex: 'post',
    width: 150,
    slots: { customRender: 'post' },
  },*/
];

/** 采空区超限 表格配置 */
export const columnsGoafLimit: BasicColumn[] = [
  {
    title: '采空区名称',
    dataIndex: 'devicePos',
    width: 400,
  },
  {
    title: '气温',
    dataIndex: 'fireAirTemperature',
  },
  {
    title: '水温',
    dataIndex: 'fireWaterTemperature',
  },
  {
    title: '状态',
    dataIndex: 'status',
    customRender({ text }) {
      return h(
        Tag,
        {
          color: text == 1 ? 'success' : 'error',
        },
        text == 1 ? '正常' : '异常'
      );
    },
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    label: '煤矿名称',
    field: 'mineCode',
    component: 'MineCascader',
    colProps: { span: 6 },
  },
];

export const schemasCoalAlarm: FormSchema[] = [
  // "mineCode": null,
  // "coalSeamId": null,
  {
    label: 'ID',
    field: 'id',
    show: false,
    component: 'Input',
  },
  {
    label: '规则名称:',
    field: 'ruleName',
    labelWidth: 118,
    component: 'Input',

    colProps: { span: 24 },
  },
  {
    field: 'm1',
    label: '密闭内外压差变化风险提示模型',
    // labelWidth: 110,
    component: 'Divider',
  },
  {
    field: 'ycWarn1',
    label: '预警等级(Ⅰ):',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeNumber',
    /** 借用 */
    groupName: '<= 绝对压差变化(%) <=',
    colProps: { span: 12 },
  },
  { field: 'ycWarn1Start', label: '', show: false, component: 'Input' },
  { field: 'ycWarn1End', label: '', show: false, component: 'Input' },
  {
    field: 'ycWarn2',
    label: '预警等级(Ⅱ):',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeNumber',
    /** 借用 */
    groupName: '<= 绝对压差变化(%) <=',
    colProps: { span: 12 },
  },
  { field: 'ycWarn2Start', label: '', show: false, component: 'Input' },
  { field: 'ycWarn2End', label: '', show: false, component: 'Input' },
  {
    field: 'ycWarn3',
    label: '预警等级(Ⅲ):',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeNumber',
    /** 借用 */
    groupName: '<= 绝对压差变化(%) <=',
    colProps: { span: 12 },
  },
  { field: 'ycWarn3Start', label: '', show: false, component: 'Input' },
  { field: 'ycWarn3End', label: '', show: false, component: 'Input' },
  {
    field: 'ycWarn4',
    label: '预警等级(Ⅳ):',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputGreaterNumber',
    /** 借用 */
    groupName: '  绝对压差变化(%) <=',
    colProps: { span: 12 },
  },
  // { field: 'ycWarn4', label: '', show: false, component: 'Input' },
  {
    field: 'm2',
    label: '煤自然发火隐患分级预警模型',
    // labelWidth: 110,
    component: 'Divider',
  },
  {
    field: 'fireWarn1CoRzl',
    label: '预警等级(Ⅰ):',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputGreaterNumber',
    /** 借用 */
    groupName: '  CO日增率(%) <=',
    colProps: { span: 12 },
  },
  // { field: 'fireWarn1CoRzl', label: '', show: false, component: 'Input' },
  {
    field: 'fireWarn1CoZf',
    label: ' ',
    suffix: '',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputGreaterNumber',
    /** 借用 */
    groupName: '  CO增幅(μ) <=',
    colProps: { span: 12 },
  },
  // { field: 'fireWarn1CoZf', label: '', show: false, component: 'Input' },
  {
    field: 'fireWarn1CoNd',
    label: ' ',
    suffix: '',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputGreaterNumber',
    /** 借用 */
    groupName: '  CO浓度(ppm) <=',
    colProps: { span: 12 },
  },
  // { field: 'fireWarn1CoNd', label: '', show: false, component: 'Input' },
  {
    field: 'fireWarn1O2',
    label: ' ',
    suffix: '',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputGreaterNumber',
    /** 借用 */
    groupName: '  O2(%) <=',
    colProps: { span: 12 },
  },
  // { field: 'fireWarn1O2', label: '', show: false, component: 'Input' },
  {
    field: 'fireWarn1T',
    label: ' ',
    suffix: '',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputGreaterNumber',
    /** 借用 */
    groupName: '  T-μT(℃) <',
    colProps: { span: 12 },
  },
  // { field: 'fireWarn1T', label: '', show: false, component: 'Input' },
  {
    field: 'fireWarn1Co2',
    label: ' ',
    suffix: '',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputGreaterNumber',
    /** 借用 */
    groupName: '  CO2(%) <=',
    colProps: { span: 12 },
  },
  // { field: 'fireWarn1Co2', label: '', show: false, component: 'Input' },
  {
    field: 'fireWarn2CoRzl',
    label: '预警等级(Ⅱ):',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeNumber',
    /** 借用 */
    groupName: '< CO日增率(%) <=',
    colProps: { span: 12 },
  },
  { field: 'fireWarn2CoRzlStart', label: '', show: false, component: 'Input' },
  { field: 'fireWarn2CoRzlEnd', label: '', show: false, component: 'Input' },
  {
    field: 'fireWarn2CoZf',
    label: ' ',
    suffix: '',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeNumber',
    /** 借用 */
    groupName: '< CO增幅(μ) <=',
    colProps: { span: 12 },
  },
  { field: 'fireWarn2CoZfStart', label: '', show: false, component: 'Input' },
  { field: 'fireWarn2CoZfEnd', label: '', show: false, component: 'Input' },
  {
    field: 'fireWarn2CoNd',
    label: ' ',
    suffix: '',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeNumber',
    /** 借用 */
    groupName: '< CO浓度(ppm) <=',
    colProps: { span: 12 },
  },
  { field: 'fireWarn2CoNdStart', label: '', show: false, component: 'Input' },
  { field: 'fireWarn2CoNdEnd', label: '', show: false, component: 'Input' },
  {
    field: 'fireWarn2T',
    label: ' ',
    suffix: '',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeNumber',
    /** 借用 */
    groupName: '<= T-μT(℃) <=',
    colProps: { span: 12 },
  },
  { field: 'fireWarn2TStart', label: '', show: false, component: 'Input' },
  { field: 'fireWarn2TEnd', label: '', show: false, component: 'Input' },
  {
    field: 'fireWarn2Co2',
    label: ' ',
    suffix: '',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputGreaterNumber',
    /** 借用 */
    groupName: '  CO2(%) <',
    colProps: { span: 12, style: 'margin-right: 1px' },
  },
  {
    field: 'fireWarn3CoRzl',
    label: '预警等级(Ⅲ):',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeNumber',
    /** 借用 */
    groupName: '< CO日增率(%) <=',
    colProps: { span: 12 },
  },
  { field: 'fireWarn3CoRzlStart', label: '', show: false, component: 'Input' },
  { field: 'fireWarn3CoRzlEnd', label: '', show: false, component: 'Input' },
  {
    field: 'fireWarn3CoZf',
    label: ' ',
    suffix: '',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeNumber',
    /** 借用 */
    groupName: '< CO增幅(μ) <=',
    colProps: { span: 12 },
  },
  { field: 'fireWarn3CoZfStart', label: '', show: false, component: 'Input' },
  { field: 'fireWarn3CoZfEnd', label: '', show: false, component: 'Input' },
  {
    field: 'fireWarn3CoNd',
    label: ' ',
    suffix: '',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeNumber',
    /** 借用 */
    groupName: '<= CO浓度(ppm) <=',
    colProps: { span: 12 },
  },
  { field: 'fireWarn3CoNdStart', label: '', show: false, component: 'Input' },
  { field: 'fireWarn3CoNdEnd', label: '', show: false, component: 'Input' },
  {
    field: 'fireWarn3T',
    label: ' ',
    suffix: '',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeNumber',
    /** 借用 */
    groupName: '< T-μT(℃) <=',
    colProps: { span: 12 },
  },
  { field: 'fireWarn3TStart', label: '', show: false, component: 'Input' },
  { field: 'fireWarn3TEnd', label: '', show: false, component: 'Input' },
  {
    field: 'fireWarn3Co2',
    label: ' ',
    suffix: '',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputGreaterNumber',
    /** 借用 */
    groupName: '  CO2(%) <',
    colProps: { span: 12, style: 'margin-right: 1px' },
  },
  {
    field: 'fireWarn4CoRzl',
    label: '预警等级(Ⅳ):',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputLowerNumber',
    /** 借用 */
    groupName: '< CO日增率(%)  ',
    colProps: { span: 12 },
  },
  // { field: 'fireWarn4CoRzl', label: '', show: false, component: 'Input' },
  {
    field: 'fireWarn4CoZf',
    label: ' ',
    suffix: '',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputLowerNumber',
    /** 借用 */
    groupName: '< CO增幅(μ)  ',
    colProps: { span: 12 },
  },
  // { field: 'fireWarn4CoZf', label: '', show: false, component: 'Input' },
  {
    field: 'fireWarn4CoNd',
    label: ' ',
    suffix: '',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputLowerNumber',
    /** 借用 */
    groupName: '< CO浓度(ppm)  ',
    colProps: { span: 12 },
  },
  // { field: 'fireWarn4CoNd', label: '', show: false, component: 'Input' },
  {
    field: 'fireWarn4T',
    label: ' ',
    suffix: '',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputLowerNumber',
    /** 借用 */
    groupName: '< T-μT(℃)  ',
    colProps: { span: 12 },
  },
  // { field: 'fireWarn4T', label: '', show: false, component: 'Input' },
  {
    field: 'fireWarn4Co2',
    label: ' ',
    suffix: '',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputLowerNumber',
    /** 借用 */
    groupName: '<= CO2(%)  ',
    colProps: { span: 12 },
  },
  {
    field: 'm3',
    label: '火区密闭启封判定模型',
    // labelWidth: 110,
    component: 'Divider',
  },
  // { field: 'ycWarn4', label: '', show: false, component: 'Input' },
  {
    field: 'openWarn1',
    label: '预警等级(Ⅰ):',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputGreaterNumber',
    /** 借用 */
    groupName: '  空气温度(℃) <',
    colProps: { span: 12 },
  },
  {
    field: 'openWarn2',
    label: '预警等级(Ⅱ):',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputGreaterNumber',
    /** 借用 */
    groupName: '  氧气浓度(%) <',
    colProps: { span: 12 },
  },
  {
    field: 'openWarn3',
    label: '预警等级(Ⅲ):',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputGreaterNumber',
    /** 借用 */
    groupName: '  不含甲烷、乙烯、CO浓度(%) <',
    colProps: { span: 12 },
  },
  {
    field: 'openWarn4',
    label: '预警等级(Ⅳ):',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputGreaterNumber',
    /** 借用 */
    groupName: '  出水温度(℃) <',
    colProps: { span: 12 },
  },
  {
    field: 'openWarn5',
    label: '预警等级(Ⅴ):',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputLowerNumber',
    /** 借用 */
    groupName: '< 指标稳定时长(天)  ',
    colProps: { span: 12 },
  },
];
export const schemasGoafLimit: FormSchema[] = [
  {
    label: 'ID',
    field: 'id',
    show: false,
    component: 'Input',
  },
  {
    label: '监测值:',
    field: 'alarmField',
    component: 'Select',
    componentProps: {
      options: goafAlarmOptions,
    },
  },
  {
    label: '下限值:',
    field: 'lowerLimit',
    component: 'InputNumber',
  },
  {
    label: '上限值:',
    field: 'upperLimit',
    component: 'InputNumber',
  },
];
