diff --git a/config/router.config.ts b/config/router.config.ts index 1675a34..ed40662 100644 --- a/config/router.config.ts +++ b/config/router.config.ts @@ -307,7 +307,7 @@ export default [ }, { name: '年审打分', - path: 'supplierAnnual/supplierAnnualScore', + path: '/supplierAnnual/supplierAnnualScore', hideInMenu: true, icon: 'icon-dafen', component: '@/pages/supplierAnnualManage/supplierAnnualReview/supplierAnnualScore', diff --git a/src/components/ScoreEvaluationTable/ScoreEvaluationTable.less b/src/components/ScoreEvaluationTable/ScoreEvaluationTable.less index b037586..7fa940e 100644 --- a/src/components/ScoreEvaluationTable/ScoreEvaluationTable.less +++ b/src/components/ScoreEvaluationTable/ScoreEvaluationTable.less @@ -32,4 +32,9 @@ color: #faad14; margin-left: 4px; } + .required { + color: red; + vertical-align: middle; + margin-right: 5px; + } } diff --git a/src/components/ScoreEvaluationTable/ScoreEvaluationTable.tsx b/src/components/ScoreEvaluationTable/ScoreEvaluationTable.tsx index a8b09c7..e9b5fef 100644 --- a/src/components/ScoreEvaluationTable/ScoreEvaluationTable.tsx +++ b/src/components/ScoreEvaluationTable/ScoreEvaluationTable.tsx @@ -2,13 +2,7 @@ // 用于展示和填写供应商评价得分,基于EvaluateTemplateTable组件扩展 // 在二级指标中添加了评分列和说明列 import React, { useState, useEffect } from 'react'; -import { - Table, - Input, - InputNumber, - Typography, - Tooltip, -} from 'antd'; +import { Table, Input, InputNumber, Typography, Tooltip } from 'antd'; import { useIntl } from 'umi'; import './ScoreEvaluationTable.less'; @@ -92,6 +86,7 @@ const ScoreEvaluationTable: React.FC = ({ ndScore: stItem.score || '0', score: stItem.actualScore || '', remark: stItem.remark || '', + isStar: stItem.isStar || '', }); } else { // 处理二级指标 @@ -107,7 +102,7 @@ const ScoreEvaluationTable: React.FC = ({ stScore: stItem.score || '0', subIndicator: ndItem.subIndicator || '', ndScore: ndItem.subScore || '0', - isStar: ndItem.starIndicator || '', + isStar: ndItem.isStar || '', score: ndItem.scoreNum || '', remark: ndItem.remark || '', }); @@ -125,15 +120,18 @@ const ScoreEvaluationTable: React.FC = ({ // 将表格数据转换回API格式 const convertTableDataToApiData = (tableData: TableRowItem[]): any[] => { // 按一级指标分组 - const groupedByLevel1 = tableData.reduce((acc: Record, item: TableRowItem) => { - const groupKey = item.baseIndicator || `empty-${item.key}`; + const groupedByLevel1 = tableData.reduce( + (acc: Record, item: TableRowItem) => { + const groupKey = item.baseIndicator || `empty-${item.key}`; - if (!acc[groupKey]) { - acc[groupKey] = []; - } - acc[groupKey].push(item); - return acc; - }, {}); + if (!acc[groupKey]) { + acc[groupKey] = []; + } + acc[groupKey].push(item); + return acc; + }, + {}, + ); // 转换为API需要的格式 return Object.keys(groupedByLevel1).map((groupKey, stIndex) => { @@ -152,9 +150,10 @@ const ScoreEvaluationTable: React.FC = ({ subScore: item.ndScore || '0', starIndicator: item.isStar || '0', scoreNum: item.score || '', - remark: item.remark || '' + remark: item.remark || '', + isStar: item.isStar, }; - }) + }), }; }); }; @@ -220,7 +219,9 @@ const ScoreEvaluationTable: React.FC = ({ if (!record.baseIndicator) return text || '-'; // 查找相同baseIndicator的所有项 - const level1Items = dataSource.filter((item) => item.baseIndicator === record.baseIndicator); + const level1Items = dataSource.filter( + (item) => item.baseIndicator === record.baseIndicator, + ); const index = level1Items.findIndex((item) => item.key === record.key); if (index === 0) { @@ -245,7 +246,9 @@ const ScoreEvaluationTable: React.FC = ({ if (!record.baseIndicator) return text || '-'; // 查找相同baseIndicator的所有项 - const level1Items = dataSource.filter((item) => item.baseIndicator === record.baseIndicator); + const level1Items = dataSource.filter( + (item) => item.baseIndicator === record.baseIndicator, + ); const index = level1Items.findIndex((item) => item.key === record.key); if (index === 0) { @@ -270,7 +273,9 @@ const ScoreEvaluationTable: React.FC = ({ if (!record.baseIndicator) return text || '0'; // 查找相同baseIndicator的所有项 - const level1Items = dataSource.filter((item) => item.baseIndicator === record.baseIndicator); + const level1Items = dataSource.filter( + (item) => item.baseIndicator === record.baseIndicator, + ); const index = level1Items.findIndex((item) => item.key === record.key); if (index === 0) { @@ -296,7 +301,15 @@ const ScoreEvaluationTable: React.FC = ({ key: 'subIndicator', align: 'center' as const, width: 200, - render: (text: string) => text || '-', + render: (text: string, record: TableRowItem) => ( + <> + {/* 是否必填 1是 0否 */} + {record.isStar && record.isStar === '1' && ( + * + )} + {text || '-'} + + ), }, { title: intl.formatMessage({ id: 'supplierEvaluateScore.scoreTable.subScore' }), @@ -317,14 +330,18 @@ const ScoreEvaluationTable: React.FC = ({ return text || '-'; } return ( - handleInputChange(val, record, 'score')} - style={{ width: '100%' }} - placeholder={intl.formatMessage({ id: 'supplierEvaluateScore.scoreTable.placeholder.score' })} - /> + <> + handleInputChange(val, record, 'score')} + style={{ width: '100%' }} + placeholder={intl.formatMessage({ + id: 'supplierEvaluateScore.scoreTable.placeholder.score', + })} + /> + ); }, }, @@ -345,7 +362,9 @@ const ScoreEvaluationTable: React.FC = ({