CustomSearchCharts.js
4.5 KB
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
$(function () {
//设置charts区域的高度
var chartsHight = $(window).height() - $("#top").height() - 30
$("#charts").height(chartsHight);
$("#chartsview").height(chartsHight);
//详细表单隐藏和显示,默认为隐藏
if ($("#dataFrom option:selected").val() == 1) {
$("#customSql").parent().parent().hide();
}
//开启帮助提示
$(".help").wTooltip({html: true});
//检查必填
if($("#title").length > 0 && $("#width").length > 0 && $("#name").length > 0 && $("#showorder").length > 0 ){
checkinput("title", "titleimage");
checkinput("width", "widthimage");
checkinput("name", "nameimage");
checkinput("showorder", "showorderimage");
}
window.onresize = function () {
setTimeout(function(){
var chartsHight = $(window).height() - $("#top").height() - 5;
$("#showCharts").height(chartsHight);
$("#chartsview").height(chartsHight);
},300);
};
});
/**
* 移除详细图表
* @param clos 当前div
* @param message 提示信息
* @param chartsId 图表的数据ID
*/
function removeChart(clos, message, chartsId) {
window.Dialog.confirm(message, function () {
$(clos).parent(".main").remove();
//删除详细图表后台数据
$.post('/formmode/search/CustomSeachCharts.jsp', {
'chartsId': chartsId,
'action': 'delChart'
}, function () {
});
})
}
/**
* 数据源切换change事件
*/
$("#dataFrom").change(function () {
if ($("#dataFrom option:selected").val() == 1) {
$("#customSql").parent().parent().hide();
$("#xAxis").parent().parent().show();
$("#yAxis").parent().parent().show();
$("#groupField").parent().parent().show();
$("#calculateType").parent().parent().show();
} else {
$("#xAxis").parent().parent().hide();
$("#yAxis").parent().parent().hide();
$("#groupField").parent().parent().hide();
$("#calculateType").parent().parent().hide();
$("#customSql").parent().parent().show();
}
});
/**
* 保存图表主信息
*/
function doSave() {
if (check_form(base, 'title') && check_form(base, 'width')) {
$.post('/formmode/search/CustomSeachCharts.jsp', {
'customid': $("#customid").val(),
'title': $("#title").val(),
'width': $("#width").val(),
'isExpand': $("#isExpand").val(),
'isEnable': $("#isEnable").val(),
'action': 'saveBase'
}, function () {
location.reload();
});
}
}
/**
* 保存图表详细信息
*/
function addChart() {
if (check_form(detail, 'name') && check_form(detail, 'showorder') && check_form(detail, 'chartsType') && check_form(detail, 'xAxis') && check_form(detail, 'yAxis') && check_form(detail, 'calculateType')) {
$.post('/formmode/search/CustomSeachCharts.jsp', {
'baseId': $("#baseId").val(),
'name': $("#name").val(),
'showorder': $("#showorder").val(),
'chartsType': $("#chartsType").val(),
'dataFrom': $("#dataFrom").val(),
'xAxis': $("#xAxis").val(),
'yAxis': $("#yAxis").val(),
'groupField': $("#groupField").val(),
'calculateType': $("#calculateType").val(),
'customSql': $("#customSql").val(),
'showAvgLine': "1",
'action': 'addChart'
}, function () {
location.reload();
});
}
}
/**
* 显示建模查询列表的统计区域
* @param customid
*/
function showCharts(customid) {
$("#showCharts").show();
}
/**
* 统计区域失去焦点就隐藏
* @param event
*/
$('body :not(#showCharts)').click(function () {
$("#showCharts").hide();
})
/**
* 收缩,展开
*/
function onflagshow(customid) {
$("#showCharts").show();
$("#flaghide").show();
$("#flagshow").hide();
$("#loading").show();
$("#loading").html("加载中...");
var listCondition = document.getElementById("tabcontentframe").contentWindow.document.getElementById("listCondition").value;
var params = encodeURI('customid='+customid+'&listCondition='+listCondition);
$("#chartsIframe").attr('src', '/formmode/search/ChartsView.jsp?'+params);
}
function onflaghide() {
$("#showCharts").hide();
$("#flagshow").show();
$("#flaghide").hide();
}
function showConfig(customid) {
window.open("CustomSeachCharts.jsp?customid="+customid);
}
function loading() {
$("#loading").hide();
};