中英文切换 初始化
This commit is contained in:
@@ -14,10 +14,12 @@ import {
|
||||
import { getOrgList } from '../../api/organization';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { RootState } from '../../store';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const { Option } = Select;
|
||||
|
||||
export default function StationManage() {
|
||||
const { t } = useTranslation();
|
||||
const [stationList, setStationList] = useState([]);
|
||||
const [currentStation, setCurrentStation] = useState(null);
|
||||
const [regionList, setRegionList] = useState([]);
|
||||
@@ -171,11 +173,11 @@ export default function StationManage() {
|
||||
}
|
||||
saveSite(params).then(res => {
|
||||
if (res.code === 200) {
|
||||
messageApi.success(editRecord ? '编辑成功' : '新增成功');
|
||||
messageApi.success(editRecord ? t('common.editSuccess') : t('common.addSuccess'));
|
||||
getStationData();
|
||||
setModalVisible(false);
|
||||
} else {
|
||||
messageApi.error(res.msg || '保存失败');
|
||||
messageApi.error(res.msg || t('common.saveFail'));
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -185,10 +187,10 @@ export default function StationManage() {
|
||||
const handleDelete = (id) => {
|
||||
deleteSite([id]).then(res => {
|
||||
if (res.code === 200) {
|
||||
messageApi.success('删除成功');
|
||||
messageApi.success(t('common.deleteSuccess'));
|
||||
getStationData();
|
||||
} else {
|
||||
messageApi.error(res.msg || '删除失败');
|
||||
messageApi.error(res.msg || t('common.deleteFail'));
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -215,7 +217,7 @@ export default function StationManage() {
|
||||
|
||||
saveRegion(params).then(res => {
|
||||
if (res.code === 200) {
|
||||
messageApi.success('保存成功');
|
||||
messageApi.success(t('common.saveSuccess'));
|
||||
getStationRegions({ id: currentStation.id }).then(r => {
|
||||
setRegionList(r.data || []);
|
||||
});
|
||||
@@ -229,7 +231,7 @@ export default function StationManage() {
|
||||
const handleDeleteRegion = (id) => {
|
||||
deleteRegion([id]).then(res => {
|
||||
if (res.code === 200) {
|
||||
messageApi.success('删除成功');
|
||||
messageApi.success(t('common.deleteSuccess'));
|
||||
setRegionList(regionList.filter(x => x.id !== id));
|
||||
}
|
||||
});
|
||||
@@ -243,7 +245,7 @@ export default function StationManage() {
|
||||
|
||||
// ====================== 表格列 ======================
|
||||
const columns = [
|
||||
{ title: '场站名称', dataIndex: 'siteName' },
|
||||
{ title: t('systemSetting.siteName'), dataIndex: 'siteName' },
|
||||
{
|
||||
title: '所属组织',
|
||||
dataIndex: 'orgId',
|
||||
@@ -254,15 +256,15 @@ export default function StationManage() {
|
||||
},
|
||||
{ title: '地址', dataIndex: 'address' },
|
||||
{
|
||||
title: '操作',
|
||||
title: t('roles.actions'),
|
||||
width: 400,
|
||||
render: (_, record) => (
|
||||
<Space wrap size="small">
|
||||
<Button icon={<EditOutlined />} onClick={() => handleEdit(record)}>编辑</Button>
|
||||
<Button icon={<EditOutlined />} onClick={() => handleEdit(record)}>{t('roles.edit')}</Button>
|
||||
<Button icon={<BgColorsOutlined />} onClick={() => handleOpenArea(record)}>分区设置</Button>
|
||||
<Button onClick={() => handleOpenMap(record)}>边界绘制</Button>
|
||||
<Popconfirm title="确定删除?" onConfirm={() => handleDelete(record.id)}>
|
||||
<Button danger>删除</Button>
|
||||
<Popconfirm title={t('common.confirmDelete')} onConfirm={() => handleDelete(record.id)}>
|
||||
<Button danger>roles.delete</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
)
|
||||
@@ -273,7 +275,7 @@ export default function StationManage() {
|
||||
<div style={{ padding: '8px 0px' }}>
|
||||
{contextHolder}
|
||||
<div style={{ padding: '0px 0px 8px' }}>
|
||||
<Typography.Title level={4} style={{ margin: 0, fontSize: 'clamp(14px, 1.2vw, 18px)' }}>场站管理</Typography.Title>
|
||||
<Typography.Title level={4} style={{ margin: 0, fontSize: 'clamp(14px, 1.2vw, 18px)' }}>{t('router.station')}</Typography.Title>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -293,7 +295,7 @@ export default function StationManage() {
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
<Button onClick={handleReset}>重置</Button>
|
||||
<Button onClick={handleReset}>{t('common.reset')}</Button>
|
||||
<Button type="primary" icon={<PlusOutlined />} onClick={handleAdd}>
|
||||
新增场站
|
||||
</Button>
|
||||
@@ -329,8 +331,8 @@ export default function StationManage() {
|
||||
<Form form={form} layout="vertical">
|
||||
<Row gutter={16}>
|
||||
<Col span={12}>
|
||||
<Form.Item name="siteName" label="场站名称" rules={[{ required: true }]}>
|
||||
<Input placeholder="请输入" />
|
||||
<Form.Item name="siteName" label={t('systemSetting.siteName')} rules={[{ required: true }]}>
|
||||
<Input placeholder={t('common.pleaseInput')} />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
@@ -348,13 +350,13 @@ export default function StationManage() {
|
||||
|
||||
<Row gutter={16}>
|
||||
<Col span={12}>
|
||||
<Form.Item name="longitude" label="经度">
|
||||
<Input placeholder="经度" />
|
||||
<Form.Item name="longitude" label={t('systemSetting.longitude')}>
|
||||
<Input placeholder={t('systemSetting.longitude')} />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Form.Item name="latitude" label="纬度">
|
||||
<Input placeholder="纬度" />
|
||||
<Form.Item name="latitude" label={t('systemSetting.latitude')}>
|
||||
<Input placeholder={t('systemSetting.latitude')} />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
</Row>
|
||||
@@ -368,22 +370,22 @@ export default function StationManage() {
|
||||
<Row gutter={16}>
|
||||
<Col span={6}>
|
||||
<Form.Item name="dingTalkPush" label="钉钉告警推送" valuePropName="checked">
|
||||
<Switch checkedChildren="开启" unCheckedChildren="关闭" />
|
||||
<Switch checkedChildren="开启" unCheckedChildren={t('common.close')} />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={6}>
|
||||
<Form.Item name="dingTalkOrderPush" label="钉钉工单推送" valuePropName="checked">
|
||||
<Switch checkedChildren="开启" unCheckedChildren="关闭" />
|
||||
<Switch checkedChildren="开启" unCheckedChildren={t('common.close')} />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={6}>
|
||||
<Form.Item name="emailPush" label="邮件推送" valuePropName="checked">
|
||||
<Switch checkedChildren="开启" unCheckedChildren="关闭" />
|
||||
<Switch checkedChildren="开启" unCheckedChildren={t('common.close')} />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={6}>
|
||||
<Form.Item name="alertPush" label="告警弹窗推送" valuePropName="checked">
|
||||
<Switch checkedChildren="开启" unCheckedChildren="关闭" />
|
||||
<Switch checkedChildren="开启" unCheckedChildren={t('common.close')} />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
</Row>
|
||||
@@ -416,12 +418,12 @@ export default function StationManage() {
|
||||
</Row>
|
||||
) : null}
|
||||
|
||||
<Form.Item name="remark" label="备注">
|
||||
<Form.Item name="remark" label={t('roles.remark')}>
|
||||
<Input.TextArea rows={3} />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="status" label="场站状态" valuePropName="checked">
|
||||
<Switch checkedChildren="启用" unCheckedChildren="停用" />
|
||||
<Form.Item name="status" label={t('systemSetting.siteStatus')} valuePropName="checked">
|
||||
<Switch checkedChildren={t('common.enable')} unCheckedChildren={t('roles.stopped')} />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
@@ -454,12 +456,12 @@ export default function StationManage() {
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Form.Item name="status" label="状态" valuePropName="checked">
|
||||
<Switch checkedChildren="启用" unCheckedChildren="停用" />
|
||||
<Form.Item name="status" label={t('roles.status')} valuePropName="checked">
|
||||
<Switch checkedChildren={t('common.enable')} unCheckedChildren={t('roles.stopped')} />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
</Row>
|
||||
<Form.Item name="remark" label="备注"><Input.TextArea rows={2} /></Form.Item>
|
||||
<Form.Item name="remark" label={t('roles.remark')}><Input.TextArea rows={2} /></Form.Item>
|
||||
<Button type="primary" onClick={handleSaveRegion}>保存分区</Button>
|
||||
</Form>
|
||||
|
||||
@@ -471,15 +473,15 @@ export default function StationManage() {
|
||||
columns={[
|
||||
{ title: '分区名称', dataIndex: 'regionName' },
|
||||
{ title: '编码', dataIndex: 'regionCode' },
|
||||
{ title: '类型', dataIndex: 'type' },
|
||||
{ title: t('common.type'), dataIndex: 'type' },
|
||||
{
|
||||
title: '状态', render: r => r.status === 1 ? '启用' : '停用'
|
||||
title: t('roles.status'), render: r => r.status === 1 ? t('common.enable') : t('roles.stopped')
|
||||
},
|
||||
{
|
||||
title: '操作', render: (_, r) => (
|
||||
title: t('roles.actions'), render: (_, r) => (
|
||||
<Space>
|
||||
<Button onClick={() => { setEditRegion(r); regionForm.setFieldsValue(r); }}>编辑</Button>
|
||||
<Button danger onClick={() => handleDeleteRegion(r.id)}>删除</Button>
|
||||
<Button onClick={() => { setEditRegion(r); regionForm.setFieldsValue(r); }}>{t('roles.edit')}</Button>
|
||||
<Button danger onClick={() => handleDeleteRegion(r.id)}>{t('roles.delete')}</Button>
|
||||
</Space>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user