From 59002e559ecb92e3a05ff173c9d4e97c880c70e7 Mon Sep 17 00:00:00 2001 From: root <295172551@qq.com> Date: Sat, 28 Jun 2025 15:05:08 +0800 Subject: [PATCH] dasda1 --- LTEMvcApp/Views/Home/Index.cshtml | 35 +++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/LTEMvcApp/Views/Home/Index.cshtml b/LTEMvcApp/Views/Home/Index.cshtml index 387e52d..8f9f1f1 100644 --- a/LTEMvcApp/Views/Home/Index.cshtml +++ b/LTEMvcApp/Views/Home/Index.cshtml @@ -484,6 +484,10 @@ return; } if (!confirm('确定要启动该网络吗?')) return; + + // 显示等待状态 + row.find('td').eq(6).html('等待中...'); + $.ajax({ url: '/api/ipgroup/start', type: 'POST', @@ -502,9 +506,12 @@ console.log('解析响应数据失败:', e); } } - loadAllNetworkConfigs(); + // 保持当前选择的key,只更新apn/band/comment信息 + updateNetworkInfo(ip, port, key); }, error: function(xhr) { + // 恢复原状态 + row.find('td').eq(6).html('停止'); var errorMsg = '启动失败'; try { var errorResponse = JSON.parse(xhr.responseText); @@ -528,6 +535,10 @@ return; } if (!confirm('确定要停止该网络吗?')) return; + + // 显示等待状态 + row.find('td').eq(6).html('等待中...'); + $.ajax({ url: '/api/ipgroup/stop', type: 'POST', @@ -546,9 +557,12 @@ console.log('解析响应数据失败:', e); } } - loadAllNetworkConfigs(); + // 保持当前选择的key,只更新apn/band/comment信息 + updateNetworkInfo(ip, port, key); }, error: function(xhr) { + // 恢复原状态 + row.find('td').eq(6).html('运行'); var errorMsg = '停止失败'; try { var errorResponse = JSON.parse(xhr.responseText); @@ -561,6 +575,23 @@ }); } + function updateNetworkInfo(ip, port, key) { + // 只更新指定IP的apn/band/comment信息,不重新加载下拉框 + $.ajax({ + url: '/api/ipgroup/network-config', + type: 'GET', + data: { ip: ip, port: port }, + success: function(res) { + if (res.isSuccess && res.data) { + const cfg = res.data.find(x => x.configKey === key); + $('.apn-cell[data-ip="' + ip + '"]').text(cfg ? (cfg.apn || '') : ''); + $('.band-cell[data-ip="' + ip + '"]').text(cfg && cfg.band ? cfg.band.join(',') : ''); + $('.comment-cell[data-ip="' + ip + '"]').text(cfg ? (cfg.comment || '') : ''); + } + } + }); + } + function showToast(message, type) { // 简单的提示函数,可以替换为更美观的toast组件 var alertClass = type === 'success' ? 'alert-success' : 'alert-danger';