hdw
2018-12-24 62372bbc389e9dc507708f55d7b3e157f6948e0d
添加系统类型
1个文件已修改
40 ■■■■ 已修改文件
gx_tieta/WebRoot/batt-station-update1.jsp 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/WebRoot/batt-station-update1.jsp
@@ -153,11 +153,16 @@
                var element = layui.element;    // 获取元素操作模块
                
                // 设置检测文件名弹出框的content
                var cFilenameContent = '<div style="width:300px; height: 80px;"><div style="margin-top: 20px;margin-left: 8px; margin-right: 8px; text-algin: center;">'+
                var cFilenameContent = '<div style="width:300px; height: 110px;"><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">'+
                                            '<option value="avr_dfu.uc3">avr_dfu.uc3</option>'+
                                            '<option value="E51_DFU.SM5">E51_DFU.SM5</option>'+
                                        '</select><br><br>'+
                                        '<span>系&nbsp;统&nbsp;类&nbsp;型:</span>'+
                                        '<select id="sysType" style="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">'+
@@ -441,9 +446,10 @@
                        ,yes: function(index) {
                            var filename = $('#equipeTypeSel').val();
                            var newestVer = $('#newestVer').val();
                            var sysType = $('#sysType').val();
                            
                            // 校验要更新的设备
                            checkStationState(updateList, data, filename, newestVer);
                            checkStationState(updateList, data, filename, newestVer, sysType);
                            layer.close(index);
                        }
                    });
@@ -481,9 +487,9 @@
                        ,btn:['设置', '取消']
                        ,yes: function(index) {
                            var newestVer = $('#newestVer').val();
                            var sysType = $('#sysType').val();
                            // 校验要更新的设备
                            checkStationState(updateList, allData, data.filename, newestVer);
                            checkStationState(updateList, allData, data.filename, newestVer, sysType);
                            layer.close(index);
                        }
                    });
@@ -753,7 +759,7 @@
                
                
                // 验证设备是否允许设备进行远程升级
                function checkStationState(temp, all, filename, newestVer){
                function checkStationState(temp, all, filename, newestVer, sysType){
                    $.ajax({     
                        type: "post",                 
                        url: "Fbs9100s_dfu_stateAction_action_judgeStation",                
@@ -765,7 +771,7 @@
                            //console.log(rs);
                            if(rs.code == 1) {
                                var data = rs.data;
                                var updateData = checkUpdating(data, all, filename, newestVer);
                                var updateData = checkUpdating(data, all, filename, newestVer, sysType);
                                $('#updateIframeData').data('update', updateData.good);                // 可更新的设备信息
                                $('#updateIframeData').data('errorUpdate', updateData.bad);    // 无法更新的设备信息 
                                
@@ -835,7 +841,7 @@
                }
                
                // 格式话升级的设备
                function checkUpdating(rsData, all, filename, newestVer) {
                function checkUpdating(rsData, all, filename, newestVer, sysType) {
                    var rs = {
                        good: []
                        ,bad: []
@@ -852,7 +858,8 @@
                                if(_all.fbsid == _rsData.FBSDeviceId && _all.filename == filename) {
                                    // 检测当前版本号是否为最新
                                    var isNewstVer = checkNewestVer(newestVer, _all.version);
                                    if(!isNewstVer) {
                                    var isSysType = checkSysType(sysType, _all.version);
                                    if(!isNewstVer && isSysType) {
                                        isError = false;    
                                    }
                                }
@@ -993,7 +1000,7 @@
                    return filename;
                }
                
                console.log(checkNewestVer('42', 'D:8,V2.53.44'));
                //console.log(checkNewestVer('42', 'D:8,V2.53.44'));
                // 验证版本
                function checkNewestVer(ver ,version) {
                    var pattern = '^.*\\.[0-9]*\\.([0-9]*)$';
@@ -1006,6 +1013,21 @@
                    }
                    return isNewest;
                }
                //checkSysType('12', 'D:8,V12.53.44');
                // 验证当前版本2v/12v
                function checkSysType(sys ,version) {
                    var pattern = '^.*V([0-9]*)\\.[0-9]*\\.[0-9]*$';
                    var reg = new RegExp(pattern);
                    reg.test(version);
                    //console.log(RegExp.$1);
                    var rs = false;
                    if(sys == RegExp.$1) {
                        rs = true;
                    }
                    // console.log(rs);
                    return rs;
                }
            });
        </script>
    </body>