feat(python3.10): 适配 Python 3.10 并修复 SNMP 问题

修改内容:
1. 修复 SNMP 凭据显示问题:确保设备列表返回 snmp_credential_id
2. 修复清除 SNMP 凭据功能:新增 clear_snmp_credential 参数
3. 前端适配:处理清除凭据时的参数转换
4. 更新 requirements.txt:添加 Python 3.10 兼容说明和 typing-extensions
5. 添加 PYTHON_3_10_COMPATIBILITY.md 兼容性说明文档

验证:
- 所有代码无 Python 3.11 特有语法
- 依赖包版本均支持 Python 3.10
- typing-extensions 提供向后兼容支持
This commit is contained in:
Your Name
2026-07-23 13:58:52 +08:00
parent 5b93e4536f
commit a8e764b102
5 changed files with 65 additions and 4 deletions
+7 -1
View File
@@ -398,7 +398,13 @@ const saveDevice = async () => {
submitting.value = true
try {
if (isDeviceEdit.value) {
await snmpApi.updateDevice(deviceForm.id, deviceForm)
// 处理清除凭据:snmp_credential_id=null 时发送 clear_snmp_credential=true
const updateData = { ...deviceForm }
if (updateData.snmp_credential_id === null) {
delete updateData.snmp_credential_id
updateData.clear_snmp_credential = true
}
await snmpApi.updateDevice(deviceForm.id, updateData)
ElMessage.success('更新成功')
} else {
await snmpApi.createDevice(deviceForm)