赣州市洪水风险预警系统二维版本
xiebin
2023-03-02 b39483c96ae572121d3c619c0b9d37634e682cc4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
define([
    "dojo",
    "dojo/_base/declare",
    "dojo/_base/lang",
    "base/BaseWidget",
    "dojo/text!widgets/echarts/template.html",
    "widgets/echarts/config",
    "base/AppEvent",
    "base/ConfigData",
    "dojo/dom",
    "dojo/dom-construct",
    "dojo/dom-attr",
    "dojo/dom-style",
    "dojo/on",
    "esri/layers/FeatureLayer",
    "controls/tab/TabControl",
    "esri/dijit/SymbolStyler",
    "esri/styles/basic",
    "dojo/_base/array",
    "esri/tasks/QueryTask",
    "esri/tasks/query",
    "jslibs/echarts.min",
    "esri/Color",
    "esri/symbols/TextSymbol",
    "esri/symbols/Font",
    "esri/tasks/StatisticDefinition",
    "dojo/domReady!"
], function (dojo,
             declare,
             lang,
             BaseWidget,
             template,
             config,
             AppEvent,
             ConfigData,
             dom,
             domConstruct,
             domAttr,
             domStyle,
             on,
             FeatureLayer,
             TabControl,
             SymbolStyler,
             basic,
             arrayUtils,
             QueryTask,
             Query,
             echarts,
             Color,
             TextSymbol,
             Font,
             StatisticDefinition) {
    var Widget = declare([BaseWidget], {
        widgetName: "echartsWidget",
        label: "统计图表",
        templateString: template,
        _map: null,
        _tabControl: null,
        _styler: null,
        _selectLayer: null,
        _printer: null,
        _openprinturl: null,
        echartsObj: null,
        XZQ: null,
        XZQfeatures: null,
        et: null,
        constructor: function (options, srcRefNode) {
            this._map = options.map;
        },
        postCreate: function () {
        },
        startup: function () {
            this.inherited(arguments);
            echartsObj = this;
            echartsObj._buildLayerTree();
            AppEvent.addAppEventListener("menuclick", lang.hitch(this, function (evt) {
                echartsObj.et = evt;
                $("#bg").show();
                if (echartsObj.XZQfeatures == null) {
                    echartsObj._getXZQ();
                    return;
                }
                $("#barh1").html(evt.name + $("#statistics-item option:selected").text() + "统计情况");
                echartsObj._getdata(evt.data);
            }));
            AppEvent.addAppEventListener("showDetails", lang.hitch(this, function (evt) {
                echartsObj.et = evt;
                $("#bg").show();
                $("#barh1").html(evt.name + evt.conditionValue + $("#statistics-item option:selected").text() + "统计情况");
                echartsObj._showDetails();
            }));
        },
        //绑定统计面板事件
        _buildLayerTree: function () {
            //绑定打开按钮事件
            on(dom.byId("below_bar"), "click", function () {
                var echartsdiv = $("#echartsWidget");
                if (echartsdiv.height() == 0) {
                    $("#below_bar").hide();
                    echartsdiv.height('100%');
                }
            });
            //隐藏按钮事件
            on(dom.byId("hide_bar"), "click", function () {
                var echartsdiv = $("#echartsWidget");
                if (echartsdiv.height() != 0) {
                    $("#below_bar").show();
                    echartsdiv.height(0);
                }
            });
            // $('#condition1').change(function () {
            //     if ($('#statistics-item option:selected').attr('data')) {
            //         AppEvent.dispatchAppEvent("menuclick", {
            //             name: $('.statistics-layer-input').val(),
            //             path: $('.statistics-layer-input').attr('data'),
            //             item: $('#statistics-item option:selected').attr('data')
            //         });
            //     }
            // });
            // $('#condition2').change(function () {
            //     if ($('#statistics-item option:selected').attr('data')) {
            //         AppEvent.dispatchAppEvent("menuclick", {
            //             name: $('.statistics-layer-input').val(),
            //             path: $('.statistics-layer-input').attr('data'),
            //             item: $('#statistics-item option:selected').attr('data')
            //         });
            //     }
            // });
        },
        //查询18个行政区
        _getXZQ: function () {
            echartsObj.XZQfeatures = ConfigData.XZQfeatures;
            if (echartsObj.XZQfeatures != null) {
                echartsObj.XZQ = {city: [], county: []};
                for (var i = 0; i < echartsObj.XZQfeatures.length; i++) {
                    echartsObj.XZQ.city.push({
                        name: echartsObj.XZQfeatures[i].attributes["CITY"]
                    });
                }
                AppEvent.dispatchAppEvent("menuclick", {
                    name: echartsObj.et.name,
                    url: echartsObj.et.url,
                    data: echartsObj.et.data
                });
            } else {
                var queryTask = new QueryTask(ConfigData.XZQUrl);
                var query = new Query();
                query.returnGeometry = false;
                query.outFields = ["*"];
                query.orderByFields = ["CITY_GB"];
                query.where = "1=1";
                queryTask.execute(query, function (results) {
                    ConfigData.XZQfeatures = results.features;
                    echartsObj.XZQfeatures = ConfigData.XZQfeatures;
                    echartsObj.XZQ = {city: [], county: []};
                    for (var i = 0; i < echartsObj.XZQfeatures.length; i++) {
                        echartsObj.XZQ.city.push({
                            name: echartsObj.XZQfeatures[i].attributes["CITY"]
                        });
                    }
                    AppEvent.dispatchAppEvent("menuclick", {
                        name: echartsObj.et.name,
                        url: echartsObj.et.url,
                        data: echartsObj.et.data
                    });
                }, function (error) {
                    console.log(error);
                    $("#bg").hide();
                    alert('获取行政区数据失败!');
                });
            }
        },
        //查询统计左侧子项信息
        _showDetails: function () {
            $.get(echartsObj.et.url + '?f=pjson', function (e) {
                var displayField = JSON.parse(e).displayField;
                AppEvent.dispatchAppEvent("clearcolor");
                if ($('#bg').is(":hidden")) $('#bg').show();
                var queryTask = new QueryTask(echartsObj.et.url);
                var query = new Query();
//              debugger
                if ($('#statistics-condition').val() == '行政区') {//统计单元选择行政区时,则统计所选的市对应的县
                    query.where = "CITY LIKE '%" + echartsObj.et.conditionValue + "%'";//只查询指定的行政区
                    if (echartsObj.et.statisticsArea) {//添加查询范围
                        query.geometry = echartsObj.et.statisticsArea;
                    }
                    //添加统计参数
                    var statDefs = [];
                    for (var itemKey in echartsObj.et.statisticsCondition.item) {
                        var StatDef = new StatisticDefinition();
                        if (echartsObj.et.statisticsCondition.item[itemKey] == '湿地个数') {
                            StatDef.statisticType = "count";
                            StatDef.onStatisticField = displayField;
                            StatDef.outStatisticFieldName = "湿地个数";
                        } else {
                            StatDef.statisticType = "sum";
                            StatDef.onStatisticField = echartsObj.et.statisticsCondition.itemFields[itemKey];
                            StatDef.outStatisticFieldName = echartsObj.et.statisticsCondition.item[itemKey];
                        }
                        statDefs.push(StatDef);
                    }
                    query.groupByFieldsForStatistics = ['COUNTY'];
                } else {
                    //判断统计单元是否经过了字典转换,如转换则进行逆转换
                    if (config.dictionary.hasOwnProperty($('#statistics-condition option:selected').attr('data'))) {
                        var dictionary = config.dictionary[$('#statistics-condition option:selected').attr('data')];
                        for (var dictionaryKey in dictionary) {
                            if (dictionary[dictionaryKey] == echartsObj.et.conditionValue) {
                                if (isNaN(dictionaryKey)){
                                    echartsObj.et.conditionValue = dictionaryKey;
                                } else {
                                    echartsObj.et.conditionValue = Number(dictionaryKey);
                                }
                            }
                        }
                    }
                    //只查询指定的类型
                    if (typeof (echartsObj.et.conditionValue)=='number'){
                        query.where = $('#statistics-condition option:selected').attr('data') + " = " + echartsObj.et.conditionValue;
                    } else {
                        query.where = $('#statistics-condition option:selected').attr('data') + " LIKE '%" + echartsObj.et.conditionValue + "%'";
                    }
 
                    if (echartsObj.et.statisticsArea) {//添加查询范围
                        query.geometry = echartsObj.et.statisticsArea;
                    }
                    //添加统计参数
                    var statDefs = [];
                    for (var itemKey in echartsObj.et.statisticsCondition.item) {
                        var StatDef = new StatisticDefinition();
                        if (echartsObj.et.statisticsCondition.item[itemKey] == '湿地个数') {
                            StatDef.statisticType = "count";
                            StatDef.onStatisticField = displayField;
                            StatDef.outStatisticFieldName = "湿地个数";
                        } else {
                            StatDef.statisticType = "sum";
                            StatDef.onStatisticField = echartsObj.et.statisticsCondition.itemFields[itemKey];
                            StatDef.outStatisticFieldName = echartsObj.et.statisticsCondition.item[itemKey];
                        }
                        statDefs.push(StatDef);
                    }
                    query.groupByFieldsForStatistics = ['CITY'];
                }
                query.returnGeometry = false;
                query.outStatistics = statDefs;
                queryTask.execute(query, function (results) {
                    if (results.features.length > 0) {
                        var data = results.features;
                        for (var dictionaryKey in config.dictionary) {//判断是否包括需要字典转换的属性,包括的话直接进行转换
                            data.map(function (value) {
                                if (value.attributes.hasOwnProperty(dictionaryKey)) {
                                    value.attributes[dictionaryKey] = config.dictionary[dictionaryKey][value.attributes[dictionaryKey]];
                                    return;
                                }
                            });
                        }
                        echartsObj.et.data = data;
                        echartsObj._getdata(data, 'showDetails');
                        $('#bg').hide();
                    } else {
                        $('#bg').hide();
                    }
                }, function (er) {
                    console.log(er);
                    $('#bg').hide();
                });
            });
        },
        //查询图层,获取统计信息
        _getdata: function (data, type) {
            var classifyData = echartsObj._classifyFeatures(data, type);
            //构造图表
            echartsObj._bar(classifyData);
            echartsObj._pie(classifyData);
            $("#bg").hide();
        },
        //对数据进行分类,组装成需要的结构
        _classifyFeatures: function (e, type) {//参数:统计结果、返回结果类型、统计条件、子项分类
            if (type) {
                var conditionField = $('#statistics-condition').val() == '行政区' ? 'COUNTY' : 'CITY';
            } else {
                var conditionField = $('#statistics-condition option:selected').attr('data');
            }
            var dataSorce = {};//临时存放处理后的统计结果
            // if (!item) {
            //     //对数据进行排序,数值大的放在前面
            //     var i = 0,
            //         len = classifyData.length,
            //         j, d;
            //     var sn = "";
            //     for (; i < len; i++) {
            //         for (j = 0; j < len; j++) {
            //             if (Number(classifyData[i].data) < Number(classifyData[j].data)) {
            //                 d = classifyData[j].data;
            //                 sn = classifyData[j].name;
            //                 classifyData[j].data = classifyData[i].data;
            //                 classifyData[j].name = classifyData[i].name;
            //                 classifyData[i].data = d;
            //                 classifyData[i].name = sn;
            //             }
            //         }
            //     }
            // }
            dataSorce.xAxisData = [];//x坐标轴数据
            dataSorce.datas = {};//各类型统计数据
            e.map(function (item) {
                dataSorce.xAxisData.push(item.attributes[conditionField]);
                for (var itemKey in item.attributes) {
                    if (itemKey != conditionField) {//剔除统计单元项
                        var nu = itemKey == '湿地个数' ? 0 : 2;
                        if (dataSorce.datas.hasOwnProperty(itemKey)) {
                            var value = Number(Number(item.attributes[itemKey]).toFixed(nu));
                            dataSorce.datas[itemKey].push({name: item.attributes[conditionField], value: value});
                        } else {
                            dataSorce.datas[itemKey] = [];
                            var value = Number(Number(item.attributes[itemKey]).toFixed(nu));
                            dataSorce.datas[itemKey].push({name: item.attributes[conditionField], value: value});
                        }
                    }
                }
            });
 
            //如果是按行政区统计,则应该将没有数据的行政区补0
            if (conditionField == 'CITY') {
                if (echartsObj.XZQfeatures.length != dataSorce.xAxisData.length) {//判断行政区个数是否相等
                    for (var xzQfeaturesKey in echartsObj.XZQfeatures) {//遍历查找出缺失的行政区
                        if (dataSorce.xAxisData.indexOf(echartsObj.XZQfeatures[xzQfeaturesKey].attributes.CITY) == -1) {
                            dataSorce.xAxisData.push(echartsObj.XZQfeatures[xzQfeaturesKey].attributes.CITY);//x轴数据补全行政区
                            for (var datasKey in dataSorce.datas) {//补全各项数据中缺失的行政区数据
                                dataSorce.datas[datasKey].push({
                                    name: echartsObj.XZQfeatures[xzQfeaturesKey].attributes.CITY,
                                    value: 0
                                });
                            }
                        }
                    }
                }
            }
            return dataSorce;
        },
        //统计饼图
        _pie: function (data) {
            //先销毁上次生成的所有piedom
            domConstruct.destroy('pie-container');
            var pieContainer = domConstruct.create('div', {id: 'pie-container'}, 'main_pie');
            var pieleft = domConstruct.create('div', {id: 'pie-left'}, pieContainer);
            var pieright = domConstruct.create('div', {id: 'pie-right'}, pieContainer);
            var pie = [];
            on(pieleft, 'click', function () {
                var prevdom = null;
                $('.pie-dom-show').each(function (index, dom) {
                    $('.pie-dom-show').each(function (index, dom) {
                        if ($(dom).is(':visible')) {
                            if ($(dom).prev().index() > 1) {
                                prevdom = $(dom).prev();
                                $(dom).hide();
                            }
                        }
                    });
                });
                if (prevdom) {
                    prevdom.fadeIn('fast');
                    setTimeout(function () {
                        var domIndex = $(prevdom).index() - 2;
                        pie[domIndex * 2].resize();
                        pie[domIndex * 2 + 1].resize();
                    }, 50);
                }
            });
            on(pieright, 'click', function () {
                var nextdom = null;
                $('.pie-dom-show').each(function (index, dom) {
                    if ($(dom).is(':visible')) {
                        if ($(dom).next().length > 0) {
                            nextdom = $(dom).next();
                            $(dom).hide();
                        }
                    }
                });
                if (nextdom) {
                    nextdom.fadeIn('fast');
                    setTimeout(function () {
                        var domIndex = $(nextdom).index() - 2;
                        pie[domIndex * 2].resize();
                        if (domIndex * 2 + 1 <= pie.length - 1) {
                            pie[domIndex * 2 + 1].resize();
                        }
                    }, 50);
                }
            });
            var nowPieDom = domConstruct.create('div', {
                class: 'pie-dom-show',
                style: 'display:block'
            }, pieContainer);
            var index = 1;
            for (var i in data.datas) {
                if (i == '湿地个数') {
                    var unit = '个'
                } else {
                    var unit = '公顷'
                }
                var pieoption = {
                    title: {
                        text: i + "比例情况(%)",
                        x: 'center',
                        top: '10px'
                    },
                    tooltip: {
                        trigger: 'item',
                        formatter: "",
                        formatter: "{b} :{c} " + unit + "<br>占比:{d}%"
                    },
                    legend: {
                        type: 'scroll',
                        orient: 'vertical',
                        right: '15px',
                        top: '50px',
                        bottom: '50px'
                    },
                    series: [{
                        name: '',
                        type: 'pie',
                        selectedMode: 'single',
                        label: {
                            normal: {
                                position: 'inside',
                                formatter: '{d}%'
                            }
                        },
                        labelLine: {
                            normal: {
                                smooth: 0.2,
                                length: 10,
                                length2: 10
                            }
                        },
                        radius: '70%',
                        center: ['40%', '50%'],
                        data: data.datas[i]
                    }]
                };
                if (index == 3) {
                    var nowPieDom = domConstruct.create('div', {
                        class: 'pie-dom-show'
                    }, pieContainer);
                    index = 1;
                }
                index++;
                var pieDom = domConstruct.create('div', {
                    class: 'pie-dom',
                }, nowPieDom);
                var thispie = echarts.init(pieDom);
                thispie.setOption(pieoption, true);
                pie.push(thispie);
            }
            $(window).resize(function () {
                setTimeout(function () {
                    pie.map(function (value) {
                        value.resize();
                    });
                }, 500);
            });
            // myChart.on('mouseover', function (administrative) {
            //     var data = [];
            //     data.push({
            //         name: administrative.name,
            //     });
            //     echartsObj._mouseover(data);
            // });
            // myChart.on('mouseout', function () {
            //     echartsObj.graphic_border.clear();
            // });
        },
        //统计柱状图
        _bar: function (data) {
            var series = [];
            var legendData = [];
            for (var datasKey in data.datas) {//填充数据,图斑个数使用折线
                legendData.push(datasKey);
                if (datasKey == '湿地个数') {
                    var type = 'line';
                    var yAxisIndex = 1;
                } else {
                    var type = 'bar';
                    var yAxisIndex = 0;
                }
                series.push({
                    type: type,
                    // barWidth: 20,
                    name: datasKey,
                    label: {
                        normal: {
                            show: false
                        }
                    },
                    // itemStyle: {
                    //     normal: {
                    //         color: new echarts.graphic.LinearGradient(
                    //             0, 0, 0, 1,
                    //             [
                    //                 {offset: 0, color: '#3bf15a'},
                    //                 {offset: 0.5, color: '#29c14e'},
                    //                 {offset: 1, color: '#00aa01'}
                    //             ]
                    //         )
                    //     }
                    // },
                    data: data.datas[datasKey],
                    yAxisIndex: yAxisIndex
                });
            }
 
            var baroption = {
                legend: {
                    type: 'scroll',
                    orient: 'horizontal',
                    top: 20,
                    data: legendData
                },
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        type: 'cross',
                        crossStyle: {
                            color: '#999'
                        }
                    }
                },
                toolbox: {
                    show: true,
                    feature: {
                        magicType: {
                            type: ['stack', 'tiled']
                        }
                    }
                },
                textStyle: {
                    color: "#6b6b6b"
                },
                grid: {
                    left: '4%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                yAxis: [{
                    type: 'value',
                    name: '面积',
                    splitLine: {
                        show: true,
                        lineStyle: {
                            type: 'solid',
                            color: '#d7d7d7'
                        }
                    },
                    axisLine: {
                        lineStyle: {
                            color: "#6b6b6b"
                        }
                    },
                    axisLabel: {
                        formatter: '{value} 公顷'
                    }
                }, {
                    type: 'value',
                    name: '湿地个数',
                    splitLine: {
                        show: true,
                        lineStyle: {
                            type: 'solid',
                            color: '#d7d7d7'
                        }
                    },
                    axisLine: {
                        lineStyle: {
                            color: "#6b6b6b"
                        }
                    },
                    axisLabel: {
                        formatter: '{value} 个'
                    }
                }],
                xAxis: [{
                    type: 'category',
                    data: data.xAxisData,
                    axisTick: {
                        show: true,
                        interval: 0//强制显示所有标签
                    },
                    axisLabel: {
                        show: true,
                        interval: 0//强制显示所有标签
                    },
                    axisLine: {
                        lineStyle: {
                            color: "#6b6b6b"
                        }
                    },
                    axisPointer: {
                        type: 'shadow'
                    }
                }],
                series: series
            };
            var domMain = document.getElementById("main_bar");
            var bar = echarts.init(domMain);
            bar.setOption(baroption, true);
            $(window).resize(function () {
                setTimeout(function () {
                    bar.resize();
                }, 500);
            });
            // myChart.on('mouseover', function (administrative) {
            //     var data = [];
            //     data.push({
            //         name: administrative.name,
            //     });
            //     echartsObj._mouseover(data);
            // });
            // myChart.on('mouseout', function () {
            //     echartsObj.graphic_border.clear();
            // });
            // $("#main_bar").unbind("mousemove").mousemove(function () {
            //     if ($($("#main_bar")[0].lastChild).is(":visible")){
            //         var target_name = $("#main_bar")[0].lastChild.firstChild.data;
            //         var data = [];
            //         data.push({
            //             name: target_name,
            //         });
            //         echartsObj._mouseover(data);
            //     } else {
            //         echartsObj.graphic_border.clear();
            //     }
            // });
        },
        //统计表格
        _table: function (countdata) {
            var data = echartsObj._classifyFeatures(countdata, 'table', $('#condition1').val(), $('#condition2 option:selected').attr('data'));
            var tableheight = $('.main_list').height();
            var unit = echartsObj.et.item == '湿地个数' ? '(个)' : '(公顷)';
            var columns;//设定列
            var rows = [];//设定行
            if (data.dimensions.length > 1) {//子项有分类
                columns = [{
                    field: 'condition',
                    title: $('#condition1').val()
                }, {
                    field: 'item',
                    title: $('#condition2').val()
                }, {
                    field: 'value',
                    title: echartsObj.et.name + $("#statistics-item option:selected").text() + "统计详情" + unit
                }];
                for (var sourceKey in data.source) {
                    var condition = sourceKey;
                    for (var i = 0; i < data.source[sourceKey].length; i++) {
                        rows.push({
                            condition: condition,
                            item: data.dimensions[i + 1],
                            value: data.source[sourceKey][i]
                        });
                    }
                }
            } else {//子项没有分类
                columns = [{
                    field: 'condition',
                    title: $('#condition1').val()
                }, {
                    field: 'value',
                    title: echartsObj.et.name + $("#statistics-item option:selected").text() + "统计详情" + unit
                }];
                for (var sourceKey in data.source) {
                    rows.push({
                        condition: sourceKey,
                        value: data.source[sourceKey]
                    });
                }
            }
 
            $('#content_list').bootstrapTable('destroy');
            $('#content_list').bootstrapTable({
                height: tableheight,
                // showHeader:true,
                columns: columns,
                data: rows
            });
 
            $('.fixed-table-body').height(tableheight - 42);
            //加载自定义滚动条
            $(".fixed-table-body").mCustomScrollbar("destroy"); //清除滚动条
            $(".fixed-table-body").mCustomScrollbar({
                scrollButtons: {
                    enable: true, //是否添加 滚动条两端按钮支持 值:true,false
                    scrollType: "continuous", //滚动按钮滚动类型 值:”continuous”(当你点击滚动控制按钮时断断续续滚动) “pixels”(根据每次点击的像素数来滚动)
                    scrollSpeed: 50, //设置点击滚动按钮时候的滚动速度(默认 20)
                    scrollAmount: 60 //设置点击滚动按钮时候每次滚动的数值 像素单位 默认 40像素
                },
                autoHideScrollbar: true,
                horizontalScroll: false, //是否创建一个水平滚动条 默认是垂直滚动条
                set_width: false, //:设置你内容的宽度 值可以是像素或者百分比
                set_height: false, //:设置你内容的高度 值可以是像素或者百分比
                mouseWheel: true, //鼠标滚动的支持 值为:true.false
            });
        },
    });
    return Widget;
});