评价模板禁用逻辑

This commit is contained in:
linxd
2025-07-03 20:15:54 +08:00
parent 0960d48748
commit bb3bea51b1
5 changed files with 284 additions and 52 deletions

View File

@ -1,7 +1,7 @@
// 供应商评价 模板管理新增中的table
import React, { useState, useEffect } from 'react';
import { useIntl } from 'umi';
import { Table, Input, Button, Select, InputNumber, message, Popconfirm } from 'antd';
import { Table, Input, Button, Select, InputNumber, message, Popconfirm, Switch } from 'antd';
import {
PlusOutlined,
MinusCircleOutlined,
@ -13,6 +13,7 @@ import type { DictItem } from '@/servers/api/dicts';
import { StarLevel, StarLevelText } from '@/dicts/supplierTemplateDict';
import { generateUUID } from '@/utils/utils';
import './EvaluateTemplateTable.less';
import { useUser } from '@/hooks/useUser';
const { Option } = Select;
const { TextArea } = Input;
@ -24,6 +25,8 @@ interface EvaluateTemplateTableProps {
isCheck?: boolean; // 是否显示勾选操作如果为true则在表格最后一列增加勾选操作项
onSelect?: (selectedItems: any[]) => void; // 勾选回调函数
defaultSelectedIds?: string[]; // 默认选中的二级指标ID数组
firstIsAdd?: boolean; // 是否可追加一级指标 默认是
disableType?: string; // 禁用指标类型
}
// 内部使用的数据结构,扁平化后的行数据
@ -50,6 +53,18 @@ interface TableRowItem {
selected?: boolean; // 是否选中
disabledSt?: boolean; // 是否禁用一级
disabledNd?: boolean; // 是否禁用二级
// 因为table是需要扁平化数据所以需要添加以下字段
baseIndicatorEdit?: string; // 基本指标是否可编辑 0.是、1.否
descIndicatorEdit?: string; // 指标说明是否可编辑(0.是、1.否)
scoreEdit?: string; // 分值是否可编辑(0.是、1.否)
indicatorStEdit?: string; // 该一级指标是否可编辑(0.是、1.否)
indicatorStEditST?: string; // 该一级指标是否可编辑(0.是、1.否)
baseIndicatorEditST?: string; // 基本指标是否可编辑 0.是、1.否
descIndicatorEditST?: string; // 指标说明是否可编辑(0.是、1.否)
scoreEditST?: string; // 分值是否可编辑(0.是、1.否)
}
const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
@ -59,11 +74,23 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
isCheck = false,
onSelect,
defaultSelectedIds = [],
firstIsAdd = true,
disableType = '',
}) => {
const { getUserRole } = useUser();
const intl = useIntl();
const [dataSource, setDataSource] = useState<TableRowItem[]>([]);
const [indicatorTypes, setIndicatorTypes] = useState<DictItem[]>([]);
const [loadingTypes, setLoadingTypes] = useState<boolean>(false);
const [isFirstDisabled, setIsFirstDisabled] = useState<boolean>(!firstIsAdd);
useEffect(() => {
setIsFirstDisabled(!firstIsAdd);
if (disableType) {
const newIndicatorTypes = indicatorTypes.filter((item) => item.code !== disableType);
setIndicatorTypes(newIndicatorTypes);
}
}, [firstIsAdd, disableType]);
// 获取指标类型字典
const fetchIndicatorTypes = async () => {
@ -106,8 +133,6 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
orderBy: typeof item.stOrderBy === 'string' ? parseInt(item.stOrderBy) : item.stOrderBy,
ndOrderBy: typeof item.orderBy === 'string' ? parseInt(item.orderBy) : item.orderBy,
selected: defaultSelectedIds.includes(item.id), // 根据defaultSelectedIds设置选中状态
disabledSt: item.disabledSt ?? false,
disabledNd: item.disabledNd,
}));
}
@ -132,10 +157,10 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
ndOrderBy:
typeof ndItem.orderBy === 'string' ? parseInt(ndItem.orderBy) : ndItem.orderBy,
selected: defaultSelectedIds.includes(ndItem.id), // 根据defaultSelectedIds设置选中状态
// 关键点1将API数据中的disabled属性映射到表格数据的disabledStdisabledNd
// 这确保了一级指标的禁用状态正确传递到所有相关行,二级指标保持自己的禁用状态
disabledSt: stItem.disabled, // 根据disabled设置一级禁用状态
disabledNd: ndItem.disabled, // 根据disabled设置二级禁用状态
indicatorStEditST: stItem.indicatorStEdit,
baseIndicatorEditST: stItem.baseIndicatorEdit,
descIndicatorEditST: stItem.descIndicatorEdit,
scoreEditST: stItem.scoreEdit,
});
});
});
@ -174,6 +199,10 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
id: firstItem.stId || tempStId,
baseIndicator: firstItem.baseIndicator || '',
descIndicator: firstItem.descIndicator || '',
indicatorStEdit: firstItem.indicatorStEditST || 0,
baseIndicatorEdit: firstItem.baseIndicatorEditST || 0,
descIndicatorEdit: firstItem.descIndicatorEditST || 0,
scoreEdit: firstItem.scoreEditST || 0,
score: firstItem.stScore || '0',
orderBy: firstItem.orderBy || stIndex + 1,
indicatorType: firstItem.indicatorType || '',
@ -229,7 +258,6 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
const currentValueStr = JSON.stringify(value);
const currentDataSourceApiStr =
dataSource.length > 0 ? JSON.stringify(convertTableDataToApiData(dataSource)) : '';
if (currentValueStr !== currentDataSourceApiStr) {
const tableData = convertApiDataToTableData(value);
// 保留现有项的key确保稳定性
@ -256,7 +284,6 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
return newItem;
});
// 确保所有key都是唯一的
setDataSource(ensureUniqueKeys(updatedTableData));
} else {
@ -278,7 +305,6 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
selected: defaultSelectedIds.includes(item.ndId || ''),
}));
setDataSource(newData);
// 如果有onSelect回调传递所有选中的项
@ -293,10 +319,8 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
// 更新数据源
const updateDataSource = (newData: TableRowItem[]) => {
// 确保每行都有唯一稳定的key
const finalData = ensureUniqueKeys(newData);
setDataSource(finalData);
if (onChange) {
// 转换回API格式再传递给父组件
@ -325,6 +349,7 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
// 处理输入变化
const handleInputChange = (val: any, record: TableRowItem, field: string) => {
console.log('handleInputChange', val, record, field);
const newData = [...dataSource];
const index = newData.findIndex((item) => item.key === record.key);
if (index > -1) {
@ -406,7 +431,7 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
disabledNd: false, // 默认不禁用二级指标
};
// 制作数据源的副本,避免直接修改状态
const newData = dataSource.map(item => ({ ...item }));
const newData = dataSource.map((item) => ({ ...item }));
// 找到当前记录所在的一级指标组的最后一行
let insertIndex = -1;
@ -429,7 +454,6 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
newData.push(newItem);
}
updateDataSource(newData);
};
@ -495,7 +519,6 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
newData.push(newItem);
}
updateDataSource(newData);
};
@ -542,13 +565,13 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
if (index === 0) {
// 关键点5检查同组内是否有任何行的disabledSt为true
// 这是解决问题的核心,通过这个判断来决定是否禁用整个一级指标组的控件
const anyDisabled = level1Items.some(item => !!item.disabledSt);
const anyDisabled = level1Items.some((item) => !!item.disabledSt);
// 关键点6创建一个临时记录使用组内任何行的禁用状态
// 这样确保只要组内有一行禁用,整个组的一级指标控件都会显示为禁用状态
const tempRecord = {
...record,
disabledSt: anyDisabled
disabledSt: anyDisabled,
};
return {
@ -566,6 +589,18 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
};
};
const filterColumns = (col: any) => {
if ((isDetail || getUserRole() != 'admin') && ['level1Action', 'indicator_st_edit', 'base_indicator_edit', 'desc_indicator_edit', 'score_edit'].includes(col.key)) {
return false;
}
return true;
};
const filterColumnsSecond = (col: any) => {
if ((isDetail || getUserRole() != 'admin') && ['level2Action'].includes(col.key)) {
return false;
}
return true;
};
const columns = [
{
title: intl.formatMessage({ id: 'supplierTemplateManage.evaluateTable.levelOne' }),
@ -603,7 +638,7 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
})}
style={{ width: '100%' }}
loading={loadingTypes}
disabled={record.disabledSt}
disabled={record.indicatorStEditST === "1"}
>
{indicatorTypes.map((item) => (
<Option key={item.code} value={item.code}>
@ -629,7 +664,7 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
return (
<Input
value={cellContent}
disabled={record.disabledSt}
disabled={record.baseIndicatorEditST === "1" || record.indicatorStEditST === "1"}
onChange={(e) => handleInputChange(e.target.value, record, 'baseIndicator')}
placeholder={intl.formatMessage({
id: 'supplierTemplateManage.evaluateTable.placeholder.baseIndicator',
@ -640,9 +675,31 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
},
},
{
title: intl.formatMessage({
id: 'supplierTemplateManage.evaluateTable.indicatorDescription',
}),
// (0.是、1.否 int类型)
title: '是否可编辑',
align: 'center',
dataIndex: 'baseIndicatorEditST',
key: 'baseIndicatorEditST',
width: 50,
render: (text: string, record: TableRowItem) => {
return renderWithRowSpan(text, record, (cellContent) => {
if (isDetail) {
return cellContent === 1 ? '是' : '否';
}
return (
<Switch
defaultChecked={true}
checked={cellContent === "0"}
onChange={(checked) =>
handleInputChange(checked ? "0" : "1", record, 'baseIndicatorEditST')
}
/>
);
});
},
},
{
title: "指标说明",
align: 'center',
dataIndex: 'descIndicator',
key: 'descIndicator',
@ -655,7 +712,7 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
return (
<Input
value={cellContent}
disabled={record.disabledSt}
disabled={record.descIndicatorEditST === "1" || record.indicatorStEditST === "1"}
onChange={(e) => handleInputChange(e.target.value, record, 'descIndicator')}
placeholder={intl.formatMessage({
id: 'supplierTemplateManage.evaluateTable.placeholder.indicatorDescription',
@ -665,6 +722,32 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
});
},
},
{
// (0.是、1.否 int类型)
title: '是否可编辑',
align: 'center',
dataIndex: 'descIndicatorEditST',
key: 'descIndicatorEditST',
width: 50,
render: (text: string, record: TableRowItem) => {
return renderWithRowSpan(text, record, (cellContent) => {
if (isDetail) {
return cellContent === 1 ? '是' : '否';
}
return (
<>
<Switch
defaultChecked={true}
checked={cellContent === "0"}
onChange={(checked) =>
handleInputChange(checked ? "0" : "1", record, 'descIndicatorEditST')
}
/>
</>
);
});
},
},
{
title: intl.formatMessage({ id: 'supplierTemplateManage.evaluateTable.score' }),
align: 'center',
@ -680,7 +763,7 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
<InputNumber
min={0}
max={100}
disabled={record.disabledSt}
disabled={record.scoreEditST === "1" || record.indicatorStEditST === "1"}
value={parseFloat(cellContent) || 0}
onChange={(val) => handleInputChange(val?.toString() || '0', record, 'stScore')}
style={{ width: '100%' }}
@ -689,6 +772,30 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
});
},
},
{
// (0.是、1.否 int类型)
title: '是否可编辑',
align: 'center',
dataIndex: 'scoreEditST',
key: 'scoreEditST',
width: 50,
render: (text: string, record: TableRowItem) => {
return renderWithRowSpan(text, record, (cellContent) => {
if (isDetail) {
return cellContent === 1 ? '是' : '否';
}
return (
<Switch
defaultChecked={true}
checked={cellContent === "0"}
onChange={(checked) =>
handleInputChange(checked ? "0" : "1", record, 'scoreEditST')
}
/>
);
});
},
},
{
title: intl.formatMessage({ id: 'supplierTemplateManage.evaluateTable.action' }),
key: 'level1Action',
@ -701,6 +808,7 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
<div className="action-buttons">
<Button
type="text"
disabled={isFirstDisabled || record.indicatorStEditST === "1"}
icon={<PlusCircleOutlined />}
onClick={() => {
addLevel1Indicator(record);
@ -724,7 +832,7 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
<Button
type="text"
danger
disabled={record.disabledSt}
disabled={isFirstDisabled || record.indicatorStEditST === "1"}
icon={<DeleteOutlined />}
title={intl.formatMessage({
id: 'supplierTemplateManage.evaluateTable.button.deleteLevelOne',
@ -735,7 +843,31 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
));
},
},
].filter((col) => !(isDetail && col.key === 'level1Action')),
{
// (0.是、1.否 int类型)
title: '是否可编辑',
align: 'center',
dataIndex: 'indicatorStEditST',
key: 'indicatorStEditST',
width: 50,
render: (text: string, record: TableRowItem) => {
return renderWithRowSpan(text, record, (cellContent) => {
if (isDetail) {
return cellContent === 1 ? '是' : '否';
}
return (
<Switch
defaultChecked={true}
checked={cellContent === "0"}
onChange={(checked) =>
handleInputChange(checked ? "0" : "1", record, 'indicatorStEditST')
}
/>
);
});
},
},
].filter(filterColumns),
},
{
title: intl.formatMessage({ id: 'supplierTemplateManage.evaluateTable.levelTwo' }),
@ -896,7 +1028,7 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
},
]
: []),
].filter((col) => !(isDetail && col.key === 'level2Action')),
].filter(filterColumnsSecond),
},
];
@ -916,7 +1048,7 @@ const EvaluateTemplateTable: React.FC<EvaluateTemplateTableProps> = ({
}),
}}
/>
{!isDetail && (
{!isDetail && !isFirstDisabled && (
<div className="add-button-row">
<Button
type="dashed"

View File

@ -11,6 +11,17 @@ export const CategoryLimitationTypeText = {
[CategoryLimitationType.UNIVERSAL]: '通用不限品类',
[CategoryLimitationType.LIMITED]: '限制品类',
};
//指标类型 通用 技术
export const Types = [
{
label: '通用类型',
value: 'generalType',
},
{
label: '技术类型',
value: 'categoryType',
},
];
// 模板状态
export const TemplateStatus = {
@ -49,8 +60,8 @@ export enum IndicatorAddOption {
}
export const IndicatorAddOptionText = {
[IndicatorAddOption.CAN_ADD]: '可修改',
[IndicatorAddOption.CANNOT_ADD]: '不可修改',
[IndicatorAddOption.CAN_ADD]: '',
[IndicatorAddOption.CANNOT_ADD]: '',
};
// 重新导出任务类型

18
src/hooks/useUser.ts Normal file
View File

@ -0,0 +1,18 @@
import { useState } from "react";
// 获取用户信息
export const useUser = () => {
const [user, setUser] = useState<any>({
role: 'admin',
});
const getUserInfo = ()=>{
return user;
}
const setUserInfo = (user: any) => {
setUser(user);
}
const getUserRole = ()=>{
return user.role;
}
return { user, getUserInfo, setUserInfo, getUserRole };
};

View File

@ -15,6 +15,7 @@ import {
Typography,
Spin,
Modal,
Checkbox,
} from 'antd';
import { history, useLocation, useIntl, connect } from 'umi';
import type { Dispatch, ConnectProps } from 'umi';
@ -28,7 +29,11 @@ import {
TemplateStatus,
TemplateStatusText,
IndicatorAddOption,
IndicatorAddOptionText,
Types,
} from '@/dicts/supplierTemplateDict';
import { useUser } from '@/hooks/useUser';
import {
getTemplateDetail,
getAllTemplates,
@ -36,6 +41,8 @@ import {
addTemplate,
} from '@/servers/api/supplierEvaluate';
import styles from './supplierTemplateManage.less';
import { getDictList } from '@/servers/api/dicts';
import type { DictItem } from '@/servers/api/dicts';
const { Option } = Select;
const { confirm } = Modal;
@ -65,6 +72,7 @@ interface LocationState {
const { Title } = Typography;
const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }) => {
const { getUserRole, setUserInfo } = useUser();
const intl = useIntl();
const [form] = Form.useForm<FormValues>();
const [loading, setLoading] = useState<boolean>(false);
@ -74,10 +82,11 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
useState<SupplierTemplateManage.TemplateDetailResponse['data']>();
const [templateList, setTemplateList] = useState<SupplierTemplateManage.TemplateItem[]>([]);
// 添加控制开关的状态
// 添加控制开关的状态 一级指标是否可增加(0.可增加、1.不可增加)
const [indicatorStMore, setIndicatorStMore] = useState<string>(IndicatorAddOption.CAN_ADD);
//二级指标是否可增加(0.可增加、1.不可增加)
const [indicatorNdMore, setIndicatorNdMore] = useState<string>(IndicatorAddOption.CAN_ADD);
const [indicatorTypes, setIndicatorTypes] = useState<{ label: string; value: string }[]>([]);
// 获取路由传递的数据
const location = useLocation<LocationState>();
@ -128,6 +137,7 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
copyTemplateId: res.data.copyTemplateId,
indicatorStMore: res.data.indicatorStMore || IndicatorAddOption.CAN_ADD,
indicatorNdMore: res.data.indicatorNdMore || IndicatorAddOption.CAN_ADD,
indicatorTypeMore: res.data.indicatorTypeMore || '',
});
// 直接设置指标数据,无需转换
@ -147,6 +157,31 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
setLoading(false);
}
};
// 获取指标类型字典
const fetchIndicatorTypes = async () => {
try {
const res = await getDictList('Indicator_type');
if (res.success && res.data) {
setIndicatorTypes(
res.data.map((item: DictItem) => ({
label: item.dicName,
value: item.code,
})),
);
} else {
message.error(
intl.formatMessage({ id: 'supplierTemplateManage.evaluateTable.message.getTypeFailed' }),
);
}
} catch (error) {
console.error('获取指标类型失败:', error);
message.error(
intl.formatMessage({ id: 'supplierTemplateManage.evaluateTable.message.getTypeFailed' }),
);
} finally {
}
};
useEffect(() => {
if (location.state?.editData?.id && dispatch) {
dispatch({
@ -164,6 +199,8 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
useEffect(() => {
// 获取所有模板列表
fetchTemplateList();
// 获取指标类型
fetchIndicatorTypes();
// 如果是编辑模式,加载编辑数据
if (location.state?.isEdit && location.state?.editData) {
setIsEdit(true);
@ -188,7 +225,6 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
...values,
templateType: selectedTemplate?.templateType || '',
indicatorStList: templateData,
indicatorTypeMore: IndicatorAddOption.CAN_ADD,
status: parseInt(values.status, 10),
} as unknown as SupplierTemplateManage.TemplateUpdateRequest;
@ -196,7 +232,6 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
if (isEdit && templateDetail) {
dataToSubmit.id = templateDetail.id;
}
setLoading(true);
try {
// 调用API接口
@ -260,6 +295,7 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
// 处理指标数据变更
const handleTemplateDataChange = (data: SupplierTemplateManage.IndicatorSt[]) => {
console.log('handleTemplateDataChange', data);
setTemplateData(data);
};
@ -371,7 +407,7 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
</Button>
</div>
<Form<FormValues>
<Form
form={form}
onFinish={handleSubmit}
initialValues={{
@ -511,22 +547,39 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
</Form.Item>
</Col>
</Row>
<Row gutter={24}>
<Col span={8}>
<Form.Item
label={intl.formatMessage({ id: 'supplierTemplateManage.form.indicatorStMore' })}
name="indicatorStMore"
valuePropName="checked"
getValueProps={(value) => ({ checked: value === IndicatorAddOption.CAN_ADD })}
{getUserRole() === 'admin' && (
<Row gutter={24}>
<Col span={8}>
<Form.Item label="是否可追加一级指标" name="indicatorStMore">
<Radio.Group>
<Radio value={IndicatorAddOption.CAN_ADD}>
{IndicatorAddOptionText[IndicatorAddOption.CAN_ADD]}
</Radio>
<Radio value={IndicatorAddOption.CANNOT_ADD}>
{IndicatorAddOptionText[IndicatorAddOption.CANNOT_ADD]}
</Radio>
</Radio.Group>
</Form.Item>
</Col>
<Form.Item // 这里必须放在Row下
shouldUpdate={(prev, curr) => prev.indicatorStMore !== curr.indicatorStMore}
noStyle
>
<Switch
checked={indicatorStMore === IndicatorAddOption.CAN_ADD}
onChange={(checked) => handleSwitchChange('indicatorStMore', checked)}
/>
{({ getFieldValue }) =>
getFieldValue('indicatorStMore') === IndicatorAddOption.CANNOT_ADD ? (
<Col span={8}>
<Form.Item label="禁用指标类型" name="indicatorTypeMore">
<Select
placeholder="请选择禁用指标类型"
options={indicatorTypes}
allowClear
/>
</Form.Item>
</Col>
) : null
}
</Form.Item>
</Col>
<Col span={8}>
{/* <Col span={8}>
<Form.Item
label={intl.formatMessage({ id: 'supplierTemplateManage.form.indicatorNdMore' })}
name="indicatorNdMore"
@ -538,8 +591,9 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
onChange={(checked) => handleSwitchChange('indicatorNdMore', checked)}
/>
</Form.Item>
</Col>
</Row>
</Col> */}
</Row>
)}
</Card>
<Divider />
@ -549,7 +603,22 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
bordered={false}
className={styles.innerCard}
>
<EvaluateTemplateTable onChange={handleTemplateDataChange} value={templateData} />
<Form.Item
shouldUpdate={(prev, curr) =>
prev.indicatorStMore !== curr.indicatorStMore ||
prev.indicatorTypeMore !== curr.indicatorTypeMore
}
noStyle
>
{({ getFieldValue }) => (
<EvaluateTemplateTable
disableType={getFieldValue('indicatorTypeMore')}
firstIsAdd={getFieldValue('indicatorStMore') === IndicatorAddOption.CAN_ADD}
onChange={handleTemplateDataChange}
value={templateData}
/>
)}
</Form.Item>
</Card>
</Spin>

View File

@ -56,6 +56,8 @@ declare namespace SupplierTemplateManage {
dimensions: TemplateDimension[];
indicatorStMore: string;
indicatorNdMore: string;
indicatorStList: IndicatorSt[];
indicatorNdList: IndicatorNd[];
[key: string]: any;
};
message: string;