模板管理中的指标自动合并bug修复
This commit is contained in:
@ -377,31 +377,29 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
|
||||
|
||||
// 特殊处理baseIndicator字段,确保唯一性
|
||||
if (field === 'baseIndicator') {
|
||||
// 如果之前为空,现在有值,则视为新的一级指标
|
||||
if (!item.baseIndicator && val) {
|
||||
// 检查是否有重复的baseIndicator
|
||||
// 检查是否有重复的baseIndicator(无论是新建还是修改都检查)
|
||||
if (val) {
|
||||
// 只要新值不为空
|
||||
const existingNames = newData.map((d) => d.baseIndicator).filter(Boolean);
|
||||
if (existingNames.includes(val)) {
|
||||
const sameNameItems = existingNames.filter((name) => name === val);
|
||||
// 排除当前项自己
|
||||
const isDuplicate =
|
||||
sameNameItems.length > 0 && (item.baseIndicator !== val || sameNameItems.length > 1);
|
||||
if (isDuplicate) {
|
||||
// 只做提示,不做自动合并
|
||||
message.warning(
|
||||
intl.formatMessage({
|
||||
id: 'supplierTemplateManage.evaluateTable.message.duplicateName',
|
||||
}),
|
||||
);
|
||||
// 禁止合并,直接返回,不做任何数据更改
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 更新同组内所有行的一级指标信息
|
||||
if (item.baseIndicator) {
|
||||
const oldName = item.baseIndicator;
|
||||
newData.forEach((row, i) => {
|
||||
if (row.baseIndicator === oldName) {
|
||||
newData[i] = { ...row, baseIndicator: val };
|
||||
}
|
||||
});
|
||||
} else {
|
||||
newData[index] = { ...item, [field]: val };
|
||||
}
|
||||
// 原有逻辑:同步更新同组内所有行的一级指标信息
|
||||
// 现在只允许单独修改当前行的baseIndicator,不再自动合并
|
||||
newData[index] = { ...item, [field]: val };
|
||||
}
|
||||
// 处理其他一级指标字段,需要同步到同组的所有行
|
||||
else if (['descIndicator', 'stScore', 'indicatorType'].includes(field)) {
|
||||
@ -664,7 +662,8 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const compShowDelBtnByRecord = useCallback((record: TableRowItem) => {
|
||||
const compShowDelBtnByRecord = useCallback(
|
||||
(record: TableRowItem) => {
|
||||
// isFirstDisabled 是否禁用 true false;
|
||||
// record.indicatorStEditST 是否可编辑 0是 1否
|
||||
// record.id 是否是新增的 有id是新增的 没有id是新增的
|
||||
@ -676,7 +675,9 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
|
||||
// return false;
|
||||
// }
|
||||
return true;
|
||||
}, [isFirstDisabled]);
|
||||
},
|
||||
[isFirstDisabled],
|
||||
);
|
||||
const columns = [
|
||||
{
|
||||
title: intl.formatMessage({ id: 'supplierTemplateManage.evaluateTable.levelOne' }),
|
||||
|
@ -27,6 +27,7 @@ interface SupplierSelectorProps {
|
||||
* @property {string} [deptId] - 部门ID
|
||||
* @property {string} [deptName] - 部门名称
|
||||
* @property {string} [companyName] - 公司名称
|
||||
* @property {string} [unifiedCode] - 统一社会信用代码
|
||||
* @property {string} [categoryName] - 所属品类
|
||||
* @property {string} [levelName] - 最新评价等级
|
||||
* @property {Date} [admissionTime] - 准入时间
|
||||
@ -247,12 +248,12 @@ const SupplierSelector: React.FC<SupplierSelectorProps> = ({
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({ id: 'supplierTaskManage.column.socialCreditCode' }),
|
||||
dataIndex: 'socialCreditCode',
|
||||
dataIndex: 'unifiedCode',
|
||||
width: 120,
|
||||
ellipsis: true,
|
||||
render: (socialCreditCode: string) => (
|
||||
<Tooltip placement="topLeft" title={socialCreditCode}>
|
||||
{socialCreditCode || '-'}
|
||||
render: (unifiedCode: string) => (
|
||||
<Tooltip placement="topLeft" title={unifiedCode}>
|
||||
{unifiedCode || '-'}
|
||||
</Tooltip>
|
||||
),
|
||||
},
|
||||
|
Reference in New Issue
Block a user