整理接口定义规范
This commit is contained in:
@ -7,14 +7,12 @@ import React, {
|
||||
useRef,
|
||||
} from 'react';
|
||||
import { Table, Tag, Space, Button, message, Modal, Spin } from 'antd';
|
||||
import type { PersonnelItem } from '@/servers/types/evaluator';
|
||||
import type { ColumnsType } from 'antd/es/table';
|
||||
import EvaluateTemplateTable from '@/components/EvaluateTemplateTable';
|
||||
import { getTemplateDetail } from '@/servers/api/supplierEvaluate';
|
||||
import type { Dispatch } from 'umi';
|
||||
import { connect } from 'umi';
|
||||
import type { SupplierTaskModelState } from '@/models/supplierTaskManage';
|
||||
import type { IndicatorItem } from '@/servers/dao/supplierEvaluateTask';
|
||||
|
||||
// 组件接收的Props定义
|
||||
interface DivisionStepProps {
|
||||
@ -39,13 +37,13 @@ const DivisionStepComponent = (props: DivisionStepProps) => {
|
||||
const { taskFormData, mode } = supplierTaskManage;
|
||||
|
||||
// 从上一步获取的评价人员列表
|
||||
const [evaluators, setEvaluators] = useState<PersonnelItem[]>([]);
|
||||
const [evaluators, setEvaluators] = useState<SupplierTaskManage.PersonnelItem[]>([]);
|
||||
|
||||
// 选中的行keys
|
||||
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
|
||||
|
||||
// 指标列表 - 不再直接使用mockIndicators,而是从templateData派生
|
||||
const [indicators, setIndicators] = useState<IndicatorItem[]>([]);
|
||||
const [indicators, setIndicators] = useState<SupplierTaskManage.IndicatorItem[]>([]);
|
||||
|
||||
// 评价指标模板查看弹窗可见性
|
||||
const [templateViewModalVisible, setTemplateViewModalVisible] = useState(false);
|
||||
@ -209,14 +207,14 @@ const DivisionStepComponent = (props: DivisionStepProps) => {
|
||||
// 批量更新indicatorList和userList
|
||||
userIds.forEach((userId) => {
|
||||
// 更新indicatorList
|
||||
indicatorList.forEach((item: IndicatorItem) => {
|
||||
indicatorList.forEach((item: SupplierTaskManage.IndicatorItem) => {
|
||||
if (item.userId === userId) {
|
||||
item.indicatorIds = [...new Set([...(item.indicatorIds || []), ...indicatorNdListIds])];
|
||||
}
|
||||
});
|
||||
|
||||
// 更新userList
|
||||
userList.forEach((item: PersonnelItem) => {
|
||||
userList.forEach((item: SupplierTaskManage.PersonnelItem) => {
|
||||
if (item.id === userId) {
|
||||
item.indicatorIds = indicatorNdListIds;
|
||||
}
|
||||
@ -273,7 +271,7 @@ const DivisionStepComponent = (props: DivisionStepProps) => {
|
||||
};
|
||||
|
||||
// 查看评价人员的指标分工
|
||||
const handleViewAssignment = (person: PersonnelItem) => {
|
||||
const handleViewAssignment = (person: SupplierTaskManage.PersonnelItem) => {
|
||||
const assignment = person.indicatorIds;
|
||||
if (!assignment) {
|
||||
message.info('该评价人员尚未设置分工');
|
||||
@ -326,7 +324,7 @@ const DivisionStepComponent = (props: DivisionStepProps) => {
|
||||
// 从上一步获取评价人员列表 - 避免频繁更新
|
||||
useEffect(() => {
|
||||
if (!taskFormData.userList) return;
|
||||
setEvaluators(taskFormData.userList as PersonnelItem[]);
|
||||
setEvaluators(taskFormData.userList as SupplierTaskManage.PersonnelItem[]);
|
||||
}, [taskFormData.userList]);
|
||||
|
||||
// 暴露给父组件的方法
|
||||
@ -350,7 +348,7 @@ const DivisionStepComponent = (props: DivisionStepProps) => {
|
||||
};
|
||||
|
||||
// 表格列定义
|
||||
const columns: ColumnsType<PersonnelItem> = [
|
||||
const columns: ColumnsType<SupplierTaskManage.PersonnelItem> = [
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'name',
|
||||
@ -369,7 +367,7 @@ const DivisionStepComponent = (props: DivisionStepProps) => {
|
||||
{
|
||||
title: '是否设置分工',
|
||||
key: 'hasDivision',
|
||||
render: (_: any, record: PersonnelItem) => {
|
||||
render: (_: any, record: SupplierTaskManage.PersonnelItem) => {
|
||||
if (!record.indicatorIds || record.indicatorIds.length === 0)
|
||||
return <Tag color="red">未设置</Tag>;
|
||||
return <Tag color="green">已设置</Tag>;
|
||||
@ -378,7 +376,7 @@ const DivisionStepComponent = (props: DivisionStepProps) => {
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
render: (_: any, record: PersonnelItem) => (
|
||||
render: (_: any, record: SupplierTaskManage.PersonnelItem) => (
|
||||
<Space size="middle">
|
||||
{!record.isSelected && (
|
||||
<>
|
||||
|
Reference in New Issue
Block a user