检测项频率仅在数据源只有录波时禁用
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')){
|
||||
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;
|
||||
// 获取当前选中的 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 : '';
|
||||
});
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
// 当数据源有多个且包含录波数据源时,只禁用闪变选项
|
||||
else if (hasLuBo && selectedLabels.length > 1) {
|
||||
if (option.label.includes('闪变')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
|
||||
//导入设备
|
||||
const deviceImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user