IT-KIMI_SHI\SINOIT.KIMI
2018-12-07 50eb1d766c470dc6ff927199eaee934f972a8b70
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
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
/**
 * Created by ct on 2016/8/13.
 */
require.config({
    baseUrl: 'resources/js',
    paths: {
        "formatData": "lib/charts/formatData",
        "jquery": "lib/bootstrap/js/jquery-2.1.4.min",
        "bootstrap": "lib/bootstrap/js/bootstrap.min",
        "jquery-ui": "lib/jquery-ui.min",
        "lodash": "lib/gridstack/js/lodash.min",
        "underscore": "lib/underscore/underscore-min",
        "spectrum": "lib/bootstrap/js/spectrum",
        "renderMenu" : 'app/renderMenu',
        "domReady" : 'lib/domReady',
        "zrender": "lib/zrender/zrender",
        "zrender/shape/Rectangle": "lib/zrender/zrender",
        "zrender/shape/Image": "lib/zrender/zrender",
        "zrender/tool/color": "lib/zrender/zrender",
        "zrender/Storage" : "lib/zrender/zrender",
        "CanvasTag" : "customModule/CanvasTag/CanvasTag",
        "CanvasTagOfImage" : "customModule/CanvasTag/CanvasTagOfImage",
        "confirmModal": "lib/confirm/confirm-bootstrap",
        "vue": "lib/vue/vue",
        "bootstrapFileStyle": "lib/bootstrapFileStyle/fileinput.min",
        "interact": "lib/interact/interact",
        "echarts": "lib/charts/echarts",
        "theme": "lib/charts/theme",
        "nicescroll": "lib/nicescroll/jquery.nicescroll.min",
        "tableExport": "lib/tableExport/tableexport.min",
        "file-saverjs": "lib/tableExport/FileSaver",
        "blobjs": "lib/tableExport/Blob",
        "xlsx": "lib/tableExport/xlsx",
        "jzip": "lib/tableExport/jszip",
        "tooltipster": "lib/gridly/tooltipster.bundle.min",
        "generateTableHtml": "app/generateTableHtml",
        "commonModule" : 'app/commonModule',
        "thenBy": "lib/thenBy",
        "jquery-confirm": "lib/confirm/jquery-confirm.min",
        "jquery-loading": "lib/jqueryLoading/jquery.loading"
    },
    shim : {
        "bootstrap" : { "deps" :['jquery'] },
        "confirmModal" : { "deps" :['jquery'] },
        "bootstrapFileStyle" : { "deps" :['bootstrap'] },
        "tableExport": { "deps" :['blobjs', 'file-saverjs', 'xlsx', 'jzip'] }
    },
    waitSeconds: 30
});
 
