模板管理新增时,获取选择模板接口增加type字段;
评价结果审批状态通过字典获取
This commit is contained in:
@ -79,7 +79,7 @@ const SupplierAnnualTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, disp
|
|||||||
const fetchTemplateList = async () => {
|
const fetchTemplateList = async () => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const res = await getAllAnnualTemplates({ status: '1' });
|
const res = await getAllAnnualTemplates({ status: '1', type: 'currentUnit' });
|
||||||
if (res.success && res.data) {
|
if (res.success && res.data) {
|
||||||
// 如果是修改,需要过滤掉自己
|
// 如果是修改,需要过滤掉自己
|
||||||
if (location.state?.editData) {
|
if (location.state?.editData) {
|
||||||
@ -144,7 +144,7 @@ const SupplierAnnualTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, disp
|
|||||||
if (location.state?.editData?.id && dispatch) {
|
if (location.state?.editData?.id && dispatch) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'breadcrumb/updateBreadcrumbName',
|
type: 'breadcrumb/updateBreadcrumbName',
|
||||||
payload: intl.formatMessage({ id: "supplierAnnualTemplateManage.add.edit" }),
|
payload: intl.formatMessage({ id: 'supplierAnnualTemplateManage.add.edit' }),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,17 +13,17 @@ import {
|
|||||||
message,
|
message,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import type { TablePaginationConfig } from 'antd';
|
import type { TablePaginationConfig } from 'antd';
|
||||||
import {
|
import { SearchOutlined, DeleteOutlined } from '@ant-design/icons';
|
||||||
SearchOutlined,
|
|
||||||
DeleteOutlined,
|
|
||||||
} from '@ant-design/icons';
|
|
||||||
import { TaskStatusText, TaskStatusColor } from '@/dicts/supplierTaskDict';
|
import { TaskStatusText, TaskStatusColor } from '@/dicts/supplierTaskDict';
|
||||||
import { history, useIntl } from 'umi';
|
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 { getDictList } from '@/servers/api/dicts';
|
||||||
import type { DictItem } from '@/servers/api/dicts';
|
import type { DictItem } from '@/servers/api/dicts';
|
||||||
|
import { render } from 'react-dom';
|
||||||
|
|
||||||
|
|
||||||
// 扩展评价任务搜索参数类型
|
// 扩展评价任务搜索参数类型
|
||||||
interface EvaluateTaskSearchParams {
|
interface EvaluateTaskSearchParams {
|
||||||
@ -33,29 +33,26 @@ interface EvaluateTaskSearchParams {
|
|||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const { Option } = Select;
|
const { Option } = Select;
|
||||||
const { RangePicker } = DatePicker;
|
const { RangePicker } = DatePicker;
|
||||||
|
|
||||||
const SupplierEvaluateResult: React.FC = () => {
|
const SupplierEvaluateResult: React.FC = () => {
|
||||||
const userId = sessionStorage.getItem('userId') || '';
|
const userId = sessionStorage.getItem('userId') || '';
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const [loading, setLoading] = useState < boolean > (false);
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [resultData, setResultData] = useState < SupplierEvaluateResult.EvaluateTaskItem[] > ([]);
|
const [resultData, setResultData] = useState<SupplierEvaluateResult.EvaluateTaskItem[]>([]);
|
||||||
const [pagination, setPagination] = useState < TablePaginationConfig > ({
|
const [pagination, setPagination] = useState<TablePaginationConfig>({
|
||||||
current: 1,
|
current: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
total: 0,
|
total: 0,
|
||||||
showSizeChanger: true,
|
showSizeChanger: true,
|
||||||
showQuickJumper: true,
|
showQuickJumper: true,
|
||||||
showTotal: (total) => intl.formatMessage(
|
showTotal: (total) =>
|
||||||
{ id: 'supplierEvaluateResult.pagination.total' },
|
intl.formatMessage({ id: 'supplierEvaluateResult.pagination.total' }, { total }),
|
||||||
{ total }
|
|
||||||
),
|
|
||||||
});
|
});
|
||||||
const [searchParams, setSearchParams] = useState < EvaluateTaskSearchParams > ({});
|
const [searchParams, setSearchParams] = useState<EvaluateTaskSearchParams>({});
|
||||||
const [evaluateStatus, setEvaluateStatus] = useState < DictItem[] > ([]);
|
const [evaluateStatus, setEvaluateStatus] = useState<DictItem[]>([]);
|
||||||
// 获取评价结果列表
|
// 获取评价结果列表
|
||||||
const fetchResultList = async (
|
const fetchResultList = async (
|
||||||
current = 1,
|
current = 1,
|
||||||
@ -75,7 +72,7 @@ const SupplierEvaluateResult: React.FC = () => {
|
|||||||
pageNo: current,
|
pageNo: current,
|
||||||
pageSize: pageSize,
|
pageSize: pageSize,
|
||||||
},
|
},
|
||||||
selectBy: "create",
|
selectBy: 'create',
|
||||||
};
|
};
|
||||||
|
|
||||||
// 添加搜索条件
|
// 添加搜索条件
|
||||||
@ -96,7 +93,7 @@ const SupplierEvaluateResult: React.FC = () => {
|
|||||||
const { records, total, current: currentPage, size } = response.data;
|
const { records, total, current: currentPage, size } = response.data;
|
||||||
|
|
||||||
// 处理数据,增加表格需要的key属性
|
// 处理数据,增加表格需要的key属性
|
||||||
const formattedData = records.map(record => ({
|
const formattedData = records.map((record) => ({
|
||||||
...record,
|
...record,
|
||||||
key: record.id,
|
key: record.id,
|
||||||
}));
|
}));
|
||||||
@ -109,7 +106,10 @@ const SupplierEvaluateResult: React.FC = () => {
|
|||||||
total,
|
total,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
message.error(response.message || intl.formatMessage({ id: 'supplierEvaluateResult.message.fetchFailed' }));
|
message.error(
|
||||||
|
response.message ||
|
||||||
|
intl.formatMessage({ id: 'supplierEvaluateResult.message.fetchFailed' }),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取评价结果列表失败:', error);
|
console.error('获取评价结果列表失败:', error);
|
||||||
@ -118,6 +118,7 @@ const SupplierEvaluateResult: React.FC = () => {
|
|||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const [approveTypeList, setApproveTypeList] = useState<DictItem[]>([]);
|
||||||
|
|
||||||
// 首次加载获取数据
|
// 首次加载获取数据
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -127,6 +128,12 @@ const SupplierEvaluateResult: React.FC = () => {
|
|||||||
setEvaluateStatus(res.data);
|
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' }),
|
title: intl.formatMessage({ id: 'supplierEvaluateResult.confirm.title' }),
|
||||||
content: intl.formatMessage(
|
content: intl.formatMessage(
|
||||||
{ id: 'supplierEvaluateResult.confirm.content' },
|
{ id: 'supplierEvaluateResult.confirm.content' },
|
||||||
{ theme: record.evaluateTheme }
|
{ theme: record.evaluateTheme },
|
||||||
),
|
),
|
||||||
okText: intl.formatMessage({ id: 'supplierEvaluateResult.confirm.ok' }),
|
okText: intl.formatMessage({ id: 'supplierEvaluateResult.confirm.ok' }),
|
||||||
cancelText: intl.formatMessage({ id: 'supplierEvaluateResult.confirm.cancel' }),
|
cancelText: intl.formatMessage({ id: 'supplierEvaluateResult.confirm.cancel' }),
|
||||||
@ -166,17 +173,22 @@ const SupplierEvaluateResult: React.FC = () => {
|
|||||||
try {
|
try {
|
||||||
const response = await submitTaskForApproval(record.id);
|
const response = await submitTaskForApproval(record.id);
|
||||||
if (response.success) {
|
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);
|
fetchResultList(pagination.current, pagination.pageSize, searchParams);
|
||||||
} else {
|
} else {
|
||||||
message.error(response.message || intl.formatMessage({ id: 'supplierEvaluateResult.message.approveFailed' }));
|
message.error(
|
||||||
|
response.message ||
|
||||||
|
intl.formatMessage({ id: 'supplierEvaluateResult.message.approveFailed' }),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('提交审批失败:', error);
|
console.error('提交审批失败:', error);
|
||||||
message.error(intl.formatMessage({ id: 'supplierEvaluateResult.message.approveError' }));
|
message.error(intl.formatMessage({ id: 'supplierEvaluateResult.message.approveError' }));
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -184,11 +196,10 @@ const SupplierEvaluateResult: React.FC = () => {
|
|||||||
const handleViewDetail = (record: SupplierEvaluateResult.EvaluateTaskItem) => {
|
const handleViewDetail = (record: SupplierEvaluateResult.EvaluateTaskItem) => {
|
||||||
history.push({
|
history.push({
|
||||||
pathname: 'supplierEvaluateResultInfo',
|
pathname: 'supplierEvaluateResultInfo',
|
||||||
state: { record }
|
state: { record },
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: intl.formatMessage({ id: 'supplierEvaluateResult.column.index' }),
|
title: intl.formatMessage({ id: 'supplierEvaluateResult.column.index' }),
|
||||||
@ -219,7 +230,10 @@ const SupplierEvaluateResult: React.FC = () => {
|
|||||||
showTitle: false,
|
showTitle: false,
|
||||||
},
|
},
|
||||||
render: (text: string) => (
|
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' })}
|
{text || intl.formatMessage({ id: 'supplierEvaluateResult.text.unspecified' })}
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
),
|
),
|
||||||
@ -258,9 +272,12 @@ const SupplierEvaluateResult: React.FC = () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: intl.formatMessage({ id: 'supplierEvaluateResult.column.approveName' }),
|
title: intl.formatMessage({ id: 'supplierEvaluateResult.column.approveName' }),
|
||||||
dataIndex: 'approveName',
|
dataIndex: 'approveStatus',
|
||||||
key: 'approveName',
|
key: 'approveStatus',
|
||||||
width: 100,
|
width: 100,
|
||||||
|
render: (text: string, record: any) => (
|
||||||
|
<div>{approveTypeList.find((item) => item.code === text)?.dicName || '-'}</div>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: intl.formatMessage({ id: 'supplierEvaluateResult.column.action' }),
|
title: intl.formatMessage({ id: 'supplierEvaluateResult.column.action' }),
|
||||||
@ -278,11 +295,16 @@ const SupplierEvaluateResult: React.FC = () => {
|
|||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{record.approveStatus === '0' && userId == '8' && (
|
{record.approveStatus === '0' && userId == '8' && (
|
||||||
<Button type="link" onClick={() => {
|
<Button
|
||||||
supplierChangeApprove({ workFlowId: record.workFlowId, approveStatus: '1' }).then(() => {
|
type="link"
|
||||||
handleReset()
|
onClick={() => {
|
||||||
})
|
supplierChangeApprove({ workFlowId: record.workFlowId, approveStatus: '1' }).then(
|
||||||
}}>
|
() => {
|
||||||
|
handleReset();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
>
|
||||||
审批
|
审批
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
@ -294,27 +316,38 @@ const SupplierEvaluateResult: React.FC = () => {
|
|||||||
return (
|
return (
|
||||||
<div className="common-container">
|
<div className="common-container">
|
||||||
<div className="filter-action-row">
|
<div className="filter-action-row">
|
||||||
<Form
|
<Form form={form} layout="inline" onFinish={handleSearch} className="filter-form">
|
||||||
form={form}
|
<Form.Item
|
||||||
layout="inline"
|
name="evaluateTheme"
|
||||||
onFinish={handleSearch}
|
label={intl.formatMessage({ id: 'supplierEvaluateResult.form.evaluateTheme' })}
|
||||||
className="filter-form"
|
>
|
||||||
>
|
<Input
|
||||||
<Form.Item name="evaluateTheme" label={intl.formatMessage({ id: 'supplierEvaluateResult.form.evaluateTheme' })}>
|
placeholder={intl.formatMessage({
|
||||||
<Input placeholder={intl.formatMessage({ id: 'supplierEvaluateResult.form.placeholder.evaluateTheme' })} allowClear />
|
id: 'supplierEvaluateResult.form.placeholder.evaluateTheme',
|
||||||
|
})}
|
||||||
|
allowClear
|
||||||
|
/>
|
||||||
</Form.Item>
|
</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
|
<RangePicker
|
||||||
placeholder={[
|
placeholder={[
|
||||||
intl.formatMessage({ id: 'supplierEvaluateResult.form.placeholder.startDate' }),
|
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"
|
format="YYYY-MM-DD"
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</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
|
<Select
|
||||||
placeholder={intl.formatMessage({ id: 'supplierEvaluateResult.form.placeholder.status' })}
|
placeholder={intl.formatMessage({
|
||||||
|
id: 'supplierEvaluateResult.form.placeholder.status',
|
||||||
|
})}
|
||||||
allowClear
|
allowClear
|
||||||
style={{ width: 150 }}
|
style={{ width: 150 }}
|
||||||
>
|
>
|
||||||
@ -329,12 +362,7 @@ const SupplierEvaluateResult: React.FC = () => {
|
|||||||
<Button type="primary" icon={<SearchOutlined />} onClick={() => form.submit()}>
|
<Button type="primary" icon={<SearchOutlined />} onClick={() => form.submit()}>
|
||||||
{intl.formatMessage({ id: 'supplierEvaluateResult.button.search' })}
|
{intl.formatMessage({ id: 'supplierEvaluateResult.button.search' })}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button type="primary" danger icon={<DeleteOutlined />} onClick={handleReset}>
|
||||||
type="primary"
|
|
||||||
danger
|
|
||||||
icon={<DeleteOutlined />}
|
|
||||||
onClick={handleReset}
|
|
||||||
>
|
|
||||||
{intl.formatMessage({ id: 'supplierEvaluateResult.button.reset' })}
|
{intl.formatMessage({ id: 'supplierEvaluateResult.button.reset' })}
|
||||||
</Button>
|
</Button>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
@ -92,7 +92,7 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
|
|||||||
// 获取所有模板列表
|
// 获取所有模板列表
|
||||||
const fetchTemplateList = async () => {
|
const fetchTemplateList = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await getAllTemplates({ status: '1' });
|
const res = await getAllTemplates({ status: '1', type: 'currentUnit' });
|
||||||
if (res.success && res.data) {
|
if (res.success && res.data) {
|
||||||
// 如果是修改,需要过滤掉自己
|
// 如果是修改,需要过滤掉自己
|
||||||
if (location.state?.editData) {
|
if (location.state?.editData) {
|
||||||
@ -234,10 +234,9 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
|
|||||||
// 校验每个一级指标下的二级指标之和是否等于该一级指标分值
|
// 校验每个一级指标下的二级指标之和是否等于该一级指标分值
|
||||||
for (const stItem of templateData) {
|
for (const stItem of templateData) {
|
||||||
const firstLevelScore = parseFloat(stItem.score || '0');
|
const firstLevelScore = parseFloat(stItem.score || '0');
|
||||||
const secondLevelTotal = stItem.indicatorNdList?.reduce(
|
const secondLevelTotal =
|
||||||
(acc, ndItem) => acc + parseFloat(ndItem.score || '0'),
|
stItem.indicatorNdList?.reduce((acc, ndItem) => acc + parseFloat(ndItem.score || '0'), 0) ||
|
||||||
0,
|
0;
|
||||||
) || 0;
|
|
||||||
|
|
||||||
if (secondLevelTotal !== firstLevelScore) {
|
if (secondLevelTotal !== firstLevelScore) {
|
||||||
message.error(`二级指标分值之和必须等于其一级指标的分值`);
|
message.error(`二级指标分值之和必须等于其一级指标的分值`);
|
||||||
@ -305,8 +304,8 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
|
|||||||
message.error(intl.formatMessage({ id: 'supplierTemplateManage.message.addIndicator' }));
|
message.error(intl.formatMessage({ id: 'supplierTemplateManage.message.addIndicator' }));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 校验分数
|
// 校验分数
|
||||||
if (!validateScore()) {
|
if (!validateScore()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ export async function getAnnualTemplateList(params: supplierAnnualTemplateManage
|
|||||||
* 获取所有供应商年度模板列表
|
* 获取所有供应商年度模板列表
|
||||||
* @returns Promise
|
* @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', {
|
return request<supplierAnnualTemplateManage.AllTemplatesResponse>('/annualreview/template/getAllList', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params
|
params
|
||||||
|
@ -3,7 +3,7 @@ import request from '@/utils/request';
|
|||||||
* 获取所有模板列表
|
* 获取所有模板列表
|
||||||
* @returns 所有模板列表
|
* @returns 所有模板列表
|
||||||
*/
|
*/
|
||||||
export async function getAllTemplates(params?: {status: string}) {
|
export async function getAllTemplates(params?: { status: string, type: string }) {
|
||||||
return request('/coscoEvaluate/template/getAllList', {
|
return request('/coscoEvaluate/template/getAllList', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params
|
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