|
|
@ -15,7 +15,8 @@ import { |
|
|
Spin, |
|
|
Spin, |
|
|
Alert, |
|
|
Alert, |
|
|
Tooltip, |
|
|
Tooltip, |
|
|
Modal |
|
|
Modal, |
|
|
|
|
|
Tabs |
|
|
} from "antd"; |
|
|
} from "antd"; |
|
|
import { |
|
|
import { |
|
|
SettingOutlined, |
|
|
SettingOutlined, |
|
|
@ -87,15 +88,20 @@ const AdvancedSettings = ({ onLogout, locationConfig }) => { |
|
|
const windowSize = settings.filterConfig?.size ?? 5; |
|
|
const windowSize = settings.filterConfig?.size ?? 5; |
|
|
const filterThreshold = settings.filterConfig?.threshold ?? 0.1; |
|
|
const filterThreshold = settings.filterConfig?.threshold ?? 0.1; |
|
|
const flowThreshold = settings.filterConfig?.imgThreshold ?? 10.0; |
|
|
const flowThreshold = settings.filterConfig?.imgThreshold ?? 10.0; |
|
|
const enableMqtt = settings.mqttConfig?.enable ?? true; |
|
|
|
|
|
const brokerAddress = settings.mqttConfig?.mqtt?.broker ?? ''; |
|
|
|
|
|
const mqttPort = settings.mqttConfig?.mqtt?.port ?? 1883; |
|
|
|
|
|
const mqttTopic = settings.mqttConfig?.mqtt?.topic ?? ''; |
|
|
|
|
|
const mqttClientId = settings.mqttConfig?.mqtt?.client_id ?? ''; |
|
|
|
|
|
const mqttUsername = settings.mqttConfig?.mqtt?.username ?? ''; |
|
|
|
|
|
const mqttPassword = settings.mqttConfig?.mqtt?.password ?? ''; |
|
|
|
|
|
const enableBatch = settings.mqttConfig?.batch ?? false; |
|
|
const enableBatch = settings.mqttConfig?.batch ?? false; |
|
|
const batchInterpolation = settings.mqttConfig?.interpolation ?? 'copy'; |
|
|
const batchInterpolation = settings.mqttConfig?.interpolation ?? 'copy'; |
|
|
|
|
|
const MQTT_TEMPLATE = { |
|
|
|
|
|
enable: false, |
|
|
|
|
|
broker: '', |
|
|
|
|
|
port: 1883, |
|
|
|
|
|
topic: '', |
|
|
|
|
|
username: '', |
|
|
|
|
|
password: '', |
|
|
|
|
|
client_id: '' |
|
|
|
|
|
}; |
|
|
|
|
|
const mqtts = settings.mqttConfig?.mqtts ?? [MQTT_TEMPLATE, MQTT_TEMPLATE]; |
|
|
|
|
|
const brokers = [0, 1].map((i) => ({ ...MQTT_TEMPLATE, ...(mqtts[i] ?? {}) })); |
|
|
|
|
|
const anyMqttEnabled = brokers.some((b) => b.enable); |
|
|
|
|
|
|
|
|
// 更新本地状态的辅助函数 |
|
|
// 更新本地状态的辅助函数 |
|
|
const setDeviceId = (value) => updateLocalSettings({ deviceId: value }); |
|
|
const setDeviceId = (value) => updateLocalSettings({ deviceId: value }); |
|
|
@ -135,78 +141,22 @@ const AdvancedSettings = ({ onLogout, locationConfig }) => { |
|
|
updateLocalSettings({ |
|
|
updateLocalSettings({ |
|
|
filterConfig: { ...settings.filterConfig, imgThreshold: value }, |
|
|
filterConfig: { ...settings.filterConfig, imgThreshold: value }, |
|
|
}); |
|
|
}); |
|
|
const setEnableMqtt = (value) => |
|
|
const setMqttEnable = (index, value) => |
|
|
updateLocalSettings({ |
|
|
|
|
|
mqttConfig: { |
|
|
|
|
|
enable: value, |
|
|
|
|
|
mqtt: settings.mqttConfig?.mqtt ?? { |
|
|
|
|
|
broker: '', |
|
|
|
|
|
port: 1883, |
|
|
|
|
|
topic: '', |
|
|
|
|
|
username: '', |
|
|
|
|
|
password: '', |
|
|
|
|
|
client_id: '' |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
|
|
|
const setBrokerAddress = (value) => |
|
|
|
|
|
updateLocalSettings({ |
|
|
updateLocalSettings({ |
|
|
mqttConfig: { |
|
|
mqttConfig: { |
|
|
...settings.mqttConfig, |
|
|
...settings.mqttConfig, |
|
|
mqtt: { |
|
|
mqtts: brokers.map((b, i) => |
|
|
...(settings.mqttConfig?.mqtt ?? {}), |
|
|
i === index ? { ...b, enable: value } : b |
|
|
broker: value |
|
|
), |
|
|
}, |
|
|
|
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
const setMqttPort = (value) => |
|
|
const setMqttField = (index, field, value) => |
|
|
updateLocalSettings({ |
|
|
updateLocalSettings({ |
|
|
mqttConfig: { |
|
|
mqttConfig: { |
|
|
...settings.mqttConfig, |
|
|
...settings.mqttConfig, |
|
|
mqtt: { |
|
|
mqtts: brokers.map((b, i) => |
|
|
...(settings.mqttConfig?.mqtt ?? {}), |
|
|
i === index ? { ...b, [field]: value } : b |
|
|
port: value |
|
|
), |
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
|
|
|
const setMqttTopic = (value) => |
|
|
|
|
|
updateLocalSettings({ |
|
|
|
|
|
mqttConfig: { |
|
|
|
|
|
...settings.mqttConfig, |
|
|
|
|
|
mqtt: { |
|
|
|
|
|
...(settings.mqttConfig?.mqtt ?? {}), |
|
|
|
|
|
topic: value |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
|
|
|
const setMqttClientId = (value) => |
|
|
|
|
|
updateLocalSettings({ |
|
|
|
|
|
mqttConfig: { |
|
|
|
|
|
...settings.mqttConfig, |
|
|
|
|
|
mqtt: { |
|
|
|
|
|
...(settings.mqttConfig?.mqtt ?? {}), |
|
|
|
|
|
client_id: value |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
|
|
|
const setMqttUsername = (value) => |
|
|
|
|
|
updateLocalSettings({ |
|
|
|
|
|
mqttConfig: { |
|
|
|
|
|
...settings.mqttConfig, |
|
|
|
|
|
mqtt: { |
|
|
|
|
|
...(settings.mqttConfig?.mqtt ?? {}), |
|
|
|
|
|
username: value |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
|
|
|
const setMqttPassword = (value) => |
|
|
|
|
|
updateLocalSettings({ |
|
|
|
|
|
mqttConfig: { |
|
|
|
|
|
...settings.mqttConfig, |
|
|
|
|
|
mqtt: { |
|
|
|
|
|
...(settings.mqttConfig?.mqtt ?? {}), |
|
|
|
|
|
password: value |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
const setEnableBatch = (value) => |
|
|
const setEnableBatch = (value) => |
|
|
@ -303,21 +253,36 @@ const AdvancedSettings = ({ onLogout, locationConfig }) => { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const handleSave = async () => { |
|
|
const handleSave = async () => { |
|
|
if (enableMqtt) { |
|
|
for (let index = 0; index < brokers.length; index++) { |
|
|
if (brokerAddress && !validateIP(brokerAddress)) { |
|
|
const broker = brokers[index]; |
|
|
message.error('Broker 地址格式不正确,请检查后重试'); |
|
|
if (!broker.enable) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
const brokerNo = index + 1; |
|
|
|
|
|
if (broker.broker && !validateIP(broker.broker)) { |
|
|
|
|
|
message.error(`Broker ${brokerNo} 地址格式不正确,请检查后重试`); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (mqttPort && !validatePort(mqttPort)) { |
|
|
if (broker.port && !validatePort(broker.port)) { |
|
|
message.error('端口号格式不正确,请检查后重试'); |
|
|
message.error(`Broker ${brokerNo} 端口号格式不正确,请检查后重试`); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (!brokerAddress) { |
|
|
if (!broker.broker) { |
|
|
message.warning('启用 MQTT 时请填写 Broker 地址'); |
|
|
message.warning(`启用了 Broker ${brokerNo},请填写 Broker 地址`); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
brokers[0].enable && |
|
|
|
|
|
brokers[1].enable && |
|
|
|
|
|
brokers[0].broker.trim().toLowerCase() === |
|
|
|
|
|
brokers[1].broker.trim().toLowerCase() |
|
|
|
|
|
) { |
|
|
|
|
|
message.warning("Broker 1 与 Broker 2 的地址不能相同"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
setSaving(true); |
|
|
setSaving(true); |
|
|
const success = await saveAllSettings(); |
|
|
const success = await saveAllSettings(); |
|
|
@ -333,6 +298,145 @@ const AdvancedSettings = ({ onLogout, locationConfig }) => { |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 渲染单个 Broker 配置面板(Tabs 内容) |
|
|
|
|
|
const renderBrokerPane = (index) => { |
|
|
|
|
|
const broker = brokers[index]; |
|
|
|
|
|
const brokerNo = index + 1; |
|
|
|
|
|
return ( |
|
|
|
|
|
<div> |
|
|
|
|
|
{/* 启用开关 */} |
|
|
|
|
|
<div |
|
|
|
|
|
style={{ |
|
|
|
|
|
background: |
|
|
|
|
|
"linear-gradient(135deg, #f5f7fa 0%, #e8eef5 100%)", |
|
|
|
|
|
padding: 20, |
|
|
|
|
|
borderRadius: 12, |
|
|
|
|
|
}} |
|
|
|
|
|
> |
|
|
|
|
|
<Row justify="space-between" align="middle"> |
|
|
|
|
|
<Col> |
|
|
|
|
|
<Text strong>启用 Broker {brokerNo} 上报</Text> |
|
|
|
|
|
<br /> |
|
|
|
|
|
<Text type="secondary" style={{ fontSize: 12 }}> |
|
|
|
|
|
开启后,设备将按下方配置向该 Broker 上报数据。 |
|
|
|
|
|
</Text> |
|
|
|
|
|
</Col> |
|
|
|
|
|
<Col> |
|
|
|
|
|
<Switch |
|
|
|
|
|
checked={broker.enable} |
|
|
|
|
|
onChange={(value) => setMqttEnable(index, value)} |
|
|
|
|
|
checkedChildren="开启" |
|
|
|
|
|
unCheckedChildren="关闭" |
|
|
|
|
|
/> |
|
|
|
|
|
</Col> |
|
|
|
|
|
</Row> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
{/* Broker 配置字段 */} |
|
|
|
|
|
<Row gutter={[12, 12]} style={{ marginTop: 16 }}> |
|
|
|
|
|
<Col span={12}> |
|
|
|
|
|
<div style={{ marginBottom: 4, fontWeight: 500 }}> |
|
|
|
|
|
Broker Address |
|
|
|
|
|
<Text type="danger"> *</Text> |
|
|
|
|
|
</div> |
|
|
|
|
|
<Input |
|
|
|
|
|
value={broker.broker} |
|
|
|
|
|
onChange={(e) => setMqttField(index, 'broker', e.target.value)} |
|
|
|
|
|
placeholder="例如: 218.3.126.49 或 mqtt.example.com" |
|
|
|
|
|
size="large" |
|
|
|
|
|
disabled={!broker.enable} |
|
|
|
|
|
style={{ |
|
|
|
|
|
borderRadius: 8, |
|
|
|
|
|
borderColor: broker.broker && !validateIP(broker.broker) ? '#ff4d4f' : undefined |
|
|
|
|
|
}} |
|
|
|
|
|
status={broker.broker && !validateIP(broker.broker) ? 'error' : undefined} |
|
|
|
|
|
/> |
|
|
|
|
|
{broker.broker && !validateIP(broker.broker) && ( |
|
|
|
|
|
<Text type="danger" style={{ fontSize: 12 }}> |
|
|
|
|
|
请输入有效的 IPv4 地址 |
|
|
|
|
|
</Text> |
|
|
|
|
|
)} |
|
|
|
|
|
</Col> |
|
|
|
|
|
<Col span={8}> |
|
|
|
|
|
<div style={{ marginBottom: 4, fontWeight: 500 }}> |
|
|
|
|
|
Port |
|
|
|
|
|
<Text type="danger"> *</Text> |
|
|
|
|
|
</div> |
|
|
|
|
|
<Input |
|
|
|
|
|
value={broker.port} |
|
|
|
|
|
onChange={(e) => setMqttField(index, 'port', e.target.value)} |
|
|
|
|
|
placeholder="1883" |
|
|
|
|
|
size="large" |
|
|
|
|
|
disabled={!broker.enable} |
|
|
|
|
|
style={{ |
|
|
|
|
|
borderRadius: 8, |
|
|
|
|
|
borderColor: broker.port && !validatePort(broker.port) ? '#ff4d4f' : undefined |
|
|
|
|
|
}} |
|
|
|
|
|
status={broker.port && !validatePort(broker.port) ? 'error' : undefined} |
|
|
|
|
|
/> |
|
|
|
|
|
{broker.port && !validatePort(broker.port) && ( |
|
|
|
|
|
<Text type="danger" style={{ fontSize: 12 }}> |
|
|
|
|
|
端口范围: 1-65535 |
|
|
|
|
|
</Text> |
|
|
|
|
|
)} |
|
|
|
|
|
</Col> |
|
|
|
|
|
<Col span={12}> |
|
|
|
|
|
<div style={{ marginBottom: 4, fontWeight: 500 }}> |
|
|
|
|
|
Topic |
|
|
|
|
|
</div> |
|
|
|
|
|
<Input |
|
|
|
|
|
value={broker.topic} |
|
|
|
|
|
onChange={(e) => setMqttField(index, 'topic', e.target.value)} |
|
|
|
|
|
placeholder="例如: wybb/z/mqtt179" |
|
|
|
|
|
size="large" |
|
|
|
|
|
disabled={!broker.enable} |
|
|
|
|
|
style={{ borderRadius: 8 }} |
|
|
|
|
|
/> |
|
|
|
|
|
</Col> |
|
|
|
|
|
<Col span={8}> |
|
|
|
|
|
<div style={{ marginBottom: 4, fontWeight: 500 }}> |
|
|
|
|
|
Client ID |
|
|
|
|
|
</div> |
|
|
|
|
|
<Input |
|
|
|
|
|
value={broker.client_id} |
|
|
|
|
|
onChange={(e) => setMqttField(index, 'client_id', e.target.value)} |
|
|
|
|
|
placeholder="wybb_z1_123" |
|
|
|
|
|
size="large" |
|
|
|
|
|
disabled={!broker.enable} |
|
|
|
|
|
style={{ borderRadius: 8 }} |
|
|
|
|
|
/> |
|
|
|
|
|
</Col> |
|
|
|
|
|
<Col span={8}> |
|
|
|
|
|
<div style={{ marginBottom: 4, fontWeight: 500 }}> |
|
|
|
|
|
Username |
|
|
|
|
|
</div> |
|
|
|
|
|
<Input |
|
|
|
|
|
value={broker.username} |
|
|
|
|
|
onChange={(e) => setMqttField(index, 'username', e.target.value)} |
|
|
|
|
|
placeholder="用户名" |
|
|
|
|
|
size="large" |
|
|
|
|
|
disabled={!broker.enable} |
|
|
|
|
|
style={{ borderRadius: 8 }} |
|
|
|
|
|
/> |
|
|
|
|
|
</Col> |
|
|
|
|
|
<Col span={8}> |
|
|
|
|
|
<div style={{ marginBottom: 4, fontWeight: 500 }}> |
|
|
|
|
|
Password |
|
|
|
|
|
</div> |
|
|
|
|
|
<Input.Password |
|
|
|
|
|
value={broker.password} |
|
|
|
|
|
onChange={(e) => setMqttField(index, 'password', e.target.value)} |
|
|
|
|
|
placeholder="密码" |
|
|
|
|
|
size="large" |
|
|
|
|
|
disabled={!broker.enable} |
|
|
|
|
|
style={{ borderRadius: 8 }} |
|
|
|
|
|
/> |
|
|
|
|
|
</Col> |
|
|
|
|
|
</Row> |
|
|
|
|
|
</div> |
|
|
|
|
|
); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
const handleReset = () => { |
|
|
const handleReset = () => { |
|
|
fetchAllSettings(); |
|
|
fetchAllSettings(); |
|
|
}; |
|
|
}; |
|
|
@ -654,7 +758,7 @@ const AdvancedSettings = ({ onLogout, locationConfig }) => { |
|
|
</div> |
|
|
</div> |
|
|
<InputNumber |
|
|
<InputNumber |
|
|
min={3} |
|
|
min={3} |
|
|
max={21} |
|
|
max={31} |
|
|
step={2} |
|
|
step={2} |
|
|
value={windowSize} |
|
|
value={windowSize} |
|
|
onChange={setWindowSize} |
|
|
onChange={setWindowSize} |
|
|
@ -697,24 +801,10 @@ const AdvancedSettings = ({ onLogout, locationConfig }) => { |
|
|
|
|
|
|
|
|
<Card |
|
|
<Card |
|
|
title={ |
|
|
title={ |
|
|
<div |
|
|
|
|
|
style={{ |
|
|
|
|
|
display: "flex", |
|
|
|
|
|
justifyContent: "space-between", |
|
|
|
|
|
alignItems: "center", |
|
|
|
|
|
}} |
|
|
|
|
|
> |
|
|
|
|
|
<Space> |
|
|
<Space> |
|
|
<CloudUploadOutlined style={{ color: "#667eea" }} /> |
|
|
<CloudUploadOutlined style={{ color: "#667eea" }} /> |
|
|
<span>数据上报 (MQTT)</span> |
|
|
<span>数据上报 (MQTT)</span> |
|
|
</Space> |
|
|
</Space> |
|
|
<Switch |
|
|
|
|
|
checked={enableMqtt} |
|
|
|
|
|
onChange={setEnableMqtt} |
|
|
|
|
|
checkedChildren="启用" |
|
|
|
|
|
unCheckedChildren="禁用" |
|
|
|
|
|
/> |
|
|
|
|
|
</div> |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
style={{ |
|
|
style={{ |
|
|
@ -723,106 +813,14 @@ const AdvancedSettings = ({ onLogout, locationConfig }) => { |
|
|
paddingRight: 24, |
|
|
paddingRight: 24, |
|
|
}} |
|
|
}} |
|
|
> |
|
|
> |
|
|
<Row gutter={[12, 12]}> |
|
|
<Tabs |
|
|
<Col span={12}> |
|
|
defaultActiveKey="0" |
|
|
<div style={{ marginBottom: 4, fontWeight: 500 }}> |
|
|
items={[0, 1].map((index) => ({ |
|
|
Broker Address |
|
|
key: String(index), |
|
|
<Text type="danger"> *</Text> |
|
|
label: `Broker ${index + 1}`, |
|
|
</div> |
|
|
children: renderBrokerPane(index), |
|
|
<Input |
|
|
}))} |
|
|
value={brokerAddress} |
|
|
|
|
|
onChange={(e) => setBrokerAddress(e.target.value)} |
|
|
|
|
|
placeholder="例如: 218.3.126.49 或 mqtt.example.com" |
|
|
|
|
|
size="large" |
|
|
|
|
|
disabled={!enableMqtt} |
|
|
|
|
|
style={{ |
|
|
|
|
|
borderRadius: 8, |
|
|
|
|
|
borderColor: brokerAddress && !validateIP(brokerAddress) ? '#ff4d4f' : undefined |
|
|
|
|
|
}} |
|
|
|
|
|
status={brokerAddress && !validateIP(brokerAddress) ? 'error' : undefined} |
|
|
|
|
|
/> |
|
|
|
|
|
{brokerAddress && !validateIP(brokerAddress) && ( |
|
|
|
|
|
<Text type="danger" style={{ fontSize: 12 }}> |
|
|
|
|
|
请输入有效的 IPv4 地址 |
|
|
|
|
|
</Text> |
|
|
|
|
|
)} |
|
|
|
|
|
</Col> |
|
|
|
|
|
<Col span={8}> |
|
|
|
|
|
<div style={{ marginBottom: 4, fontWeight: 500 }}> |
|
|
|
|
|
Port |
|
|
|
|
|
<Text type="danger"> *</Text> |
|
|
|
|
|
</div> |
|
|
|
|
|
<Input |
|
|
|
|
|
value={mqttPort} |
|
|
|
|
|
onChange={(e) => setMqttPort(e.target.value)} |
|
|
|
|
|
placeholder="1883" |
|
|
|
|
|
size="large" |
|
|
|
|
|
disabled={!enableMqtt} |
|
|
|
|
|
style={{ |
|
|
|
|
|
borderRadius: 8, |
|
|
|
|
|
borderColor: mqttPort && !validatePort(mqttPort) ? '#ff4d4f' : undefined |
|
|
|
|
|
}} |
|
|
|
|
|
status={mqttPort && !validatePort(mqttPort) ? 'error' : undefined} |
|
|
|
|
|
/> |
|
|
|
|
|
{mqttPort && !validatePort(mqttPort) && ( |
|
|
|
|
|
<Text type="danger" style={{ fontSize: 12 }}> |
|
|
|
|
|
端口范围: 1-65535 |
|
|
|
|
|
</Text> |
|
|
|
|
|
)} |
|
|
|
|
|
</Col> |
|
|
|
|
|
<Col span={12}> |
|
|
|
|
|
<div style={{ marginBottom: 4, fontWeight: 500 }}> |
|
|
|
|
|
Topic |
|
|
|
|
|
</div> |
|
|
|
|
|
<Input |
|
|
|
|
|
value={mqttTopic} |
|
|
|
|
|
onChange={(e) => setMqttTopic(e.target.value)} |
|
|
|
|
|
placeholder="例如: wybb/z/mqtt179" |
|
|
|
|
|
size="large" |
|
|
|
|
|
disabled={!enableMqtt} |
|
|
|
|
|
style={{ borderRadius: 8 }} |
|
|
|
|
|
/> |
|
|
/> |
|
|
</Col> |
|
|
|
|
|
<Col span={8}> |
|
|
|
|
|
<div style={{ marginBottom: 4, fontWeight: 500 }}> |
|
|
|
|
|
Client ID |
|
|
|
|
|
</div> |
|
|
|
|
|
<Input |
|
|
|
|
|
value={mqttClientId} |
|
|
|
|
|
onChange={(e) => setMqttClientId(e.target.value)} |
|
|
|
|
|
placeholder="wybb_z1_123" |
|
|
|
|
|
size="large" |
|
|
|
|
|
disabled={!enableMqtt} |
|
|
|
|
|
style={{ borderRadius: 8 }} |
|
|
|
|
|
/> |
|
|
|
|
|
</Col> |
|
|
|
|
|
<Col span={8}> |
|
|
|
|
|
<div style={{ marginBottom: 4, fontWeight: 500 }}> |
|
|
|
|
|
Username |
|
|
|
|
|
</div> |
|
|
|
|
|
<Input |
|
|
|
|
|
value={mqttUsername} |
|
|
|
|
|
onChange={(e) => setMqttUsername(e.target.value)} |
|
|
|
|
|
placeholder="用户名" |
|
|
|
|
|
size="large" |
|
|
|
|
|
disabled={!enableMqtt} |
|
|
|
|
|
style={{ borderRadius: 8 }} |
|
|
|
|
|
/> |
|
|
|
|
|
</Col> |
|
|
|
|
|
<Col span={8}> |
|
|
|
|
|
<div style={{ marginBottom: 4, fontWeight: 500 }}> |
|
|
|
|
|
Password |
|
|
|
|
|
</div> |
|
|
|
|
|
<Input.Password |
|
|
|
|
|
value={mqttPassword} |
|
|
|
|
|
onChange={(e) => setMqttPassword(e.target.value)} |
|
|
|
|
|
placeholder="密码" |
|
|
|
|
|
size="large" |
|
|
|
|
|
disabled={!enableMqtt} |
|
|
|
|
|
style={{ borderRadius: 8 }} |
|
|
|
|
|
/> |
|
|
|
|
|
</Col> |
|
|
|
|
|
</Row> |
|
|
|
|
|
|
|
|
|
|
|
{/* 每秒批量上报 */} |
|
|
{/* 每秒批量上报 */} |
|
|
<div |
|
|
<div |
|
|
@ -848,7 +846,7 @@ const AdvancedSettings = ({ onLogout, locationConfig }) => { |
|
|
onChange={setEnableBatch} |
|
|
onChange={setEnableBatch} |
|
|
checkedChildren="开启" |
|
|
checkedChildren="开启" |
|
|
unCheckedChildren="关闭" |
|
|
unCheckedChildren="关闭" |
|
|
disabled={!enableMqtt} |
|
|
disabled={!anyMqttEnabled} |
|
|
/> |
|
|
/> |
|
|
</Col> |
|
|
</Col> |
|
|
</Row> |
|
|
</Row> |
|
|
@ -863,7 +861,7 @@ const AdvancedSettings = ({ onLogout, locationConfig }) => { |
|
|
value={batchInterpolation} |
|
|
value={batchInterpolation} |
|
|
onChange={setBatchInterpolation} |
|
|
onChange={setBatchInterpolation} |
|
|
size="large" |
|
|
size="large" |
|
|
disabled={!enableMqtt || !enableBatch} |
|
|
disabled={!anyMqttEnabled || !enableBatch} |
|
|
style={{ width: "50%", borderRadius: 8 }} |
|
|
style={{ width: "50%", borderRadius: 8 }} |
|
|
> |
|
|
> |
|
|
<Option value="copy">分段复制</Option> |
|
|
<Option value="copy">分段复制</Option> |
|
|
|