riku
2025-09-11 307b17ef15c73a071912a262834f2a5f68e1fa87
src/constant/radio-options.js
@@ -1,84 +1,50 @@
import { TYPE0, TYPE1, TYPE2 } from '@/constant/device-type';
import {
  option1,
  default1,
  option2,
  default2
} from '@/constant/radio-options/options';
import {
  option1 as option1Jingan,
  default1 as default1Jingan
} from '@/constant/radio-options/options-jingan';
// 监测因子单选框选项
function radioOptions(deviceType) {
  if ([TYPE0, TYPE1].includes(deviceType)) {
    return option1;
  } else if (deviceType == TYPE2) {
    return option2;
  if (import.meta.env.VITE_DATA_MODE == 'jingan') {
    if (TYPE0 == deviceType) {
      return option1Jingan;
    } else {
      return [];
    }
  } else {
    return [];
    if ([TYPE0, TYPE1].includes(deviceType)) {
      return option1;
    } else if (deviceType == TYPE2) {
      return option2;
    } else {
      return [];
    }
  }
}
const option1 = [
  {
    label: 'NO2',
    name: 'NO2',
    value: '1'
  },
  {
    label: 'CO',
    name: 'CO',
    value: '2'
  },
  {
    label: 'H2S',
    name: 'H2S',
    value: '3'
  },
  {
    label: 'SO2',
    name: 'SO2',
    value: '4'
  },
  {
    label: 'O3',
    name: 'NO2',
    value: '5'
  },
  {
    label: 'PM2.5',
    name: 'PM25',
    value: '6'
  },
  {
    label: 'PM10',
    name: 'PM10',
    value: '7'
  },
  {
    label: 'TVOC',
    name: 'VOC',
    value: '10'
function defaultOptions(deviceType) {
  if (import.meta.env.VITE_DATA_MODE == 'jingan') {
    if (TYPE0 == deviceType) {
      return default1Jingan;
    } else {
      return undefined;
    }
  } else {
    if ([TYPE0, TYPE1].includes(deviceType)) {
      return default1;
    } else if (deviceType == TYPE2) {
      return default2;
    } else {
      return undefined;
    }
  }
];
}
const option2 = [
  {
    label: '温度',
    name: '温度',
    value: '1'
  },
  {
    label: '电导率',
    name: '电导率',
    value: '2'
  },
  {
    label: '浊度',
    name: '浊度',
    value: '3'
  },
  {
    label: '溶解氧',
    name: '溶解氧',
    value: '4'
  },
  {
    label: 'PH',
    name: 'PH',
    value: '5'
  }
];
export { radioOptions };
export { radioOptions, defaultOptions };