import { h } from 'vue';
import { FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table';
import { Tag } from 'ant-design-vue';

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

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

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

export const limitationModel = {
  ch4Val: {
    alarmField: 'ch4Val',
    lowerLimit: undefined,
    upperLimit: undefined,
  },
  o2Val: {
    alarmField: 'o2Val',
    lowerLimit: undefined,
    upperLimit: undefined,
  },
  coVal: {
    alarmField: 'coVal',
    lowerLimit: undefined,
    upperLimit: undefined,
  },
  co2Val: {
    alarmField: 'co2Val',
    lowerLimit: undefined,
    upperLimit: undefined,
  },
  c2h4Val: {
    alarmField: 'c2h4Val',
    lowerLimit: undefined,
    upperLimit: undefined,
  },
  c2h2Val: {
    alarmField: 'c2h2Val',
    lowerLimit: undefined,
    upperLimit: undefined,
  },
  sourcePressure: {
    alarmField: 'sourcePressure',
    lowerLimit: undefined,
    upperLimit: undefined,
  },
  temperature: {
    alarmField: 'temperature',
    lowerLimit: undefined,
    upperLimit: undefined,
  },
};

export const schemasGoafInfo: FormSchema[] = [
  {
    field: 'id',
    label: 'ID',
    labelWidth: 118,
    component: 'Input',
    show: false,
    // colProps: { span: 12 },
  },
  {
    field: 'fireAirTemperature',
    label: '气温',
    labelWidth: 118,
    component: 'Input',
    // colProps: { span: 12 },
  },
  {
    field: 'fireWaterTemperature',
    label: '水温',
    labelWidth: 118,
    component: 'Input',
    // colProps: { span: 12 },
  },
  {
    field: 'size',
    label: '尺寸',
    labelWidth: 118,
    component: 'Input',
    // colProps: { span: 12 },
  },
  {
    field: 'material',
    label: '材质',
    labelWidth: 118,
    component: 'Input',
    // colProps: { span: 12 },
  },
  {
    field: 'strucure',
    label: '结构',
    labelWidth: 118,
    component: 'Input',
    // colProps: { span: 12 },
  },
  {
    field: 'area',
    label: '采区',
    labelWidth: 118,
    component: 'Input',
    // colProps: { span: 12 },
  },
  {
    field: 'person',
    label: '负责人',
    labelWidth: 118,
    component: 'Input',
    // colProps: { span: 12 },
  },
];

export const schemasGoafLimit: FormSchema[] = [
  {
    // 甲烷
    field: 'ch4Val',
    label: 'CH4(%)',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeGoaf',
    defaultValue: limitationModel.ch4Val,
    /** 借用 */
    groupName: '下限 - 上限',
    colProps: { span: 12 },
  },
  {
    // 氧气
    field: 'o2Val',
    label: 'O2(%)',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeGoaf',
    defaultValue: limitationModel.o2Val,
    /** 借用 */
    groupName: '下限 - 上限',
    colProps: { span: 12 },
  },
  {
    // 一氧化碳
    field: 'coVal',
    label: 'CO(ppm)',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeGoaf',
    defaultValue: limitationModel.coVal,
    /** 借用 */
    groupName: '下限 - 上限',
    colProps: { span: 12 },
  },
  {
    // 二氧化碳
    field: 'co2Val',
    label: 'CO2(%)',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeGoaf',
    defaultValue: limitationModel.co2Val,
    /** 借用 */
    groupName: '下限 - 上限',
    colProps: { span: 12 },
  },
  {
    // 乙烯
    field: 'c2h4Val',
    label: 'C2H4(ppm)',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeGoaf',
    defaultValue: limitationModel.c2h4Val,
    /** 借用 */
    groupName: '下限 - 上限',
    colProps: { span: 12 },
  },
  {
    // 乙炔
    field: 'c2h2Val',
    label: 'C2H2(ppm)',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeGoaf',
    defaultValue: limitationModel.c2h2Val,
    /** 借用 */
    groupName: '下限 - 上限',
    colProps: { span: 12 },
  },
  {
    field: 'sourcePressure',
    label: '压差(Pa)',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeGoaf',
    defaultValue: limitationModel.sourcePressure,
    /** 借用 */
    groupName: '下限 - 上限',
    colProps: { span: 12 },
  },
  {
    field: 'temperature',
    label: '温度(℃)',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeGoaf',
    defaultValue: limitationModel.temperature,
    /** 借用 */
    groupName: '下限 - 上限',
    colProps: { span: 12 },
  },
];

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

    colProps: { span: 24 },
  },
  {
    field: 'm1',
    label: '密闭墙内外压差变化风险提示模型',
    // labelWidth: 140,
    component: 'Divider',
  },
  {
    field: 'ycWarn1',
    label: '预警等级(Ⅰ):',
    labelWidth: 140,
    component: 'Input',
    slot: 'relation',
    // required: true,
  },
  {
    field: 'ycWarn2',
    label: '预警等级(Ⅱ):',
    labelWidth: 140,
    component: 'Input',
    slot: 'relation',
  },
  {
    field: 'ycWarn3',
    label: '预警等级(Ⅲ):',
    labelWidth: 140,
    component: 'Input',
    slot: 'relation',
  },
  {
    field: 'ycWarn4',
    label: '预警等级(Ⅳ):',
    labelWidth: 140,
    component: 'Input',
    slot: 'relation',
  },
  {
    field: 'm2',
    label: '密闭墙内煤自燃发火隐患分级预警模型',
    // labelWidth: 140,
    component: 'Divider',
  },
  {
    field: 'fireWarn1',
    label: '预警等级(Ⅰ):',
    suffix: '',
    labelWidth: 140,
    component: 'Input',
    slot: 'relation',
  },
  {
    field: 'fireWarn2',
    label: '预警等级(Ⅱ):',
    suffix: '',
    labelWidth: 140,
    component: 'Input',
    slot: 'relation',
  },
  {
    field: 'fireWarn3',
    label: '预警等级(Ⅲ):',
    suffix: '',
    labelWidth: 140,
    component: 'Input',
    slot: 'relation',
  },
  {
    field: 'fireWarn4',
    label: '预警等级(Ⅳ):',
    suffix: '',
    labelWidth: 140,
    component: 'Input',
    slot: 'relation',
  },
  {
    field: 'm3',
    label: '密闭墙外煤自燃发火隐患分级预警模型',
    // labelWidth: 140,
    component: 'Divider',
  },
  {
    field: 'fireOutWarn1',
    label: '预警等级(Ⅰ):',
    labelWidth: 140,
    component: 'Input',
    slot: 'relation',
  },
  {
    field: 'fireOutWarn2',
    label: '预警等级(Ⅱ):',
    labelWidth: 140,
    component: 'Input',
    slot: 'relation',
  },
  {
    field: 'fireOutWarn3',
    label: '预警等级(Ⅲ):',
    labelWidth: 140,
    component: 'Input',
    slot: 'relation',
  },
  {
    field: 'fireOutWarn4',
    label: '预警等级(Ⅳ):',
    labelWidth: 140,
    component: 'Input',
    slot: 'relation',
  },
  {
    field: 'openWarn',
    label: '火区密闭启封判定:',
    labelWidth: 140,
    component: 'Input',
    slot: 'relation',
  },
];