require(['jquery','domReady','vue','CanvasTagOfImage','renderMenu','echarts','interact','formatData','CanvasTag','zrender','theme','commonModule',
        'bootstrapFileStyle','spectrum','confirmModal','nicescroll','tableExport'],
    function ($,domReady,vue,CanvasTagOfImage,renderMenu,echarts,interact,formatData,CanvasTag,zrender,theme,commonModule) {
        domReady(function () {
            //charts配置双向绑定组件
            vue.component('chart-option-component',{
                template: formatData.tableAndConfigOfBarAndLine(),
                props: ['chartOption'],
                data: function(){
                    return {
                        option: '',
                        myChart: '',
                        optionSetting: {
                            titleContent: '',
                            titleTop: '',
                            titleX: '',
                            titleFontFamily: '',
                            titleFontSize: '',
                            titleFontWeight: '',
                            titleFontStyle: '',
                            titleFontColor: '',
                            subtitleContent: '',
                            subtitleFontFamily: '',
                            subtitleFontSize: '',
                            subtitleFontWeight: '',
                            subtitleFontStyle: '',
                            subtitleFontColor: '',
                            tooltipShow: '',
                            tooltipBorderColor: '',
                            tooltipBorderWidth: '',
                            tooltipBackgroundColor: '',
                            tooltipFontFamily: '',
                            tooltipFontSize: '',
                            tooltipFontWeight: '',
                            tooltipFontColor: '',
                            backgroundOpacity: ''
                            // xRotate: '',
                            // yAxisContent: ''
                        }
                    }
                },
                watch: {
                    chartOption: function(){
                        var self  = this;
                        //颜色选择器初始化
                        $("#titleFontColor").spectrum({
                            showInput: true,
                            allowEmpty:true,
                            color: this.chartOption.title[0].textStyle.color,
                            change: function(color){
                                self.optionSetting.titleFontColor = color.toHexString();
                            }
                        });
                        $("#subtitleFontColor").spectrum({
                            showInput: true,
                            allowEmpty:true,
                            color: this.chartOption.title[0].subtextStyle.color,
                            change: function(color) {
                                self.optionSetting.subtitleFontColor = color.toHexString();
                            }
                        });
                        $("#tooltipBorderColor").spectrum({
                            showInput: true,
                            allowEmpty:true,
                            color: this.chartOption.tooltip[0].borderColor,
                            change: function(color) {
                                self.optionSetting.tooltipBorderColor = color.toHexString();
                            }
                        });
                        $("#tooltipBackgroundColor").spectrum({
                            showInput: true,
                            allowEmpty:true,
                            color: this.chartOption.tooltip[0].backgroundColor,
                            change: function(color) {
                                self.optionSetting.tooltipBackgroundColor = color.toHexString();
                            }
                        });
                        $("#tooltipFontColor").spectrum({
                            showInput: true,
                            allowEmpty:true,
                            color: this.chartOption.tooltip[0].textStyle.color,
                            change: function(color) {
                                self.optionSetting.tooltipFontColor = color.toHexString();
                            }
                        });
                        if(JSON.stringify(this.chartOption.backgroundColor).split(",").length<4){
                            this.chartOption.backgroundColor = 'rgba(255,255,255,1)';
                        }
                        if(this.chartOption.title[0] || this.chartOption.tooltip[0]){
                            var settings = {
                                titleContent: this.chartOption.title[0].text,
                                titleTop: this.chartOption.title[0].top,
                                titleX: this.chartOption.title[0].left,
                                titleFontFamily: this.chartOption.title[0].textStyle.fontFamily,
                                titleFontSize: this.chartOption.title[0].textStyle.fontSize,
                                titleFontWeight: this.chartOption.title[0].textStyle.fontWeight,
                                titleFontStyle: this.chartOption.title[0].textStyle.fontStyle,
                                titleFontColor: this.chartOption.title[0].textStyle.color,
                                subtitleContent: this.chartOption.title[0].subtext,
                                subtitleFontFamily: this.chartOption.title[0].subtextStyle.fontFamily,
                                subtitleFontSize: this.chartOption.title[0].subtextStyle.fontSize,
                                subtitleFontWeight: this.chartOption.title[0].subtextStyle.fontWeight,
                                subtitleFontStyle: this.chartOption.title[0].subtextStyle.fontStyle,
                                subtitleFontColor: this.chartOption.title[0].subtextStyle.color,
                                tooltipShow: this.chartOption.tooltip[0].show,
                                tooltipBorderColor: this.chartOption.tooltip[0].borderColor,
                                tooltipBorderWidth: this.chartOption.tooltip[0].borderWidth,
                                tooltipBackgroundColor: this.chartOption.tooltip[0].backgroundColor,
                                tooltipFontFamily: this.chartOption.tooltip[0].textStyle.fontFamily,
                                tooltipFontSize: this.chartOption.tooltip[0].textStyle.fontSize,
                                tooltipFontWeight: this.chartOption.tooltip[0].textStyle.fontWeight,
                                tooltipFontColor: this.chartOption.tooltip[0].textStyle.color,
                                backgroundOpacity: JSON.stringify(this.chartOption.backgroundColor).split(",")[3].replace(')"','')*100,
                                // xRotate: this.chartOption.xAxis[0].axisLabel.rotate ? this.chartOption.xAxis[0].axisLabel.rotate : 0,
                                // yAxisContent: ''
                            };
                            this.optionSetting = settings;
                        }
                        this.option = this.chartOption;
                        $("#optionModal").unbind("shown.bs.modal");
                        $("#optionModal").on("shown.bs.modal", function (e) {
                            self.myChart = echarts.init(document.getElementById("optionContainer"));
                            self.myChart.setOption(self.option,true);
                        });
                    },
                    optionSetting: {
                        handler: function(val, oldVal){
                            this.chartOption.title[0].text = this.optionSetting.titleContent;
                            this.chartOption.title[0].top = this.optionSetting.titleTop;
                            this.chartOption.title[0].left = this.optionSetting.titleX;
                            this.chartOption.title[0].textStyle.fontFamily = this.optionSetting.titleFontFamily;
                            this.chartOption.title[0].textStyle.fontSize = this.optionSetting.titleFontSize;
                            this.chartOption.title[0].textStyle.fontWeight = this.optionSetting.titleFontWeight;
                            this.chartOption.title[0].textStyle.fontStyle = this.optionSetting.titleFontStyle;
                            this.chartOption.title[0].textStyle.color = this.optionSetting.titleFontColor;
                            this.chartOption.title[0].subtext = this.optionSetting.subtitleContent;
                            this.chartOption.title[0].subtextStyle.fontFamily = this.optionSetting.subtitleFontFamily;
                            this.chartOption.title[0].subtextStyle.fontSize = this.optionSetting.subtitleFontSize;
                            this.chartOption.title[0].subtextStyle.fontWeight = this.optionSetting.subtitleFontWeight;
                            this.chartOption.title[0].subtextStyle.fontStyle = this.optionSetting.subtitleFontStyle;
                            this.chartOption.title[0].subtextStyle.color = this.optionSetting.subtitleFontColor;
                            this.chartOption.tooltip[0].show = 'false' == this.optionSetting.tooltipShow ? false : true;
                            this.chartOption.tooltip[0].borderColor = this.optionSetting.tooltipBorderColor;
                            this.chartOption.tooltip[0].borderWidth = this.optionSetting.tooltipBorderWidth;
                            this.chartOption.tooltip[0].backgroundColor = this.optionSetting.tooltipBackgroundColor;
                            this.chartOption.tooltip[0].textStyle.fontFamily = this.optionSetting.tooltipFontFamily;
                            this.chartOption.tooltip[0].textStyle.fontSize = this.optionSetting.tooltipFontSize;
                            this.chartOption.tooltip[0].textStyle.fontWeight = this.optionSetting.tooltipFontWeight;
                            this.chartOption.tooltip[0].textStyle.color = this.optionSetting.tooltipFontColor;
                            if(JSON.stringify(this.chartOption.backgroundColor).split(",").length == 4){
                                this.chartOption.backgroundColor = this.chartOption.backgroundColor.split(",")[0]+","+this.chartOption.backgroundColor.split(",")[1]+","+this.chartOption.backgroundColor.split(",")[2]+","+this.optionSetting.backgroundOpacity*0.01+")";
                            }
                            // this.chartOption.xAxis[0].axisLabel.rotate = this.optionSetting.xRotate;
                            // this.chartOption.yAxis[0].name = this.optionSetting.yAxisContent;
                            if(this.myChart != ''){
                                this.myChart.setOption(this.option,true);
                            }
                        },
                        deep: true
                    }
                }
            });
            //text配置双向绑定组件
            vue.component('text-option-component',{
                template: formatData.tableAndConfigOfText(),
                props: ['textOption'],
                data: function(){
                    return {
                        option: '',
                        optionSetting: {
                            text: '',
                            textColor: '',
                            fontSize: '',
                            color: '',
                            strokeColor: ''
                        }
                    }
                },
                watch: {
                    textOption: function(){
                        var self = this;
                        $("#textColor").spectrum({
                            showInput: true,
                            allowEmpty:true,
                            color: self.textOption.textColor,
                            change: function(color) {
                                self.optionSetting.textColor = color.toHexString();
                            }
                        });
 
                        $("#tagColor").spectrum({
                            showInput: true,
                            allowEmpty:true,
                            color: self.textOption.color,
                            showAlpha: true,
                            change: function(color) {
                                var c = color.toRgb();
                                self.optionSetting.color = "rgba(" + c.r + ", " + c.g + ", " + c.b + ", " + c.a + ")";
                            }
                        });
 
 
                        $("#tagStrokeColor").spectrum({
                            showInput: true,
                            allowEmpty:true,
                            color: self.textOption.strokeColor,
                            showAlpha: true,
                            change: function(color) {
                                var c = color.toRgb();
                                self.optionSetting.strokeColor = "rgba(" + c.r + ", " + c.g + ", " + c.b + ", " + c.a + ")";
                            }
                        });
                        self.optionSetting.text = self.textOption.text;
                        self.optionSetting.textColor = self.textOption.textColor;
                        self.optionSetting.fontSize = self.textOption.textFont.split(" ")[1].replace("px","");
                        self.optionSetting.color = self.textOption.color;
                        self.optionSetting.strokeColor = self.textOption.strokeColor;
                        self.option = self.textOption;
                        $("#textOptionModal").unbind("shown.bs.modal");
                        $("#textOptionModal").on("shown.bs.modal", function (e) {
                            CanvasTag().render("textOptionContainer",self.option);
                        });
 
                    },
                    optionSetting: {
                        handler: function(){
                            this.option.text = this.optionSetting.text;
                            this.option.textColor = this.optionSetting.textColor;
                            this.option.textFont = this.textOption.textFont.split(" ")[0] + " " +this.optionSetting.fontSize + "px " + this.textOption.textFont.split(" ")[2];
                            this.option.color = this.optionSetting.color;
                            this.option.strokeColor = this.optionSetting.strokeColor;
                            CanvasTag().render("textOptionContainer",this.option);
                        },
                        deep: true
                    }
                }
            });
            //image配置双向绑定组件
            vue.component('img-option-component',{
                template: formatData.tableAndConfigOfSubGroup(),
                props: ['subGroupOption'],
                data: function(){
                    return {
                        option: '',
                        optionSetting: {
                            subGroupText: '',
                            subGroupTextColor: '',
                            subGroupFontSize: ''
                        }
                    }
                },
                watch: {
                    subGroupOption: function(){
                        var self = this;
                        $("#subGroupTextColor").spectrum({
                            showInput: true,
                            allowEmpty:true,
                            color: self.subGroupOption.textColor,
                            change: function(color){
                                self.optionSetting.subGroupTextColor = color.toHexString();
                            }
                        });
                        self.optionSetting.subGroupText = self.subGroupOption.text;
                        self.optionSetting.subGroupTextColor = self.subGroupOption.textColor;
                        self.optionSetting.subGroupFontSize = self.subGroupOption.textFont.split(" ")[1].replace("px","");
                        self.option = self.subGroupOption;
                        $("#textOptionModal").unbind("shown.bs.modal");
                        $("#textOptionModal").on("shown.bs.modal", function (e)  {
                            CanvasTagOfImage().render("textOptionContainer",'',self.option,false);
                        });
                    },
                    optionSetting: {
                        handler: function(){
                            this.option.text = this.optionSetting.subGroupText;
                            this.option.textColor = this.optionSetting.subGroupTextColor;
                            this.option.textFont = this.subGroupOption.textFont.split(" ")[0] + " " +this.optionSetting.subGroupFontSize+ "px " + this.subGroupOption.textFont.split(" ")[2];
                            CanvasTagOfImage().render("textOptionContainer",'',this.option,false);
                        },
                        deep: true
                    }
                }
            });
 
            var app = new vue({
                el: '#app',
                data: {
                    backgroundClass: 'background-default',
                    isExpanded: false,
                    isLoader: false,
                    isSaveLoader: 'none',
                    currentActiveIndex: -1,
                    currentSelectedIndex: -1,
                    dangerIndex: -1,
                    helpTip: '请上传组件图片.',
                    isImgLoad: 'none',
                    isChartsLoad: 'none',
                    hideImg: '',
                    isShowImgSetting: false,
                    order: 0,
                    //自定义组件option属性
                    myWidgetOption: '',
                    subGroupText: '',
                    subGroupTextColor: '',
                    subGroupFontSize: '',
                    subGroupImageWidth: '',
                    subGroupImageHeight: '',
                    subGroupFontLocation: '',
                    //“我的图表”和“我的组件”所需动态渲染的数据
                    myCharts: [],
                    mySubGroup: [],
                    //可拖拽模块的配置
                    widgets: [],
                    //选中渲染是否失败
                    // isRenderFail: false,
                    //当前页是否保存
                    isSave:true,
                    //组件参数
                    chartOption: '',
                    textOption: '',
                    subGroupOption: '',
                    //当前渲染组件
                    currentView: '',
                    //是否全屏
                    isAllScreen: false,
                    //自定义组件图片base64编码
                    subGroupBase64: '',
                    //获取从哪一个图表或者组件菜单进入细节设置模态框
                    domId: 0,
                    chartType: '',
                    //是否切换了主题
                    currentTheme: '',
                    renderFailList: [],
                    //每一个图表container的overflow属性
                    scrollType: 'visible',
                    tableCurrentPage: {},
                    currentPage: 1,
                    allSubGroupPage: 0
                },
                methods: {
                    //背景样式切换
                    saveCurrentBackground: function(event){
                        var target = $(event.target);
                        var targetClass = event.target.className.replace("img-thumbnail", "").trim();
                        $.each(target.parent().siblings().find('span'),function (index,obj) {
                            var sibClass = $(obj).attr("class").replace("img-thumbnail", "").trim() || "";
                            if(app.backgroundClass == sibClass){
                                app.backgroundClass = '';
                            }
                        });
                        app.backgroundClass = targetClass;
                        var deferred = $.ajax({
                            type: 'POST',
                            dataType: 'json',
                            url: 'myPanel/crud',
                            data : {
                                exportId : $("#exportId").val(),
                                backgroundClass : targetClass
                            },
                            headers :{
                                oper : 'update'
                            },
                            success: function(){
                                app.isSave = false;
                            }
                        });
                    },
                    //侧边菜单栏显示/隐藏
                    toggleSideMenu: function(){
                        if(app.isExpanded == false){
                            app.isExpanded = true
                        }else {
                            app.isExpanded = false
                        }
                    },
                    //标记当前菜单所选项
                    toggleSecondMenu: function(index){
                        this.currentActiveIndex = index;
                        $(".side-menu .nav .dropdown .collapse").collapse('hide');
                    },
                    //顶部菜单划过动画
                    topMenuMouseEnter: function(index){
                        app.dangerIndex = index;
                    },
                    //自定义控件
                    makeSelfWidget: function(){
                        if($("[name='imgFile']").val() == ""){
                            app.helpTip = '请先选择您要上传的控件背景图';
                        }else {
                            app.isImgLoad = 'block';
                            $.ajax({
                                type: 'POST',
                                url: 'imgToBase64',
                                data: new FormData($("#imgFile")[0]),
                                async: false,
                                cache: false,
                                contentType: false,
                                processData: false,
                                success: function(data){
                                    if(data.imgBase64 == "noFile"){
                                        app.helpTip = "请先选择您要上传的控件背景图";
                                        app.isImgLoad = 'none';
                                    }else if(data.imgBase64 == "noImage"){
                                        app.helpTip = "请上传图片类型文件";
                                        app.isImgLoad = 'none';
                                    }else{
                                        app.hideImg = ['<img src=\'data:image/jpg;base64,'+data.imgBase64+'\' onerror="this.src=\'resources/img/white.jpg\'">'].join("");
                                        setTimeout(function(){
                                            if($("#subGroupContainer").parent().find("img")[0]){
                                                app.isImgLoad = 'none';
                                                var canvasTagOfImage = CanvasTagOfImage().render("subGroupContainer",$("#subGroupContainer").parent().find("img")[0]);
                                                app.isShowImgSetting = true;
                                                app.myWidgetOption = canvasTagOfImage.getOption();
                                                app.subGroupBase64 = data.imgBase64;
                                                //初始化
                                                app.subGroupText = app.myWidgetOption.text;
                                                app.subGroupTextColor = app.myWidgetOption.textColor;
                                                app.subGroupFontSize = app.myWidgetOption.textFont.split(" ")[1].replace('px','');
                                                app.subGroupFontLocation = app.myWidgetOption.textPosition;
                                            }
                                        }, 0);
                                    }
                                },
                                error: function(){
                                    alert("上传失败,请重试!");
                                }
                            });
                        }
                    },
                    //获取所有图表和控件
                    getAllCharts: function(tag){
                        app.allSubGroupPage++;
                        //先置空以防止vue就地复用
                        if(tag == 'init'){
                            app.myCharts = [];
                            app.mySubGroup = [];
                            app.allSubGroupPage = 1;
                        }
                        this.currentSelectedIndex = -1;
                        this.isChartsLoad = 'block';
                        $.ajax({
                            type: 'POST',
                            url: 'selectChartInfo',
                            data: {
                                page: app.allSubGroupPage,
                                pageSize: 10
                            },
                            success: function(response){
                                app.isChartsLoad = 'none';
                                // var myCharts = [];
                                // var mySubGroup = [];
                                for(var i=0;i<response.data.length;i++){
                                    var dataType;
                                    if(parseInt(response.data[i].isRealTime) == 0){
                                        dataType = "引用当前数据库";
                                    }else if(parseInt(response.data[i].isRealTime) == 1){
                                        dataType = "实时获取";
                                    }
                                    if(response.data[i].chartType == 'text:subGroupOfImage'){
                                        app.mySubGroup.push({ chartId: response.data[i].id, base64: "data:image/jpg;base64,"+JSON.parse(response.data[i].jsCode).image});
                                    }else if($.inArray(response.data[i].chartType,['bar','line','pie','table']) != -1){
                                        app.myCharts.push({ chartId: response.data[i].id,chartType: response.data[i].chartType, chartName: response.data[i].chartName, dataType: dataType, imgSrc: "resources/img/"+response.data[i].chartType+"_chart.png" });
                                    }
                                }
                                // app.myCharts = myCharts;
                                // app.mySubGroup = mySubGroup;
                                /**
                                 * 注册图表删除事件
                                 */
                                setTimeout(function(){
                                    $('.deleteOneChart').click(function (event) {
                                        event.stopPropagation();//屏蔽父元素select样式选择
                                    });
                                    $('.deleteOneChart').confirmModal({
                                        confirmTitle     : '提示',
                                        confirmMessage   : '你确定删除该图表?',
                                        confirmOk        : '是的',
                                        confirmCancel    : '取消',
                                        confirmDirection : 'rtl',
                                        confirmStyle     : 'primary',
                                        confirmCallback  : function (target) {
                                            var cid = target.parent().attr('data-cid');
                                            $.ajax({
                                                type: 'POST',
                                                url: 'authority/checkUserAuthority',
                                                data: {
                                                    chartId: cid
                                                },
                                                success: function(data){
                                                    if(data.haveAuthority == true){
                                                        var deferred = $.ajax({
                                                            type: 'POST',
                                                            dataType: 'json',
                                                            url: 'myChart/deleteOneChart',
                                                            data : {
                                                                "chartId": cid
                                                            },
                                                            headers :{
                                                                oper : 'delete'
                                                            }
                                                        });
                                                        deferred.done(function(data){
                                                            if(data.isDelete == true){
                                                                target.parent().remove();//当前面板的图表类型选择框删除
                                                                $.each($('.draggable'),function (index,target) {//删除panel中该图表的div元素
                                                                    if(cid == $(target).attr("chartid")){
                                                                        $(target).remove();
                                                                    }
                                                                });
                                                            }else{
                                                                alert("部分设计面板中使用了本图表,暂不可删除!");
                                                            }
                                                        })
                                                    }else if(data.haveAuthority == false){
                                                        alert("您没有权限!");
                                                    }
                                                }
                                            });
                                        },
                                        confirmDismiss   : true,
                                        confirmAutoOpen  : false
                                    });
                                },0);
                            }
                        });
                    },
                    //图表和控件是否选中
                    select: function(index){
                        if(index == this.currentSelectedIndex){
                            this.currentSelectedIndex = -1;
                        }else {
                            this.currentSelectedIndex = index;
                        }
                    },
                    //图表,组件选中渲染
                    renderSelected: function(type){
                        if( this.currentSelectedIndex != -1 ){
                            var defer = $.ajax({
                                type: 'POST',
                                url: 'selectOneChartInfo',
                                data: "id=" + this.currentSelectedIndex
                            });
                            defer.done(function(data){
                                app.isSave = false;
                                var $targetDiv;
                                if(data.chartType.indexOf("subGroupOfImage") >= 0){
                                    var imgBase64 = JSON.parse(data.jsCode).image;
                                    var option = JSON.parse(data.jsCode);
                                    app.order = app.order + 1;
                                    app.widgets.push({ chartType: 'text:subGroupOfImage',id: app.order,chartId: data.id,width: option.width + 'px',height: option.height + 'px', hideImg: 'data:image/jpg;base64,'+imgBase64, chartName: '' });
                                    setTimeout(function(){
                                        $targetDiv = $("#"+app.order);
                                        option.image = $targetDiv.parent().find("img")[0];
                                        CanvasTagOfImage().render(app.order,"",option,false);
                                        renderMenu.renderMenu($targetDiv,'',app);
                                    }, 0);
                                }else {
                                    app.order = app.order + 1;
                                    var chartTag;
                                    if(data.chartType == 'table'){
                                        chartTag = 'table';
                                    }else {
                                        chartTag = 'chart';
                                    }
                                    app.widgets.push({ chartType: chartTag,id: app.order,chartId: data.id,width: '400px',height: '400px', chartName: data.chartName });
                                    setTimeout(function(){
                                        if(parseInt(data.isRealTime) == 0){
                                            $targetDiv = $("#"+app.order);
                                            if(data.chartType == 'table'){
                                                app.scrollType = 'auto';
                                                // $targetDiv.html(data.jsCode);
                                                app.tableCurrentPage[data.id] = 1;
                                                renderMenu.renderTableInPanel($targetDiv,data,app);
                                            }else {
                                                echarts.init($targetDiv[0]).setOption(JSON.parse(data.jsCode));
                                                app.$nextTick(function(){
                                                    renderMenu.renderMenu($targetDiv, data.chartName, app);
                                                });
                                            }
                                        }else if(parseInt(data.isRealTime) == 1){
                                            $.ajax({
                                                async: false,
                                                type: 'POST',
                                                contentType: "application/json; charset=utf-8",
                                                url: 'render',
                                                data: JSON.stringify({
                                                    'chartType': data.chartType,
                                                    'dataRecordId': data.sqlRecordingId,
                                                    'builderModel': JSON.parse(data.buildModel)
                                                }),
                                                success: function(option){
                                                    $targetDiv = $("#"+app.order);
                                                    var newOption = JSON.parse(data.jsCode);
                                                    newOption.series[0].data = option.series[0].data;
                                                    if('legend' in option){
                                                        newOption.legend.data = option.legend.data;
                                                    }
                                                    if('xAxis' in option){
                                                        newOption.xAxis[0].data = option.xAxis[0].data;
                                                    }
                                                    echarts.init($targetDiv.get(0)).setOption(newOption);
                                                    renderMenu.renderMenu($targetDiv, data.chartName, app);
                                                },
                                                error: function(){
                                                    app.renderFailList.push(app.order);
                                                }
                                            });
                                        }
                                        $(".draggable").niceScroll();
                                    }, 0);
                                }
                            });
                        }
                        if(type == 'mySubGroup'){
                            $("#mySubGroup").modal('toggle');
                        }else if( type == 'myChart' ){
                            $("#myChart").modal('toggle');
                        }
                    },
                    //全屏/取消全屏
                    allScreen: function(){
                        this.isAllScreen = this.isAllScreen == false ? true : false;
                    },
                    //保存并渲染自定义组件
                    renderMySubGroup: function(){
                        if($("#subGroupContainer").attr("zid")){
                            var pzr = zrender.getInstance($("#subGroupContainer").attr("zid"));//原控件
                            var option = $.extend(true, {}, pzr.storage.getShapeList()[0].style);
                            //保存时只能保存图片的base64编码
                            option.image = app.subGroupBase64;
                            var deffer = $.ajax({
                                type: 'POST',
                                url: 'addCharts',
                                data : {
                                    'chartType': "text:subGroupOfImage",
                                    'sqlRecordingId': "0",
                                    'buildModel': JSON.stringify({}),
                                    'jsCode': JSON.stringify(option),
                                    'chartName': "自定义组件"
                                }
                            });
                            deffer.done(function(result){
                                app.order++;
                                app.widgets.push({ id: app.order, chartId: result, chartType: 'text:subGroupOfImage', width: option.width + 'px', height: option.height + 'px', hideImg: 'data:image/jpg;base64,'+app.subGroupBase64 });
                                app.isSave = false;
                                setTimeout(function(){
                                    var $target  = $("#"+app.order);
                                    option.image = $target.parent().find("img")[0];
                                    //渲染时
                                    CanvasTagOfImage().render(app.order,"",option,false);
                                    renderMenu.renderMenu($target,'',app);
                                    //重置模态框
                                    app.isShowImgSetting = false;
                                    $(".fileinput-remove").trigger("click");
                                    $('#subGroupContainer').replaceWith('<div id="subGroupContainer" class="thumbnail" style="width:45%;height:410px;float:left;overflow: auto;border:1px dashed rgb(238,238,238);"></div>');
                                }, 0);
                            });
                        }
                        $("#subGroupModal").modal('toggle');
                    },
                    //主题切换递归运算
                    overloadItemStyle: function(optItem, theme) {
                        for(k in theme) {
                            if(optItem[k] && (typeof theme[k] !== 'object')){
                                delete optItem[k];
                            } else if(typeof theme[k] == 'object') {
                                this.overloadItemStyle(optItem, theme[k]);
                            }
                        }
                    },
                    //修改图表,组件细节后保存
                    saveOptionChange: function(){
                        var domOption;
                        if(this.chartType.indexOf('text') >= 0){
                            //id为domId div的zid
                            var domZid = $("#"+this.domId).attr("zid");
                            var domPzr = zrender.getInstance(domZid);//原控件
                            domOption = $.extend(true, {}, domPzr.storage.getShapeList()[0].style);
                            //id为textOptionContainer div的zid
                            var zid = $("#textOptionContainer").attr("zid");
                            var pzr = zrender.getInstance(zid);//原控件
                            var option = $.extend(true, {}, pzr.storage.getShapeList()[0].style);
                            if(this.chartType.indexOf("subGroupOfImage") < 0){
                                domOption.text =  option.text;
                                domOption.textColor = option.textColor;
                                domOption.textFont = option.textFont;
                                domOption.color = option.color;
                                domOption.strokeColor = option.strokeColor;
                                //文字组件不存在复用,不保存到T_MY_CHARTS表中
                                var index= this.order - 1;
                                this.widgets[index].option = domOption;
                                // domPzr.storage.getShapeList()[0].style = domOption;
                                CanvasTag().render(this.domId,domOption);
                                renderMenu.renderMenu($("#" + this.domId),'',app);
                                // domPzr.refresh();
                            }else {
                                domOption.text = option.text;
                                domOption.textColor = option.textColor;
                                domOption.textFont = option.textFont;
                                //不能直接把option给domPzr实例,有些属性不能同步,例如画布宽高
                                // domPzr.storage.getShapeList()[0].style = domOption;
                                CanvasTagOfImage().render(this.domId,'',domOption,false);
                                renderMenu.renderMenu($("#"+this.domId),'',app);
                                // domPzr.refresh();
                                // domOption.image = option.image.currentSrc.split(',')[1];
                            }
                        }else if(this.chartType.indexOf('chart') >= 0){
                            var instance = echarts.getInstanceByDom(document.getElementById("optionContainer"));
                            echarts.getInstanceByDom(document.getElementById(this.domId)).setOption(instance.getOption());
                            domOption = instance.getOption();
                        }
                        if(this.chartType.indexOf('subGroupOfImage') >= 0 || this.chartType.indexOf('chart') >= 0){
                            $.ajax({
                                type: 'POST',
                                url: 'updateChartInfo',
                                headers: {
                                    imgBase64: domOption.image.currentSrc.split(',')[1]
                                },
                                data: {
                                    'id': $("#"+this.domId).attr("chartId"),
                                    'jsCode': JSON.stringify(domOption)
                                },
                                success: function(){
                                    app.isSave = false;
                                },
                                error: function(){
                                    alert("保存时失败,请重试!");
                                }
                            });
                        }
                    },
                    //保存当前面板图表
                    saveCurrentPanel: function(){
                        this.isLoader = true;
                        this.isSaveLoader = 'block';
 
                        var arr = window.location.href.split("/");
                        var exportId = $("#exportId").val();
                        var shareHref = arr[0]+"//"+arr[2]+"/"+arr[3]+"/share.page?exportId="+exportId;
 
                        var widgets = this.widgets;
                        var chartIds = [];          //保存图表id
                        var containerIds = [];           //保存容器id
                        for(var i=0;i<widgets.length;i++) {
                            var chartId = widgets[i].chartId;
                            var containerId = widgets[i].id;
                            if(widgets[i].chartType.indexOf('rectangle') < 0){
                                chartIds.push(chartId);
                                containerIds.push(containerId);
                            }
 
                            var target = $('#'+containerId);
                            if(widgets[i].width == 0 && widgets[i].height == 0){     //如果已删除,height和width为0
                                this.widgets[i].datax = 0;
                                this.widgets[i].datay = 0
                            }else {
                                if(target.css('transform').toString() == 'none'){     //如果未拖动,css属性transform属性为none
                                    this.widgets[i].datax = 0;
                                    this.widgets[i].datay = 0;
                                }else {
                                    this.widgets[i].datax = typeof($(target).attr('data-x')) == 'undefined' ? target.css('transform').toString().split(',')[4] : $(target).attr('data-x');
                                    this.widgets[i].datay = typeof($(target).attr('data-y')) == 'undefined' ? target.css('transform').toString().split(',')[5].replace(')','') : $(target).attr('data-y');
                                }
                                this.widgets[i].width = target.css('width');
                                this.widgets[i].height = target.css('height');
                            }
                            if(this.currentTheme != '' && widgets[i].chartType.indexOf('text') < 0 && widgets[i].chartType.indexOf('table') < 0){
                                this.widgets[i].themeName = this.currentTheme;
                            }
                        }
 
                        $.ajax({
                            type: 'POST',
                            url: "panelChartsWrapper/updateWrapper",
                            data: "chartIds="+chartIds+"&containerIds="+containerIds+"&exportId="+exportId
                        });
 
                        $.ajax({
                            type: 'POST',
                            url: "export",
                            data: {
                                "htmlCode": JSON.stringify(this.widgets),
                                "exportId": exportId,
                                "extraMsg": shareHref
                            },
                            success : function(){
                                app.isSave = true;                           //点击导出后表明已保存
                                app.isLoader = false;
                                app.isSaveLoader = 'none';
                                // location.reload();
                            },
                            error : function(){
                                app.isLoader = false;
                                app.isSaveLoader = 'none';
                                alert("保存失败,请重试!");
                            }
                        });
                    },
                    //改变图表主题
                    changeTheme: function(themeName){
                        this.isSave = false;
                        this.currentTheme = themeName;
                        var widgets = this.widgets;
                        for(var i=0;i<widgets.length;i++) {
                            var target = $("#" + widgets[i].id);
                            var chartName = $(target).find('#chartTitle').text();
                            if (widgets[i].chartType.indexOf("text") < 0 && widgets[i].chartType.indexOf('table') < 0) {
                                var chartOption = echarts.getInstanceByDom($(target)[0]).getOption();
                                echarts.dispose($(target)[0]);
                                echarts.registerTheme(themeName, theme[themeName]);
                                var exportChart = echarts.init($(target)[0], themeName);
                                app.overloadItemStyle(chartOption, theme[themeName]);       // 主题与图表option合并
                                if(chartOption.series[0].type == 'line' || chartOption.series[0].type == 'bar'){
                                    chartOption.xAxis[0].axisLine.lineStyle.color = '#999999';
                                    chartOption.yAxis[0].axisLine.lineStyle.color = '#999999';
                                    chartOption.xAxis[0].axisTick.lineStyle.color = '#999999';
                                    chartOption.yAxis[0].axisTick.lineStyle.color = '#999999';
                                    chartOption.xAxis[0].axisLabel.textStyle.color = '#999999';
                                    chartOption.yAxis[0].axisLabel.textStyle.color = '#999999';
                                }
                                exportChart.setOption(chartOption);
                                renderMenu.renderMenu($(target), chartName, app);
                            }
                        }
                    }
                },
                mounted: function () {
                    //初始化设计面板背景
                    var deferred = $.ajax({
                        type: 'POST',
                        dataType: 'json',
                        url: 'myPanel/crud',
                        data : {
                            exportId : $("#exportId").val()
                        },
                        headers :{
                            oper : 'query'
                        }
                    });
                    deferred.done(function(data){
                        if(data.myPanel.backgroundClass){
                            app.backgroundClass = data.myPanel.backgroundClass;
                        }
                    });
                    //fileInput初始化
                    $("#input-id").fileinput({
                        language: 'zh',
                        showUpload: false,
                        allowedFileExtensions : ['jpg', 'png','gif']
                    });
                    //颜色选择器初始化(自定义组件)
                    $("#subGroupTextColorMounted").spectrum({
                        showInput: true,
                        allowEmpty:true,
                        color: 'black',
                        change: function(color){
                            app.subGroupTextColor = color.toHexString();
                        }
                    });
                    //初始化拖拽
                    interact('.draggable')
                        .draggable({
                            inertia: true,
                            restrict: {
                                restriction: "#app",
                                endOnly: true,
                                elementRect: { top: 0, left: 0, bottom: 1, right: 1 }
                            },
                            onmove: function(event){
                                app.isSave = false;
                                var target = event.target,
                                    // keep the dragged position in the data-x/data-y attributes
                                    x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx,
                                    y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy;
 
                                // translate the element
                                target.style.webkitTransform =
                                    target.style.transform =
                                        'translate(' + x + 'px, ' + y + 'px)';
 
                                // update the posiion attributes
                                target.setAttribute('data-x', x);
                                target.setAttribute('data-y', y);
                            }
                        })
                        .resizable({
                            preserveAspectRatio: false,
                            edges: { left: true, right: true, bottom: true, top: true }
                        })
                        .on('resizemove', function (event) {
                            var target = event.target,
                                x = (parseFloat(target.getAttribute('data-x')) || 0),
                                y = (parseFloat(target.getAttribute('data-y')) || 0);
 
                            // update the element's style
                            target.style.width  = event.rect.width + 'px';
                            target.style.height = event.rect.height + 'px';
 
                            // translate when resizing from top or left edges
                            x += event.deltaRect.left;
                            y += event.deltaRect.top;
 
                            target.style.webkitTransform = target.style.transform =
                                'translate(' + x + 'px,' + y + 'px)';
 
                            target.setAttribute('data-x', x);
                            target.setAttribute('data-y', y);
 
                            //自适应容器变化
                            app.isSave = false;
                            var chartType = target.getAttribute('charttype');
                            var id = target.getAttribute('id');
                            var zid = target.getAttribute('zid');
                            if(chartType.indexOf("text") >= 0){
                                var zrInstance = zrender.getInstance(zid);
                                var width = parseInt($(target).css('width').replace('px',''));
                                var height = parseInt($(target).css('height').replace('px',''));
                                if(chartType.indexOf("subGroup") >= 0){
                                    zrInstance.storage.getShapeList()[0].style.height = height;
                                    zrInstance.storage.getShapeList()[0].style.width = width;
                                }else {
                                    zrInstance.storage.getShapeList()[0].style.height = height - (height / 4);
                                    zrInstance.storage.getShapeList()[0].style.width = width - (width / 4);
                                }
                                zrInstance.resize();
                            }else if( chartType == 'chart' ){
                                echarts.getInstanceByDom(document.getElementById(id)).resize();
                            }else if( chartType == 'table' ){
                                width = parseInt($(target).css('width').replace('px',''));
                                height = parseInt($(target).css('height').replace('px',''))*0.77;
                                $(target).find('table').css('width', width);
                                $(target).find('table').css('height', height);
                            }
                        });
                    //文字组件初始化
                    $('.background-text-pick-block').draggable({
                        cursor: "move",
                        opacity: 0.7,
                        appendTo :'#app',
                        helper: function (event) {
                            var target = $(this).clone();
                            target.zIndex( 100000000 );
                            target.css('position','absolute');
                            return target;
                        }
                    });
                    $(".app-container").droppable({
                        drop : function (event,ui) {
                            //屏蔽重复拖拽
                            if(ui.draggable.hasClass("background-text-pick-block")) {
                                app.order ++;
                                app.widgets.push({ chartType: 'text:rectangle',id: app.order,width: '400px',height: '100px',datax: (ui.position.left),datay:(ui.position.top) });
                                setTimeout(function(){
                                    CanvasTag().render(app.order);
                                    renderMenu.renderMenu($("#" + app.order),'',app);
                                    $("#"+app.order).css('background-color', 'unset');
                                }, 0);
                            }
                        }
                    });
                    //domId,chartType初始化
                    $("#optionModal").on("show.bs.modal",function(e){
                        app.domId = e.relatedTarget.parentNode.parentNode.parentNode.getAttribute('id');
                        app.chartType = e.relatedTarget.parentNode.parentNode.parentNode.getAttribute('charttype');
                    });
                    $("#textOptionModal").on("show.bs.modal",function(e){
                        app.domId = e.relatedTarget.parentNode.parentNode.parentNode.getAttribute('id');
                        app.chartType = e.relatedTarget.parentNode.parentNode.parentNode.getAttribute('charttype');
                    });
                    //显示面板
                    var chartIds = [];
                    var containerIds = [];
                    // var textIds = [];
                    var initCharts = $.ajax({
                        type: 'POST',
                        dataType: 'json',
                        url: 'myPanel/crud',
                        data : {
                            exportId : $("#exportId").val()
                        },
                        headers :{
                            oper : 'query'
                        }
                    });
                    initCharts.done(function(data){
                        if(data.myPanel.htmlCode){
                            app.widgets = JSON.parse(data.myPanel.htmlCode);
                            app.$nextTick(function(){
                                app.order = app.widgets.length;
                                for(item in app.widgets){
                                    if(app.widgets[item].chartId){
                                        chartIds.push(app.widgets[item].chartId);
                                        containerIds.push(app.widgets[item].id);
                                    }else {
                                        // textIds.push(app.widgets[item].id);
                                        CanvasTag().render(app.widgets[item].id,app.widgets[item].option);
                                        renderMenu.renderMenu($('#'+app.widgets[item].id),'',app);
                                        $('#'+app.widgets[item].id).css('background-color', 'unset');
                                    }
                                }
                                //查询所有chart的option
                                var defer = $.ajax({
                                    type: 'POST',
                                    url: 'getShareOptions',
                                    data: 'cids='+chartIds
                                });
                                defer.done(function(data) {
                                    var themeName;
                                    var chartNames = [];
                                    for (var i = 0; i < chartIds.length; i++) {
                                        if(app.widgets[i].themeName){
                                            themeName = app.widgets[i].themeName;
                                        }
                                        var target = $('#'+containerIds[i]);
                                        if (data[i].chartType.indexOf("text") < 0) {
                                            var exportChart = echarts.init($(target)[0]);
                                            if (parseInt(data[i].isRealTime) == 0) {
                                                if(data[i].chartType == 'table'){
                                                    app.scrollType = 'auto';
                                                    // $("#"+containerIds[i]).html(data[i].jsCode);
                                                    app.tableCurrentPage[data[i].id] = 1;
                                                    renderMenu.renderTableInPanel(target,data[i],app);
 
                                                    var menuInfo = [];
                                                    menuInfo.push(target);
                                                    menuInfo.push(data[i].chartName);
                                                    chartNames.push(menuInfo);
                                                }else {
                                                    exportChart.setOption(JSON.parse(data[i].jsCode));
                                                    renderMenu.renderMenu($(target), data[i].chartName, app);
                                                }
                                            } else if (parseInt(data[i].isRealTime) == 1) {
                                                $.ajax({
                                                    async: false,
                                                    type: 'POST',
                                                    contentType: "application/json; charset=utf-8",
                                                    url: 'render',
                                                    data: JSON.stringify({
                                                        'chartType': data[i].chartType,
                                                        'dataRecordId': data[i].sqlRecordingId,
                                                        'builderModel': JSON.parse(data[i].buildModel)
                                                    }),
                                                    success: function (option) {
                                                        var newOption = JSON.parse(data[i].jsCode);        // 若本图表选择数据获取模式为实时获取,
                                                        newOption.series[0].data = option.series[0].data;  // 在渲染时将数据库中的option中的series部分替换为新生成的option的series部分即可
                                                        if ('legend' in option) {
                                                            newOption.legend.data = option.legend.data;
                                                        }
                                                        if ('xAxis' in option) {
                                                            newOption.xAxis[0].data = option.xAxis[0].data;
                                                        }
                                                        exportChart.setOption(newOption);
                                                        renderMenu.renderMenu($(target), data[i].chartName, app);
                                                    },
                                                    error: function () {
                                                        app.renderFailList.push(app.order);
                                                    }
                                                });
                                            }
                                        } else {
                                            if (data[i].chartType.indexOf("subGroupOfImage") >= 0) {
                                                var option = JSON.parse(data[i].jsCode);
                                                option.image = $(target).find("img")[0];
                                                option.width = app.widgets[i].width.replace('px','');
                                                option.height = app.widgets[i].height.replace('px','');
                                                CanvasTagOfImage().render(containerIds[i],"",option,false);
                                                renderMenu.renderMenu($(target),'',app);
                                            }
                                        }
                                    }
                                    app.$nextTick(function(){
                                        //table的menu渲染
                                        // for(var i=0;i<chartNames.length;i++){
                                        //     renderMenu.renderMenu(chartNames[i][0], chartNames[i][1], app);
                                        // }
                                        $(".draggable").niceScroll();
                                    });
                                    //theme
                                    app.changeTheme(themeName);
                                    app.isSave = true;
                                })
                            });
                        }
                        //保存返回图表渲染
                        if(window.location.href.indexOf("chartId") > 0){
                            var chartId = window.location.href.split("=")[2].replace("#","");
                            var defer01 = $.ajax({
                                type: 'POST',
                                url: 'selectOneChartInfo',
                                data: "id="+chartId
                            });
                            defer01.done(function(data){
                                if(data && $('[chartId='+data.id+']').length <= 0) {
                                    app.isSave = false;
                                    app.order = app.order + 1;
                                    var chartTag;
                                    if(data.chartType == 'table'){
                                        chartTag = 'table';
                                    }else {
                                        chartTag = 'chart';
                                    }
                                    app.widgets.push({ chartType: chartTag,id: app.order,chartId: data.id,width: '400px',height: '400px', chartName: data.chartName });
                                    app.$nextTick(function(){
                                        if(parseInt(data.isRealTime) == 0){
                                            if(data.chartType == 'table'){
                                                app.scrollType = 'auto';
                                                // $("#"+app.order).html(data.jsCode);
                                                app.tableCurrentPage[data.id] = 1;
                                                renderMenu.renderTableInPanel($("#"+app.order),data,app);
                                            }else {
                                                echarts.init($("#"+app.order)[0]).setOption(JSON.parse(data.jsCode));
                                                setTimeout(function(){
                                                    renderMenu.renderMenu($("#"+app.order),data.chartName,app);
                                                }, 0);
                                            }
                                        }else if(parseInt(data.isRealTime) == 1){
                                            $.ajax({
                                                type: 'POST',
                                                contentType: "application/json; charset=utf-8",
                                                url: 'render',
                                                data: JSON.stringify({
                                                    'chartType': data.chartType,
                                                    'dataRecordId': data.sqlRecordingId,
                                                    'builderModel': JSON.parse(data.buildModel)
                                                }),
                                                success: function(option){
                                                    echarts.init($("#"+app.order)[0]).setOption(option);
                                                    renderMenu.renderMenu($("#"+app.order),data.chartName,app);
                                                },
                                                error: function(){
                                                    app.renderFailList.push(app.order);
                                                }
                                            });
                                        }
                                        $(".draggable").niceScroll();
                                    })
                                }
                            });
                        }
                    });
                    //窗口关闭监听
                    //关闭窗口时弹出确认提示
                    $(window).bind('beforeunload', function(){
                        // 只有在标识变量is_confirm不为false时,才弹出确认提示
                        if(app.isSave == false)
                            return '您可能有数据没有保存';
                    });
                },
                watch: {
                    subGroupText: function(){
                        this.myWidgetOption.text = this.subGroupText;
                        CanvasTagOfImage().render("subGroupContainer","",this.myWidgetOption);
                    },
                    subGroupTextColor: function(){
                        this.myWidgetOption.textColor = this.subGroupTextColor;
                        CanvasTagOfImage().render("subGroupContainer","",this.myWidgetOption);
                    },
                    subGroupFontSize: function(){
                        this.myWidgetOption.textFont = this.myWidgetOption.textFont.split(" ")[0] + " " +this.subGroupFontSize+ "px " + this.myWidgetOption.textFont.split(" ")[2];
                        CanvasTagOfImage().render("subGroupContainer","",this.myWidgetOption);
                    },
                    subGroupFontLocation: function(){
                        this.myWidgetOption.textPosition = this.subGroupFontLocation;
                        CanvasTagOfImage().render("subGroupContainer","",this.myWidgetOption);
                    },
                    isSave: function(){
                        if(app.isSave == false){
                            $("title").html("*Infovis-Designer");
                        }else if(app.isSave == true) {
                            $("title").html("Infovis-Designer");
                        }
                    }
                }
            });
        });
    });