add set imei section

This commit is contained in:
fujr 2024-05-11 14:26:25 +08:00
parent 7d40dbdd89
commit a0c2660804

View File

@ -3,6 +3,8 @@
<script type="text/javascript">//<![CDATA[
window.onload = function () {
//获取模组选择框元素
var modem_select = document.getElementById('modem_select');
//更换模组AT串口时触发
@ -264,7 +266,7 @@
//显示模组选择界面
document.getElementById("cbi-modem").style.display = "block";
//显示标签菜单界面
document.getElementById("tab_menu").style.display = "block";
document.getElementById("tab_menu").style.display = "flex";
//显示标签内容界面
document.getElementById("tab_context").style.display = "block";
//隐藏AT命令标题
@ -490,7 +492,7 @@
var current_lockband = lockband_info["lock_band"];
var avalible_lockband = lockband_info["available_band"];
//可选锁频配置td
var avalible_lockband_td = document.getElementById('lockband_custom_config_values');
var avalible_lockband_td = document.getElementById('lockband_custom_config');
//设置偏好选项和复选框
if (first_cache) {
@ -609,6 +611,8 @@
network_prefer_config[checkbox.value.toUpperCase()] = Number(checkbox.checked);
}
//stringify
network_prefer_config = JSON.stringify(network_prefer_config);
//设置偏好
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "set_network_prefer")%>', { "port": at_port, "prefer_config": network_prefer_config },
function (x, data) {
@ -632,7 +636,6 @@
var at_port = document.getElementById("modem_select").value;
//获取偏好配置
var network_prefer_config = {};
lockband_config = ""
var checkboxes = document.querySelectorAll('input[name="lockband_option"]:checked');
for (checkbox of checkboxes) {
@ -645,7 +648,7 @@
function (x, data) {
var current_lockband = data["lock_band"];
var avalible_lockband = data["available_band"];
var avalible_lockband_td = document.getElementById('lockband_custom_config_values');
var avalible_lockband_td = document.getElementById('lockband_custom_config');
for (key in avalible_lockband) {
id = "lockband_config_" + key;
checkbox_get = document.getElementById(id);
@ -742,6 +745,9 @@
}
);
}
else if (data_tab == "set_imei") {
get_imei_info();
}
}
// 更新neighbor cell信息
@ -790,7 +796,7 @@
var rat = document.getElementById("rat_select").value;
var scs = document.getElementById("scs_select").value;
var nrband = document.getElementById("nrband_input").value;
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "set_lock_cell")%>', { "port": at_port, "func": this.id.replace("lockcell_feature_",""), "pci": pci, "arfcn": arfcn, "celltype": rat, "scs": scs, "nrband": nrband},
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "set_lock_cell")%>', { "port": at_port, "func": this.id.replace("lockcell_feature_", ""), "pci": pci, "arfcn": arfcn, "celltype": rat, "scs": scs, "nrband": nrband },
function (x, data) {
console.log(data["response"]);
update_cell_config();
@ -802,9 +808,10 @@
lockcell_status = data["lockcell_status"];
neighbor_cells = {
"LTE" : data["LTE"],
"NR" : data["NR"]
"LTE": data["LTE"],
"NR": data["NR"]
}
try{
for (type in neighbor_cells) {
for (cell_info of neighbor_cells[type]) {
@ -812,7 +819,7 @@
cell_info["rat"] = rat;
innerHTML = `RAT:${type} `
console.log(innerHTML)
for (cell_info_key in cell_info){
for (cell_info_key in cell_info) {
if (cell_info[cell_info_key] == "") {
continue
}
@ -838,6 +845,11 @@
neighbor_cell_info.appendChild(cell_tr);
}
}
}
catch (e) {
console.log(e);
}
lockcell_status_div = document.getElementById('current_cell_status');
childElements = lockcell_status_div.childNodes;
@ -895,6 +907,37 @@
}
}
function set_imei() {
var at_port = document.getElementById("modem_select").value;
var imei = document.getElementById("imei1_input").value;
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "set_imei")%>', { "port": at_port, "imei": imei },
function (x, data) {
set_imei_view(data);
}
);
}
function set_imei_view(imei_info) {
var imei = imei_info["imei"];
document.getElementById("imei1_input").value = imei;
}
function get_imei_info() {
var at_port = document.getElementById("modem_select").value;
//set dont_edit flag
var dont_edit = document.getElementById("tab_menu").getAttribute("dont_edit");
if (dont_edit == null) {
document.getElementById("tab_menu").setAttribute("dont_edit", "true");
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "get_imei")%>', { "port": at_port },
function (x, data) {
set_imei_view(data);
}
);
}
}
// 定时触发更新AT串口
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "modem", "get_at_port")%>', null,
(function () {
@ -1024,6 +1067,12 @@
text-align: center;
display: none;
}
#lockcell_feature {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
</style>
</head>
@ -1089,6 +1138,9 @@
<li class="cbi-tab-disabled" data-tab="at_command_tab"><a href="#">
<%:AT Command%>
</a></li>
<li class="cbi-tab-disabled" data-tab="set_imei_tab"><a href="#">
<%:Set IMEI%>
</a></li>
</ul>
<div class="cbi-section-node cbi-section-node-tabbed" id="tab_context">
@ -1136,10 +1188,8 @@
</td>
<td class="td">
<div>
<button class="btn cbi-button cbi-button-apply" id="mode_button"
onclick="set_mode()" alt="<%:Apply%>" title="<%:Apply%>">
<%:Apply%>
</button>
<input type="button" class="cbi-button-apply" id="mode_button" onclick="set_mode()"
alt="<%:Apply%>" value="<%:Apply%>">
</div>
</td>
</tr>
@ -1157,7 +1207,9 @@
<th class="th cbi-section-table-cell">
<%:Config%>
</th>
<th class="th cbi-section-table-cell cbi-section-actions"></th>
<th class="th cbi-section-table-cell cbi-section-actions">
<%:Apply%>
</th>
</tr>
<tr class="tr cbi-section-table-row cbi-rowstyle-1">
<td class="td cbi-value-field" data-title="<%:Config%>" id="prefer_custom_config">
@ -1186,14 +1238,11 @@
</div>
</td>
<td class="td">
<div>
<button class="btn cbi-button cbi-button-apply" id="network_prefer_button"
onclick="set_network_prefer()" alt="<%:Apply%>" title="<%:Apply%>">
<%:Apply%>
</button>
</div>
<input type="button" class="cbi-button-apply" id="network_prefer_button"
onclick="set_network_prefer()" value="<%:Apply%>">
</td>
</tr>
</tbody>
</table>
</div>
@ -1209,32 +1258,19 @@
</th>
</tr>
<tr class="tr cbi-section-table-row">
<td class="td cbi-value-field" data-title="<%:Config%>" id="lockband_custom_config"
class="width:80%;">
<div id="lockband_custom_config_values">
</div>
<div>
<div>
<button class="btn cbi-button cbi-button-apply" id="lockband_button"
onclick="all_choose_lockband_custom_config()" alt="<%:Select All Band>"
title="<%:Select All Band%>">
<%:Select All Band%>
</button>
<button class="btn cbi-button cbi-button-apply" id="lockband_button"
onclick="set_lockband()" alt="<%:Apply%>" title="<%:Apply%>">
<%:Apply%>
</button>
</div>
</div>
<td class="td cbi-value-field" data-title="<%:Config%>" id="lockband_custom_config">
</td>
</tr>
</tbody>
</table>
<input type="button" class="cbi-button-apply" onclick="all_choose_lockband_custom_config()"value="<%:Select All Band%>">
<input type="button" class="cbi-button-apply" onclick="set_lockband()" value="<%:Apply%>">
</div>
<div class="cbi-section" data-tab="lockcell_tab" data-tab-title="<%:Lock Cell/Arfcn Settings%>"
data-tab-active="false" style="display: none;">
<h3 id="Lock Cell/Arfcn_title">
@ -1262,9 +1298,10 @@
<%:Select Rat%>
</td>
<td class="td left">
<select name="rat_select" id="rat_select" class="cbi-input-select" onchange="lockcell_rat_onchange()">
<select name="rat_select" id="rat_select" class="cbi-input-select"
onchange="lockcell_rat_onchange()">
<option value="0">4G</option>
<option value="1" >5G</option>
<option value="1">5G</option>
</select>
</td>
</tr>
@ -1296,8 +1333,8 @@
<td class="td left">
<select name="rat_select" id="scs_select" class="cbi-input-select">
<option value="0">15KHZ</option>
<option value="1" >30KHZ</option>
<option value="2" >60KHZ</option>
<option value="1">30KHZ</option>
<option value="2">60KHZ</option>
</select>
</td>
</tr>
@ -1317,14 +1354,6 @@
</td>
<td class="td left">
<div id="lockcell_feature">
<!-- <input class="cbi-button cbi-button-apply" type="button" value="<%:Unlock Cell%>"
onclick="unlock_cell()" alt="<%:Unlock Cell%>" title="<%:Unlock Cell%>">
<input class="cbi-button cbi-button-apply" type="button" value="<%:Lock Current%>"
onclick="lock_current_cell()" alt="<%:Lock Current%>" title="<%:Lock Current%>">
<input class="cbi-button cbi-button-reset" type="button" value="<%:Lock PCI%>"
onclick="lock_pci()" alt="<%:Lock PCI%>" title="<%:Lock PCI%>">
<input class="cbi-button cbi-button-reset" type="button" value="<%:Lock ARFCN%>"
onclick="lock_arfcn()" alt="<%:Lock ARFCN%>" title="<%:Lock ARFCN%>"> -->
</div>
</td>
</tr>
@ -1451,6 +1480,32 @@
</tbody>
</table>
</div>
<div class="cbi-section" data-tab="set_imei_tab" data-tab-title="<%:Set IMEI%>" data-tab-active="false"
style="display: none;">
<table class="table cbi-section-table">
<tbody id="imei_setting">
<tr class="tr cbi-section-table-titles anonymous">
<th>
<%:IMEI%>
</th>
<th>
<%:Set IMEI%>
</th>
</tr>
<tr class="tr">
<td class="td" style="width: auto;">
<%:IMEI%>
</td>
<td class="td cbi-value-field">
<input type="text" id="imei1_input" class="cbi-input-text"></input>
</td>
</tr>
</tbody>
</table>
<input type="button" class="cbi-button-apply" onclick="set_imei()" value="<%:Apply%>">
</div>
</div>
</div>