维护国际化

This commit is contained in:
linxd
2025-07-03 10:21:55 +08:00
parent fafb2cda44
commit cf8e9d0820
61 changed files with 2246 additions and 836 deletions

View File

@ -4,6 +4,7 @@ import { RightOutlined, LeftOutlined } from '@ant-design/icons';
import { getSupplierPage } from '@/servers/api/supplier';
import CategorySelector from '@/components/CategorySelector/CategorySelector';
import './SupplierSelector.less';
import { useIntl } from 'umi';
const { Option } = Select;
@ -56,6 +57,7 @@ const SupplierSelector: React.FC<SupplierSelectorProps> = ({
onSelect,
selectedSuppliers: initialSelectedSuppliers = [],
}) => {
const intl = useIntl();
// 表单实例,用于管理查询条件
const [form] = Form.useForm();
@ -159,14 +161,14 @@ const SupplierSelector: React.FC<SupplierSelectorProps> = ({
});
} else {
// 请求失败,显示错误信息
message.error(response?.message || '获取供应商列表失败');
message.error(response?.message || intl.formatMessage({ id: 'supplierTaskManage.message.fetchSupplierListFailed' }));
setTableListData([]);
setPagination({ current: 1, pageSize: 10, total: 0 });
}
} catch (error) {
// 处理异常情况
console.error('获取供应商列表出错:', error);
message.error('获取供应商列表失败,请稍后重试');
message.error(intl.formatMessage({ id: 'supplierTaskManage.message.fetchSupplierFailed' }));
setTableListData([]);
setPagination({ current: 1, pageSize: 10, total: 0 });
} finally {
@ -233,7 +235,7 @@ const SupplierSelector: React.FC<SupplierSelectorProps> = ({
// 表格列定义
const columns = [
{
title: '供应商名称',
title: intl.formatMessage({ id: 'supplierTaskManage.column.supplierName' }),
dataIndex: 'supplierName',
ellipsis: true,
render: (supplierName: string) => (
@ -243,7 +245,7 @@ const SupplierSelector: React.FC<SupplierSelectorProps> = ({
),
},
{
title: '统一社会信用代码',
title: intl.formatMessage({ id: 'supplierTaskManage.column.socialCreditCode' }),
dataIndex: 'socialCreditCode',
ellipsis: true,
render: (socialCreditCode: string) => (
@ -253,7 +255,7 @@ const SupplierSelector: React.FC<SupplierSelectorProps> = ({
),
},
{
title: '准入品类',
title: intl.formatMessage({ id: 'supplierTaskManage.column.categoryName' }),
dataIndex: 'categoryName',
ellipsis: true,
render: (categoryName: string) => (
@ -269,27 +271,27 @@ const SupplierSelector: React.FC<SupplierSelectorProps> = ({
<div className="supplier-selector">
{/* 查询表单 */}
<Form layout="inline" form={form} onFinish={handleSearch} style={{ marginBottom: 30 }}>
<Form.Item name="name" label="供应商名称">
<Input placeholder="供应商名称" allowClear />
<Form.Item name="name" label={intl.formatMessage({ id: 'supplierTaskManage.form.supplierName' })}>
<Input placeholder={intl.formatMessage({ id: 'supplierTaskManage.placeholder.supplierName' })} allowClear />
</Form.Item>
<Form.Item name="deptId" label="部门">
<Select placeholder="请选择部门" allowClear style={{ width: 150 }}>
<Option value="1"></Option>
<Option value="2"></Option>
<Option value="3"></Option>
<Form.Item name="deptId" label={intl.formatMessage({ id: 'supplierTaskManage.form.department' })}>
<Select placeholder={intl.formatMessage({ id: 'supplierTaskManage.placeholder.selectDepartment' })} allowClear style={{ width: 150 }}>
<Option value="1">{intl.formatMessage({ id: 'supplierTaskManage.department.purchase' })}</Option>
<Option value="2">{intl.formatMessage({ id: 'supplierTaskManage.department.technology' })}</Option>
<Option value="3">{intl.formatMessage({ id: 'supplierTaskManage.department.quality' })}</Option>
</Select>
</Form.Item>
<Form.Item name="categoryId" label="所属品类">
<Form.Item name="categoryId" label={intl.formatMessage({ id: 'supplierTaskManage.form.category' })}>
<CategorySelector multiple={false} style={{ width: 150 }} />
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit"></Button>
<Button type="primary" htmlType="submit">{intl.formatMessage({ id: 'supplierTaskManage.button.search' })}</Button>
</Form.Item>
<Form.Item>
<Button onClick={handleReset}></Button>
<Button onClick={handleReset}>{intl.formatMessage({ id: 'supplierTaskManage.button.reset' })}</Button>
</Form.Item>
</Form>
@ -298,8 +300,8 @@ const SupplierSelector: React.FC<SupplierSelectorProps> = ({
{/* 左侧待选列表 */}
<Col span={10}>
<div className="list-title">
<span className="search-count">{pagination.total}</span>
{intl.formatMessage({ id: 'supplierTaskManage.text.availableSuppliers' })}
<span className="search-count">{intl.formatMessage({ id: 'supplierTaskManage.text.itemCount' }, { count: pagination.total })}</span>
</div>
<Table
rowSelection={{
@ -334,8 +336,8 @@ const SupplierSelector: React.FC<SupplierSelectorProps> = ({
{/* 右侧已选列表 */}
<Col span={10}>
<div className="list-title">
<span className="search-count">{chosenSuppliers.length}</span>
{intl.formatMessage({ id: 'supplierTaskManage.text.selectedSuppliers' })}
<span className="search-count">{intl.formatMessage({ id: 'supplierTaskManage.text.itemCount' }, { count: chosenSuppliers.length })}</span>
</div>
<Table
rowSelection={{