| | |
| | | var element = layui.element; // 获取元素操作模块 |
| | | |
| | | // 设置检测文件名弹出框的content |
| | | var cFilenameContent = '<div style="width:300px; height: 110px;"><div style="margin-top: 20px;margin-left: 8px; margin-right: 8px; text-algin: center;">'+ |
| | | var cFilenameContent = '<div style="width:300px; height: 80px;"><div style="margin-top: 20px;margin-left: 8px; margin-right: 8px; text-algin: center;">'+ |
| | | '<span>选择文件名:</span>'+ |
| | | '<select id="equipeTypeSel" style="width: 200px;height: 26px; border: 1px solid #ccc">'+ |
| | | '<select id="equipeTypeSel" style="width: 200px;height: 26px; border: 1px solid #ccc" disabled>'+ |
| | | '<option value="IDCE-Power8kw.bin">IDCE-Power8kw.bin</option>'+ |
| | | '<option value="avr_dfu.uc3">avr_dfu.uc3</option>'+ |
| | | '<option value="E51_DFU_1.SM5">E51_DFU_1.SM5</option>'+ |
| | | '<option value="E51_DFU_2.SM5">E51_DFU_2.SM5</option>'+ |
| | | '</select><br><br>'+ |
| | | '<span>系 统 类 型:</span>'+ |
| | | '<select id="sysType" style="width: 200px;height: 26px; border: 1px solid #ccc">'+ |
| | | '<span style="display: none">系 统 类 型:</span>'+ |
| | | '<select id="sysType" style="display: none; width: 200px;height: 26px; border: 1px solid #ccc">'+ |
| | | '<option value="12">1U</option>'+ |
| | | '<option value="2">2U</option>'+ |
| | | '</select><br><br>'+ |
| | | '<span>输入版本号:</span>'+ |
| | | '<input type="text" id="newestVer" style="width: 200px;height: 24px; border: 1px solid #ccc">'+ |
| | | '<span style="display: none">输入版本号:</span>'+ |
| | | '<input type="text" id="newestVer" style="display: none; width: 200px;height: 24px; border: 1px solid #ccc">'+ |
| | | '</div></div>'; |
| | | |
| | | var cVerContent = '<div style="width:300px; height: 50px;"><div style="margin-top: 20px;margin-left: 8px; margin-right: 8px; text-algin: center;">'+ |
| | |
| | | ,{field:'stationname', title:'机房名称', align:'center', width: 400} |
| | | ,{field:'fbsid', title:'设备ID', align:'center'} |
| | | ,{field:'updatestatus', title:'升级状态', align:'center'} |
| | | ,{field: 'version', title: '版本号', align: 'center'} |
| | | ,{field: 'version', title: '版本号', align: 'center', width: 240} |
| | | ,{field:'filename', title:'升级文件名', align:'center'} |
| | | ,{field:'status', title:'读写状态', align:'center'} |
| | | ,{field:'progress', title:'读/写进度', align: 'center', templet:'#upProgress'} |
| | |
| | | var formaterData = formaterAddData(rs.data, allData); //解析数据 |
| | | if(formaterData.length) { |
| | | // 遍历formaterData |
| | | //console.log(formaterData); |
| | | // console.log(formaterData); |
| | | for(var i=0; i<formaterData.length; i++) { |
| | | var _formaterData = formaterData[i]; |
| | | var tmp = {}; |
| | | // 检测设备是否为8kw |
| | | if(checkDevId(_formaterData.FBSDeviceId, 98) && _formaterData.StationIp == '') { |
| | | _formaterData.StationIp = 'IDCE-8KW-V0.0.0'; |
| | | } |
| | | //_formaterData.StationIp = 'IDCE-Pro-8KW-V3.01.16'; |
| | | tmp.stationid = _formaterData.StationId; // 机房id |
| | | tmp.stationname = _formaterData.StationName; // 机房名称 |
| | | tmp.fbsid = _formaterData.FBSDeviceId; // 设备id |
| | |
| | | data:"json = "+JSON.stringify(temp), |
| | | success: function(result){ |
| | | var rs = JSON.parse(result.result); |
| | | //console.log(rs); |
| | | // console.log(rs); |
| | | if(rs.code == 1) { |
| | | var data = rs.data; |
| | | // console.log(data); |
| | | var updateData = checkUpdating(data, all, filename, newestVer, sysType); |
| | | $('#updateIframeData').data('update', updateData.good); // 可更新的设备信息 |
| | | $('#updateIframeData').data('errorUpdate', updateData.bad); // 无法更新的设备信息 |
| | |
| | | if(_all.updatestatusnum != 1) { |
| | | if(_all.fbsid == _rsData.FBSDeviceId && _all.filename == filename) { |
| | | // 检测当前版本号是否为最新 |
| | | var isNewstVer = checkNewestVer(newestVer, _all.version); |
| | | var isSysType = checkSysType(sysType, _all.version); |
| | | var isNewstVer = false; |
| | | var isSysType = true; |
| | | if(!isNewstVer && isSysType) { |
| | | isError = false; |
| | | } |
| | |
| | | rs.good.push(_all); |
| | | } |
| | | } |
| | | |
| | | return rs; |
| | | } |
| | | |
| | |
| | | |
| | | return rs; |
| | | } |
| | | //console.log(getFnameByVer('D:8,V2.53.40')); |
| | | console.log(getFnameByVer('IDCE-Pro-8KW-V3.01.16')); |
| | | // 根据版本号获取文件的名称 |
| | | function getFnameByVer(version) { |
| | | console.log(version.trim().length); |
| | | console.log(version); |
| | | var fileList = [ |
| | | { |
| | | filename: 'avr_dfu.uc3' |
| | |
| | | ,{ |
| | | filename: 'E51_DFU_2.SM5' |
| | | ,pattern: /^.*V2\.53\.[0-9]*$/ |
| | | },{ |
| | | } |
| | | ,{ |
| | | filename: 'E51_DFU_1.SM5' |
| | | ,pattern: /^.*V12\.53\.[0-9]*$/ |
| | | } |
| | | |
| | | |
| | | ,{ |
| | | filename: 'IDCE-Power8kw.bin' |
| | | ,pattern: /^.*V[0-9]+\.[0-9]+\.[0-9]+.*$/ |
| | | } |
| | | ]; |
| | | |
| | | // 遍历并获取filename |
| | |
| | | filename = _fileList.filename; |
| | | } |
| | | } |
| | | |
| | | console.log(filename); |
| | | return filename; |
| | | } |
| | | |
| | |
| | | // console.log(rs); |
| | | return rs; |
| | | } |
| | | |
| | | // 验证设备ID |
| | | function checkDevId(dev_id, type) { |
| | | var reg; |
| | | // 根据类型选择正则匹配规则 |
| | | switch(type) { |
| | | case 98: |
| | | reg = /^98[0-9]{7}$/; |
| | | break; |
| | | } |
| | | return reg.test(dev_id); |
| | | } |
| | | }); |
| | | </script> |
| | | </body> |