diff --git a/src/views/operation/report/index.vue b/src/views/operation/report/index.vue index 00f9049..78dd00e 100644 --- a/src/views/operation/report/index.vue +++ b/src/views/operation/report/index.vue @@ -135,7 +135,7 @@ - + + + + + + + + + + + + + + + + + + + + + @@ -228,6 +260,45 @@ const data = reactive({ const { queryParams } = toRefs(data) +function tableColumnActive(row, modelType, key) { + // 检查row是否为空对象或缺少必要属性 + if (!row || Object.keys(row).length === 0) { + return ''; + } + + // 确保reportResults存在且为数组 + if (!row.reportResults || !Array.isArray(row.reportResults)) { + return ''; + } + + // 查找对应modelType的数据 + const reportData = row.reportResults.find(item => item.modelType === modelType); + + // 如果没有找到对应数据,返回空字符串 + if (!reportData) { + return ''; + } + + console.log(reportData) + + // 根据key值获取对应字段的值并判断是否应该添加active类 + const value = reportData[key]; + if (value && value === '1') { + return 'table-column-active-1'; + } + if (value && value === '0.5') { + return 'table-column-active-11'; + } + if (value && value === '-1') { + return 'table-column-active-2'; + } + if (value && value === '-0.5') { + return 'table-column-active-22'; + } + + return '4'; +} + function rowPrediction(row, modelType) { return row.reportResults && row.reportResults.find(el => el.modelType === modelType) || {} @@ -381,4 +452,43 @@ onMounted(() => { // 列表查询 getList() }) - \ No newline at end of file + + + \ No newline at end of file