diff --git a/adminSystem/src/api/amt.ts b/adminSystem/src/api/amt.ts
index 7149fe7..f64f57d 100644
--- a/adminSystem/src/api/amt.ts
+++ b/adminSystem/src/api/amt.ts
@@ -6,7 +6,7 @@ export const scanApi = {
startScan(networkSegment: string, subnetMask: string) {
return request.post({
url: '/api/scan/start',
- params: { networkSegment, subnetMask }
+ data: { networkSegment, subnetMask }
})
},
@@ -96,6 +96,15 @@ export const deviceApi = {
return request.get({
url: `/api/devices/${id}/credentials`
})
+ },
+
+ // 设置设备 AMT 凭据
+ setAmtCredentials(id: number, data: { username: string; password: string }) {
+ return request.put({
+ url: `/api/devices/${id}/amt-credentials`,
+ data: data,
+ showSuccessMessage: true
+ })
}
}
diff --git a/adminSystem/src/views/amt/credentials.vue b/adminSystem/src/views/amt/credentials.vue
deleted file mode 100644
index 52347ce..0000000
--- a/adminSystem/src/views/amt/credentials.vue
+++ /dev/null
@@ -1,174 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- 已设置
- 未设置
-
-
-
-
- 默认
-
-
-
-
-
- 编辑
- 删除
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 留空则不修改密码
-
-
-
-
-
- 默认凭据将用于扫描时的认证
-
-
-
-
-
-
-
- 取消
- 确定
-
-
-
-
-
-
-
-
diff --git a/adminSystem/src/views/amt/devices.vue b/adminSystem/src/views/amt/devices.vue
index 18d9d78..aa3a781 100644
--- a/adminSystem/src/views/amt/devices.vue
+++ b/adminSystem/src/views/amt/devices.vue
@@ -25,10 +25,52 @@
+
+
+
-
+
+
-
+
{{ row.systemUuid }}
@@ -64,16 +106,15 @@
-
+
-
- {{ row.osOnline ? '运行中' : '已关机' }}
-
+ {{ row.amtUsername }}
+ 未配置
-
+
- {{ row.windowsUsername }}
+ {{ row.amtPasswordDecrypted }}
未配置
@@ -83,34 +124,11 @@
{{ formatDateTime(row.discoveredAt) }}
-
+
-
- 远程桌面
-
-
- 配置账号
-
- handlePowerCommand(cmd, row)" style="margin-left: 8px">
-
- 电源管理
-
-
-
- 开机
- 关机
- 重启
- 强制关机
- 强制重启
-
-
-
-
+
硬件配置
-
- 删除
-
@@ -122,17 +140,23 @@
-
-
-
-
-
+
+
+
+
+ 将为以下 {{ credentialsTargetDevices.length }} 台设备配置相同的 AMT 账号:
+ {{ credentialsTargetDevices.map(d => d.ipAddress).join(', ') }}
+
+
+
+
+
-
+
-
+
@@ -143,10 +167,11 @@
+
-
-
diff --git a/backend-csharp/AmtScanner.Api/Controllers/DevicesController.cs b/backend-csharp/AmtScanner.Api/Controllers/DevicesController.cs
index 030b098..2b986d8 100644
--- a/backend-csharp/AmtScanner.Api/Controllers/DevicesController.cs
+++ b/backend-csharp/AmtScanner.Api/Controllers/DevicesController.cs
@@ -29,10 +29,32 @@ public class DevicesController : ControllerBase
}
[HttpGet]
- public async Task>>> GetAllDevices()
+ public async Task>>> GetAllDevices()
{
var devices = await _context.AmtDevices.ToListAsync();
- return Ok(ApiResponse>.Success(devices));
+
+ // 解密 AMT 密码返回给前端
+ var result = devices.Select(d => new {
+ d.Id,
+ d.IpAddress,
+ d.Hostname,
+ d.SystemUuid,
+ d.MajorVersion,
+ d.MinorVersion,
+ d.ProvisioningState,
+ d.Description,
+ d.AmtOnline,
+ d.OsOnline,
+ d.WindowsUsername,
+ d.WindowsPassword,
+ d.AmtUsername,
+ AmtPasswordDecrypted = string.IsNullOrEmpty(d.AmtPassword) ? null :
+ System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(d.AmtPassword)),
+ d.DiscoveredAt,
+ d.LastSeenAt
+ }).ToList();
+
+ return Ok(ApiResponse>.Success(result.Cast