暂存评价任务新增
This commit is contained in:
@ -4,15 +4,15 @@ import styles from '../supplierTaskManageAdd.less';
|
||||
import SupplierSelector from '@/components/SupplierSelector';
|
||||
|
||||
interface SupplierSelectStepProps {
|
||||
formData: any;
|
||||
onFormDataChange: (data: any) => void;
|
||||
formData: any; // 从父组件传递的表单数据
|
||||
onFormDataChange: (data: any) => void; // 表单数据变更的回调函数
|
||||
}
|
||||
|
||||
interface SupplierItem {
|
||||
id: string;
|
||||
name: string;
|
||||
supplierType: string;
|
||||
[key: string]: any;
|
||||
id: string; // 供应商ID
|
||||
name: string; // 供应商名称
|
||||
supplierType: string; // 供应商类型
|
||||
[key: string]: any; // 其他可能的字段
|
||||
}
|
||||
|
||||
const SupplierSelectStep = forwardRef<any, SupplierSelectStepProps>(({ formData, onFormDataChange }, ref) => {
|
||||
@ -40,10 +40,19 @@ const SupplierSelectStep = forwardRef<any, SupplierSelectStepProps>(({ formData,
|
||||
|
||||
// 处理供应商选择
|
||||
const handleSupplierSelect = (suppliers: SupplierItem[]) => {
|
||||
|
||||
// 确保每个供应商都有evaluators字段
|
||||
const suppliersWithEvaluators = suppliers.map(supplier => ({
|
||||
...supplier,
|
||||
evaluators: supplier.evaluators || [], // 确保evaluators字段存在,即使是空数组
|
||||
evaluatorCount: supplier.evaluators?.length || 0 // 计算评价人员数量
|
||||
}));
|
||||
|
||||
|
||||
onFormDataChange({
|
||||
...formData,
|
||||
selectedSuppliers: suppliers,
|
||||
supplierIds: suppliers.map(supplier => ({ id: supplier.id }))
|
||||
selectedSuppliers: suppliersWithEvaluators,
|
||||
supplierIds: suppliersWithEvaluators.map(supplier => ({ id: supplier.id }))
|
||||
});
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user