whychdw
2019-11-07 b7e06045363299592d03a15d55c645877b563f09
拓扑图添加数据
3个文件已修改
108 ■■■■■ 已修改文件
Idce_Lithium/WebRoot/control.jsp 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Idce_Lithium/WebRoot/js/kw/kw.js 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Idce_Lithium/WebRoot/js/kw/topgraph.js 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Idce_Lithium/WebRoot/control.jsp
@@ -261,7 +261,8 @@
                $('#ele_tension').val(groupVol);
                
                // 电池电流
                $('#ele_current').val(data.dev_captest_curr+"A");
                var current = data.dev_captest_curr+"A";
                $('#ele_current').val(current);
                
                // 更新日期
                $('#test_date').val(data.record_datetime);
@@ -273,10 +274,15 @@
                // 测试容量
                $("#test_content").val(data.dev_captest_cap.toFixed(1)+"AH");
                
                // 设置面板的值
                status8kw.setText('workstatus', '设备状态:'+data.note);
                status8kw.setText('stop', '上一次终止原因:'+data.stop_reason);
                status8kw.setText('signalCount', '通信计数:'+data.dev_commcount);
                // 设置丢包率
                var errorCount = data.dev_errcommcount;
                var allCount = data.dev_commcount+errorCount;
                var percent= (allCount==0?0:errorCount/allCount*100).toFixed(3);
                status8kw.setText('percent', "通信丢包率:"+percent+'%');
                
                // 电路拓扑图状态
                var topgraphType = '';
@@ -290,6 +296,21 @@
                }
                // 设置电路图
                setTopGraphState(topgraph, topgraphInfo, topgraphType);
                // 电路拓扑图组端电压
                topgraph.change('groupVolTxt', {
                    text: data.dev_captest_groupvol+'V'
                });
                // 电路拓扑图组端电压
                topgraph.change('onlineVolTxt', {
                    text: data.dev_captest_onlinevol+'V'
                });
                // 电路拓扑图测试电流
                topgraph.change('current', {
                    text: data.dev_captest_curr+'A'
                });
            }
            // 读取设备参数
            function getDevParam(flush) {
Idce_Lithium/WebRoot/js/kw/kw.js
@@ -70,12 +70,54 @@
    // 用电负载
    var loaderImg = drawLoaderImg(topgraph);
    console.log(loaderImg);
    // 电池组1
    var eleGroup = drawEleGroup(topgraph);
    // 电池组2
    var eleGroup2 = drawEleGroup2(topgraph);
    // 组端电压
    var groupVolTxt = topgraph.setText({
        id: 'groupVolTxt',
        point: {
            x: eleGroup2.eleGroup.top.x+5,
            y: eleGroup2.eleGroup.top.y-5,
        },
        text: '0V',
        font: 12,
        lineWidth: 4,
        direct: "start",
        color: "#1495E7"
    });
    // 在线电压
    var onlineVolTxt = topgraph.setText({
        id: 'onlineVolTxt',
        point: {
            x: loaderImg.loader.top.x+5,
            y: loaderImg.loader.top.y-5,
        },
        text: '0V',
        font: 12,
        lineWidth: 4,
        direct: "start",
        color: "#1495E7"
    });
    // 电流
    var current = topgraph.setText({
        id: 'current',
        point: {
            x: startLine.start.x+20,
            y: startLine.start.y-5,
        },
        text: '0A',
        font: 12,
        lineWidth: 4,
        direct: "start",
        color: "#1495E7"
    });
    
    // 绘制8kw测试模块
    function draw8kwModule(topgraph) {
@@ -1422,12 +1464,21 @@
            }
        },
        {
            name:'devVersion',
            name: 'signalCount',
            type: 'text',
            status: 0,
            notShow: true,
            notShow: false,
            content: {
                text: '设备版本号:???'
                text: '通信计数:0'
            }
        },
        {
            name:'percent',
            type: 'text',
            status: 0,
            notShow: false,
            content: {
                text: '丢包率:?%'
            }
        },
        {
Idce_Lithium/WebRoot/js/kw/topgraph.js
@@ -618,6 +618,7 @@
        },
        text: option.text,
        font: option.font,
        direct: option.direct,
        color: option.color
    });
@@ -644,7 +645,15 @@
        var tmp = $.extend({}, option);
        tmp.text = texts[i];
        tmp.point.y = startY+font*i;
        this._centerText(tmp);
        switch(tmp.direct) {
            case 'start':
                this._leftText(tmp);
            break;
            default:
                this._centerText(tmp);
            break;
        }
    }
}
// 绘制起始点向两边发散的文字
@@ -662,6 +671,19 @@
    context.fillText(option.text, x, y);
}
// 绘制文字从起始点开始
TopGraph.prototype._leftText = function(option) {
    var context = this.context;
    var point = option.point;
    var font = option.font;
    var x = point.x;
    var y = point.y;
    context.font = font+'px Verdana';
    context.fillStyle = option.color;
    context.lineWidth = 1;
    context.fillText(option.text, x, y);
};
// 绘制图片
TopGraph.prototype.drawImage = function(image, option) {
    var context = this.context;