diff --git a/src/views/equipement/standard/book/components/dataAnalysis.vue b/src/views/equipement/standard/book/components/dataAnalysis.vue index b9c89b1..fa0dd1b 100644 --- a/src/views/equipement/standard/book/components/dataAnalysis.vue +++ b/src/views/equipement/standard/book/components/dataAnalysis.vue @@ -48,12 +48,18 @@ 1: 'checkItemDataCalibratorList', // 多功能校准源 2: 'checkItemDataDcPowerList', // 直流稳压电源 3: 'checkItemDataElectricalSafetyList', // 多功能电气安全 - 4: 'checkItemDataPistonGaugeList', // 0.02活塞 xxxxxxx + 4: 'checkItemDataPistonGaugeList', // 0.02活塞 5: 'checkItemDataResistanceThermometerList', // 二等铂 8: 'checkItemDataETwoList', // E2等砝码 + 9: 'checkItemDataSpectrumAnalyzerList', // 频谱分析仪 + 10: 'checkItemDataSignalGeneratorList', // 信号发生器 11: 'checkItemDataMicrowaveAttenuationList', // 微博衰减 + 12: 'checkItemDataFrequencyStabilityList', // 短稳 + 13: 'checkItemDataOscilloscopeList', // 示波器 + 14: 'checkItemDataCesiumAtomList', // 铯原子 15: 'checkItemDataLowerPowerList', // 小功率 16: 'checkItemDataLowFrequencySignalList', // 低频信号源 + 17: 'checkItemDataSParamList', // S参数 18: 'checkItemDataDistortionFactorList', // 失真度 }) const fetchData = async () => { @@ -73,7 +79,7 @@ deviceList.value = res.data.rows // 设置默认选中 if (deviceList.value.length) { - listQuery.value.id = deviceList.value[0].id + listQuery.value.id = deviceList.value[1].id } else { loading.value = false @@ -103,6 +109,13 @@ if (newVal) { const data = deviceList.value.filter((item: any) => item.id === newVal)[0] || {} console.log(data, '选中的设备') + if (standardCode.value === '4') { + TypeList.value = uniqueArray(deviceList.value.filter((item: any) => item.id === newVal).map((item: any) => item.itemCategoryName)) + if (isFirst.value) { + listQuery.value.type = TypeList.value[0] + } + return + } // 获取配置项 getCheckItemDetail({ equipmentId: data.id, // 设备id @@ -124,6 +137,9 @@ if (standardCode.value === '11') { data = data.map((item: any) => ({ ...item, params: item.gearType })) } + if (standardCode.value === '12') { + data = data.map((item: any) => ({ ...item, params: item.checkSystem })) + } allConfigData.value = JSON.parse(JSON.stringify(data)) configList.value = uniqueArray(data.map((item: any) => item.params)) @@ -132,9 +148,9 @@ listQuery.value.config = 'E2核查' configList.value[0] = 'E2核查' } - if (standardCode.value === '15' || standardCode.value === '18') { - listQuery.value.config = configList.value[0] - } + // if (standardCode.value === '15' || standardCode.value === '18' || standardCode.value === '14') { + // listQuery.value.config = configList.value[0] + // } if (standardCode.value === '1') { TypeList.value = uniqueArray(allConfigData.value.map((item: any) => item.testType)) if (isFirst.value) { @@ -157,6 +173,40 @@ configList.value = [] ponitList.value = [] if (newVal) { + if (standardCode.value === '4') { + const data = deviceList.value.filter((item: any) => item.id === listQuery.value.id && item.itemCategoryName === newVal)[0] + getCheckItemDetail({ + equipmentId: listQuery.value.id, // 设备id + belongStandardEquipment: standardMap.value[$route.query.standardName as string], // 检校标准装置code + itemCategoryId: data.itemCategoryId, // 核查项分类id + itemCategoryName: data.itemCategoryName, // 核查项分类名称 + }).then((res) => { + if (newVal === '压力值') { + ponitList.value = uniqueArray(res.data.checkItemDataPistonGaugeList.map((item: any) => `${item.checkPoint}${item.unit}`)) + if (isFirst.value) { + listQuery.value.ponit = ponitList.value + loading.value = !!ponitList.value.length + dateRange.value = [dayjs().subtract(7, 'day').format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')] + listQuery.value.startTime = dayjs().subtract(7, 'day').format('YYYY-MM-DD') + listQuery.value.endTime = dayjs().format('YYYY-MM-DD') + searchList() + setTimeout(() => { + isFirst.value = false + }, 2000) + } + } + else { + allConfigData.value = res.data.checkItemDataPistonGaugeList + configList.value = uniqueArray(res.data.checkItemDataPistonGaugeList.map((item: any) => item.checkItem === '1' ? '直流电压测量误差' : '直流电流测量误差')) + if (isFirst.value) { + listQuery.value.config = configList.value[0] + loading.value = !!configList.value.length + } + } + }) + + return + } const data = allConfigData.value.filter((item: any) => item.testType === newVal) configList.value = uniqueArray(data.map((item: any) => item.params)) // 设置默认选中 @@ -177,9 +227,9 @@ data = allConfigData.value.filter((item: any) => item.params === newVal && item.testType === listQuery.value.type) } console.log(data, '第三下拉框') - let attribute = {} as { [key: string]: any } - let unit = {} as { [key: string]: any } - if (standardCode.value === '16' || standardCode.value === '2' || standardCode.value === '5' || standardCode.value === '4' || standardCode.value === '3' || standardCode.value === '8' || standardCode.value === '15' || standardCode.value === '1' || standardCode.value === '18' || standardCode.value === '11') { + if (standardCode.value === '16' || standardCode.value === '2' || standardCode.value === '5' || standardCode.value === '3' || standardCode.value === '8' || standardCode.value === '15' || standardCode.value === '1' || standardCode.value === '18' || standardCode.value === '11' || standardCode.value === '10' || standardCode.value === '9' || standardCode.value === '14' || standardCode.value === '13' || standardCode.value === '12' || standardCode.value === '17') { + let attribute = {} as { [key: string]: any } + let unit = {} as { [key: string]: any } attribute = { // 多功能校准源 1: { @@ -213,11 +263,50 @@ 8: { E2核查: 'checkPoint', }, + // 频谱分析仪 + 9: { + 频率: 'checkPoint', + 功率: 'checkPoint', + 相对电平: 'checkPoint', + }, + // 信号发生器 + 10: { + 频率: 'checkPoint', + 功率: 'checkPoint', + 相对电平: 'checkPoint', + 调幅度: 'checkPoint', + 调频频偏: 'checkPoint', + 调相相偏: 'checkPoint', + 谐波: 'checkPoint', + }, // 微博衰减 11: { '1dB档位': 'frequency', '10dB档位': 'frequency', }, + // 短稳 + 12: { + '双混频时差法-5110/5120': 'outputFrequency', + '差拍法-10830': 'outputFrequency', + '双混频时差法-BM1308-15': 'outputFrequency', + }, + // 示波器 + 13: { + '时标': 'checkPoint', + '方波电压(50Ω)': 'checkPoint', + '方波电压(1MΩ)': 'checkPoint', + '直流电压(50Ω)': 'checkPoint', + '直流电压(1MΩ)': 'checkPoint', + '输入阻抗': 'checkPoint', + '稳幅正弦信号电压平坦度': 'checkPoint', + '上升时间': 'checkPoint', + }, + // 铯原子 + 14: { + 铯原子频标核查: 'checkMethod', + 函数信号发生器核查: 'checkPoint', + 信号源核查: 'checkMethod', + }, // 小功率 15: { 校准因子: 'frequency', @@ -231,6 +320,12 @@ 平坦度: 'frequency', 失真: 'frequency', }, + // S参数 + 17: { + 失配测量: 'typeValue', + 衰减测量: 'typeValue', + 相移测量: 'typeValue', + }, // 失真度 18: { 失真度: 'frequency', @@ -269,11 +364,50 @@ 8: { E2核查: '', }, + // 频谱分析仪 + 9: { + 频率: 'unit', + 功率: 'unit', + 相对电平: 'unit', + }, + // 信号发生器 + 10: { + 频率: 'unit', + 功率: 'unit', + 相对电平: 'unit', + 调幅度: 'unit', + 调频频偏: 'unit', + 调相相偏: 'unit', + 谐波: 'unit', + }, // 微博衰减 11: { '1dB档位': 'frequencyUnit', '10dB档位': 'frequencyUnit', }, + // 短稳 + 12: { + '双混频时差法-5110/5120': 'outputFrequencyUnit', + '差拍法-10830': 'outputFrequencyUnit', + '双混频时差法-BM1308-15': 'outputFrequencyUnit', + }, + // 示波器 + 13: { + '时标': 'unit', + '方波电压(50Ω)': 'unit', + '方波电压(1MΩ)': 'unit', + '直流电压(50Ω)': 'unit', + '直流电压(1MΩ)': 'unit', + '输入阻抗': 'unit', + '稳幅正弦信号电压平坦度': 'unit', + '上升时间': 'unit', + }, + // 铯原子 + 14: { + 铯原子频标核查: '', + 函数信号发生器核查: 'unit', + 信号源核查: 'unit', + }, // 小功率 15: { 校准因子: 'frequencyUnit', @@ -287,16 +421,28 @@ 平坦度: 'frequencyUnit', 失真: 'frequencyUnit', }, + // S参数 + 17: { + 失配测量: '', + 衰减测量: '', + 相移测量: '', + }, // 失真度 18: { 失真度: 'frequencyUnit', }, } + ponitList.value = uniqueArray(data.filter(item => item[attribute[standardMap.value[$route.query.standardName as string]][newVal]]).map((item: any) => (item[attribute[standardMap.value[$route.query.standardName as string]][newVal]] + (item[unit[standardMap.value[$route.query.standardName as string]][newVal]] || ' ')))) } - ponitList.value = uniqueArray(data.filter(item => item[attribute[standardMap.value[$route.query.standardName as string]][newVal]]).map((item: any) => (item[attribute[standardMap.value[$route.query.standardName as string]][newVal]] + (item[unit[standardMap.value[$route.query.standardName as string]][newVal]] || ' ')))) + else if (standardCode.value === '4') { + const data = allConfigData.value.filter((item: any) => item.checkItem === (newVal === '直流电压测量误差' ? '1' : '2')) + console.log(allConfigData.value, 'allConfigData.value') + ponitList.value = uniqueArray(data.map((item: any) => `${item.checkPoint}${item.unit}`)) + } + // 设置默认选中 if (isFirst.value) { - if (standardCode.value === '18' || standardCode.value === '11') { + if (standardCode.value === '18' || standardCode.value === '11' || standardCode.value === '10' || standardCode.value === '9' || standardCode.value === '14' || standardCode.value === '12' || standardCode.value === '17') { listQuery.value.ponit = ponitList.value[0] } else { @@ -306,7 +452,7 @@ dateRange.value = [dayjs().subtract(7, 'day').format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')] listQuery.value.startTime = dayjs().subtract(7, 'day').format('YYYY-MM-DD') listQuery.value.endTime = dayjs().format('YYYY-MM-DD') - if (standardCode.value === '18' || standardCode.value === '11') { + if (standardCode.value === '18' || standardCode.value === '11' || standardCode.value === '10' || standardCode.value === '9' || standardCode.value === '14' || standardCode.value === '12' || standardCode.value === '17') { return } searchList() @@ -323,10 +469,75 @@ nominalList.value = uniqueArray(data.map(item => `${item.nominalValue}%`)) } else if (standardCode.value === '11') { - console.log(newVal, 'newValnewValnewVal') const data = allConfigData.value.filter((item: any) => `${item.frequency}${item.frequencyUnit}` === newVal) nominalList.value = uniqueArray(data.map(item => `${item.attenuationAmount}${item.attenuationAmountUnit}`)) - console.log(nominalList.value, 'nominalList.valuenominalList.valuenominalList.value') + } + else if (standardCode.value === '10') { + const data = allConfigData.value.filter((item: any) => `${item.checkPoint}${item.unit}` === newVal && item.params === listQuery.value.config) + if (listQuery.value.config === '频率' || listQuery.value.config === '谐波') { + nominalList.value = ['/'] + } + else if (listQuery.value.config === '功率') { + nominalList.value = uniqueArray(data.map(item => `${item.power}${item.powerUnit}`)) + } + else if (listQuery.value.config === '相对电平') { + nominalList.value = uniqueArray(data.map(item => `${item.relativeLevel}${item.relativeLevelUnit}`)) + } + else if (listQuery.value.config === '调幅度') { + nominalList.value = uniqueArray(data.map(item => `${item.modulation}${item.relativeLevelUnit}`)) + } + else if (listQuery.value.config === '调频频偏') { + nominalList.value = uniqueArray(data.map(item => `${item.frequencyDeviation}${item.frequencyDeviationUnit}`)) + } + else if (listQuery.value.config === '调相相偏') { + nominalList.value = uniqueArray(data.map(item => `${item.phaseDeviation}${item.phaseDeviationUnit}`)) + } + } + else if (standardCode.value === '9') { + const data = allConfigData.value.filter((item: any) => `${item.checkPoint}${item.unit}` === newVal && item.params === listQuery.value.config) + if (listQuery.value.config === '频率') { + nominalList.value = ['/'] + } + else if (listQuery.value.config === '功率') { + nominalList.value = uniqueArray(data.map(item => `${item.power}${item.powerUnit}`)) + } + else if (listQuery.value.config === '相对电平') { + nominalList.value = uniqueArray(data.map(item => `${item.relativeLevel}${item.relativeLevelUnit}`)) + } + } + else if (standardCode.value === '14') { + const data = allConfigData.value.filter((item: any) => item.params === listQuery.value.config) + if (listQuery.value.config === '铯原子频标核查') { + nominalList.value = uniqueArray(data.filter((item: any) => `${item.checkMethod}` === newVal.trim()).map((item: any) => `${item.checkPoint}${item.unit}`)) + } + else if (listQuery.value.config === '函数信号发生器核查') { + nominalList.value = uniqueArray(data.filter((item: any) => `${item.checkPoint}${item.unit}` === newVal).map((item: any) => `${item.electricalLevel}${item.electricalLevelUnit}`)) + } + else if (listQuery.value.config === '信号源核查') { + nominalList.value = uniqueArray(data.filter((item: any) => `${item.checkPoint}${item.unit}` === newVal).map((item: any) => `${item.electricalLevel}${item.electricalLevelUnit}`)) + } + } + + else if (standardCode.value === '12') { + const data = allConfigData.value.filter((item: any) => item.params === listQuery.value.config) + nominalList.value = uniqueArray(data.filter((item: any) => `${item.outputFrequency}${item.outputFrequencyUnit}` === newVal).map((item: any) => `${item.testedFrequency}${item.testedFrequencyUnit}`)) + if (isFirst.value) { + listQuery.value.nominal = nominalList.value[0] + } + return + } + else if (standardCode.value === '17') { + const data = allConfigData.value.filter((item: any) => item.params === listQuery.value.config) + if (listQuery.value.config === '失配测量') { + nominalList.value = uniqueArray(data.filter((item: any) => `${item.typeValue}` === newVal.trim()).map((item: any) => item.vswr)) + } + else { + nominalList.value = uniqueArray(data.filter((item: any) => `${item.typeValue}` === newVal.trim()).map((item: any) => `${item.frequency}${item.frequencyUnit}`)) + } + if (isFirst.value) { + listQuery.value.nominal = nominalList.value[0] + } + return } // 设置默认选中 if (isFirst.value) { @@ -339,6 +550,58 @@ } } }) + +const type = ref() +const type13List = ref([]) +watch(() => listQuery.value.config, (newVal) => { + if (newVal === '稳幅正弦信号电压平坦度') { + const data = uniqueArray(allConfigData.value.filter((item: any) => item.params === '稳幅正弦信号电压平坦度').map(item => item.typeValue)) + type13List.value = data + } +}) +watch(() => type.value, (newVal) => { + listQuery.value.ponit = [] + nominalList.ponitList = [] + if (newVal) { + ponitList.value = uniqueArray(allConfigData.value.filter((item: any) => item.params === '稳幅正弦信号电压平坦度' && item.typeValue === newVal).map(item => `${item.checkPoint}${item.unit}`)) + } +}) +const nominal = ref() +const nominal12List = ref([]) +watch(() => listQuery.value.nominal, (newVal) => { + nominal.value = '' + nominal12List.value = [] + if (newVal) { + if (standardCode.value === '12') { + const data = allConfigData.value.filter((item: any) => item.params === listQuery.value.config && `${item.outputFrequency}${item.outputFrequencyUnit}` === listQuery.value.ponit && `${item.testedFrequency}${item.testedFrequencyUnit}` === newVal) + nominal12List.value = uniqueArray(data.map((item: any) => `${item.sampleTime}${item.sampleTimeUnit}`)) + } + else if (standardCode.value === '17') { + if (listQuery.value.config === '失配测量') { + const data = allConfigData.value.filter((item: any) => item.params === listQuery.value.config && item.typeValue.trim() === listQuery.value.ponit.trim() && item.vswr === newVal) + nominal12List.value = uniqueArray(data.map((item: any) => `${item.frequency}${item.frequencyUnit}`)) + } + else if (listQuery.value.config === '衰减测量') { + const data = allConfigData.value.filter((item: any) => item.params === listQuery.value.config && item.typeValue.trim() === listQuery.value.ponit.trim() && `${item.frequency}${item.frequencyUnit}` === newVal) + nominal12List.value = uniqueArray(data.map((item: any) => `${item.amplitude}${item.amplitudeUnit}`)) + } + else if (listQuery.value.config === '相移测量') { + const data = allConfigData.value.filter((item: any) => item.params === listQuery.value.config && item.typeValue.trim() === listQuery.value.ponit.trim() && `${item.frequency}${item.frequencyUnit}` === newVal) + nominal12List.value = uniqueArray(data.map((item: any) => `${item.phase}${item.phaseUnit}`)) + } + } + // 设置默认选中 + if (isFirst.value) { + nominal.value = nominal12List.value + loading.value = !!nominal12List.value.length + searchList() + setTimeout(() => { + isFirst.value = false + }, 2000) + } + } +}) + // 查询 function searchList() { xAxisData.value = [] @@ -351,14 +614,20 @@ flag = !!listQuery.value[i].length } else if (i === 'type') { - flag = standardCode.value === '1' ? !!listQuery.value[i] : true + flag = standardCode.value === '1' || standardCode.value === '4' ? !!listQuery.value[i] : true } else if (i === 'nominal') { - flag = standardCode.value === '18' || standardCode.value === '11' ? !!listQuery.value[i] : true + flag = standardCode.value === '18' || standardCode.value === '11' || standardCode.value === '10' || standardCode.value === '9' || standardCode.value === '14' ? !!listQuery.value[i].length : true } else { flag = !!listQuery.value[i] } + if (standardCode.value === '12' || standardCode.value === '17') { + flag = !!nominal.value.length + } + if (listQuery.value.type === '压力值') { + flag = true + } if (!flag) { break } @@ -367,11 +636,20 @@ setTimeout(() => { // 模拟数据 xAxisData.value = getRangeAllTime(listQuery.value.startTime, listQuery.value.endTime).map(item => item) - if (standardCode.value === '18' || standardCode.value === '11') { + if (standardCode.value === '18' || standardCode.value === '11' || standardCode.value === '10' || standardCode.value === '9' || standardCode.value === '14') { dataTrend.value = listQuery.value.nominal.map((item: any) => ({ name: item, data: xAxisData.value.map(item => Math.floor(Math.random() * 100) + 1), })) + if (listQuery.value.nominal[0] === '/') { + dataTrend.value = [] + } + } + else if (standardCode.value === '12' || standardCode.value === '17') { + dataTrend.value = nominal12List.value.map((item: any) => ({ + name: item, + data: xAxisData.value.map(item => Math.floor(Math.random() * 100) + 1), + })) } else { dataTrend.value = listQuery.value.ponit.map((item: any) => ({ @@ -445,7 +723,7 @@ - + - + + + + + + - + + + + + +