export const schemasCoalLimit: FormSchema[] = [
  {
    // 甲烷
    field: 'ch4Val',
    label: 'CH4(%)',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeGoaf',
    defaultValue: limitationModel.ch4Val,
    /** 借用 */
    groupName: '下限 - 上限',
    colProps: { span: 12 },
  },
  {
    // 氧气
    field: 'o2Val',
    label: 'O2(%)',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeGoaf',
    defaultValue: limitationModel.o2Val,
    /** 借用 */
    groupName: '下限 - 上限',
    colProps: { span: 12 },
  },
  {
    // 一氧化碳
    field: 'coVal',
    label: 'CO(ppm)',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeGoaf',
    defaultValue: limitationModel.coVal,
    /** 借用 */
    groupName: '下限 - 上限',
    colProps: { span: 12 },
  },
  {
    // 二氧化碳
    field: 'co2Val',
    label: 'CO2(%)',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeGoaf',
    defaultValue: limitationModel.co2Val,
    /** 借用 */
    groupName: '下限 - 上限',
    colProps: { span: 12 },
  },
  {
    // 乙烯
    field: 'c2h4Val',
    label: 'C2H4(ppm)',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeGoaf',
    defaultValue: limitationModel.c2h4Val,
    /** 借用 */
    groupName: '下限 - 上限',
    colProps: { span: 12 },
  },
  {
    // 乙炔
    field: 'c2h2Val',
    label: 'C2H2(ppm)',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeGoaf',
    defaultValue: limitationModel.c2h2Val,
    /** 借用 */
    groupName: '下限 - 上限',
    colProps: { span: 12 },
  },
  {
    field: 'sourcePressure',
    label: '压差(Pa)',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeGoaf',
    defaultValue: limitationModel.sourcePressure,
    /** 借用 */
    groupName: '下限 - 上限',
    colProps: { span: 12 },
  },
  {
    field: 'temperature',
    label: '温度(℃)',
    labelWidth: 118,
    component: 'Input',
    slot: 'InputRangeGoaf',
    defaultValue: limitationModel.temperature,
    /** 借用 */
    groupName: '下限 - 上限',
    colProps: { span: 12 },
  },
];
