| | |
| | | import { TYPE0, TYPE1, TYPE2, TYPE4 } from '@/constant/device-type'; |
| | | import { |
| | | option1, |
| | | default1, |
| | | option2, |
| | | option3, |
| | | default3, |
| | | option4 |
| | | } from '@/constant/checkbox-options/options'; |
| | | import { |
| | | option1 as option1Jingan, |
| | | default1 as default1Jingan |
| | | } from '@/constant/checkbox-options/options-jingan'; |
| | | |
| | | // 监测因子单选框选项 |
| | | function checkboxOptions(deviceType) { |
| | | switch (deviceType) { |
| | | case TYPE0: |
| | | return option1; |
| | | case TYPE1: |
| | | return option3; |
| | | case TYPE2: |
| | | return option2; |
| | | case TYPE4: |
| | | return option4; |
| | | default: |
| | | return option1; |
| | | if (import.meta.env.VITE_DATA_MODE == 'jingan') { |
| | | switch (deviceType) { |
| | | case TYPE0: |
| | | return option1Jingan; |
| | | default: |
| | | return option1Jingan; |
| | | } |
| | | } else { |
| | | switch (deviceType) { |
| | | case TYPE0: |
| | | return option1; |
| | | case TYPE1: |
| | | return option3; |
| | | case TYPE2: |
| | | return option2; |
| | | case TYPE4: |
| | | return option4; |
| | | default: |
| | | return option1; |
| | | } |
| | | } |
| | | } |
| | | |
| | | 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: 'O3', |
| | | value: '5' |
| | | }, |
| | | { |
| | | label: 'PM2.5', |
| | | name: 'PM25', |
| | | value: '6' |
| | | }, |
| | | { |
| | | label: 'PM10', |
| | | name: 'PM10', |
| | | value: '7' |
| | | }, |
| | | { |
| | | label: 'TVOC', |
| | | name: 'VOC', |
| | | value: '10' |
| | | }, |
| | | |
| | | // { |
| | | // label: "NOI", |
| | | // name: "NOI", |
| | | // value: "11" |
| | | // }, |
| | | { |
| | | label: '车速', |
| | | name: 'VELOCITY', |
| | | value: '14' |
| | | }, |
| | | { |
| | | label: '风速', |
| | | name: 'WIND_SPEED', |
| | | value: '16' |
| | | }, |
| | | { |
| | | label: '风向', |
| | | name: 'WIND_DIRECTION', |
| | | value: '17' |
| | | }, |
| | | { |
| | | label: '高度', |
| | | name: 'HEIGHT', |
| | | value: '18' |
| | | function defaultOptions(deviceType) { |
| | | if (import.meta.env.VITE_DATA_MODE == 'jingan') { |
| | | switch (deviceType) { |
| | | case TYPE0: |
| | | return default1Jingan; |
| | | default: |
| | | return undefined; |
| | | } |
| | | } else { |
| | | switch (deviceType) { |
| | | case TYPE0: |
| | | return default1; |
| | | case TYPE1: |
| | | return default3; |
| | | case TYPE2: |
| | | return undefined; |
| | | case TYPE4: |
| | | return undefined; |
| | | default: |
| | | return undefined; |
| | | } |
| | | } |
| | | ]; |
| | | } |
| | | |
| | | const option2 = [ |
| | | { |
| | | label: '温度', |
| | | name: 'TMP', |
| | | value: '1' |
| | | }, |
| | | { |
| | | label: '电导率', |
| | | name: 'spC', |
| | | value: '2' |
| | | }, |
| | | { |
| | | label: '浊度', |
| | | name: 'tur', |
| | | value: '3' |
| | | }, |
| | | { |
| | | label: '溶解氧', |
| | | name: 'DO', |
| | | value: '4' |
| | | }, |
| | | { |
| | | label: 'PH', |
| | | name: 'PH', |
| | | value: '5' |
| | | /** |
| | | * 默认选项 |
| | | * @param {*} deviceType 设备类型 |
| | | * @param {*} count 默认选中个数 |
| | | * @returns |
| | | */ |
| | | function defaultFactorTypes(deviceType, count = 3) { |
| | | const defaultOpt = defaultOptions(deviceType); |
| | | if (defaultOpt) { |
| | | if (defaultOpt.length > count) { |
| | | return defaultOpt.slice(0, count); |
| | | } else { |
| | | return defaultOpt; |
| | | } |
| | | } else { |
| | | const list = checkboxOptions(deviceType); |
| | | if (list.length > count) { |
| | | return list.slice(0, count).map((v) => v.value); |
| | | } else { |
| | | return list.map((v) => v.value); |
| | | } |
| | | } |
| | | ]; |
| | | } |
| | | |
| | | const option3 = [ |
| | | { |
| | | 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: 'O3', |
| | | value: '5' |
| | | }, |
| | | { |
| | | label: 'PM2.5', |
| | | name: 'PM25', |
| | | value: '6' |
| | | }, |
| | | { |
| | | label: 'PM10', |
| | | name: 'PM10', |
| | | value: '7' |
| | | }, |
| | | { |
| | | label: 'TVOC', |
| | | name: 'VOC', |
| | | value: '10' |
| | | }, |
| | | { |
| | | label: '风速', |
| | | name: 'WIND_SPEED', |
| | | value: '16' |
| | | }, |
| | | { |
| | | label: '风向', |
| | | name: 'WIND_DIRECTION', |
| | | value: '17' |
| | | } |
| | | ]; |
| | | |
| | | const option4 = [ |
| | | { |
| | | label: 'A相电流', |
| | | name: 'EA', |
| | | value: '1' |
| | | }, |
| | | { |
| | | label: 'B相电流', |
| | | name: 'EB', |
| | | value: '2' |
| | | }, |
| | | { |
| | | label: 'C相电流', |
| | | name: 'EC', |
| | | value: '3' |
| | | } |
| | | ]; |
| | | export { checkboxOptions }; |
| | | export { checkboxOptions, defaultFactorTypes }; |