echarts 添加Loading 等层

2022-03-15 15:35:45
capturedsDetailsEcharts: function(id) {
        if (!id) {
            id = mini.get("chnNameCaptureds").getValue();
        }
        let captureds = echarts.init(document.getElementById('capturedsDetails'));
        let beginTime = mini.get("beginTimeCaptureds").getValue();
        let endTime = mini.get("endTimeCaptureds").getValue();
        let timeGran = mini.get("timeGrainCaptureds").getValue();
        let tableName = mini.get("tableCaptureds").getValue();

        captureds.showLoading({
            text: '数据正在加载...',
            textStyle: { fontSize : 30 , color: '#444' },
            effectOption: {backgroundColor: 'rgba(0, 0, 0, 0)'}
        });

        $.ajax({
            url: contextPath + "/source-system/query-captured.html",
            dataType: "json",
            type: "post",
            data: {
                jsonParam:  
                    Constants.encodeObjToJSON({
                            beginTime: beginTime,
                            endTime: endTime,
                            timeGran: timeGran,
                            id: id,
                            tableName: tableName
                        }
                    )
            },
            success: function(datas) {
                let option = {
                /*    title: {
                        text: "捕获数据曲线图"
                    },*/
                    legend: {
                        data: ["插入数量","更新数量","删除数量","捕获数量"],
                        right:30,
                        bottom:20
                    },
                    xAxis: {
                        type: "time",
                        min: beginTime,
                        max: endTime,
                        splitNumber: 20
                    },
                    yAxis: {
                        type: "value"
                    },
                    grid:{
                        top:20,
                        bottom:90,
                        left:80,
                        right:30
                    },
                    color:['#00B9FF','#AF00BC', '#00CA68', '#FF8C00', '#FF0000'],
                    series: datas
                };
                captureds.setOption(option);
                captureds.hideLoading();
            }
        });
    },