中英文切换 初始化
This commit is contained in:
@@ -31,6 +31,7 @@ import { getUser } from '@/api/user/index';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { RootState } from '@/src/store';
|
||||
import utils from '@/lib/utils';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
interface DroneManagementProps {
|
||||
allOrgOptions: any[];
|
||||
@@ -45,6 +46,7 @@ export default function DroneManagement({
|
||||
allUserOptions,
|
||||
onAllDataNeedRefresh,
|
||||
}: DroneManagementProps) {
|
||||
const { t } = useTranslation();
|
||||
const { modal } = App.useApp();
|
||||
const { userInfo } = useSelector((state: RootState) => state.user);
|
||||
const { stationId, currentStation } = useSelector((state: RootState) => state.station);
|
||||
@@ -233,8 +235,8 @@ export default function DroneManagement({
|
||||
modal.confirm({
|
||||
title: '确认解绑',
|
||||
content: `确定要为选中的无人机清除${typeText}绑定吗?`,
|
||||
okText: '确定',
|
||||
cancelText: '取消',
|
||||
okText: t('common.ok'),
|
||||
cancelText: t('common.cancel'),
|
||||
onOk: async () => {
|
||||
try {
|
||||
const res = await unbindDrone({ sns: validSns, type });
|
||||
@@ -254,8 +256,8 @@ export default function DroneManagement({
|
||||
};
|
||||
|
||||
const droneColumns = [
|
||||
{ title: '设备名称', width: 150, dataIndex: 'drone_callsign', key: 'name' },
|
||||
{ title: 'SN码', width: 180, dataIndex: 'device_sn', key: 'sn' },
|
||||
{ title: t('devices.deviceName'), width: 150, dataIndex: 'drone_callsign', key: 'name' },
|
||||
{ title: t('systemSetting.snCode'), width: 180, dataIndex: 'device_sn', key: 'sn' },
|
||||
{ title: '机场SN', width: 150, dataIndex: 'gateway_sn', key: 'gsn' },
|
||||
{
|
||||
title: '所属组织', width: 150, key: 'orgName',
|
||||
@@ -272,18 +274,18 @@ export default function DroneManagement({
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '负责人', width: 150, key: 'userName',
|
||||
title: t('systemSetting.leader'), width: 150, key: 'userName',
|
||||
render: (_, record) => {
|
||||
const user = allUserOptions.find(u => u.userId == record.userId);
|
||||
return user ? (user.nickName || user.userName) : <Text type="secondary">未绑定</Text>;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '状态', width: 150, dataIndex: 'onlineStatus', key: 'status',
|
||||
render: s => <Tag color={s === 1 ? 'green' : 'default'}>{s === 1 ? '在线' : '离线'}</Tag>
|
||||
title: t('roles.status'), width: 150, dataIndex: 'onlineStatus', key: 'status',
|
||||
render: s => <Tag color={s === 1 ? 'green' : 'default'}>{s === 1 ? t('devices.online') : t('devices.offline')}</Tag>
|
||||
},
|
||||
{
|
||||
title: '操作', key: 'action', fixed: 'right' as const, width: 250,
|
||||
title: t('roles.actions'), key: 'action', fixed: 'right' as const, width: 250,
|
||||
render: (_, record: any) => (
|
||||
<Space>
|
||||
<Tooltip title="人员解绑">
|
||||
@@ -326,16 +328,16 @@ export default function DroneManagement({
|
||||
onChange={(e) => setDroneParams({ ...droneParams, sn: e.target.value })}
|
||||
/>
|
||||
<Select
|
||||
placeholder="状态"
|
||||
placeholder={t('roles.status')}
|
||||
style={{ width: 120 }}
|
||||
value={droneParams.status}
|
||||
allowClear
|
||||
onChange={(val) => setDroneParams({ ...droneParams, status: val })}
|
||||
>
|
||||
<Select.Option value="1">在线</Select.Option>
|
||||
<Select.Option value="2">离线</Select.Option>
|
||||
<Select.Option value="1">{t('devices.online')}</Select.Option>
|
||||
<Select.Option value="2">{t('devices.offline')}</Select.Option>
|
||||
</Select>
|
||||
<Button icon={<ReloadOutlined />} onClick={() => setDroneParams({ pageNum: 1, pageSize: 10, sn: '', status: '' })}>重置</Button>
|
||||
<Button icon={<ReloadOutlined />} onClick={() => setDroneParams({ pageNum: 1, pageSize: 10, sn: '', status: '' })}>{t('common.reset')}</Button>
|
||||
<Button type="primary" icon={<LinkOutlined />} onClick={openBindModal}>绑定无人机</Button>
|
||||
<Button disabled={selectedDroneKeys.length === 0} onClick={() => handleUnbind(selectedDroneKeys, 1)}>批量解绑(用户)</Button>
|
||||
<Button disabled={selectedDroneKeys.length === 0} onClick={() => handleUnbind(selectedDroneKeys, 2)}>批量解绑(场站)</Button>
|
||||
@@ -434,7 +436,7 @@ export default function DroneManagement({
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item label="负责人" name="userId" rules={[{ required: true, message: '请选择负责人' }]}>
|
||||
<Form.Item label={t('systemSetting.leader')} name="userId" rules={[{ required: true, message: '请选择负责人' }]}>
|
||||
<Select
|
||||
placeholder="请先选择场站后选择负责人"
|
||||
allowClear
|
||||
|
||||
Reference in New Issue
Block a user