Compare commits
2 Commits
3cf4e0298c
...
a524a91494
Author | SHA1 | Date | |
---|---|---|---|
a524a91494 | |||
8d8d5eb638 |
@ -307,7 +307,7 @@ export default [
|
||||
},
|
||||
{
|
||||
name: '年审打分',
|
||||
path: 'supplierAnnual/supplierAnnualScore',
|
||||
path: '/supplierAnnual/supplierAnnualScore',
|
||||
hideInMenu: true,
|
||||
icon: 'icon-dafen',
|
||||
component: '@/pages/supplierAnnualManage/supplierAnnualReview/supplierAnnualScore',
|
||||
|
@ -32,4 +32,9 @@
|
||||
color: #faad14;
|
||||
margin-left: 4px;
|
||||
}
|
||||
.required {
|
||||
color: red;
|
||||
vertical-align: middle;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
@ -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<ScoreEvaluationTableProps> = ({
|
||||
ndScore: stItem.score || '0',
|
||||
score: stItem.actualScore || '',
|
||||
remark: stItem.remark || '',
|
||||
isStar: stItem.isStar || '',
|
||||
});
|
||||
} else {
|
||||
// 处理二级指标
|
||||
@ -107,7 +102,7 @@ const ScoreEvaluationTable: React.FC<ScoreEvaluationTableProps> = ({
|
||||
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<ScoreEvaluationTableProps> = ({
|
||||
// 将表格数据转换回API格式
|
||||
const convertTableDataToApiData = (tableData: TableRowItem[]): any[] => {
|
||||
// 按一级指标分组
|
||||
const groupedByLevel1 = tableData.reduce((acc: Record<string, TableRowItem[]>, item: TableRowItem) => {
|
||||
const groupKey = item.baseIndicator || `empty-${item.key}`;
|
||||
const groupedByLevel1 = tableData.reduce(
|
||||
(acc: Record<string, TableRowItem[]>, 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<ScoreEvaluationTableProps> = ({
|
||||
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<ScoreEvaluationTableProps> = ({
|
||||
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<ScoreEvaluationTableProps> = ({
|
||||
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<ScoreEvaluationTableProps> = ({
|
||||
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<ScoreEvaluationTableProps> = ({
|
||||
key: 'subIndicator',
|
||||
align: 'center' as const,
|
||||
width: 200,
|
||||
render: (text: string) => text || '-',
|
||||
render: (text: string, record: TableRowItem) => (
|
||||
<>
|
||||
{/* 是否必填 1是 0否 */}
|
||||
{record.isStar && record.isStar === '1' && (
|
||||
<span className="required">*</span>
|
||||
)}
|
||||
{text || '-'}
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({ id: 'supplierEvaluateScore.scoreTable.subScore' }),
|
||||
@ -317,14 +330,18 @@ const ScoreEvaluationTable: React.FC<ScoreEvaluationTableProps> = ({
|
||||
return text || '-';
|
||||
}
|
||||
return (
|
||||
<InputNumber
|
||||
min={0}
|
||||
max={parseFloat(record.ndScore) || 0}
|
||||
value={text ? parseFloat(String(text)) : undefined}
|
||||
onChange={(val) => handleInputChange(val, record, 'score')}
|
||||
style={{ width: '100%' }}
|
||||
placeholder={intl.formatMessage({ id: 'supplierEvaluateScore.scoreTable.placeholder.score' })}
|
||||
/>
|
||||
<>
|
||||
<InputNumber
|
||||
min={0}
|
||||
max={parseFloat(record.ndScore) || 0}
|
||||
value={text ? parseFloat(String(text)) : undefined}
|
||||
onChange={(val) => handleInputChange(val, record, 'score')}
|
||||
style={{ width: '100%' }}
|
||||
placeholder={intl.formatMessage({
|
||||
id: 'supplierEvaluateScore.scoreTable.placeholder.score',
|
||||
})}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
},
|
||||
},
|
||||
@ -345,7 +362,9 @@ const ScoreEvaluationTable: React.FC<ScoreEvaluationTableProps> = ({
|
||||
<TextArea
|
||||
value={text}
|
||||
onChange={(e) => handleInputChange(e.target.value, record, 'remark')}
|
||||
placeholder={intl.formatMessage({ id: 'supplierEvaluateScore.scoreTable.placeholder.remark' })}
|
||||
placeholder={intl.formatMessage({
|
||||
id: 'supplierEvaluateScore.scoreTable.placeholder.remark',
|
||||
})}
|
||||
autoSize={{ minRows: 1, maxRows: 3 }}
|
||||
/>
|
||||
);
|
||||
@ -366,7 +385,9 @@ const ScoreEvaluationTable: React.FC<ScoreEvaluationTableProps> = ({
|
||||
size="middle"
|
||||
loading={loading}
|
||||
scroll={{ x: 'max-content' }}
|
||||
locale={{ emptyText: intl.formatMessage({ id: 'supplierEvaluateScore.scoreTable.emptyText' }) }}
|
||||
locale={{
|
||||
emptyText: intl.formatMessage({ id: 'supplierEvaluateScore.scoreTable.emptyText' }),
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
@ -14,7 +14,11 @@
|
||||
margin-left: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.require{
|
||||
color: red;
|
||||
margin-right: 5px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.content-area {
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@ interface ScoreFormItem {
|
||||
description: string;
|
||||
examineResult: string;
|
||||
remark: string;
|
||||
isStar: string; // 是否为星号项
|
||||
}
|
||||
|
||||
const SupplierAnnualReviewScore: React.FC = () => {
|
||||
@ -76,7 +77,9 @@ const SupplierAnnualReviewScore: React.FC = () => {
|
||||
message.warning(intl.formatMessage({ id: 'supplierAnnualReview.score.noScoreItemData' }));
|
||||
}
|
||||
} else {
|
||||
message.error(res.message || intl.formatMessage({ id: 'supplierAnnualReview.detail.getDetailFailed' }));
|
||||
message.error(
|
||||
res.message || intl.formatMessage({ id: 'supplierAnnualReview.detail.getDetailFailed' }),
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取审查详情失败:', error);
|
||||
@ -128,7 +131,9 @@ const SupplierAnnualReviewScore: React.FC = () => {
|
||||
message.success(intl.formatMessage({ id: 'supplierAnnualReview.score.submitSuccess' }));
|
||||
history.goBack();
|
||||
} else {
|
||||
message.error(res.message || intl.formatMessage({ id: 'supplierAnnualReview.score.submitFailed' }));
|
||||
message.error(
|
||||
res.message || intl.formatMessage({ id: 'supplierAnnualReview.score.submitFailed' }),
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('评审提交失败:', error);
|
||||
@ -142,6 +147,21 @@ const SupplierAnnualReviewScore: React.FC = () => {
|
||||
try {
|
||||
// 表单验证
|
||||
await form.validateFields();
|
||||
const formValues = form.getFieldsValue();
|
||||
const scoreVoList = scoreItems.map((item) => ({
|
||||
id: item.id,
|
||||
name: item.itemName,
|
||||
description: item.description,
|
||||
examineResult: formValues[`examineResult_${item.id}`],
|
||||
remark: formValues[`remark_${item.id}`] || '',
|
||||
isStar: item.isStar, // 是否为星号项
|
||||
}));
|
||||
// 检查所有星号项是否必填
|
||||
const validateIsStar = scoreVoList.some((item) => item.isStar == '1' && !item.examineResult);
|
||||
if (validateIsStar) {
|
||||
message.warning('请填写所有星号项的评审结果!');
|
||||
return;
|
||||
}
|
||||
|
||||
// 确认提交
|
||||
Modal.confirm({
|
||||
@ -159,7 +179,8 @@ const SupplierAnnualReviewScore: React.FC = () => {
|
||||
|
||||
// 获取状态标签
|
||||
const getStatusTag = (status: string | undefined, statusName: string | undefined) => {
|
||||
if (!status) return <Tag>{intl.formatMessage({ id: 'supplierAnnualReview.common.unknownStatus' })}</Tag>;
|
||||
if (!status)
|
||||
return <Tag>{intl.formatMessage({ id: 'supplierAnnualReview.common.unknownStatus' })}</Tag>;
|
||||
const color =
|
||||
AnnualReviewStatusColor[status as keyof typeof AnnualReviewStatusColor] || 'default';
|
||||
const text =
|
||||
@ -183,23 +204,47 @@ const SupplierAnnualReviewScore: React.FC = () => {
|
||||
<Spin spinning={loading}>
|
||||
{reviewDetail ? (
|
||||
<>
|
||||
<Card title={intl.formatMessage({ id: 'supplierAnnualReview.score.basicInfo' })} bordered={false} className={styles['detail-card']}>
|
||||
<Card
|
||||
title={intl.formatMessage({ id: 'supplierAnnualReview.score.basicInfo' })}
|
||||
bordered={false}
|
||||
className={styles['detail-card']}
|
||||
>
|
||||
<Descriptions column={2} bordered>
|
||||
<Descriptions.Item label={intl.formatMessage({ id: 'supplierAnnualReview.list.reviewTheme' })}>
|
||||
<Descriptions.Item
|
||||
label={intl.formatMessage({ id: 'supplierAnnualReview.list.reviewTheme' })}
|
||||
>
|
||||
{reviewDetail.annualreviewTheme}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label={intl.formatMessage({ id: 'supplierAnnualReview.list.supplierName' })}>
|
||||
<a onClick={() => supplierDetailModal?.(reviewDetail.supplierId)}>{reviewDetail.name}</a>
|
||||
<Descriptions.Item
|
||||
label={intl.formatMessage({ id: 'supplierAnnualReview.list.supplierName' })}
|
||||
>
|
||||
<a onClick={() => supplierDetailModal?.(reviewDetail.supplierId)}>
|
||||
{reviewDetail.name}
|
||||
</a>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label={intl.formatMessage({ id: 'supplierAnnualReview.list.department' })}>
|
||||
<Descriptions.Item
|
||||
label={intl.formatMessage({ id: 'supplierAnnualReview.list.department' })}
|
||||
>
|
||||
{reviewDetail.deptName || '-'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label={intl.formatMessage({ id: 'supplierAnnualReview.list.reviewer' })}>
|
||||
<Descriptions.Item
|
||||
label={intl.formatMessage({ id: 'supplierAnnualReview.list.reviewer' })}
|
||||
>
|
||||
{reviewDetail.reviewerName || '-'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label={intl.formatMessage({ id: 'supplierAnnualReview.list.startTime' })}>{reviewDetail.startTime}</Descriptions.Item>
|
||||
<Descriptions.Item label={intl.formatMessage({ id: 'supplierAnnualReview.list.endTime' })}>{reviewDetail.endTime}</Descriptions.Item>
|
||||
<Descriptions.Item label={intl.formatMessage({ id: 'supplierAnnualReview.list.status' })}>
|
||||
<Descriptions.Item
|
||||
label={intl.formatMessage({ id: 'supplierAnnualReview.list.startTime' })}
|
||||
>
|
||||
{reviewDetail.startTime}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
label={intl.formatMessage({ id: 'supplierAnnualReview.list.endTime' })}
|
||||
>
|
||||
{reviewDetail.endTime}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
label={intl.formatMessage({ id: 'supplierAnnualReview.list.status' })}
|
||||
>
|
||||
{reviewDetail.reviewStatusName || '-'}
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
@ -207,7 +252,11 @@ const SupplierAnnualReviewScore: React.FC = () => {
|
||||
|
||||
<Divider />
|
||||
|
||||
<Card title={intl.formatMessage({ id: 'supplierAnnualReview.score.examineResult' })} bordered={false} className={styles['detail-card']}>
|
||||
<Card
|
||||
title={intl.formatMessage({ id: 'supplierAnnualReview.score.examineResult' })}
|
||||
bordered={false}
|
||||
className={styles['detail-card']}
|
||||
>
|
||||
<Form form={form} layout="vertical" className={styles['score-form']}>
|
||||
{scoreItems.length > 0 ? (
|
||||
<Table
|
||||
@ -221,20 +270,22 @@ const SupplierAnnualReviewScore: React.FC = () => {
|
||||
title: intl.formatMessage({ id: 'supplierAnnualReview.score.scoreItem' }),
|
||||
dataIndex: 'itemName',
|
||||
width: '15%',
|
||||
render: (text, record) => (
|
||||
<div>
|
||||
{record.isStar == '1' && <span className={styles['require']}>*</span>}
|
||||
{text}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
// {
|
||||
// title: intl.formatMessage({ id: 'supplierAnnualReview.score.scoreItemDesc' }),
|
||||
// dataIndex: 'description',
|
||||
// width: '25%',
|
||||
// },
|
||||
{
|
||||
title: intl.formatMessage({ id: 'supplierAnnualReview.detail.examineResult' }),
|
||||
title: intl.formatMessage({
|
||||
id: 'supplierAnnualReview.detail.examineResult',
|
||||
}),
|
||||
dataIndex: 'examineResult',
|
||||
width: '25%',
|
||||
render: (_, record) => (
|
||||
<Form.Item
|
||||
name={`examineResult_${record.id}`}
|
||||
rules={[{ required: true, message: intl.formatMessage({ id: 'supplierAnnualReview.score.pleaseSelectResult' }) }]}
|
||||
style={{ marginBottom: 0 }}
|
||||
>
|
||||
<Radio.Group>
|
||||
@ -249,17 +300,18 @@ const SupplierAnnualReviewScore: React.FC = () => {
|
||||
),
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({ id: 'supplierAnnualReview.score.examineRemark' }),
|
||||
title: intl.formatMessage({
|
||||
id: 'supplierAnnualReview.score.examineRemark',
|
||||
}),
|
||||
dataIndex: 'remark',
|
||||
width: '35%',
|
||||
render: (_, record) => (
|
||||
<Form.Item
|
||||
name={`remark_${record.id}`}
|
||||
style={{ marginBottom: 0 }}
|
||||
>
|
||||
<Form.Item name={`remark_${record.id}`} style={{ marginBottom: 0 }}>
|
||||
<TextArea
|
||||
rows={2}
|
||||
placeholder={intl.formatMessage({ id: 'supplierAnnualReview.score.pleaseInputRemark' })}
|
||||
placeholder={intl.formatMessage({
|
||||
id: 'supplierAnnualReview.score.pleaseInputRemark',
|
||||
})}
|
||||
maxLength={200}
|
||||
/>
|
||||
</Form.Item>
|
||||
@ -268,7 +320,11 @@ const SupplierAnnualReviewScore: React.FC = () => {
|
||||
]}
|
||||
/>
|
||||
) : (
|
||||
<Empty description={intl.formatMessage({ id: 'supplierAnnualReview.score.noScoreItemData' })} />
|
||||
<Empty
|
||||
description={intl.formatMessage({
|
||||
id: 'supplierAnnualReview.score.noScoreItemData',
|
||||
})}
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className={styles['score-actions']}>
|
||||
@ -285,7 +341,11 @@ const SupplierAnnualReviewScore: React.FC = () => {
|
||||
</Card>
|
||||
</>
|
||||
) : (
|
||||
!loading && <Empty description={intl.formatMessage({ id: 'supplierAnnualReview.detail.noDetailData' })} />
|
||||
!loading && (
|
||||
<Empty
|
||||
description={intl.formatMessage({ id: 'supplierAnnualReview.detail.noDetailData' })}
|
||||
/>
|
||||
)
|
||||
)}
|
||||
</Spin>
|
||||
</Card>
|
||||
|
@ -79,7 +79,7 @@ const SupplierAnnualTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, disp
|
||||
const fetchTemplateList = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const res = await getAllAnnualTemplates({ status: '1' });
|
||||
const res = await getAllAnnualTemplates({ status: '1', type: 'currentUnit' });
|
||||
if (res.success && res.data) {
|
||||
// 如果是修改,需要过滤掉自己
|
||||
if (location.state?.editData) {
|
||||
@ -144,7 +144,7 @@ const SupplierAnnualTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, disp
|
||||
if (location.state?.editData?.id && dispatch) {
|
||||
dispatch({
|
||||
type: 'breadcrumb/updateBreadcrumbName',
|
||||
payload: intl.formatMessage({ id: "supplierAnnualTemplateManage.add.edit" }),
|
||||
payload: intl.formatMessage({ id: 'supplierAnnualTemplateManage.add.edit' }),
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -13,17 +13,17 @@ import {
|
||||
message,
|
||||
} from 'antd';
|
||||
import type { TablePaginationConfig } from 'antd';
|
||||
import {
|
||||
SearchOutlined,
|
||||
DeleteOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import { SearchOutlined, DeleteOutlined } from '@ant-design/icons';
|
||||
import { TaskStatusText, TaskStatusColor } from '@/dicts/supplierTaskDict';
|
||||
import { history, useIntl } from 'umi';
|
||||
import { getEvaluateResultList, submitTaskForApproval, supplierChangeApprove } from '@/servers/api/supplierEvaluate';
|
||||
import {
|
||||
getEvaluateResultList,
|
||||
submitTaskForApproval,
|
||||
supplierChangeApprove,
|
||||
} from '@/servers/api/supplierEvaluate';
|
||||
import { getDictList } from '@/servers/api/dicts';
|
||||
import type { DictItem } from '@/servers/api/dicts';
|
||||
|
||||
|
||||
import { render } from 'react-dom';
|
||||
|
||||
// 扩展评价任务搜索参数类型
|
||||
interface EvaluateTaskSearchParams {
|
||||
@ -33,29 +33,26 @@ interface EvaluateTaskSearchParams {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
|
||||
const { Option } = Select;
|
||||
const { RangePicker } = DatePicker;
|
||||
|
||||
const SupplierEvaluateResult: React.FC = () => {
|
||||
const userId = sessionStorage.getItem('userId') || '';
|
||||
const intl = useIntl();
|
||||
const [loading, setLoading] = useState < boolean > (false);
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
const [form] = Form.useForm();
|
||||
const [resultData, setResultData] = useState < SupplierEvaluateResult.EvaluateTaskItem[] > ([]);
|
||||
const [pagination, setPagination] = useState < TablePaginationConfig > ({
|
||||
const [resultData, setResultData] = useState<SupplierEvaluateResult.EvaluateTaskItem[]>([]);
|
||||
const [pagination, setPagination] = useState<TablePaginationConfig>({
|
||||
current: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
showTotal: (total) => intl.formatMessage(
|
||||
{ id: 'supplierEvaluateResult.pagination.total' },
|
||||
{ total }
|
||||
),
|
||||
showTotal: (total) =>
|
||||
intl.formatMessage({ id: 'supplierEvaluateResult.pagination.total' }, { total }),
|
||||
});
|
||||
const [searchParams, setSearchParams] = useState < EvaluateTaskSearchParams > ({});
|
||||
const [evaluateStatus, setEvaluateStatus] = useState < DictItem[] > ([]);
|
||||
const [searchParams, setSearchParams] = useState<EvaluateTaskSearchParams>({});
|
||||
const [evaluateStatus, setEvaluateStatus] = useState<DictItem[]>([]);
|
||||
// 获取评价结果列表
|
||||
const fetchResultList = async (
|
||||
current = 1,
|
||||
@ -75,7 +72,7 @@ const SupplierEvaluateResult: React.FC = () => {
|
||||
pageNo: current,
|
||||
pageSize: pageSize,
|
||||
},
|
||||
selectBy: "create",
|
||||
selectBy: 'create',
|
||||
};
|
||||
|
||||
// 添加搜索条件
|
||||
@ -96,7 +93,7 @@ const SupplierEvaluateResult: React.FC = () => {
|
||||
const { records, total, current: currentPage, size } = response.data;
|
||||
|
||||
// 处理数据,增加表格需要的key属性
|
||||
const formattedData = records.map(record => ({
|
||||
const formattedData = records.map((record) => ({
|
||||
...record,
|
||||
key: record.id,
|
||||
}));
|
||||
@ -109,7 +106,10 @@ const SupplierEvaluateResult: React.FC = () => {
|
||||
total,
|
||||
});
|
||||
} else {
|
||||
message.error(response.message || intl.formatMessage({ id: 'supplierEvaluateResult.message.fetchFailed' }));
|
||||
message.error(
|
||||
response.message ||
|
||||
intl.formatMessage({ id: 'supplierEvaluateResult.message.fetchFailed' }),
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取评价结果列表失败:', error);
|
||||
@ -118,6 +118,7 @@ const SupplierEvaluateResult: React.FC = () => {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
const [approveTypeList, setApproveTypeList] = useState<DictItem[]>([]);
|
||||
|
||||
// 首次加载获取数据
|
||||
useEffect(() => {
|
||||
@ -127,6 +128,12 @@ const SupplierEvaluateResult: React.FC = () => {
|
||||
setEvaluateStatus(res.data);
|
||||
}
|
||||
});
|
||||
// 获取审批状态字典
|
||||
getDictList('approve_type').then((res) => {
|
||||
if (res.success) {
|
||||
setApproveTypeList(res.data);
|
||||
}
|
||||
});
|
||||
}, []);
|
||||
|
||||
// 处理表格分页变化
|
||||
@ -158,7 +165,7 @@ const SupplierEvaluateResult: React.FC = () => {
|
||||
title: intl.formatMessage({ id: 'supplierEvaluateResult.confirm.title' }),
|
||||
content: intl.formatMessage(
|
||||
{ id: 'supplierEvaluateResult.confirm.content' },
|
||||
{ theme: record.evaluateTheme }
|
||||
{ theme: record.evaluateTheme },
|
||||
),
|
||||
okText: intl.formatMessage({ id: 'supplierEvaluateResult.confirm.ok' }),
|
||||
cancelText: intl.formatMessage({ id: 'supplierEvaluateResult.confirm.cancel' }),
|
||||
@ -166,17 +173,22 @@ const SupplierEvaluateResult: React.FC = () => {
|
||||
try {
|
||||
const response = await submitTaskForApproval(record.id);
|
||||
if (response.success) {
|
||||
message.success(intl.formatMessage({ id: 'supplierEvaluateResult.message.approveSuccess' }));
|
||||
message.success(
|
||||
intl.formatMessage({ id: 'supplierEvaluateResult.message.approveSuccess' }),
|
||||
);
|
||||
// 刷新数据
|
||||
fetchResultList(pagination.current, pagination.pageSize, searchParams);
|
||||
} else {
|
||||
message.error(response.message || intl.formatMessage({ id: 'supplierEvaluateResult.message.approveFailed' }));
|
||||
message.error(
|
||||
response.message ||
|
||||
intl.formatMessage({ id: 'supplierEvaluateResult.message.approveFailed' }),
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('提交审批失败:', error);
|
||||
message.error(intl.formatMessage({ id: 'supplierEvaluateResult.message.approveError' }));
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@ -184,11 +196,10 @@ const SupplierEvaluateResult: React.FC = () => {
|
||||
const handleViewDetail = (record: SupplierEvaluateResult.EvaluateTaskItem) => {
|
||||
history.push({
|
||||
pathname: 'supplierEvaluateResultInfo',
|
||||
state: { record }
|
||||
state: { record },
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: intl.formatMessage({ id: 'supplierEvaluateResult.column.index' }),
|
||||
@ -219,7 +230,10 @@ const SupplierEvaluateResult: React.FC = () => {
|
||||
showTitle: false,
|
||||
},
|
||||
render: (text: string) => (
|
||||
<Tooltip placement="topLeft" title={text || intl.formatMessage({ id: 'supplierEvaluateResult.text.unspecified' })}>
|
||||
<Tooltip
|
||||
placement="topLeft"
|
||||
title={text || intl.formatMessage({ id: 'supplierEvaluateResult.text.unspecified' })}
|
||||
>
|
||||
{text || intl.formatMessage({ id: 'supplierEvaluateResult.text.unspecified' })}
|
||||
</Tooltip>
|
||||
),
|
||||
@ -258,9 +272,12 @@ const SupplierEvaluateResult: React.FC = () => {
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({ id: 'supplierEvaluateResult.column.approveName' }),
|
||||
dataIndex: 'approveName',
|
||||
key: 'approveName',
|
||||
dataIndex: 'approveStatus',
|
||||
key: 'approveStatus',
|
||||
width: 100,
|
||||
render: (text: string, record: any) => (
|
||||
<div>{approveTypeList.find((item) => item.code === text)?.dicName || '-'}</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({ id: 'supplierEvaluateResult.column.action' }),
|
||||
@ -278,11 +295,16 @@ const SupplierEvaluateResult: React.FC = () => {
|
||||
</Button>
|
||||
)}
|
||||
{record.approveStatus === '0' && userId == '8' && (
|
||||
<Button type="link" onClick={() => {
|
||||
supplierChangeApprove({ workFlowId: record.workFlowId, approveStatus: '1' }).then(() => {
|
||||
handleReset()
|
||||
})
|
||||
}}>
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() => {
|
||||
supplierChangeApprove({ workFlowId: record.workFlowId, approveStatus: '1' }).then(
|
||||
() => {
|
||||
handleReset();
|
||||
},
|
||||
);
|
||||
}}
|
||||
>
|
||||
审批
|
||||
</Button>
|
||||
)}
|
||||
@ -294,27 +316,38 @@ const SupplierEvaluateResult: React.FC = () => {
|
||||
return (
|
||||
<div className="common-container">
|
||||
<div className="filter-action-row">
|
||||
<Form
|
||||
form={form}
|
||||
layout="inline"
|
||||
onFinish={handleSearch}
|
||||
className="filter-form"
|
||||
>
|
||||
<Form.Item name="evaluateTheme" label={intl.formatMessage({ id: 'supplierEvaluateResult.form.evaluateTheme' })}>
|
||||
<Input placeholder={intl.formatMessage({ id: 'supplierEvaluateResult.form.placeholder.evaluateTheme' })} allowClear />
|
||||
<Form form={form} layout="inline" onFinish={handleSearch} className="filter-form">
|
||||
<Form.Item
|
||||
name="evaluateTheme"
|
||||
label={intl.formatMessage({ id: 'supplierEvaluateResult.form.evaluateTheme' })}
|
||||
>
|
||||
<Input
|
||||
placeholder={intl.formatMessage({
|
||||
id: 'supplierEvaluateResult.form.placeholder.evaluateTheme',
|
||||
})}
|
||||
allowClear
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item name="timeRange" label={intl.formatMessage({ id: 'supplierEvaluateResult.form.evaluationTime' })}>
|
||||
<Form.Item
|
||||
name="timeRange"
|
||||
label={intl.formatMessage({ id: 'supplierEvaluateResult.form.evaluationTime' })}
|
||||
>
|
||||
<RangePicker
|
||||
placeholder={[
|
||||
intl.formatMessage({ id: 'supplierEvaluateResult.form.placeholder.startDate' }),
|
||||
intl.formatMessage({ id: 'supplierEvaluateResult.form.placeholder.endDate' })
|
||||
intl.formatMessage({ id: 'supplierEvaluateResult.form.placeholder.endDate' }),
|
||||
]}
|
||||
format="YYYY-MM-DD"
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item name="status" label={intl.formatMessage({ id: 'supplierEvaluateResult.form.status' })}>
|
||||
<Form.Item
|
||||
name="status"
|
||||
label={intl.formatMessage({ id: 'supplierEvaluateResult.form.status' })}
|
||||
>
|
||||
<Select
|
||||
placeholder={intl.formatMessage({ id: 'supplierEvaluateResult.form.placeholder.status' })}
|
||||
placeholder={intl.formatMessage({
|
||||
id: 'supplierEvaluateResult.form.placeholder.status',
|
||||
})}
|
||||
allowClear
|
||||
style={{ width: 150 }}
|
||||
>
|
||||
@ -329,12 +362,7 @@ const SupplierEvaluateResult: React.FC = () => {
|
||||
<Button type="primary" icon={<SearchOutlined />} onClick={() => form.submit()}>
|
||||
{intl.formatMessage({ id: 'supplierEvaluateResult.button.search' })}
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
danger
|
||||
icon={<DeleteOutlined />}
|
||||
onClick={handleReset}
|
||||
>
|
||||
<Button type="primary" danger icon={<DeleteOutlined />} onClick={handleReset}>
|
||||
{intl.formatMessage({ id: 'supplierEvaluateResult.button.reset' })}
|
||||
</Button>
|
||||
</Form.Item>
|
||||
|
@ -84,10 +84,10 @@ const SupplierEvaluateScoreDetail: React.FC = () => {
|
||||
id: subItem.id,
|
||||
subIndicator: subItem.subIndicator,
|
||||
subScore: subItem.subScore, // 二级指标标准分值
|
||||
isStar: subItem.starIndicator,
|
||||
scoreNum: subItem.score || '', // 实际评分值:使用API返回的score字段
|
||||
score: subItem.score || '', // 组件内部显示用
|
||||
remark: subItem.remark || '',
|
||||
isStar: subItem.isStar, // 是否必填
|
||||
};
|
||||
})
|
||||
.filter(Boolean) || [],
|
||||
@ -151,12 +151,12 @@ const SupplierEvaluateScoreDetail: React.FC = () => {
|
||||
const hasEmptyScore = scoreData.some((item) =>
|
||||
item.indicatorNdList.some((subItem: any) => {
|
||||
// 使用scoreNum字段检查是否已评分
|
||||
return !subItem.scoreNum && subItem.scoreNum !== 0;
|
||||
return !subItem.scoreNum && subItem.scoreNum !== 0 && subItem.isStar === '1'; // 只检查必填项
|
||||
}),
|
||||
);
|
||||
|
||||
if (hasEmptyScore) {
|
||||
message.warning(intl.formatMessage({ id: 'supplierEvaluateScore.message.emptyScore' }));
|
||||
message.warning("请填写所有必填项的评分!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ const handleDisableTemplate = (id: string) => {
|
||||
name="tenantName"
|
||||
label={intl.formatMessage({ id: 'supplierTemplateManage.column.tenantName' })}
|
||||
>
|
||||
<AccessDepartmentSelect placeholder={'请选择准入单位'} />
|
||||
<AccessDepartmentSelect placeholder={'请选择创建单位'} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="categoryId"
|
||||
|
@ -92,7 +92,7 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
|
||||
// 获取所有模板列表
|
||||
const fetchTemplateList = async () => {
|
||||
try {
|
||||
const res = await getAllTemplates({ status: '1' });
|
||||
const res = await getAllTemplates({ status: '1', type: 'currentUnit' });
|
||||
if (res.success && res.data) {
|
||||
// 如果是修改,需要过滤掉自己
|
||||
if (location.state?.editData) {
|
||||
@ -234,10 +234,9 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
|
||||
// 校验每个一级指标下的二级指标之和是否等于该一级指标分值
|
||||
for (const stItem of templateData) {
|
||||
const firstLevelScore = parseFloat(stItem.score || '0');
|
||||
const secondLevelTotal = stItem.indicatorNdList?.reduce(
|
||||
(acc, ndItem) => acc + parseFloat(ndItem.score || '0'),
|
||||
0,
|
||||
) || 0;
|
||||
const secondLevelTotal =
|
||||
stItem.indicatorNdList?.reduce((acc, ndItem) => acc + parseFloat(ndItem.score || '0'), 0) ||
|
||||
0;
|
||||
|
||||
if (secondLevelTotal !== firstLevelScore) {
|
||||
message.error(`二级指标分值之和必须等于其一级指标的分值`);
|
||||
@ -305,8 +304,8 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
|
||||
message.error(intl.formatMessage({ id: 'supplierTemplateManage.message.addIndicator' }));
|
||||
return;
|
||||
}
|
||||
// 校验分数
|
||||
if (!validateScore()) {
|
||||
// 校验分数
|
||||
if (!validateScore()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ export async function getAnnualTemplateList(params: supplierAnnualTemplateManage
|
||||
* 获取所有供应商年度模板列表
|
||||
* @returns Promise
|
||||
*/
|
||||
export async function getAllAnnualTemplates(params?: {status: string}) {
|
||||
export async function getAllAnnualTemplates(params?: { status: string, type: string }) {
|
||||
return request<supplierAnnualTemplateManage.AllTemplatesResponse>('/annualreview/template/getAllList', {
|
||||
method: 'GET',
|
||||
params
|
||||
|
@ -3,7 +3,7 @@ import request from '@/utils/request';
|
||||
* 获取所有模板列表
|
||||
* @returns 所有模板列表
|
||||
*/
|
||||
export async function getAllTemplates(params?: {status: string}) {
|
||||
export async function getAllTemplates(params?: { status: string, type: string }) {
|
||||
return request('/coscoEvaluate/template/getAllList', {
|
||||
method: 'GET',
|
||||
params
|
||||
@ -362,4 +362,4 @@ export async function submitTaskForApproval(id: string) {
|
||||
});
|
||||
}
|
||||
|
||||
export const supplierChangeApprove = (data: { workFlowId:string; approveStatus:string }) => request.post('/synchronous/evaluateApprove', { data });
|
||||
export const supplierChangeApprove = (data: { workFlowId: string; approveStatus: string }) => request.post('/synchronous/evaluateApprove', { data });
|
||||
|
Reference in New Issue
Block a user