中英文切换
This commit is contained in:
@@ -88,7 +88,7 @@ export default function DroneManagement({
|
||||
setDroneTotal(res.total || res.rows?.length || 0);
|
||||
}
|
||||
} catch (err) {
|
||||
utils.message.error('获取无人机列表失败');
|
||||
utils.message.error(t('systemSetting.uavFixed2ListFixed2FailedFixed2'));
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -143,7 +143,7 @@ export default function DroneManagement({
|
||||
|
||||
const openBindModal = async () => {
|
||||
if (!selectedDroneKeys.length) {
|
||||
return utils.message.warning('请先在列表中选中需要绑定的无人机');
|
||||
return utils.message.warning(t('systemSetting.listUavFixed2'));
|
||||
}
|
||||
bindForm.resetFields();
|
||||
setBindModalVisible(true);
|
||||
@@ -210,17 +210,17 @@ export default function DroneManagement({
|
||||
};
|
||||
const res = await bindDrone(payload);
|
||||
if (res.code === 200 && res.data == true) {
|
||||
utils.message.success('绑定成功');
|
||||
utils.message.success(t('systemSetting.successFixed22'));
|
||||
setBindModalVisible(false);
|
||||
setSelectedDroneKeys([]);
|
||||
bindForm.resetFields();
|
||||
fetchDroneList();
|
||||
onAllDataNeedRefresh?.();
|
||||
} else {
|
||||
utils.message.error(res.msg || '绑定失败');
|
||||
utils.message.error(res.msg || t('systemSetting.bindFail'));
|
||||
}
|
||||
} catch (err) {
|
||||
utils.message.error('操作异常');
|
||||
utils.message.error(t('systemSetting.fixed2ActionsFixed2AbnormalFixed2'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -229,27 +229,27 @@ export default function DroneManagement({
|
||||
item !== null && item !== undefined && item !== '' && item.trim() !== ''
|
||||
);
|
||||
if (validSns.length === 0) {
|
||||
return utils.message.warning('未选择有效设备,无法解绑');
|
||||
return utils.message.warning(t('systemSetting.device2'));
|
||||
}
|
||||
const typeText = { 1: '人员', 2: '场站', 3: '组织' }[type];
|
||||
const typeText = { 1: t('systemSetting.person'), 2: t('systemSetting.s24'), 3: t('systemSetting.s34') }[type];
|
||||
modal.confirm({
|
||||
title: '确认解绑',
|
||||
content: `确定要为选中的无人机清除${typeText}绑定吗?`,
|
||||
title: t('systemSetting.fixed2Confirm'),
|
||||
content: t('systemSetting.confirmClearBinding', { type: typeText }),
|
||||
okText: t('common.ok'),
|
||||
cancelText: t('common.cancel'),
|
||||
onOk: async () => {
|
||||
try {
|
||||
const res = await unbindDrone({ sns: validSns, type });
|
||||
if (res.code === 200) {
|
||||
utils.message.success('解绑成功');
|
||||
utils.message.success(t('systemSetting.successFixed2'));
|
||||
fetchDroneList();
|
||||
setSelectedDroneKeys([]);
|
||||
onAllDataNeedRefresh?.();
|
||||
} else {
|
||||
utils.message.error(res.msg || '解绑失败');
|
||||
utils.message.error(res.msg || t('systemSetting.unbindFail'));
|
||||
}
|
||||
} catch (err) {
|
||||
utils.message.error('操作异常');
|
||||
utils.message.error(t('systemSetting.fixed2ActionsFixed2AbnormalFixed2'));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -258,26 +258,26 @@ export default function DroneManagement({
|
||||
const droneColumns = [
|
||||
{ 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: t('systemSetting.sn'), width: 150, dataIndex: 'gateway_sn', key: 'gsn' },
|
||||
{
|
||||
title: '所属组织', width: 150, key: 'orgName',
|
||||
title: t('systemSetting.belongingOrg'), width: 150, key: 'orgName',
|
||||
render: (_, record) => {
|
||||
const org = allOrgOptions.find(o => (o.orgId || o.id) == record.orgId);
|
||||
return org ? (org.orgName || org.name) : <Text type="secondary">未绑定</Text>;
|
||||
return org ? (org.orgName || org.name) : <Text type="secondary">{t('systemSetting.s02')}</Text>;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '所属场站', width: 150, key: 'siteName',
|
||||
title: t('systemSetting.s9'), width: 150, key: 'siteName',
|
||||
render: (_, record) => {
|
||||
const site = allSiteOptions.find(s => (s.siteId || s.id) == record.siteId);
|
||||
return site ? (site.siteName || site.name) : <Text type="secondary">未绑定</Text>;
|
||||
return site ? (site.siteName || site.name) : <Text type="secondary">{t('systemSetting.s02')}</Text>;
|
||||
},
|
||||
},
|
||||
{
|
||||
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>;
|
||||
return user ? (user.nickName || user.userName) : <Text type="secondary">{t('systemSetting.s02')}</Text>;
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -288,14 +288,14 @@ export default function DroneManagement({
|
||||
title: t('roles.actions'), key: 'action', fixed: 'right' as const, width: 250,
|
||||
render: (_, record: any) => (
|
||||
<Space>
|
||||
<Tooltip title="人员解绑">
|
||||
<Button size="small" icon={<DisconnectOutlined />} onClick={() => handleUnbind([record.gateway_sn], 1)}>用户</Button>
|
||||
<Tooltip title={t('systemSetting.s72')}>
|
||||
<Button size="small" icon={<DisconnectOutlined />} onClick={() => handleUnbind([record.gateway_sn], 1)}>{t('systemSetting.s110')}</Button>
|
||||
</Tooltip>
|
||||
<Tooltip title="场站解绑">
|
||||
<Button size="small" icon={<DisconnectOutlined />} onClick={() => handleUnbind([record.gateway_sn], 2)}>场站</Button>
|
||||
<Tooltip title={t('systemSetting.s83')}>
|
||||
<Button size="small" icon={<DisconnectOutlined />} onClick={() => handleUnbind([record.gateway_sn], 2)}>{t('systemSetting.s24')}</Button>
|
||||
</Tooltip>
|
||||
<Tooltip title="组织解绑">
|
||||
<Button size="small" icon={<DisconnectOutlined />} onClick={() => handleUnbind([record.gateway_sn], 3)}>组织</Button>
|
||||
<Tooltip title={t('systemSetting.s92')}>
|
||||
<Button size="small" icon={<DisconnectOutlined />} onClick={() => handleUnbind([record.gateway_sn], 3)}>{t('systemSetting.s34')}</Button>
|
||||
</Tooltip>
|
||||
</Space>
|
||||
),
|
||||
@@ -321,7 +321,7 @@ export default function DroneManagement({
|
||||
<>
|
||||
<div style={{ marginBottom: 16, display: 'flex', gap: 10, flexWrap: 'wrap' }}>
|
||||
<Input
|
||||
placeholder="机场SN"
|
||||
placeholder={t('systemSetting.sn')}
|
||||
style={{ width: 200 }}
|
||||
allowClear
|
||||
value={droneParams.sn}
|
||||
@@ -338,10 +338,10 @@ export default function DroneManagement({
|
||||
<Select.Option value="2">{t('devices.offline')}</Select.Option>
|
||||
</Select>
|
||||
<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>
|
||||
<Button disabled={selectedDroneKeys.length === 0} onClick={() => handleUnbind(selectedDroneKeys, 3)}>批量解绑(组)</Button>
|
||||
<Button type="primary" icon={<LinkOutlined />} onClick={openBindModal}>{t('systemSetting.uavFixed2')}</Button>
|
||||
<Button disabled={selectedDroneKeys.length === 0} onClick={() => handleUnbind(selectedDroneKeys, 1)}>{t('systemSetting.batchUnbindUser')}</Button>
|
||||
<Button disabled={selectedDroneKeys.length === 0} onClick={() => handleUnbind(selectedDroneKeys, 2)}>{t('systemSetting.batchUnbindStation')}</Button>
|
||||
<Button disabled={selectedDroneKeys.length === 0} onClick={() => handleUnbind(selectedDroneKeys, 3)}>{t('systemSetting.batchUnbindGroup')}</Button>
|
||||
</div>
|
||||
|
||||
<div style={{ height: 'calc(100vh - 220px)', overflowY: 'auto', paddingRight: '4px' }}>
|
||||
@@ -356,7 +356,7 @@ export default function DroneManagement({
|
||||
pageSize: droneParams.pageSize,
|
||||
total: droneTotal,
|
||||
showSizeChanger: true,
|
||||
showTotal: t => `共 ${t} 条`,
|
||||
showTotal: t => `${t('common.total')} ${t} ${t('common.items')}`,
|
||||
onChange: (page, pageSize) => {
|
||||
setDroneParams({ ...droneParams, pageNum: page, pageSize });
|
||||
},
|
||||
@@ -369,7 +369,7 @@ export default function DroneManagement({
|
||||
title={
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||
<span style={{ display: 'inline-block', width: 4, height: 18, background: 'linear-gradient(180deg, #1890ff 0%, #096dd9 100%)', borderRadius: 2 }}></span>
|
||||
<span style={{ fontWeight: 600 }}>绑定无人机</span>
|
||||
<span style={{ fontWeight: 600 }}>{t('systemSetting.uavFixed2')}</span>
|
||||
</div>
|
||||
}
|
||||
open={bindModalVisible}
|
||||
@@ -385,19 +385,19 @@ export default function DroneManagement({
|
||||
width={540}
|
||||
>
|
||||
<Form form={bindForm} layout="vertical" onFinish={handleBind}>
|
||||
<Form.Item label={<>已选无人机({selectedDroneKeys.length}台)SN</>} name="sns" rules={[{ required: true, message: '请输入 SN' }]}>
|
||||
<Input.TextArea placeholder="例如: SN001, SN002" rows={2} disabled style={{ resize: 'none', background: '#fafafa' }} />
|
||||
<Form.Item label={t('systemSetting.selectedUavSn', { count: selectedDroneKeys.length })} name="sns" rules={[{ required: true, message: t('systemSetting.fixed2PleaseEnterSn') }]}>
|
||||
<Input.TextArea placeholder={t('systemSetting.sn001Sn002')} rows={2} disabled style={{ resize: 'none', background: '#fafafa' }} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={
|
||||
<Space size={6}>
|
||||
<span>所属组织</span>
|
||||
<span>{t('systemSetting.belongingOrg')}</span>
|
||||
</Space>
|
||||
}
|
||||
name="orgId" rules={[{ required: true, message: '请选择组织' }]}
|
||||
name="orgId" rules={[{ required: true, message: t('systemSetting.pleaseSelectOrg') }]}
|
||||
>
|
||||
<Select
|
||||
placeholder="请选择组织"
|
||||
placeholder={t('systemSetting.pleaseSelectOrg')}
|
||||
disabled={orgFieldDisabled}
|
||||
allowClear={isAdmin}
|
||||
onChange={(val) => {
|
||||
@@ -415,13 +415,13 @@ export default function DroneManagement({
|
||||
<Form.Item
|
||||
label={
|
||||
<Space size={6}>
|
||||
<span>所属场站</span>
|
||||
<span>{t('systemSetting.s9')}</span>
|
||||
</Space>
|
||||
}
|
||||
name="siteId" rules={[{ required: !siteFieldDisabled, message: '请选择场站' }]}
|
||||
name="siteId" rules={[{ required: !siteFieldDisabled, message: t('systemSetting.fixed2PleaseSelect2') }]}
|
||||
>
|
||||
<Select
|
||||
placeholder="请先选择组织"
|
||||
placeholder={t('systemSetting.s132')}
|
||||
disabled={siteFieldDisabled}
|
||||
allowClear={isAdmin || isManager}
|
||||
onChange={(val) => {
|
||||
@@ -436,9 +436,9 @@ export default function DroneManagement({
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item label={t('systemSetting.leader')} name="userId" rules={[{ required: true, message: '请选择负责人' }]}>
|
||||
<Form.Item label={t('systemSetting.leader')} name="userId" rules={[{ required: true, message: t('systemSetting.fixed2PleaseSelectFixed2LeaderFixed2') }]}>
|
||||
<Select
|
||||
placeholder="请先选择场站后选择负责人"
|
||||
placeholder={t('systemSetting.leaderFixed2')}
|
||||
allowClear
|
||||
showSearch
|
||||
optionFilterProp="children"
|
||||
|
||||
Reference in New Issue
Block a user