导入excel表格上传参数 下载模板 参数枚举值补充 查看修改 保存参数 限制 只有admin可以修改
This commit is contained in:
@@ -477,6 +477,17 @@ export function getTaskPath(params) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//下载 机器属性模板
|
||||||
|
|
||||||
|
export function downloadDeviceTemplate(params) {
|
||||||
|
return request({
|
||||||
|
url: '/iot/deviceRunParam/downloadTemplate',
|
||||||
|
method: 'get',
|
||||||
|
params,
|
||||||
|
responseType: 'blob', // 关键!告诉axios返回二进制
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import {
|
|||||||
DisconnectOutlined,
|
DisconnectOutlined,
|
||||||
UploadOutlined,
|
UploadOutlined,
|
||||||
EditOutlined,
|
EditOutlined,
|
||||||
|
DownloadOutlined,
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -41,6 +42,7 @@ import { RootState } from '@/src/store';
|
|||||||
import utils from '@/lib/utils';
|
import utils from '@/lib/utils';
|
||||||
import DeviceParamModal from '../devices/DeviceParamModal';
|
import DeviceParamModal from '../devices/DeviceParamModal';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { downloadDeviceTemplate } from '@/api/device';
|
||||||
|
|
||||||
interface SmartDeviceManagementProps {
|
interface SmartDeviceManagementProps {
|
||||||
allOrgOptions: any[];
|
allOrgOptions: any[];
|
||||||
@@ -195,6 +197,9 @@ export default function SmartDeviceManagement({
|
|||||||
const params = {
|
const params = {
|
||||||
deviceId: data.serialNumber,
|
deviceId: data.serialNumber,
|
||||||
};
|
};
|
||||||
|
setCurrentParamDevice(data);
|
||||||
|
setParamModalVisible(true);
|
||||||
|
return;
|
||||||
hasPermission(params).then(res => {
|
hasPermission(params).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
@@ -383,6 +388,23 @@ export default function SmartDeviceManagement({
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
const downloadDeviceTemplatefn = async () => {
|
||||||
|
try {
|
||||||
|
const res = await downloadDeviceTemplate(); // 你的参数
|
||||||
|
// 从响应头拿文件名(后端要返回 Content-Disposition)
|
||||||
|
let fileName = '设备模板.xlsx';
|
||||||
|
const blob = new Blob([res]);
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = URL.createObjectURL(blob);
|
||||||
|
a.download = fileName;
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
a.remove();
|
||||||
|
URL.revokeObjectURL(a.href);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('下载失败', err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const selectorgId = Form.useWatch('orgId', bindSmartForm);
|
const selectorgId = Form.useWatch('orgId', bindSmartForm);
|
||||||
const selectsiteId = Form.useWatch('siteId', bindSmartForm);
|
const selectsiteId = Form.useWatch('siteId', bindSmartForm);
|
||||||
@@ -415,6 +437,10 @@ export default function SmartDeviceManagement({
|
|||||||
<Upload customRequest={handleImportDevices} showUploadList={false} accept='.xlsx,.xls'>
|
<Upload customRequest={handleImportDevices} showUploadList={false} accept='.xlsx,.xls'>
|
||||||
<Button icon={<UploadOutlined />}>{t('common.import')}</Button>
|
<Button icon={<UploadOutlined />}>{t('common.import')}</Button>
|
||||||
</Upload>
|
</Upload>
|
||||||
|
<Button icon={<DownloadOutlined />} onClick={downloadDeviceTemplatefn}>
|
||||||
|
{t('common.download')}
|
||||||
|
</Button>
|
||||||
|
|
||||||
<Button disabled={selectedSmartKeys.length === 0} onClick={() => handleUnbindSmart(selectedSmartKeys, 1)}>{t('systemSetting.batchUnbindUser')}</Button>
|
<Button disabled={selectedSmartKeys.length === 0} onClick={() => handleUnbindSmart(selectedSmartKeys, 1)}>{t('systemSetting.batchUnbindUser')}</Button>
|
||||||
<Button disabled={selectedSmartKeys.length === 0} onClick={() => handleUnbindSmart(selectedSmartKeys, 2)}>{t('systemSetting.batchUnbindStation')}</Button>
|
<Button disabled={selectedSmartKeys.length === 0} onClick={() => handleUnbindSmart(selectedSmartKeys, 2)}>{t('systemSetting.batchUnbindStation')}</Button>
|
||||||
<Button disabled={selectedSmartKeys.length === 0} onClick={() => handleUnbindSmart(selectedSmartKeys, 3)}>{t('systemSetting.batchUnbindOrg')}</Button>
|
<Button disabled={selectedSmartKeys.length === 0} onClick={() => handleUnbindSmart(selectedSmartKeys, 3)}>{t('systemSetting.batchUnbindOrg')}</Button>
|
||||||
|
|||||||
@@ -434,12 +434,14 @@ export default function DeviceOverviewPage() {
|
|||||||
const params = {
|
const params = {
|
||||||
deviceId: data.serialNumber,
|
deviceId: data.serialNumber,
|
||||||
}
|
}
|
||||||
|
setCurrentParamDevice(data);
|
||||||
|
setParamModalOpen(true);
|
||||||
|
return;
|
||||||
|
|
||||||
hasPermission(params).then(res => {
|
hasPermission(params).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
setCurrentParamDevice(data);
|
|
||||||
setParamModalOpen(true);
|
|
||||||
} else {
|
} else {
|
||||||
utils.message.error(t('devices.noPermission'));
|
utils.message.error(t('devices.noPermission'));
|
||||||
}
|
}
|
||||||
@@ -635,7 +637,7 @@ export default function DeviceOverviewPage() {
|
|||||||
<Col xs={24} lg={14}>
|
<Col xs={24} lg={14}>
|
||||||
<Card title={<><EnvironmentOutlined />{t('devices.fixed2Equipment')}</>} extra={<Button type="text" icon={<SettingOutlined />} />} variant="borderless" style={{ borderRadius: 8, marginBottom: 8 }} styles={{ body: { padding: 0 } }}>
|
<Card title={<><EnvironmentOutlined />{t('devices.fixed2Equipment')}</>} extra={<Button type="text" icon={<SettingOutlined />} />} variant="borderless" style={{ borderRadius: 8, marginBottom: 8 }} styles={{ body: { padding: 0 } }}>
|
||||||
<div style={{ width: '100%', height: 350, borderRadius: 8, position: 'relative', overflow: 'hidden' }}>
|
<div style={{ width: '100%', height: 350, borderRadius: 8, position: 'relative', overflow: 'hidden' }}>
|
||||||
<div style={{ position: 'absolute', zIndex: 9999, top: 12, left: 12, background: 'rgba(255,255,255,0.95)', borderRadius: 6, padding: 8 }}>
|
<div style={{ position: 'absolute', zIndex: 11, top: 12, left: 12, background: 'rgba(255,255,255,0.95)', borderRadius: 6, padding: 8 }}>
|
||||||
<div style={{ fontSize: 11, fontWeight: 60, marginBottom: 4 }}>{t('devices.s22')}</div>
|
<div style={{ fontSize: 11, fontWeight: 60, marginBottom: 4 }}>{t('devices.s22')}</div>
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 4, fontSize: 10 }}>
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 4, fontSize: 10 }}>
|
||||||
<div><span style={{ color: '#1890ff' }}>———</span>{t('devices.fixed2Inspection')}</div>
|
<div><span style={{ color: '#1890ff' }}>———</span>{t('devices.fixed2Inspection')}</div>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
Checkbox,
|
Checkbox,
|
||||||
Slider,
|
Slider,
|
||||||
Spin,
|
Spin,
|
||||||
|
Select,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { RootState } from '@/store';
|
import { RootState } from '@/store';
|
||||||
@@ -71,9 +72,8 @@ const GainSliderInput = ({ value, onChange, disabled, min = 0.1, max = 1, step =
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 可编辑的增益滑块字段
|
||||||
|
const editableGainKeys = ['leftForwardGain', 'leftBackwardGain', 'rightForwardGain', 'rightBackwardGain'];
|
||||||
const editableKeys = ['leftForwardGain', 'leftBackwardGain', 'rightForwardGain', 'rightBackwardGain'];
|
|
||||||
|
|
||||||
interface DeviceParamModalProps {
|
interface DeviceParamModalProps {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
@@ -89,17 +89,17 @@ interface DeviceParamModalProps {
|
|||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
onSuccess?: () => void;
|
onSuccess?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const DeviceParamModal: React.FC<DeviceParamModalProps> = ({ open, device, onCancel, onSuccess }) => {
|
const DeviceParamModal: React.FC<DeviceParamModalProps> = ({ open, device, onCancel, onSuccess }) => {
|
||||||
const { stationId, currentStation } = useSelector((state: RootState) => state.station);
|
const { stationId, currentStation } = useSelector((state: RootState) => state.station);
|
||||||
const [paramForm] = Form.useForm();
|
const [paramForm] = Form.useForm();
|
||||||
const [paramData, setParamData] = useState<any>(null);
|
const [paramData, setParamData] = useState<any>(null);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
|
||||||
const deviceId = device?.serialNumber || device?.device_sn || '';
|
const deviceId = device?.serialNumber || device?.device_sn || '';
|
||||||
const deviceName = device?.deviceAlias || device?.deviceName || device?.drone_callsign || device?.callsign || deviceId;
|
const deviceName = device?.deviceAlias || device?.deviceName || device?.drone_callsign || device?.callsign || deviceId;
|
||||||
|
const userInfo = useSelector((state: RootState) => state.user.userInfo);
|
||||||
|
const isAdmin = userInfo?.roleKey === 'admin'
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (open && deviceId) {
|
if (open && deviceId) {
|
||||||
@@ -120,7 +120,6 @@ const DeviceParamModal: React.FC<DeviceParamModalProps> = ({ open, device, onCan
|
|||||||
paramForm.setFieldsValue({ ...res.data });
|
paramForm.setFieldsValue({ ...res.data });
|
||||||
} else {
|
} else {
|
||||||
utils.message.error(t('devices.fetchParamFail'));
|
utils.message.error(t('devices.fetchParamFail'));
|
||||||
|
|
||||||
setParamData(null);
|
setParamData(null);
|
||||||
paramForm.resetFields();
|
paramForm.resetFields();
|
||||||
}
|
}
|
||||||
@@ -138,10 +137,7 @@ const DeviceParamModal: React.FC<DeviceParamModalProps> = ({ open, device, onCan
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
const payload = {
|
const payload = {
|
||||||
leftForwardGain: Math.max(0.1, Math.min(1, values.leftForwardGain >= 10 ? values.leftForwardGain / 10 : values.leftForwardGain)),
|
...values,
|
||||||
leftBackwardGain: Math.max(0.1, Math.min(1, values.leftBackwardGain >= 10 ? values.leftBackwardGain / 10 : values.leftBackwardGain)),
|
|
||||||
rightForwardGain: Math.max(0.1, Math.min(1, values.rightForwardGain >= 10 ? values.rightForwardGain / 10 : values.rightForwardGain)),
|
|
||||||
rightBackwardGain: Math.max(0.1, Math.min(1, values.rightBackwardGain >= 10 ? values.rightBackwardGain / 10 : values.rightBackwardGain)),
|
|
||||||
deviceId,
|
deviceId,
|
||||||
siteId: stationId,
|
siteId: stationId,
|
||||||
orgId: currentStation?.orgId,
|
orgId: currentStation?.orgId,
|
||||||
@@ -167,63 +163,132 @@ const DeviceParamModal: React.FC<DeviceParamModalProps> = ({ open, device, onCan
|
|||||||
paramForm.resetFields();
|
paramForm.resetFields();
|
||||||
onCancel?.();
|
onCancel?.();
|
||||||
};
|
};
|
||||||
const paramFieldConfigs = [
|
|
||||||
{ key: 'leftForwardGain', label: t('devices.paramLeftForwardGain'), type: 'InputNumber', editable: true, min: 0, max: 1, step: 0.01 },
|
|
||||||
{ key: 'leftBackwardGain', label: t('devices.paramLeftBackwardGain'), type: 'InputNumber', editable: true, min: 0, max: 1, step: 0.01 },
|
|
||||||
{ key: 'rightForwardGain', label: t('devices.paramRightForwardGain'), type: 'InputNumber', editable: true, min: 0, max: 1, step: 0.01 },
|
|
||||||
{ key: 'rightBackwardGain', label: t('devices.paramRightBackwardGain'), type: 'InputNumber', editable: true, min: 0, max: 1, step: 0.01 },
|
|
||||||
|
|
||||||
{ key: 'runSpeed', label: t('devices.paramRunSpeed'), type: 'InputNumber', editable: true },
|
// ========== 按你后端Java实体顺序重新整理字段配置 ==========
|
||||||
//hasHost: "hasHost",
|
// 枚举取值参考设备参数规范:设备类型 M/I/U、车轮 W/T、动力 E/H、RTK N/B、发动机 H/L/Z 等
|
||||||
//rtkMode: "rtkMode", cameraNum: "cameraNum", wheelType: "wheelType", engineType: "engineType", capabilityList: "capabilityList", powerType: "powerType",
|
const paramFieldConfigs: any[] = [
|
||||||
{ key: 'hasHost', label: t('devices.hasHost'), type: 'Input', editable: false },
|
// 【可编辑】增益滑块 + runSpeed
|
||||||
{ key: 'rtkMode', label: t('devices.rtkMode'), type: 'Input', editable: false },
|
//{ key: 'leftForwardGain', label: t('devices.paramLeftForwardGain'), type: 'GainSlider', editable: true, min: 0.1, max: 1, step: 0.01 },
|
||||||
{ key: 'cameraNum', label: t('devices.cameraNum'), type: 'Input', editable: false },
|
//{ key: 'leftBackwardGain', label: t('devices.paramLeftBackwardGain'), type: 'GainSlider', editable: true, min: 0.1, max: 1, step: 0.01 },
|
||||||
{ key: 'wheelType', label: t('devices.wheelType'), type: 'Input', editable: false },
|
//{ key: 'rightForwardGain', label: t('devices.paramRightForwardGain'), type: 'GainSlider', editable: true, min: 0.1, max: 1, step: 0.01 },
|
||||||
{ key: 'engineType', label: t('devices.engineType'), type: 'Input', editable: false },
|
//{ key: 'rightBackwardGain', label: t('devices.paramRightBackwardGain'), type: 'GainSlider', editable: true, min: 0.1, max: 1, step: 0.01 },
|
||||||
{ key: 'capabilityList', label: t('devices.capabilityList'), type: 'Input', editable: false },
|
//{ key: 'runSpeed', label: t('devices.paramRunSpeed'), type: 'InputNumber', editable: true },
|
||||||
{ key: 'chipUidSign', label: t('devices.paramChipUidSign'), type: 'InputNumber', editable: false },
|
|
||||||
{ key: 'chipUid', label: t('devices.paramChipUid'), type: 'Input', editable: false },
|
// 下面全部只读,和后端Excel实体顺序对齐
|
||||||
{ key: 'remoteConfig', label: t('devices.paramRemoteConfig'), type: 'InputNumber', editable: false },
|
{ key: 'deviceId', label: t('devices.deviceId'), type: 'Input', editable: isAdmin },
|
||||||
{ key: 'knifeMotorMode', label: t('devices.paramKnifeMotorMode'), type: 'InputNumber', editable: false },
|
{
|
||||||
{ key: 'walkMotorMode', label: t('devices.paramWalkMotorMode'), type: 'InputNumber', editable: false },
|
key: 'productModel', label: t('devices.productModel'), type: 'Select', editable: isAdmin,
|
||||||
{ key: 'leftMotorReverse', label: t('devices.paramLeftMotorReverse'), type: 'InputNumber', editable: false },
|
options: [
|
||||||
{ key: 'rightMotorReverse', label: t('devices.paramRightMotorReverse'), type: 'InputNumber', editable: false },
|
{ value: 'ST', label: 'ST' },
|
||||||
{ key: 'swapChannel', label: t('devices.paramSwapChannel'), type: 'InputNumber', editable: false },
|
{ value: 'PL', label: 'PL' },
|
||||||
{ key: 'use4G', label: t('devices.paramUse4G'), type: 'InputNumber', editable: false },
|
{ value: 'PR', label: 'PR' },
|
||||||
{ key: 'forwardSpeedLimit', label: t('devices.paramForwardSpeedLimit'), type: 'InputNumber', editable: false },
|
{ value: 'AI', label: 'AI' },
|
||||||
{ key: 'turnSpeedLimit', label: t('devices.paramTurnSpeedLimit'), type: 'InputNumber', editable: false },
|
],
|
||||||
{ key: 'knifePolarity', label: t('devices.paramKnifePolarity'), type: 'InputNumber', editable: false },
|
},
|
||||||
{ key: 'fanPolarity', label: t('devices.paramFanPolarity'), type: 'InputNumber', editable: false },
|
{
|
||||||
{ key: 'throttlePolarity', label: t('devices.paramThrottlePolarity'), type: 'InputNumber', editable: false },
|
key: 'deviceType', label: t('devices.deviceType'), type: 'Select', editable: isAdmin,
|
||||||
{ key: 'liftProtectTime', label: t('devices.paramLiftProtectTime'), type: 'InputNumber', editable: false },
|
options: [
|
||||||
{ key: 'dualRtk', label: t('devices.paramDualRtk'), type: 'InputNumber', editable: false },
|
{ value: 'M', label: t('devices.paramEnum.deviceTypeM') },
|
||||||
{ key: 'knifeChannel', label: t('devices.paramKnifeChannel'), type: 'InputNumber', editable: false },
|
{ value: 'I', label: t('devices.paramEnum.deviceTypeI') },
|
||||||
{ key: 'fanChannel', label: t('devices.paramFanChannel'), type: 'InputNumber', editable: false },
|
{ value: 'U', label: t('devices.paramEnum.deviceTypeU') },
|
||||||
{ key: 'throttleChannel', label: t('devices.paramThrottleChannel'), type: 'InputNumber', editable: false },
|
],
|
||||||
{ key: 'remoteType', label: t('devices.paramRemoteType'), type: 'InputNumber', editable: false },
|
},
|
||||||
{ key: 'relayBoard', label: t('devices.paramRelayBoard'), type: 'Checkbox', editable: false },
|
{
|
||||||
{ key: 'liftChannel', label: t('devices.paramLiftChannel'), type: 'InputNumber', editable: false },
|
key: 'rtkMode', label: t('devices.rtkMode'), type: 'Select', editable: isAdmin,
|
||||||
{ key: 'chassisChannel', label: t('devices.paramChassisChannel'), type: 'InputNumber', editable: false },
|
options: [
|
||||||
{ key: 'armChannel', label: t('devices.paramArmChannel'), type: 'InputNumber', editable: false },
|
{ value: 'N', label: t('devices.paramEnum.rtkModeN') },
|
||||||
{ key: 'fuelPumpChannel', label: t('devices.paramFuelPumpChannel'), type: 'InputNumber', editable: false },
|
{ value: 'B', label: t('devices.paramEnum.rtkModeB') },
|
||||||
{ key: 'wifiName', label: t('devices.paramWifiName'), type: 'Input', editable: false },
|
],
|
||||||
{ key: 'wifiPassword', label: t('devices.paramWifiPassword'), type: 'Input', editable: false },
|
},
|
||||||
{ key: 'batteryType', label: t('devices.paramBatteryType'), type: 'InputNumber', editable: false },
|
{ key: 'cameraNum', label: t('devices.cameraNum'), type: 'InputNumber', editable: isAdmin, min: 0, max: 4, step: 1 },
|
||||||
{ key: 'driveType', label: t('devices.paramDriveType'), type: 'InputNumber', editable: false },
|
{
|
||||||
{ key: 'gearRatio', label: t('devices.paramGearRatio'), type: 'InputNumber', editable: false, step: 0.01 },
|
key: 'powerType', label: t('devices.powerType'), type: 'Select', editable: isAdmin,
|
||||||
{ key: 'robotLength', label: t('devices.paramRobotLength'), type: 'InputNumber', editable: false, step: 0.01 },
|
options: [
|
||||||
{ key: 'robotWidth', label: t('devices.paramRobotWidth'), type: 'InputNumber', editable: false, step: 0.01 },
|
{ value: 'E', label: t('devices.paramEnum.powerTypeE') },
|
||||||
{ key: 'robotHeight', label: t('devices.paramRobotHeight'), type: 'InputNumber', editable: false, step: 0.01 },
|
{ value: 'H', label: t('devices.paramEnum.powerTypeH') },
|
||||||
{ key: 'knifeWidth', label: t('devices.paramKnifeWidth'), type: 'InputNumber', editable: false, step: 0.01 },
|
],
|
||||||
{ key: 'tyreSize', label: t('devices.paramTyreSize'), type: 'InputNumber', editable: false, step: 0.01 },
|
},
|
||||||
{ key: 'firmwareVersion', label: t('devices.paramFirmwareVersion'), type: 'Input', editable: false },
|
{
|
||||||
{ key: 'crc16', label: 'CRC16', type: 'InputNumber', editable: false },
|
key: 'wheelType', label: t('devices.wheelType'), type: 'Select', editable: isAdmin,
|
||||||
{ key: 'tail1', label: 'tail1', type: 'InputNumber', editable: false },
|
options: [
|
||||||
{ key: 'tail2', label: 'tail2', type: 'InputNumber', editable: false },
|
{ value: 'W', label: t('devices.paramEnum.wheelTypeW') },
|
||||||
{ key: 'remark', label: t('roles.remark'), type: 'Input', editable: false },
|
{ value: 'T', label: t('devices.paramEnum.wheelTypeT') },
|
||||||
{ key: 'delFlag', label: t('devices.paramDelFlag'), type: 'Checkbox', editable: false },
|
],
|
||||||
];
|
},
|
||||||
|
{
|
||||||
|
key: 'engineType', label: t('devices.engineType'), type: 'Select', editable: isAdmin,
|
||||||
|
options: [
|
||||||
|
{ value: 'H', label: t('devices.paramEnum.engineTypeH') },
|
||||||
|
{ value: 'L', label: t('devices.paramEnum.engineTypeL') },
|
||||||
|
{ value: 'Z', label: t('devices.paramEnum.engineTypeZ') },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'hasHost', label: t('devices.hasHost'), type: 'Select', editable: isAdmin,
|
||||||
|
options: [
|
||||||
|
{ value: 0, label: t('devices.paramEnum.hasHostNo') },
|
||||||
|
{ value: 1, label: t('devices.paramEnum.hasHostYes') },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'batteryType', label: t('devices.batteryType'), type: 'Select', editable: isAdmin,
|
||||||
|
options: [
|
||||||
|
{ value: '铅酸', label: t('devices.paramEnum.batteryLeadAcid') },
|
||||||
|
{ value: '锂电', label: t('devices.paramEnum.batteryLithium') },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'walkingDriveType', label: t('devices.walkingDriveType'), type: 'Select', editable: isAdmin,
|
||||||
|
options: [
|
||||||
|
{ value: 'FDK', label: 'FDK' },
|
||||||
|
{ value: 'SdBLdc', label: 'SdBLdc' },
|
||||||
|
{ value: 'SdFoc', label: 'SdFoc' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'cutterDriveType', label: t('devices.cutterDriveType'), type: 'Select', editable: isAdmin,
|
||||||
|
options: [
|
||||||
|
{ value: 'XLD', label: 'XLD' },
|
||||||
|
{ value: 'LH', label: 'LH' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'rtkAntennasNum', label: t('devices.rtkAntennasNum'), type: 'Select', editable: isAdmin,
|
||||||
|
options: [
|
||||||
|
{ value: 1, label: t('devices.paramEnum.rtkAntennaSingle') },
|
||||||
|
{ value: 2, label: t('devices.paramEnum.rtkAntennaDual') },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'handleType', label: t('devices.handleType'), type: 'Select', editable: isAdmin,
|
||||||
|
options: [
|
||||||
|
{ value: 'SBUS', label: t('devices.paramEnum.handleSbus') },
|
||||||
|
{ value: '自定义', label: t('devices.paramEnum.handleCustom') },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ key: 'pcbVersion', label: t('devices.pcbVersion'), type: 'Input', editable: isAdmin },
|
||||||
|
{ key: 'dimensions', label: t('devices.dimensions'), type: 'Input', editable: isAdmin },
|
||||||
|
{ key: 'bladeWidth', label: t('devices.bladeWidth'), type: 'Input', editable: isAdmin },
|
||||||
|
{ key: 'tyreSize', label: t('devices.tyreSize'), type: 'Input', editable: isAdmin },
|
||||||
|
{ key: 'speedRatio', label: t('devices.speedRatio'), type: 'Input', editable: isAdmin },
|
||||||
|
{ key: 'cellularInfo', label: t('devices.cellularInfo'), type: 'Input', editable: isAdmin },
|
||||||
|
{ key: 'wifiName', label: t('devices.paramWifiName'), type: 'Input', editable: isAdmin },
|
||||||
|
{ key: 'bluetoothName', label: t('devices.bluetoothName'), type: 'Input', editable: isAdmin },
|
||||||
|
{ key: 'hardwareIdentifiers', label: t('devices.hardwareIdentifiers'), type: 'Input', editable: isAdmin },
|
||||||
|
{ key: 'imuModel', label: t('devices.imuModel'), type: 'Input', editable: isAdmin },
|
||||||
|
{ key: 'tempHumiditySensor', label: t('devices.tempHumiditySensor'), type: 'Input', editable: isAdmin },
|
||||||
|
{ key: 'barometerPresent', label: t('devices.barometerPresent'), type: 'Input', editable: isAdmin },
|
||||||
|
{ key: 'ultrasonicPresent', label: t('devices.ultrasonicPresent'), type: 'Input', editable: isAdmin },
|
||||||
|
{ key: 'dacPresent', label: t('devices.dacPresent'), type: 'Input', editable: isAdmin },
|
||||||
|
{ key: 'operator', label: t('devices.operator'), type: 'Input', editable: isAdmin },
|
||||||
|
{ key: 'inspectionNo', label: t('devices.inspectionNo'), type: 'Input', editable: isAdmin },
|
||||||
|
{ key: 'firmwareVersion', label: t('devices.paramFirmwareVersion'), type: 'Input', editable: isAdmin },
|
||||||
|
{ key: 'dealer', label: t('devices.dealer'), type: 'Input', editable: isAdmin },
|
||||||
|
];
|
||||||
|
|
||||||
|
// 区分增益滑块组 和 其余普通字段组
|
||||||
|
const gainFields = paramFieldConfigs.filter(f => f.type === 'GainSlider');
|
||||||
|
const otherFields = paramFieldConfigs.filter(f => f.type !== 'GainSlider');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
@@ -249,49 +314,33 @@ const DeviceParamModal: React.FC<DeviceParamModalProps> = ({ open, device, onCan
|
|||||||
width={780}
|
width={780}
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
>
|
>
|
||||||
{/* 加载时表单区域简单遮罩提示(打开弹窗拉取参数时的loading反馈) */}
|
|
||||||
<div style={{ maxHeight: '60vh', overflowY: 'auto', paddingRight: 8, position: 'relative' }}>
|
<div style={{ maxHeight: '60vh', overflowY: 'auto', paddingRight: 8, position: 'relative' }}>
|
||||||
<Spin spinning={loading} tip={t('common.loading')}>
|
<Spin spinning={loading} tip={t('common.loading')}>
|
||||||
<Form form={paramForm} layout="vertical" onFinish={saveParam}>
|
<Form form={paramForm} layout="vertical" onFinish={saveParam}>
|
||||||
|
{/* 增益滑块行 */}
|
||||||
<Row gutter={16}>
|
<Row gutter={16}>
|
||||||
{editableKeys.map((key) => {
|
{gainFields.map((field) => {
|
||||||
const field = paramFieldConfigs.find(f => f.key === key);
|
|
||||||
if (!field) return null;
|
|
||||||
const isGainSliderField = ['leftForwardGain', 'leftBackwardGain', 'rightForwardGain', 'rightBackwardGain'].includes(key);
|
|
||||||
const disabled = !field.editable;
|
const disabled = !field.editable;
|
||||||
return (
|
return (
|
||||||
<Col span={12} key={key}>
|
<Col span={12} key={field.key}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={<span style={{ fontWeight: 500 }}>{field.label}</span>}
|
label={<span style={{ fontWeight: 500 }}>{field.label}</span>}
|
||||||
name={field.key}
|
name={field.key}
|
||||||
>
|
>
|
||||||
{isGainSliderField ? (
|
<GainSliderInput
|
||||||
<GainSliderInput
|
disabled={disabled}
|
||||||
disabled={disabled}
|
min={field.min}
|
||||||
min={field.min}
|
max={field.max}
|
||||||
max={field.max}
|
step={field.step}
|
||||||
step={0.01}
|
/>
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<InputNumber
|
|
||||||
style={{ width: '100%' }}
|
|
||||||
disabled={disabled}
|
|
||||||
min={field.min}
|
|
||||||
max={field.max}
|
|
||||||
step={field.step}
|
|
||||||
placeholder={typeof field.min === 'number' ? `${field.min}~${field.max}` : ''}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</Row>
|
</Row>
|
||||||
|
{/* runSpeed + 其余全部只读字段 */}
|
||||||
|
|
||||||
<Row gutter={16}>
|
<Row gutter={16}>
|
||||||
{paramFieldConfigs.filter(f => !editableKeys.includes(f.key)).map((field) => {
|
{otherFields.map((field) => {
|
||||||
const disabled = !field.editable;
|
const disabled = !field.editable;
|
||||||
return (
|
return (
|
||||||
<Col span={12} key={field.key}>
|
<Col span={12} key={field.key}>
|
||||||
@@ -300,14 +349,24 @@ const DeviceParamModal: React.FC<DeviceParamModalProps> = ({ open, device, onCan
|
|||||||
name={field.key}
|
name={field.key}
|
||||||
valuePropName={field.type === 'Checkbox' ? 'checked' : undefined}
|
valuePropName={field.type === 'Checkbox' ? 'checked' : undefined}
|
||||||
>
|
>
|
||||||
{field.type === 'InputNumber' ? (
|
{field.type === 'Select' ? (
|
||||||
|
<Select
|
||||||
|
style={{ width: '100%' }}
|
||||||
|
disabled={disabled}
|
||||||
|
allowClear
|
||||||
|
showSearch
|
||||||
|
optionFilterProp="label"
|
||||||
|
options={field.options}
|
||||||
|
placeholder={t('devices.noData')}
|
||||||
|
/>
|
||||||
|
) : field.type === 'InputNumber' ? (
|
||||||
<InputNumber
|
<InputNumber
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
min={field.min}
|
min={field.min}
|
||||||
max={field.max}
|
max={field.max}
|
||||||
step={field.step}
|
step={field.step}
|
||||||
placeholder={typeof field.min === 'number' ? `${field.min}~${field.max}` : ''}
|
placeholder={typeof field.min === 'number' ? `${field.min}~${field.max}` : t('devices.noData')}
|
||||||
/>
|
/>
|
||||||
) : field.type === 'Checkbox' ? (
|
) : field.type === 'Checkbox' ? (
|
||||||
<Checkbox disabled={disabled} />
|
<Checkbox disabled={disabled} />
|
||||||
@@ -325,5 +384,4 @@ const DeviceParamModal: React.FC<DeviceParamModalProps> = ({ open, device, onCan
|
|||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default DeviceParamModal;
|
export default DeviceParamModal;
|
||||||
|
|||||||
@@ -784,7 +784,7 @@
|
|||||||
outdoor: 'Outdoor',
|
outdoor: 'Outdoor',
|
||||||
panorama: 'Panorama',
|
panorama: 'Panorama',
|
||||||
paramArmChannel: 'Param Arm Channel',
|
paramArmChannel: 'Param Arm Channel',
|
||||||
paramBatteryType: 'Param Battery Type',
|
batteryType: ' Battery Type',
|
||||||
paramChassisChannel: 'Param Chassis Channel',
|
paramChassisChannel: 'Param Chassis Channel',
|
||||||
paramChipUid: 'Param Chip Uid',
|
paramChipUid: 'Param Chip Uid',
|
||||||
paramChipUidSign: 'Param Chip Uid Sign',
|
paramChipUidSign: 'Param Chip Uid Sign',
|
||||||
@@ -823,7 +823,7 @@
|
|||||||
paramThrottleChannel: 'Param Throttle Channel',
|
paramThrottleChannel: 'Param Throttle Channel',
|
||||||
paramThrottlePolarity: 'Param Throttle Polarity',
|
paramThrottlePolarity: 'Param Throttle Polarity',
|
||||||
paramTurnSpeedLimit: 'Param Turn Speed Limit',
|
paramTurnSpeedLimit: 'Param Turn Speed Limit',
|
||||||
paramTyreSize: 'Param Tyre Size',
|
tyreSize: 'Tyre Size',
|
||||||
paramUse4G: 'Param Use4G',
|
paramUse4G: 'Param Use4G',
|
||||||
paramViewEditTitle: 'Param View Edit Title',
|
paramViewEditTitle: 'Param View Edit Title',
|
||||||
paramWalkMotorMode: 'Param Walk Motor Mode',
|
paramWalkMotorMode: 'Param Walk Motor Mode',
|
||||||
@@ -854,6 +854,50 @@
|
|||||||
realtimePowerData: 'Realtime Power Data',
|
realtimePowerData: 'Realtime Power Data',
|
||||||
realtimeSpeed: 'Realtime Speed',
|
realtimeSpeed: 'Realtime Speed',
|
||||||
forwardSpeed: 'Forward Speed',
|
forwardSpeed: 'Forward Speed',
|
||||||
|
"deviceId": "Device ID",
|
||||||
|
|
||||||
|
"walkingDriveType": "Walking Drive Type",
|
||||||
|
"cutterDriveType": "Cutter Drive Type",
|
||||||
|
"rtkAntennasNum": "RTK Antennas Number",
|
||||||
|
"handleType": "Handle Type",
|
||||||
|
"pcbVersion": "PCB Version",
|
||||||
|
"dimensions": "Dimensions",
|
||||||
|
"bladeWidth": "Blade Width",
|
||||||
|
"speedRatio": "Speed Ratio",
|
||||||
|
"cellularInfo": "Cellular Info",
|
||||||
|
"bluetoothName": "Bluetooth Name",
|
||||||
|
"hardwareIdentifiers": "Hardware Identifiers",
|
||||||
|
"imuModel": "IMU Model",
|
||||||
|
"tempHumiditySensor": "Temp Humidity Sensor",
|
||||||
|
"barometerPresent": "Barometer Present",
|
||||||
|
"ultrasonicPresent": "Ultrasonic Present",
|
||||||
|
"dacPresent": "DAC Present",
|
||||||
|
"operator": "Operator",
|
||||||
|
"inspectionNo": "Inspection No",
|
||||||
|
"activeTime": "Active Time",
|
||||||
|
"dealer": "Dealer",
|
||||||
|
paramEnum: {
|
||||||
|
deviceTypeM: 'Mower',
|
||||||
|
deviceTypeI: 'Inspection',
|
||||||
|
deviceTypeU: 'UAV',
|
||||||
|
wheelTypeW: 'Wheel',
|
||||||
|
wheelTypeT: 'Track',
|
||||||
|
powerTypeE: 'Electric',
|
||||||
|
powerTypeH: 'Hybrid',
|
||||||
|
rtkModeN: 'Network',
|
||||||
|
rtkModeB: 'Base Station',
|
||||||
|
engineTypeH: 'Honda',
|
||||||
|
engineTypeL: 'Loncin',
|
||||||
|
engineTypeZ: 'None',
|
||||||
|
hasHostNo: 'No',
|
||||||
|
hasHostYes: 'Yes',
|
||||||
|
batteryLeadAcid: 'Lead-acid',
|
||||||
|
batteryLithium: 'Lithium',
|
||||||
|
rtkAntennaSingle: 'Single antenna',
|
||||||
|
rtkAntennaDual: 'Dual antenna',
|
||||||
|
handleSbus: 'SBUS',
|
||||||
|
handleCustom: 'Custom',
|
||||||
|
},
|
||||||
turnSpeed: 'Turn Speed',
|
turnSpeed: 'Turn Speed',
|
||||||
realtimeVideoMonitor: 'Realtime Video Monitor',
|
realtimeVideoMonitor: 'Realtime Video Monitor',
|
||||||
rechargeBtn: 'Recharge Btn',
|
rechargeBtn: 'Recharge Btn',
|
||||||
|
|||||||
@@ -810,7 +810,7 @@ const zh = {
|
|||||||
outdoor: '室外',
|
outdoor: '室外',
|
||||||
panorama: '全景',
|
panorama: '全景',
|
||||||
paramArmChannel: '布防渠道',
|
paramArmChannel: '布防渠道',
|
||||||
paramBatteryType: '电量类型',
|
batteryType: '电池类型',
|
||||||
paramChassisChannel: '底盘渠道',
|
paramChassisChannel: '底盘渠道',
|
||||||
paramChipUid: '芯片UID',
|
paramChipUid: '芯片UID',
|
||||||
paramChipUidSign: '芯片UID标识',
|
paramChipUidSign: '芯片UID标识',
|
||||||
@@ -849,7 +849,7 @@ const zh = {
|
|||||||
paramThrottleChannel: '油门渠道',
|
paramThrottleChannel: '油门渠道',
|
||||||
paramThrottlePolarity: '油门极性',
|
paramThrottlePolarity: '油门极性',
|
||||||
paramTurnSpeedLimit: '转向速度限制',
|
paramTurnSpeedLimit: '转向速度限制',
|
||||||
paramTyreSize: '轮胎大小',
|
tyreSize: '轮胎尺寸',
|
||||||
paramUse4G: '4G',
|
paramUse4G: '4G',
|
||||||
paramViewEditTitle: '参数查看编辑',
|
paramViewEditTitle: '参数查看编辑',
|
||||||
paramWalkMotorMode: '行走电机模式',
|
paramWalkMotorMode: '行走电机模式',
|
||||||
@@ -1449,7 +1449,52 @@ const zh = {
|
|||||||
UnitsRobot: "台",
|
UnitsRobot: "台",
|
||||||
UnitsDrone: "架",
|
UnitsDrone: "架",
|
||||||
platformRequestControl: "{{platform}} 正在请求控制权限",
|
platformRequestControl: "{{platform}} 正在请求控制权限",
|
||||||
controlFailed: "controlFailed",
|
controlFailed: "控制失败",
|
||||||
|
|
||||||
|
"deviceId": "设备序列号",
|
||||||
|
|
||||||
|
"walkingDriveType": "行走驱动类型",
|
||||||
|
"cutterDriveType": "割刀驱动类型",
|
||||||
|
"rtkAntennasNum": "RTK天线数",
|
||||||
|
"handleType": "手柄类型",
|
||||||
|
"pcbVersion": "PCB硬件版本",
|
||||||
|
"dimensions": "长宽高",
|
||||||
|
"bladeWidth": "割刀宽度",
|
||||||
|
"speedRatio": "转速比",
|
||||||
|
"cellularInfo": "蜂窝网络通信信息",
|
||||||
|
"bluetoothName": "蓝牙广播名",
|
||||||
|
"hardwareIdentifiers": "硬件标识信息",
|
||||||
|
"imuModel": "IMU型号",
|
||||||
|
"tempHumiditySensor": "温湿度传感器",
|
||||||
|
"barometerPresent": "气压计在位",
|
||||||
|
"ultrasonicPresent": "超声波在位",
|
||||||
|
"dacPresent": "DAC在位",
|
||||||
|
"operator": "质检员",
|
||||||
|
"inspectionNo": "检测报告号",
|
||||||
|
"activeTime": "激活时间",
|
||||||
|
"dealer": "经销商",
|
||||||
|
paramEnum: {
|
||||||
|
deviceTypeM: '割草机',
|
||||||
|
deviceTypeI: '巡检',
|
||||||
|
deviceTypeU: '无人机',
|
||||||
|
wheelTypeW: '轮式',
|
||||||
|
wheelTypeT: '履带',
|
||||||
|
powerTypeE: '纯电',
|
||||||
|
powerTypeH: '混动',
|
||||||
|
rtkModeN: '网络',
|
||||||
|
rtkModeB: '基站',
|
||||||
|
engineTypeH: '本田',
|
||||||
|
engineTypeL: '隆鑫',
|
||||||
|
engineTypeZ: '无',
|
||||||
|
hasHostNo: '无',
|
||||||
|
hasHostYes: '有',
|
||||||
|
batteryLeadAcid: '铅酸',
|
||||||
|
batteryLithium: '锂电',
|
||||||
|
rtkAntennaSingle: '单天线',
|
||||||
|
rtkAntennaDual: '双天线',
|
||||||
|
handleSbus: 'SBUS',
|
||||||
|
handleCustom: '自定义',
|
||||||
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
video: {
|
video: {
|
||||||
|
|||||||
Reference in New Issue
Block a user