From 7d95a869c1354727d1e0643c172a0259ede785e3 Mon Sep 17 00:00:00 2001 From: sjl <1716605279@qq.com> Date: Fri, 28 Nov 2025 16:09:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E6=B5=8B=E9=A1=B9=E9=A2=91=E7=8E=87?= =?UTF-8?q?=E4=BB=85=E5=9C=A8=E6=95=B0=E6=8D=AE=E6=BA=90=E5=8F=AA=E6=9C=89?= =?UTF-8?q?=E5=BD=95=E6=B3=A2=E6=97=B6=E7=A6=81=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plan/planList/components/planPopup.vue | 66 ++++++++++++++----- 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/frontend/src/views/plan/planList/components/planPopup.vue b/frontend/src/views/plan/planList/components/planPopup.vue index 4f3d547..305d7d5 100644 --- a/frontend/src/views/plan/planList/components/planPopup.vue +++ b/frontend/src/views/plan/planList/components/planPopup.vue @@ -1100,12 +1100,12 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan: } } //数据源选中录波,检测项禁止频率和闪变 - if(formContent.datasourceIds.includes('wave_data')){ - const frequencyOption = secondLevelOptions.find(option => option.label.includes('频率')); - if (frequencyOption && Array.isArray(formContent.testItems)) { - formContent.testItems = formContent.testItems.filter(id => id !== frequencyOption.value); - } - } + // if(formContent.datasourceIds.includes('wave_data')){ + // const frequencyOption = secondLevelOptions.find(option => option.label.includes('频率')); + // if (frequencyOption && Array.isArray(formContent.testItems)) { + // formContent.testItems = formContent.testItems.filter(id => id !== frequencyOption.value); + // } + // } } if (mode.value != '比对式') { @@ -1310,6 +1310,7 @@ const handleDataSourceChange = () => { const hasMinuteStats = selectedLabels.some(label => label.includes('分钟')) const hasLuBo = selectedLabels.some(label => label.includes('录波')) + if (hasThreeSeconds && hasMinuteStats) { ElMessage.warning('3s实时数据与分钟统计数据不能同时选择') formContent.datasourceIds = [] @@ -1347,10 +1348,10 @@ const handleDataSourceChange = () => { } else { statisticsSetting.value = false } - if (hasLuBo) { + if (hasLuBo && selectedLabels.length === 1) { waveRecordSetting.value = true - // 当选中录波数据源时,从已选检测项中移除频率和闪变项 + //只勾选录波数据源时,从已选检测项中移除频率和闪变项 const frequencyOption = secondLevelOptions.find(option => option.label.includes('频率')); const flickerOption = secondLevelOptions.find(option => option.label.includes('闪变')); @@ -1367,30 +1368,59 @@ const handleDataSourceChange = () => { formContent.testItems = filteredItems; } - } else { + }else if (hasLuBo && selectedLabels.length > 1) { + waveRecordSetting.value = true + //数据源有多个且包含录波数据源时,从已选检测项中移除闪变项 + const flickerOption = secondLevelOptions.find(option => option.label.includes('闪变')); + + if (Array.isArray(formContent.testItems)) { + let filteredItems = [...formContent.testItems]; + + if (flickerOption) { + filteredItems = filteredItems.filter(id => id !== flickerOption.value); + } + + formContent.testItems = filteredItems; + } + }else { waveRecordSetting.value = false } } - // 判断检测项是否应被禁用 const shouldDisableTestItem = computed(() => { return (option: { label: string; value: string }) => { - // 当数据源选中录波时,禁用频率和闪变选项 - if (Array.isArray(formContent.datasourceIds)) { - const hasLuBo = formContent.datasourceIds.some(id => { - const dictItem = dictStore.getDictData(dataSourceType.value).find(item => item.code === id); - return dictItem ? dictItem.name.includes('录波') : false; - }); - - if (hasLuBo && (option.label.includes('频率') || option.label.includes('闪变'))) { + // 获取当前选中的 datasourceIds,并确保为数组 + const values = Array.isArray(formContent.datasourceIds) + ? formContent.datasourceIds + : [formContent.datasourceIds].filter(Boolean) // 转为数组并过滤空值 + + const selectedLabels = values.map(value => { + const dictItem = dictStore.getDictData(dataSourceType.value).find(item => item.code === value); + return dictItem ? dictItem.name : ''; + }); + + const hasLuBo = selectedLabels.some(label => label.includes('录波')); + + // 当只勾选录波数据源时,禁用频率和闪变选项 + if (hasLuBo && selectedLabels.length === 1) { + if (option.label.includes('频率') || option.label.includes('闪变')) { + return true; + } + } + // 当数据源有多个且包含录波数据源时,只禁用闪变选项 + else if (hasLuBo && selectedLabels.length > 1) { + if (option.label.includes('闪变')) { return true; } } + return false; }; }); + + //导入设备 const deviceImportExcel = ref | null>(null)