评价打分
This commit is contained in:
@ -69,7 +69,7 @@ const ScoreEvaluationTable: React.FC<ScoreEvaluationTableProps> = ({
|
||||
// 将API数据转换为表格数据
|
||||
const convertApiDataToTableData = (apiData: any[]): TableRowItem[] => {
|
||||
// 检查数据是否已经是扁平化的表格数据格式
|
||||
if (apiData.length > 0 && 'subIndicator' in apiData[0]) {
|
||||
if (apiData.length > 0 && 'subIndicator' in apiData[0] && !('indicatorNdList' in apiData[0])) {
|
||||
return apiData as TableRowItem[];
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ const ScoreEvaluationTable: React.FC<ScoreEvaluationTableProps> = ({
|
||||
key: `${stItem.id || stIndex}-0`,
|
||||
stId: stItem.id,
|
||||
baseIndicator: stItem.baseIndicator || '',
|
||||
descIndicator: stItem.descIndicator || '',
|
||||
descIndicator: stItem.indicatorDesc || '',
|
||||
stScore: stItem.score || '0',
|
||||
subIndicator: '',
|
||||
ndScore: '0',
|
||||
@ -94,19 +94,22 @@ const ScoreEvaluationTable: React.FC<ScoreEvaluationTableProps> = ({
|
||||
} else {
|
||||
// 处理二级指标
|
||||
stItem.indicatorNdList.forEach((ndItem: any, ndIndex: number) => {
|
||||
flattenedData.push({
|
||||
key: `${stItem.id || stIndex}-${ndItem.id || ndIndex}`,
|
||||
stId: stItem.id,
|
||||
ndId: ndItem.id,
|
||||
baseIndicator: stItem.baseIndicator || '',
|
||||
descIndicator: stItem.descIndicator || '',
|
||||
stScore: stItem.score || '0',
|
||||
subIndicator: ndItem.subIndicator || '',
|
||||
ndScore: ndItem.score || '0',
|
||||
isStar: ndItem.isStar || '',
|
||||
score: ndItem.actualScore || '',
|
||||
remark: ndItem.remark || '',
|
||||
});
|
||||
// 确保ndItem是一个对象,而不是直接渲染
|
||||
if (typeof ndItem === 'object' && ndItem !== null) {
|
||||
flattenedData.push({
|
||||
key: `${stItem.id || stIndex}-${ndItem.id || ndIndex}`,
|
||||
stId: stItem.id,
|
||||
ndId: ndItem.id,
|
||||
baseIndicator: stItem.baseIndicator || '',
|
||||
descIndicator: stItem.indicatorDesc || '',
|
||||
stScore: stItem.score || '0',
|
||||
subIndicator: ndItem.subIndicator || '',
|
||||
ndScore: ndItem.subScore || '0',
|
||||
isStar: ndItem.starIndicator || '',
|
||||
score: ndItem.scoreNum || '',
|
||||
remark: ndItem.remark || '',
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -138,15 +141,15 @@ const ScoreEvaluationTable: React.FC<ScoreEvaluationTableProps> = ({
|
||||
return {
|
||||
id: firstItem.stId || `temp-st-${stIndex}`,
|
||||
baseIndicator: firstItem.baseIndicator || '',
|
||||
descIndicator: firstItem.descIndicator || '',
|
||||
indicatorDesc: firstItem.descIndicator || '',
|
||||
score: firstItem.stScore || '0',
|
||||
indicatorNdList: level1Items.map((item, ndIndex) => {
|
||||
return {
|
||||
id: item.ndId || `temp-nd-${stIndex}-${ndIndex}`,
|
||||
subIndicator: item.subIndicator || '',
|
||||
score: item.ndScore || '0',
|
||||
isStar: item.isStar || '',
|
||||
actualScore: item.score || '',
|
||||
subScore: item.ndScore || '0',
|
||||
starIndicator: item.isStar || '0',
|
||||
scoreNum: item.score || '',
|
||||
remark: item.remark || ''
|
||||
};
|
||||
})
|
||||
|
Reference in New Issue
Block a user