lishifeng
2020-09-15 ce10677f47a14879424e7f562f78442cc03cfda1
src/assets/js/diagram/diagramStates.js
@@ -5,6 +5,9 @@
let red = "#FF0000";
// 放电状态
function diagramStates(diagram, type) {
    // 设置电路图类型
    diagram.setOption('type', 'text', '设备状态未知');
    // 断开所有的开关
    diagram.setOption('km1', 'state', false);
    diagram.setOption('km2', 'state', false);
@@ -27,6 +30,15 @@
        case 'float':
            floatCharge(diagram);
        break;
        case 'kd':
            kdTest(diagram);
        break;
        case 'yh':
            yhTest(diagram);
        break;
        case 'break':
            diagram.setOption('type', 'text', '设备未连接');
        break;
        default:
            console.log('默认状态');
        break;
@@ -35,6 +47,9 @@
// 放电状态
function discharge(diagram) {
    // 设置电路图类型
    diagram.setOption('type', 'text', '放电状态');
    // 关闭km2和km3
    diagram.setOption('km2', 'state', true);
    diagram.setOption('km3', 'state', true);
@@ -212,6 +227,9 @@
// 充电状态
function charge(diagram) {
    // 设置电路图类型
    diagram.setOption('type', 'text', '充电状态');
    // 关闭km2和km3
    diagram.setOption('km2', 'state', true);
    diagram.setOption('km3', 'state', true);
@@ -403,6 +421,9 @@
// 浮充状态
function floatCharge(diagram) {
    // 设置电路图类型
    diagram.setOption('type', 'text', '在线浮充状态');
    // 关闭km1
    diagram.setOption('km1', 'state', true);
@@ -451,10 +472,7 @@
        id: 'line19_dot',
        fillStyle: springGreen,
        flush: true,
        points: [
            line19[1],
            line19[0]
        ],
        points: line19,
    });
    // 线条18
@@ -463,10 +481,7 @@
        id: 'line18_dot',
        fillStyle: springGreen,
        flush: true,
        points: [
            line18[1],
            line18[0]
        ],
        points: line18,
    });
    // 线条17
@@ -475,10 +490,7 @@
        id: 'line17_dot',
        fillStyle: springGreen,
        flush: true,
        points: [
            line17[1],
            line17[0]
        ],
        points: line17,
    });
    
    // 线条16
@@ -487,10 +499,7 @@
        id: 'line16_dot',
        fillStyle: springGreen,
        flush: true,
        points: [
            line16[1],
            line16[0]
        ],
        points: line16,
    });
    // 线条15
@@ -571,4 +580,178 @@
        ],
    });
}
// kd测试
function kdTest(diagram) {
    // 设置电路图类型
    diagram.setOption('type', 'text', 'K1/D1测试');
    // 关闭km1,km2
    diagram.setOption('km1', 'state', true);
    diagram.setOption('km2', 'state', true);
    // 修改充放电模块的状态
    diagram.setOption('dischargeState', 'url', lightDangerImage);
    // 绘制可移动的点
    let line1 = diagram.getOption('line1').points;
    diagram.moveDot({
        id: 'line1_dot',
        fillStyle: springGreen,
        flush: true,
        points: line1,
    });
    // 绘制可移动的点
    let line2 = diagram.getOption('line2').points;
    diagram.moveDot({
        id: 'line2_dot',
        fillStyle: springGreen,
        flush: true,
        points: line2,
    });
    // 绘制可移动的点
    let line8 = diagram.getOption('line8').points;
    let line13 = diagram.getOption('line13').points;
    diagram.moveDot({
        id: 'line8_1_dot',
        fillStyle: springGreen,
        flush: true,
        points: [
            line8[0],
            line13[0]
        ],
    });
    diagram.moveDot({
        id: 'line13_dot',
        fillStyle: springGreen,
        flush: true,
        points: line13,
    });
    // 绘制可移动的点
    let line14 = diagram.getOption('line14').points;
    diagram.moveDot({
        id: 'line14_dot',
        fillStyle: springGreen,
        flush: true,
        points: line14,
    });
    // 绘制可移动的点
    let line9 = diagram.getOption('line9').points;
    diagram.moveDot({
        id: 'line9_dot',
        fillStyle: springGreen,
        flush: true,
        points: [
            line14[1],
            line9[0]
        ],
    });
    // 绘制可移动的点
    let line7 = diagram.getOption('line7').points;
    diagram.moveDot({
        id: 'line7_dot',
        fillStyle: springGreen,
        flush: true,
        points: [
            line7[1],
            line7[0]
        ],
    });
    // 绘制可移动的点
    let line5 = diagram.getOption('line5').points;
    diagram.moveDot({
        id: 'line5_dot',
        fillStyle: springGreen,
        flush: true,
        points: line5,
    });
    // 绘制可移动的点
    let line6 = diagram.getOption('line6').points;
    diagram.moveDot({
        id: 'line6_dot',
        fillStyle: springGreen,
        flush: true,
        points: line6,
    });
}
// 离线养护模式
function yhTest(diagram) {
    // 设置电路图类型
    diagram.setOption('type', 'text', '离线养护测试');
    // 绘制移动的点
    let line17 = diagram.getOption('line17').points;
    diagram.moveDot({
        id: 'line17_dot',
        fillStyle: springGreen,
        flush: true,
        points: [
            line17[1],
            line17[0]
        ],
    });
    // 绘制移动的点
    let line16 = diagram.getOption('line16').points;
    diagram.moveDot({
        id: 'line16_dot',
        fillStyle: springGreen,
        flush: true,
        points: [
            line16[1],
            line16[0]
        ],
    });
    // 绘制移动的点
    let line21 = diagram.getOption('line21').points;
    diagram.moveDot({
        id: 'line21_dot',
        fillStyle: springGreen,
        flush: true,
        points: line21,
    });
    // 绘制移动的点
    let line22 = diagram.getOption('line22').points;
    diagram.moveDot({
        id: 'line22_dot',
        fillStyle: springGreen,
        flush: true,
        points: line22,
    });
    // 绘制移动的点
    let line19 = diagram.getOption('line19').points;
    diagram.moveDot({
        id: 'line19_dot',
        fillStyle: springGreen,
        flush: true,
        points: [
            line19[1],
            line19[0]
        ],
    });
    // 绘制移动的点
    let line18 = diagram.getOption('line18').points;
    diagram.moveDot({
        id: 'line18_dot',
        fillStyle: springGreen,
        flush: true,
        points: [
            line18[1],
            line18[0]
        ],
    });
}
export default diagramStates;