两年前写的,现在看,有点想吐, 数据操作表,调试设备用
采用外挂的方法,以前设备的接口命令,简易,换个UI展示很容易
自己写着玩的,公司部分产品再用,前端展示,不涉密
index.html
<!doctype html>
<html><head><meta charset="UTF-8" /><title>Device Dashboard</title><link rel="stylesheet" type="text/css" href="themes/gray/easyui.css" /><link rel="stylesheet" type="text/css" href="themes/icon.css" /><link rel="stylesheet" type="text/css" href="www/demo.css" /><script type="text/javascript" src="jquery.min.js"></script><script type="text/javascript" src="jquery.easyui.min.js"></script><script type="text/javascript" src="www/js/dataGrid.js"></script><script type="text/javascript" src="www/js/cgiOperator.js"></script><script type="text/javascript" src="www/js/index.js"></script></head><body><br /><div class="easyui-layout" fit="true"><div id="tb" style="height: auto"><aid="refresh"href="javascript:void(0)"class="easyui-linkbutton"data-options="iconCls:'icon-reload',plain:true"onclick="reload()">Refresh</a><aid="save"href="javascript:void(0)"class="easyui-linkbutton"data-options="iconCls:'icon-save',plain:true"onclick="edit()">Save</a><aid="cancel"href="javascript:void(0)"class="easyui-linkbutton"data-options="iconCls:'icon-undo',plain:true"onclick="cancel()">Cancel</a><aid="view"href="javascript:void(0)"class="easyui-linkbutton"data-options="iconCls:'icon-search',plain:true"onclick="getChanges()">View changes</a><ahref="javascript:void(0)"class="easyui-linkbutton"data-options="iconCls:'icon-reload',plain:true"onclick="chinese()">中文</a><ahref="javascript:void(0)"class="easyui-linkbutton"data-options="iconCls:'icon-reload',plain:true"onclick="english()">ENGLISH</a></div><br /><divclass="easyui-layout"style="width: 1300px; height: 960px"fit="true"><divdata-options="region:'west',title:'Menu directory'"style="width: 250px"border="false"border="false"><ul id="tt" class="easyui-tree"><li data-options="state:'open'"><span class="dev_info">Device Information</span><ul><li><a id="SystemInfo">Base Information</a></li></ul></li><li data-options="state:'open'"><span class="dev_status">Device Status</span><ul><li><a id="MiscInfo">Misc Status</a></li><li><a id="AlarmInfo">Alarm Status</a></li></ul></li><li data-options="state:'open'"><span class="dev_setup">Device Setup</span><ul><li><a id="NetWorkConfig">Network Setup</a></li><li><a id="RadioConfigCommon">RF Common Setup</a></li><li data-options="state:'open'"><span id="5G setup">5G NR Setup</span><ul><li><a id="CarrierConfigOne">Band 1 Slots Setup</a></li><li><a id="CarrierConfigTwo">Band 2 Slots Setup</a></li></ul></li></ul></li><li data-options="state:'open'"><span class="Factorty">Factory Calibration</span><ul><li><a id="FactorySetup">Calibration Setup</a></li></ul></li></ul></div><divid="CenterBlock"data-options="region:'center',title:'Access Unit Equipment'"><divid="HomeIndex"class="easyui-tabs"style="width: auto; height: 800px"><div title="Home" style="padding: 10px"><tableid="dg"class="easyui-datagrid"style="width: auto; height: 720px"data-options="checkOnSelect:false,selectOnCheck:false,onClickCell: onClickCell,"><thead><tr><thdata-options="field:'selectRows',width:40,align:'center',checkbox:true"></th><thdata-options="field:'paramsName',width:400,align:'left'">name</th><thdata-options="field:'paramsValue',width:200,align:'left',editor:{type:'textbox'}">value</th><thdata-options="field:'UpdateTime',width:280,align:'center'">update time</th></tr></thead></table></div></div></div></div></div></body>
</html>
index.js
//cgi request url information tag is directions ajax
var cacheDataParaList = undefined;
var cacheDataParaListArray = new Array();
var cacheData = undefined;
var cacheDataArray = new Array();
var DEBUG = 0;
var ZH_TABLE = undefined;
var TableType = undefined;var NetWorkConfigArgs = new Array();
var NetWorkConfigFilterIndex = [1];var SystemInfoArgs = new Array();
var SystemFilterIndex = [0];var AlarmInfoArgs = new Array();
var AlarmFilterIndex = [100];var AlarmConfigArgs = new Array();
var AlarmConfigFilterIndex = [99];var CarrierConfigOneArgs = new Array();
var CarrierConfigOneFilterIndex = [2];var CarrierConfigTwoArgs = new Array();
var CarrierConfigTwoFilterIndex = [3];var RadioConfigCommonArgs = new Array();
var RadioConfigCommonFilterIndex = [4];var RadioConfigOneArgs = new Array();
var RadioConfigOneFilterIndex = [5];var RadioConfigTwoArgs = new Array();
var RadioConfigTwoFilterIndex = [6];var RadioConfigThreeArgs = new Array();
var RadioConfigThreeFilterIndex = [7];var RadioConfigFourArgs = new Array();
var RadioConfigFourFilterIndex = [8];var OptInfoArgs = new Array();
var OptInfoFilterIndex = [9];var MiscInfoArgs = new Array();
var MiscInfoFilterIndex = [0xa];var FactorySetupArgs = new Array();
var FactorySetupFilterIndex = [0x2b];var cgi_config = "cgi-bin/wsgi.py";function FilterIndex(IndexArray, index) {for (var i = 0; i < IndexArray.length; i++) {if (index == IndexArray[i]) {return true;}}return false;
}function ajaxPost(url_t, msg, func) {$.ajax({url: url_t,type: "POST", //对数据的请求指令使用post的请求方式data: msg,async: false,success: function(data, status) {// $.messager.alert("Successful", "Operator Successful");func(data, status);},error: function(data, status) {$.messager.alert("Failed", "Operator Failed");},});
}function RequestFromBoaParaList() {ajaxPost(cgi_config, "cmd=para_list&nodata", function(data, status) {cacheDataParaList = data;});
}function ajaxJson(url_t) {$.ajax({url: url_t,type: "GET", //对数据的请求指令使用post的请求方式async: false,dataType: "json",success: function(data, status) {// $.messager.alert("Successful", "Operator Successful");ZH_TABLE = data;},error: function(data, status) {$.messager.alert("Failed", "Operator Failed");},});
}function ajaxJsonPost(url_t, msg, func) {$.ajax({url: url_t,type: "POST", //对数据的请求指令使用post的请求方式data: msg,async: false,dataType: json,success: function(data, status) {// $.messager.alert("Successful", "Operator Successful");func(data, status);},error: function(data, status) {$.messager.alert("Failed", "Operator Failed");},});
}var DevList = undefined;function RequestDeviceList() {ajaxPost(cgi_config, "cmd=device_list&nodata", function(data, status) {console.log("REQUESTDEVICELIST: " + status);DevList = data;});
}function TreeNodeAdd() {var data = [{ text: "DeviceList", children: [{ text: "LocalDevice" }] }];var data_leaf = data[0].children;RequestDeviceList();if (DevList != undefined) {console.log(DevList);let tmp = DevList.split("&");for (var i = 1; i < tmp.length - 1; i++) {console.log(tmp[i]);data_leaf.push({ text: tmp[i] });}}console.log(data_leaf);// init tree for every node$("#ptt").tree({ data: data });
}function RequestFromBoaReadPara() {ajaxPost(cgi_config, "cmd=read&nodata", function(data, status) {console.log("RequestFromBoaReadPara: " + status);cacheData = data;});
}//may payload some data from client
function RequestFromBoaWritePara(WriteCmd, Error) {ajaxPost(cgi_config, "cmd=write&" + WriteCmd, function(data, status) {Error = data;});
}function ParaListData2Params(RemoteDataArray, ParamsDataArray) {var tmp = undefined;var tmpCOMMA = undefined;var tmpArrayEQ = new Array();var tmpArrayCOMMA = new Array();for (var i = 1; i < RemoteDataArray.length; i++) {if (RemoteDataArray[i] === "") {continue;}tmp = RemoteDataArray[i];tmpArrayEQ = tmp.split("=");ParamsDataArray[i].index = tmpArrayEQ[0];tmpCOMMA = tmpArrayEQ[1];tmpArrayCOMMA = tmpCOMMA.split(",");ParamsDataArray[i].name = tmpArrayCOMMA[0];ParamsDataArray[i].type = tmpArrayCOMMA[1];ParamsDataArray[i].coff = tmpArrayCOMMA[2];ParamsDataArray[i].attr = tmpArrayCOMMA[3];ParamsDataArray[i].len = tmpArrayCOMMA[4];}
}function ParaRead2Params(RemoteDataArray, ParamsDataArray) {var tmp = undefined;var tmpArrayEQ = new Array();for (var i = 1; i < RemoteDataArray.length; i++) {tmp = RemoteDataArray[i];tmpArrayEQ = tmp.split("=");ParamsDataArray[i].index = tmpArrayEQ[0];ParamsDataArray[i].value = tmpArrayEQ[1];}
}function clearCacheGlobData() {cacheData = undefined;cacheDataArray = null;cacheDataParaList = undefined;cacheDataParaListArray = null;
}function ParamsType() {var tmp_index = undefined;OptInfoArgs.length = 0;SystemInfoArgs.length = 0;AlarmInfoArgs.length = 0;AlarmConfigArgs.length = 0;NetWorkConfigArgs.length = 0;RadioConfigCommonArgs.length = 0;RadioConfigFourArgs.length = 0;RadioConfigOneArgs.length = 0;RadioConfigTwoArgs.length = 0;RadioConfigThreeArgs.length = 0;CarrierConfigOneArgs.length = 0;CarrierConfigTwoArgs.length = 0;MiscInfoArgs.length = 0;FactorySetupArgs.length = 0;for (var i = 0; i < ParamsDataArray.length; i++) {tmp_index = parseInt(ParamsDataArray[i].attr);if (FilterIndex(SystemFilterIndex, tmp_index)) {SystemInfoArgs.push(ParamsDataArray[i]);} else if (FilterIndex(OptInfoFilterIndex, tmp_index)) {OptInfoArgs.push(ParamsDataArray[i]);} else if (FilterIndex(AlarmFilterIndex, tmp_index)) {AlarmInfoArgs.push(ParamsDataArray[i]);} else if (FilterIndex(AlarmConfigFilterIndex, tmp_index)) {AlarmConfigArgs.push(ParamsDataArray[i]);} else if (FilterIndex(RadioConfigCommonFilterIndex, tmp_index)) {RadioConfigCommonArgs.push(ParamsDataArray[i]);} else if (FilterIndex(RadioConfigOneFilterIndex, tmp_index)) {RadioConfigOneArgs.push(ParamsDataArray[i]);} else if (FilterIndex(RadioConfigTwoFilterIndex, tmp_index)) {RadioConfigTwoArgs.push(ParamsDataArray[i]);} else if (FilterIndex(RadioConfigThreeFilterIndex, tmp_index)) {RadioConfigThreeArgs.push(ParamsDataArray[i]);} else if (FilterIndex(RadioConfigFourFilterIndex, tmp_index)) {RadioConfigFourArgs.push(ParamsDataArray[i]);} else if (FilterIndex(CarrierConfigOneFilterIndex, tmp_index)) {CarrierConfigOneArgs.push(ParamsDataArray[i]);} else if (FilterIndex(CarrierConfigTwoFilterIndex, tmp_index)) {CarrierConfigTwoArgs.push(ParamsDataArray[i]);} else if (FilterIndex(NetWorkConfigFilterIndex, tmp_index)) {NetWorkConfigArgs.push(ParamsDataArray[i]);} else if (FilterIndex(MiscInfoFilterIndex, tmp_index)) {MiscInfoArgs.push(ParamsDataArray[i]);} else if (FilterIndex(FactorySetupFilterIndex, tmp_index)) {FactorySetupArgs.push(ParamsDataArray[i]);}}
}var ParamsDataArray = new Array();$(function() {clearCacheGlobData();clearDataTable();RequestFromBoaParaList();cacheDataParaListArray = cacheDataParaList.split("&");console.log(cacheDataParaListArray);RequestFromBoaReadPara();cacheDataArray = cacheData.split("&");console.log(cacheDataArray);if (cacheDataParaListArray.length != cacheDataArray.length) {$.messager.alert("Error", "Parameter list incomplete");} else {$.messager.alert("Success", "SUCCESSFULL");}for (var i = 0; i < cacheDataArray.length; i++) {ParamsDataArray.push(new ParamsData("0", "0", "0", "0", "0", "0", "0"));}ParaListData2Params(cacheDataParaListArray, ParamsDataArray);ParaRead2Params(cacheDataArray, ParamsDataArray);//default zhajaxJson("zhTable.json");//reload with chineseif (ZH_TABLE != undefined) {console.log("ZH_TABLE");console.log(ZH_TABLE);}for (var i = 0; i < ParamsDataArray.length; i++) {if (ParamsDataArray[i].name == 0) {continue;}if (ParamsDataArray[i].index === ZH_TABLE[i].ID) {ParamsDataArray[i].name = ZH_TABLE[i].NAME;console.log(ZH_TABLE[i].NAME);}if (DEBUG) {console.log(ParamsDataArray[i].NAME);}}for (var i = 0; i < ParamsDataArray.length; i++) {if (ParamsDataArray[i].type == "uint1" && ParamsDataArray[i].len > 1) {console.log("FilterArray: ");console.log(ParamsDataArray[i]);continue;}if (ParamsDataArray[i].type != "str" && ParamsDataArray[i].coff != 1) {ParamsDataArray[i].value =parseInt(ParamsDataArray[i].value) / parseInt(ParamsDataArray[i].coff);}if (ParamsDataArray[i].type == "sint1") {if (ParamsDataArray[i].value > 127) {ParamsDataArray[i].value = ParamsDataArray[i].value - 255;}}if (ParamsDataArray[i].type == "sint2") {if (ParamsDataArray[i].value > 32767) {ParamsDataArray[i].value = ParamsDataArray[i].value - 65535;}}if (ParamsDataArray[i].type == "sint4") {if (ParamsDataArray[i].value > 2147483647) {ParamsDataArray[i].value =ParamsDataArray[i].value - 2147483647 * 2 - 1;}}}ParamsType();console.log(ParamsDataArray);var DeviceInfo = new Object();DeviceInfo.SystemInfo = new CenterBlockClass("#SystemInfo","SystemInfoTable",SystemInfoArgs,);DeviceInfo.AlarmInfo = new CenterBlockClass("#AlarmInfo","AlarmInfoTable",AlarmInfoArgs,);DeviceInfo.OptInfo = new CenterBlockClass("#OptInfo","OptInfoTable",OptInfoArgs,);var DeviceConfig = new Object();DeviceConfig.NetWorkConfig = new CenterBlockClass("#NetWorkConfig","NetConfigTable",NetWorkConfigArgs,);DeviceConfig.AlarmConfig = new CenterBlockClass("#AlarmConfig","AlarmConfigTable",AlarmConfigArgs,);DeviceConfig.RadioConfigCommon = new CenterBlockClass("#RadioConfigCommon","RadioConfigCommonTable",RadioConfigCommonArgs,);DeviceConfig.RadioConfigOne = new CenterBlockClass("#RadioConfigOne","RadioConfigOneTable",RadioConfigOneArgs,);DeviceConfig.RadioConfigTwo = new CenterBlockClass("#RadioConfigTwo","RadioConfigTwoTable",RadioConfigTwoArgs,);DeviceConfig.RadioConfigThree = new CenterBlockClass("#RadioConfigThree","RadioConfigThreeTable",RadioConfigThreeArgs,);DeviceConfig.RadioConfigFour = new CenterBlockClass("#RadioConfigFour","RadioConfigFourTable",RadioConfigFourArgs,);DeviceConfig.CarrierConfigOne = new CenterBlockClass("#CarrierConfigOne","CarrierConfigOneTable",CarrierConfigOneArgs,);DeviceConfig.CarrierConfigTwo = new CenterBlockClass("#CarrierConfigTwo","CarrierConfigTwoTable",CarrierConfigTwoArgs,);DeviceConfig.MiscInfo = new CenterBlockClass("#MiscInfo","MiscInfoTable",MiscInfoArgs,);DeviceConfig.FactorySetup = new CenterBlockClass("#FactorySetup","FactorySetupTable",FactorySetupArgs,);var CenterBlockEvent = new Array();CenterBlockEvent["SystemInfo"] = DeviceInfo.SystemInfo;CenterBlockEvent["AlarmInfo"] = DeviceInfo.AlarmInfo;CenterBlockEvent["OptInfo"] = DeviceInfo.OptInfo;CenterBlockEvent["NetWorkConfig"] = DeviceConfig.NetWorkConfig;CenterBlockEvent["AlarmConfig"] = DeviceConfig.AlarmConfig;CenterBlockEvent["RadioConfigCommon"] = DeviceConfig.RadioConfigCommon;CenterBlockEvent["RadioConfigOne"] = DeviceConfig.RadioConfigOne;CenterBlockEvent["RadioConfigTwo"] = DeviceConfig.RadioConfigTwo;CenterBlockEvent["RadioConfigThree"] = DeviceConfig.RadioConfigThree;CenterBlockEvent["RadioConfigFour"] = DeviceConfig.RadioConfigFour;CenterBlockEvent["CarrierConfigOne"] = DeviceConfig.CarrierConfigOne;CenterBlockEvent["CarrierConfigTwo"] = DeviceConfig.CarrierConfigTwo;CenterBlockEvent["MiscInfo"] = DeviceConfig.MiscInfo;CenterBlockEvent["FactorySetup"] = DeviceConfig.FactorySetup;$("#tt").tree({onClick: function(node) {var index = node.text;var ack_index = index.split('"');var txt = ack_index[2];var tmp_txt = txt.split(">");$("#HomeIndex").tabs("select", FirstTmp);var tab = $("#HomeIndex").tabs("getSelected");$("#HomeIndex").tabs("update", {tab: tab,options: {title: tmp_txt,},});do {if (ack_index[1] == undefined) {break;}FirstTmp = txt;clearDataTable();TableType = CenterBlockEvent[ack_index[1]].type;DrawTable(CenterBlockEvent[ack_index[1]].args);} while (0);},});
});
dataGrid.js
var editIndex = undefined;
var SystemInfoData = undefined;
var AlarmInfoData = undefined;
var NetWorkConfigData = undefined;
var RadioConfigData = undefined;
var checked = undefined;function AddDataGrid(ParamsData) {$("#dg").datagrid("appendRow", {paramsIndex: ParamsData.index,paramsName: ParamsData.name,paramsCoff: ParamsData.coff,paramsAttr: ParamsData.attr,paramsType: ParamsData.type,paramsValue: ParamsData.value,paramsLength: ParamsData.len,UpdateTime:new Date().getFullYear() +"-" +(new Date().getMonth() + 1) +"-" +new Date().getDate() +" " +new Date().getHours() +":" +new Date().getMinutes() +":" +new Date().getSeconds(),});
}function endEditing() {if (editIndex == undefined) {return true;}if ($("#dg").datagrid("validateRow", editIndex)) {$("#dg").datagrid("endEdit", editIndex);editIndex = undefined;return true;} else {return false;}
}function onClickCell(index, field) {if (editIndex != index) {if (endEditing()) {$("#dg").datagrid("selectRow", index).datagrid("beginEdit", index);var ed = $("#dg").datagrid("getEditor", { index: index, field: field });if (ed) {($(ed.target).data("textbox")? $(ed.target).textbox("textbox"): $(ed.target)).focus();}editIndex = index;} else {setTimeout(function() {$("#dg").datagrid("selectRow", editIndex);}, 0);}}
}// 更新客户端数据库
function cancel() {$.messager.confirm("Info:", "Whether to cancel the check?", function(r) {if (r) {$(":checked").removeAttr("checked");}});
}// 更新客户端数据库
function edit() {endEditing();$.messager.confirm("Info:","Please confirm the submission configuration?",function(r) {if (r) {checked = $("#dg").datagrid("getChecked");console.log(checked);var CmdWrite = "";var tmp = 0;for (var i = 0; i < checked.length; i++) {if (checked[i].paramsType == "uint1" && checked[i].paramsLength > 1) {console.log("FilterArray: ");console.log(checked[i]);tmp = checked[i].paramsValue;CmdWrite += checked[i].paramsIndex + "=" + tmp + "&";continue;}if (checked[i].paramsType != "str") {tmp =parseFloat(checked[i].paramsCoff) *parseFloat(checked[i].paramsValue);} else {tmp = checked[i].paramsValue;}CmdWrite += checked[i].paramsIndex + "=" + tmp + "&";}console.log(CmdWrite);var err = undefined;RequestFromBoaWritePara(CmdWrite, err);} else {$(":checked").removeAttr("checked");}},);
}
function zhBar() {$("#SystemInfo").text("系统基本信息");$("#MiscInfo").text("基础状态");$("#AlarmInfo").text("告警状态");$("#dev setup").text("设备初始化");$("#NetWorkConfig").text("网络设置");$("#RadioConfigCommon").text("射频常用设置");$("#CarrierConfigOne").text("载波 一");$("#CarrierConfigTwo").text("载波 二");$("#FactorySetup").text("工厂初始化设置");
}function enBar() {$("#SystemInfo").text("Base Infomation");$("#MiscInfo").text("Misc Info");$("#AlarmInfo").text("Alarm Info");$("#dev setup").text("Device Setup");$("#NetWorkConfig").text("NetWorkConfig");$("#RadioConfigCommon").text("RadioConfigCommon");$("#CarrierConfigOne").text("CarrierConfigOne");$("#CarrierConfigTwo").text("CarrierConfigTwo");$("#FactorySetup").text("FactorySetup");
}CH = true;
EN = false;
function chinese() {zhBar();RequestFromBoaReadPara();cacheDataArray = cacheData.split("&");console.log(cacheDataArray);CH = true;EN = false;if (cacheDataParaListArray.length !== cacheDataArray.length) {$.messager.alert("Error", "Parameter list incomplete");} else {$.messager.alert("Success", "Get the full parameter list");}ParaListData2Params(cacheDataParaListArray, ParamsDataArray);ParaRead2Params(cacheDataArray, ParamsDataArray);ajaxJson("zhTable.json");//reload with chineseif (ZH_TABLE != undefined) {console.log("CHINESE ZH_TABLE");console.log(ZH_TABLE);}for (var i = 0; i < ParamsDataArray.length; i++) {if (ParamsDataArray[i].name == 0) {continue;}if (ParamsDataArray[i].index === ZH_TABLE[i].ID) {ParamsDataArray[i].name = ZH_TABLE[i].NAME;console.log(ZH_TABLE[i].NAME);}if (DEBUG) {console.log(ParamsDataArray[i].NAME);}}for (var i = 0; i < ParamsDataArray.length; i++) {if (ParamsDataArray[i].type === "uint1" && ParamsDataArray[i].len > 1) {console.log("FilterArray: ");console.log(ParamsDataArray[i]);continue;}if (ParamsDataArray[i].type !== "str" && ParamsDataArray[i].coff !== 1) {ParamsDataArray[i].value =parseInt(ParamsDataArray[i].value) / parseInt(ParamsDataArray[i].coff);}if (ParamsDataArray[i].type === "sint1") {if (ParamsDataArray[i].value > 127) {ParamsDataArray[i].value = ParamsDataArray[i].value - 255;}}if (ParamsDataArray[i].type == "sint2") {if (ParamsDataArray[i].value > 32767) {ParamsDataArray[i].value = ParamsDataArray[i].value - 65535;}}if (ParamsDataArray[i].type == "sint4") {if (ParamsDataArray[i].value > 2147483647) {ParamsDataArray[i].value =ParamsDataArray[i].value - 2147483647 * 2 - 1;}}}ParamsType();var TableTmp = undefined;if (TableType == "SystemInfoTable") {TableTmp = SystemInfoArgs;} else if (TableType == "AlarmInfoTable") {TableTmp = AlarmInfoArgs;} else if (TableType == "OptInfoTable") {TableTmp = OptInfoArgs;} else if (TableType == "NetConfigTable") {TableTmp = NetWorkConfigArgs;} else if (TableType == "AlarmConfigTable") {TableTmp = AlarmConfigArgs;} else if (TableType == "RadioConfigCommonTable") {TableTmp = RadioConfigCommonArgs;} else if (TableType == "RadioConfigOneTable") {TableTmp = RadioConfigOneArgs;} else if (TableType == "RadioConfigTwoTable") {TableTmp = RadioConfigTwoArgs;} else if (TableType == "RadioConfigThreeTable") {TableTmp = RadioConfigThreeArgs;} else if (TableType == "RadioConfigFourTable") {TableTmp = RadioConfigFourArgs;} else if (TableType == "CarrierConfigOneTable") {TableTmp = CarrierConfigOneArgs;} else if (TableType == "CarrierConfigTwoTable") {TableTmp = CarrierConfigTwoArgs;} else if (TableType == "MiscInfoTable") {TableTmp = MiscInfoArgs;} else if (TableType == "FactorySetupTable") {TableTmp = FactorySetupArgs;}//coef calc for valueconsole.log(TableTmp);clearDataTable();DrawTable(TableTmp);
}function english() {enBar();RequestFromBoaReadPara();cacheDataArray = cacheData.split("&");console.log(cacheDataArray);CH = false;EN = true;if (cacheDataParaListArray.length != cacheDataArray.length) {$.messager.alert("Error", "Parameter list incomplete");} else {$.messager.alert("Success", "Get the full parameter list");}ParaListData2Params(cacheDataParaListArray, ParamsDataArray);ParaRead2Params(cacheDataArray, ParamsDataArray);for (var i = 0; i < ParamsDataArray.length; i++) {if (ParamsDataArray[i].type == "uint1" && ParamsDataArray[i].len > 1) {console.log("FilterArray: ");console.log(ParamsDataArray[i]);continue;}if (ParamsDataArray[i].type != "str" && ParamsDataArray[i].coff != 1) {ParamsDataArray[i].value =parseInt(ParamsDataArray[i].value) / parseInt(ParamsDataArray[i].coff);}if (ParamsDataArray[i].type == "sint1") {if (ParamsDataArray[i].value > 127) {ParamsDataArray[i].value = ParamsDataArray[i].value - 255;}}if (ParamsDataArray[i].type == "sint2") {if (ParamsDataArray[i].value > 32767) {ParamsDataArray[i].value = ParamsDataArray[i].value - 65535;}}if (ParamsDataArray[i].type == "sint4") {if (ParamsDataArray[i].value > 2147483647) {ParamsDataArray[i].value =ParamsDataArray[i].value - 2147483647 * 2 - 1;}}}ParamsType();var TableTmp = undefined;if (TableType === "SystemInfoTable") {TableTmp = SystemInfoArgs;} else if (TableType === "AlarmInfoTable") {TableTmp = AlarmInfoArgs;} else if (TableType === "OptInfoTable") {TableTmp = OptInfoArgs;} else if (TableType === "NetConfigTable") {TableTmp = NetWorkConfigArgs;} else if (TableType === "AlarmConfigTable") {TableTmp = AlarmConfigArgs;} else if (TableType === "RadioConfigCommonTable") {TableTmp = RadioConfigCommonArgs;} else if (TableType === "RadioConfigOneTable") {TableTmp = RadioConfigOneArgs;} else if (TableType == "RadioConfigTwoTable") {TableTmp = RadioConfigTwoArgs;} else if (TableType == "RadioConfigThreeTable") {TableTmp = RadioConfigThreeArgs;} else if (TableType == "RadioConfigFourTable") {TableTmp = RadioConfigFourArgs;} else if (TableType == "CarrierConfigOneTable") {TableTmp = CarrierConfigOneArgs;} else if (TableType == "CarrierConfigTwoTable") {TableTmp = CarrierConfigTwoArgs;} else if (TableType == "MiscInfoTable") {TableTmp = MiscInfoArgs;} else if (TableType == "FactorySetupTable") {TableTmp = FactorySetupArgs;}//coef calc for valueconsole.log(TableTmp);clearDataTable();DrawTable(TableTmp);
}function reload() {if (CH) {chinese();} else if (EN) {english();}
}function getChanges() {$.messager.show({title: "Modified data that has been submitted",height: 400,width: 800,msg: JSON.stringify(checked),showType: "slide",timeout: 5000000000,style: {right: "",bottom: "",},});
}function clearDataTable() {$("#dg").datagrid("loadData", { total: 0, rows: [] });
}//add data table
function DrawTable(ParamsDataArrayN) {for (var i = 0; i < ParamsDataArrayN.length; i++) {if (ParamsDataArrayN[i].name != "0") {AddDataGrid(ParamsDataArrayN[i]);}}
}
cgiOperator.js
class ParamsData {constructor(index, name, coff, attr, type, value, len) {this.index = index;this.name = name;this.coff = coff;this.attr = attr;this.type = type;this.value = value;this.len = len;this.time = (new Date()).getHours()+":"+(new Date()).getMinutes()+":"+(new Date()).getSeconds();}
}class CenterBlockClass {constructor(index, type, args) {this.index = index;this.type = type;this.args = args;}
}var FirstTmp = "Home";
function setCenterBlockEvent(CenterBlockClass) {$(CenterBlockClass.index).click(function () {var txt = $(this).text();$("#HomeIndex").tabs("select", FirstTmp);var tab = $("#HomeIndex").tabs("getSelected");$("#HomeIndex").tabs("update", {tab: tab,options: {title: txt,},});FirstTmp = txt;clearDataTable();TableType = CenterBlockClass.type;DrawTable(CenterBlockClass.args);});
}
显示看很勉强
现在看尴尬的扣脚,勉强可用
python -m http.server 5090
python server 验证 网页
cgi 还挺容易的,都可以动态修改,看到显示的变化