检测项频率仅在数据源只有录波时禁用
This commit is contained in:
@@ -1100,12 +1100,12 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//数据源选中录波,检测项禁止频率和闪变
|
//数据源选中录波,检测项禁止频率和闪变
|
||||||
if(formContent.datasourceIds.includes('wave_data')){
|
// if(formContent.datasourceIds.includes('wave_data')){
|
||||||
const frequencyOption = secondLevelOptions.find(option => option.label.includes('频率'));
|
// const frequencyOption = secondLevelOptions.find(option => option.label.includes('频率'));
|
||||||
if (frequencyOption && Array.isArray(formContent.testItems)) {
|
// if (frequencyOption && Array.isArray(formContent.testItems)) {
|
||||||
formContent.testItems = formContent.testItems.filter(id => id !== frequencyOption.value);
|
// formContent.testItems = formContent.testItems.filter(id => id !== frequencyOption.value);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode.value != '比对式') {
|
if (mode.value != '比对式') {
|
||||||
@@ -1310,6 +1310,7 @@ const handleDataSourceChange = () => {
|
|||||||
const hasMinuteStats = selectedLabels.some(label => label.includes('分钟'))
|
const hasMinuteStats = selectedLabels.some(label => label.includes('分钟'))
|
||||||
const hasLuBo = selectedLabels.some(label => label.includes('录波'))
|
const hasLuBo = selectedLabels.some(label => label.includes('录波'))
|
||||||
|
|
||||||
|
|
||||||
if (hasThreeSeconds && hasMinuteStats) {
|
if (hasThreeSeconds && hasMinuteStats) {
|
||||||
ElMessage.warning('3s实时数据与分钟统计数据不能同时选择')
|
ElMessage.warning('3s实时数据与分钟统计数据不能同时选择')
|
||||||
formContent.datasourceIds = []
|
formContent.datasourceIds = []
|
||||||
@@ -1347,10 +1348,10 @@ const handleDataSourceChange = () => {
|
|||||||
} else {
|
} else {
|
||||||
statisticsSetting.value = false
|
statisticsSetting.value = false
|
||||||
}
|
}
|
||||||
if (hasLuBo) {
|
if (hasLuBo && selectedLabels.length === 1) {
|
||||||
waveRecordSetting.value = true
|
waveRecordSetting.value = true
|
||||||
|
|
||||||
// 当选中录波数据源时,从已选检测项中移除频率和闪变项
|
//只勾选录波数据源时,从已选检测项中移除频率和闪变项
|
||||||
const frequencyOption = secondLevelOptions.find(option => option.label.includes('频率'));
|
const frequencyOption = secondLevelOptions.find(option => option.label.includes('频率'));
|
||||||
const flickerOption = secondLevelOptions.find(option => option.label.includes('闪变'));
|
const flickerOption = secondLevelOptions.find(option => option.label.includes('闪变'));
|
||||||
|
|
||||||
@@ -1365,6 +1366,20 @@ const handleDataSourceChange = () => {
|
|||||||
filteredItems = filteredItems.filter(id => id !== flickerOption.value);
|
filteredItems = filteredItems.filter(id => id !== flickerOption.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
formContent.testItems = filteredItems;
|
||||||
|
}
|
||||||
|
}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;
|
formContent.testItems = filteredItems;
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
@@ -1372,25 +1387,40 @@ const handleDataSourceChange = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 判断检测项是否应被禁用
|
// 判断检测项是否应被禁用
|
||||||
const shouldDisableTestItem = computed(() => {
|
const shouldDisableTestItem = computed(() => {
|
||||||
return (option: { label: string; value: string }) => {
|
return (option: { label: string; value: string }) => {
|
||||||
// 当数据源选中录波时,禁用频率和闪变选项
|
// 获取当前选中的 datasourceIds,并确保为数组
|
||||||
if (Array.isArray(formContent.datasourceIds)) {
|
const values = Array.isArray(formContent.datasourceIds)
|
||||||
const hasLuBo = formContent.datasourceIds.some(id => {
|
? formContent.datasourceIds
|
||||||
const dictItem = dictStore.getDictData(dataSourceType.value).find(item => item.code === id);
|
: [formContent.datasourceIds].filter(Boolean) // 转为数组并过滤空值
|
||||||
return dictItem ? dictItem.name.includes('录波') : false;
|
|
||||||
|
const selectedLabels = values.map(value => {
|
||||||
|
const dictItem = dictStore.getDictData(dataSourceType.value).find(item => item.code === value);
|
||||||
|
return dictItem ? dictItem.name : '';
|
||||||
});
|
});
|
||||||
|
|
||||||
if (hasLuBo && (option.label.includes('频率') || option.label.includes('闪变'))) {
|
const hasLuBo = selectedLabels.some(label => label.includes('录波'));
|
||||||
|
|
||||||
|
// 当只勾选录波数据源时,禁用频率和闪变选项
|
||||||
|
if (hasLuBo && selectedLabels.length === 1) {
|
||||||
|
if (option.label.includes('频率') || option.label.includes('闪变')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 当数据源有多个且包含录波数据源时,只禁用闪变选项
|
||||||
|
else if (hasLuBo && selectedLabels.length > 1) {
|
||||||
|
if (option.label.includes('闪变')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//导入设备
|
//导入设备
|
||||||
const deviceImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
|
const deviceImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user