更改状态从字典接口获取
This commit is contained in:
@ -3,18 +3,16 @@ import { Table, Button, Input, message, Space, Form, DatePicker, Select } from '
|
|||||||
import { history, useIntl } from 'umi';
|
import { history, useIntl } from 'umi';
|
||||||
import { SearchOutlined, DeleteOutlined } from '@ant-design/icons';
|
import { SearchOutlined, DeleteOutlined } from '@ant-design/icons';
|
||||||
import { getAnnualResultTaskList } from '@/servers/api/supplierAnnual';
|
import { getAnnualResultTaskList } from '@/servers/api/supplierAnnual';
|
||||||
|
import { getDictList } from '@/servers/api/dicts';
|
||||||
|
import type { DictItem } from '@/servers/api/dicts';
|
||||||
|
|
||||||
const { RangePicker } = DatePicker;
|
const { RangePicker } = DatePicker;
|
||||||
const { Option } = Select;
|
const { Option } = Select;
|
||||||
|
|
||||||
// 定义年度审查状态
|
|
||||||
const statusOptions = [
|
|
||||||
{ label: '待审核', value: '0' },
|
|
||||||
{ label: '审核中', value: '1' },
|
|
||||||
{ label: '已完成', value: '2' },
|
|
||||||
];
|
|
||||||
|
|
||||||
const SupplierAnnualResult: React.FC = () => {
|
const SupplierAnnualResult: React.FC = () => {
|
||||||
|
// 定义年度审查状态
|
||||||
|
const [statusOptions, setStatusOptions] = useState<DictItem[]>([]);
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [loading, setLoading] = useState<boolean>(false);
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
@ -57,7 +55,13 @@ const SupplierAnnualResult: React.FC = () => {
|
|||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
useEffect(() => {
|
||||||
|
getDictList('project_status ').then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
setStatusOptions(res.data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
// 监听搜索参数和分页变化,自动请求数据
|
// 监听搜索参数和分页变化,自动请求数据
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchList();
|
fetchList();
|
||||||
@ -194,8 +198,8 @@ const SupplierAnnualResult: React.FC = () => {
|
|||||||
<Form.Item name="status" label={intl.formatMessage({ id: 'supplierAnnualResult.list.status' })}>
|
<Form.Item name="status" label={intl.formatMessage({ id: 'supplierAnnualResult.list.status' })}>
|
||||||
<Select placeholder={intl.formatMessage({ id: 'supplierAnnualResult.list.pleaseSelectStatus' })} allowClear style={{ width: 150 }}>
|
<Select placeholder={intl.formatMessage({ id: 'supplierAnnualResult.list.pleaseSelectStatus' })} allowClear style={{ width: 150 }}>
|
||||||
{statusOptions.map(item => (
|
{statusOptions.map(item => (
|
||||||
<Option key={item.value} value={item.value}>
|
<Option key={item.code} value={item.code}>
|
||||||
{item.label}
|
{item.dicName}
|
||||||
</Option>
|
</Option>
|
||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
|
@ -213,11 +213,9 @@ const SupplierAnnualReview: React.FC = () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: intl.formatMessage({ id: 'supplierAnnualReview.list.status' }),
|
title: intl.formatMessage({ id: 'supplierAnnualReview.list.status' }),
|
||||||
dataIndex: 'reviewStatus',
|
dataIndex: 'reviewStatusName',
|
||||||
key: 'reviewStatus',
|
key: 'reviewStatusName',
|
||||||
width: 100,
|
width: 100
|
||||||
render: (status: string, record: supplierAnnualReview.ReviewRecord) =>
|
|
||||||
getStatusTag(status, record.reviewStatusName),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: intl.formatMessage({ id: 'supplierAnnualReview.common.operation' }),
|
title: intl.formatMessage({ id: 'supplierAnnualReview.common.operation' }),
|
||||||
|
Reference in New Issue
Block a user