Highcharts.theme = {
colors: ["#90bafe", "#93ebe5", "#fda4a1", "#5deab1", "#fdf2bf", "#fdcebf", "#8ff4ff", "#d4fce1", "#2b7bfd", "#3ddbd1", "#fa433d", "#1ac781", "#f9df5d", "#f9845d", "#29eaff", "#75f59e", "#5d9bfd", "#68e3db", "#fb736f", "#2fe49c", "#fbe98e", "#fba98e", "#5cefff", "#a5f8bf"]
};
var ONLYONESERIENAME = "serie1",
ROTATIONCATEGORIESLENGTH = 10,
commonOptions = {
colors: Highcharts.theme.colors,
chart: {},
title: {
text: ""
},
yAxis: {
title: {
text: ""
},
min: 0
},
tooltip: {
formatter: function() {
if (this.series.chart.series.length > 1) {
return "" + this.series.name + "
" + this.x + ": " + this.y
} else {
return this.x + ": " + this.y
}
}
},
plotOptions: {
column: {
borderWidth: 0,
dataLabels: {
enabled: true
}
},
bar: {
borderWidth: 0,
dataLabels: {
enabled: true
}
},
area: {
marker: {
enabled: false,
symbol: "circle",
radius: 2,
states: {
hover: {
enabled: true
}
}
}
}
}
},
dateformatters = {
formatHour: function(a) {
if (a.length === 1) {
return "0" + a + ":00"
} else {
return a + ":00"
}
},
formatDay: function(b) {
if (b.indexOf("__") > -1) {
var a = b.split("__");
return a[0] + "-" + a[1]
} else {
return b + "日"
}
},
formatWeek: function(a) {
var b = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"];
return b[parseInt(a) - 1]
},
formatMonth: function(a) {
return a + "月"
},
formatYear: function(a) {
return a + "年"
}
};
function fillNumber(c, e, d, a) {
var b = D[c].numberCount;
if (e === "avg") {
b = Math.round(D[c].numberCount * 100 / D[c].numberTimeCount) / 100
}
if (d === "normal") {
b = Highcharts.numberFormat(b, 2)
} else {
if (d === "rounded") {
b = Highcharts.numberFormat(b, 0)
} else {
if (d === "decimal") {
b = Highcharts.numberFormat(b, 2)
} else {
if (d === "scientific") {
b = new Number(b).toExponential(2)
} else {
if (d === "currency") {
b = currencys[a] + Highcharts.numberFormat(b, 2)
} else {
if (d === "currencyround") {
b = currencys[a] + Highcharts.numberFormat(b, 0)
}
}
}
}
}
}
$("#w" + c).find(".val").text(b)
}
function createPie(b, a, e) {
var d = {
chart: {
renderTo: "w" + b,
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: true
},
title: {
text: ""
},
tooltip: {
formatter: function() {
return "" + this.point.name + ":" + this.point.v
}
},
plotOptions: {
pie: {
borderWidth: 0,
allowPointSelect: true,
cursor: "pointer",
dataLabels: {
color: "#000000",
connectorColor: "#000000",
distance: 10,
width: "100px",
formatter: function() {
return "" + this.point.name + ":" + this.y + "%"
}
}
}
},
series: getPieSeries(b, e)
},
c = new Highcharts.Chart($.extend(true, d, a))
}
function createCol(d, b, f) {
if (!D[d] || !D[d].categories) {
return
}
var c = getCommonSeries(d, f),
g = !(c.length === 1 && c[0].name === ONLYONESERIENAME),
a = 0,
e = "center";
if (D[d].categories.length >= ROTATIONCATEGORIESLENGTH) {
a = -45;
e = "right"
}
opts = {
chart: {
renderTo: "w" + d,
defaultSeriesType: "column"
},
xAxis: {
categories: D[d].categories,
labels: {
rotation: a,
align: e
}
},
legend: {
enabled: g
},
series: c
},
chart = new Highcharts.Chart($.extend(true, {},
commonOptions, opts, b))
}
function createStackCol(d, b, f) {
if (!D[d].categories) {
return
}
var c = getCommonSeries(d, f),
g = !(c.length === 1 && c[0].name === ONLYONESERIENAME),
a = 0,
e = "center";
if (D[d].categories.length >= ROTATIONCATEGORIESLENGTH) {
a = -45;
e = "right"
}
opts = {
chart: {
renderTo: "w" + d,
defaultSeriesType: "column"
},
xAxis: {
categories: D[d].categories,
labels: {
rotation: a,
align: e
}
},
yAxis: {
stackLabels: {
enabled: true
}
},
legend: {
enabled: g
},
tooltip: {
formatter: function() {
return "" + this.x + "
" + this.series.name + ": " + this.y + "
Total: " + this.point.stackTotal
}
},
plotOptions: {
column: {
stacking: "normal",
dataLabels: {
enabled: true,
color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || "white"
}
}
},
series: c
},
chart = new Highcharts.Chart($.extend(true, {},
commonOptions, opts, b))
}
function createBar(c, a, f) {
if (!D[c].categories) {
return
}
var b = getCommonSeries(c, f),
g = !(b.length === 1 && b[0].name === ONLYONESERIENAME),
e = {
chart: {
renderTo: "w" + c,
defaultSeriesType: "bar"
},
xAxis: {
categories: D[c].categories
},
legend: {
enabled: g
},
series: b
},
d = new Highcharts.Chart($.extend(true, {},
commonOptions, e, a))
}
function createStackBar(c, a, f) {
if (!D[c].categories) {
return
}
var b = getCommonSeries(c, f),
g = !(b.length === 1 && b[0].name === ONLYONESERIENAME),
e = {
chart: {
renderTo: "w" + c,
defaultSeriesType: "bar"
},
xAxis: {
categories: D[c].categories
},
yAxis: {
stackLabels: {
enabled: true
}
},
legend: {
enabled: g
},
tooltip: {
formatter: function() {
return "" + this.x + "
" + this.series.name + ": " + this.y + "
Total: " + this.point.stackTotal
}
},
plotOptions: {
bar: {
stacking: "normal",
dataLabels: {
enabled: true,
color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || "white"
}
}
},
series: b
},
d = new Highcharts.Chart($.extend(true, {},
commonOptions, e, a))
}
function createLine(j, h, b, e, l) {
if (!D[j].categories) {
return
}
var g = getCommonSeries(j, b, false),
f = !(g.length === 1 && g[0].name === ONLYONESERIENAME),
d = D[j].categories,
k = 0,
c = "center";
if (D[j].categories.length >= ROTATIONCATEGORIESLENGTH) {
k = -45;
c = "right"
}
if (e) {
d = [];
$(D[j].categories).each(function(m, n) {
d.push(dateformatters[e](n))
})
}
var a = {
chart: {
renderTo: "w" + j,
defaultSeriesType: h
},
xAxis: {
categories: d,
labels: {
rotation: k,
align: c
}
},
legend: {
enabled: f
},
series: g
},
i = new Highcharts.Chart($.extend(true, {},
commonOptions, a, l))
}
function createArea(i, c, k, b) {
if (!D[i].categories) {
return
}
var g = getCommonSeries(i, b),
f = !(g.length === 1 && g[0].name === ONLYONESERIENAME),
e = D[i].categories,
j = 0,
d = "center";
if (D[i].categories.length >= ROTATIONCATEGORIESLENGTH) {
j = -45;
d = "right"
}
var a = {
chart: {
renderTo: "w" + i,
defaultSeriesType: c
},
xAxis: {
categories: D[i].categories,
labels: {
rotation: j,
align: d
}
},
legend: {
enabled: f
},
series: g
},
h = new Highcharts.Chart($.extend(true, {},
commonOptions, a, k))
}
function createStackArea(h, j, b) {
if (!D[h].categories) {
return
}
var f = getCommonSeries(h, b),
e = !(f.length === 1 && f[0].name === ONLYONESERIENAME),
d = D[h].categories,
i = 0,
c = "center";
if (D[h].categories.length >= ROTATIONCATEGORIESLENGTH) {
i = -45;
c = "right"
}
var a = {
chart: {
renderTo: "w" + h,
defaultSeriesType: "area"
},
xAxis: {
categories: D[h].categories,
labels: {
rotation: i,
align: c
}
},
yAxis: {
stackLabels: {
enabled: true
}
},
legend: {
enabled: e
},
tooltip: {
formatter: function() {
return "" + this.x + "
" + this.series.name + ": " + this.y + "
Total: " + this.point.stackTotal
}
},
plotOptions: {
area: {
stacking: "normal",
dataLabels: {
color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || "white"
}
}
},
series: f
},
g = new Highcharts.Chart($.extend(true, {},
commonOptions, a, j))
}
function getPieSeries(h, a) {
if (!D[h].categories) {
return
}
var c = [],
d,
f = false,
g = 0,
b = 0,
i = ["75%"],
e = ["0"];
$.each(D[h].series,
function(j, l) {
b++;
$(l).each(function(m, k) {
l[m] = Math.round(k * 100) / 100
})
});
if (b == 2) {
i = ["45%", "100%"];
e = ["20%", "45%"]
}
$.each(D[h].series,
function(j, m) {
if (a == "avg") {
var l = D[h].timeCountSeries[j];
$(m).each(function(o, n) {
var k = n;
if (l[o] != 0) {
k = Math.round((m[o] / l[o]) * 100) / 100
} else {
k = 0
}
m[o] = k
})
}
});
orderSeries(h);
$.each(D[h].series,
function(j, n) {
if (g == b - 1) {
f = true
}
var m = {
type: "pie",
data: [],
name: j,
size: i[g],
innerSize: e[g],
dataLabels: {
enabled: f
}
},
l = 0;
$(n).each(function(o, k) {
l += k
});
$(n).each(function(k, o) {
m.data.push({
name: D[h].categories[k],
color: Highcharts.theme.colors[k % Highcharts.theme.colors.length],
y: Math.round(o * 1000 / l) / 10,
v: o
})
});
c.push(m);
g++
});
return c
}
function orderSeries(a) {
var q = a.split("_"),
s = R.WGTS[q[0]][q[1]],
o = s.CATSORT;
var n, r = [],
g = D[a].series,
h = D[a].categories;
if (!h || h.length == 0) {
return
}
var c = 0;
$.each(g,
function(i, j) {
if (o) {
n = h;
r.push(i)
} else {
if (c == 0) {
n = j
} else {
r.push(i)
}
c++
}
});
var f = 0;
var d = n.length - 1;
var p = function(v, t) {
if (v == t) {
return
}
var u = n[v],
x = h[v],
w = [];
$.each(r,
function(j, i) {
w[j] = g[i][v]
});
var l = v;
var k = t;
while (t > v) {
if (n[t] >= u) {
t--
} else {
n[v] = n[t];
h[v] = h[t];
$.each(r,
function(j, i) {
g[i][v] = g[i][t]
});
while (t > ++v) {
if (n[v] > u) {
n[t] = n[v];
h[t] = h[v];
$.each(r,
function(j, i) {
g[i][t] = g[i][v]
});
break
}
}
}
}
if (l == v) {
p(++v, k);
return
}
n[v] = u;
h[v] = x;
$.each(r,
function(j, i) {
g[i][v] = w[j]
});
p(l, v);
p(t, k)
};
p(f, d);
if ("1" != o) {
var b = h.length,
m = Math.floor(b / 2);
for (var f = 0; f < m; f++) {
var e = h[f];
h[f] = h[b - f - 1];
h[b - f - 1] = e;
$.each(g,
function(i, j) {
e = j[f];
j[f] = j[b - f - 1];
j[b - f - 1] = e
})
}
}
}
function getCommonSeries(b, c, d) {
if (!D[b].series) {
return []
}
var a = [];
$.each(D[b].series,
function(e, f) {
$.each(f,
function(g, h) {
f[g] = Math.formatFloat(h, 2)
})
});
if (c === "avg") {
$.each(D[b].series,
function(e, f) {
$(f).each(function(h, g) {
if (D[b].timeCountSeries[e][h] !== 0) {
f[h] = Math.round(g * 100 / D[b].timeCountSeries[e][h]) / 100
} else {
f[h] = 0
}
})
})
}
if (!d) {
orderSeries(b)
}
$.each(D[b].series,
function(e, f) {
a.push({
name: e,
data: f
})
});
return a
}
function initLogo() {
var b = $("#container").attr("mobile");
if (b) {
var c = $("#logo").find("a"),
g = c.css("backgroundSize");
if ("cover" == g) {
var f = c.css("backgroundImage");
if (f) {
var e = f.substring(f.indexOf("(") + 1, f.lastIndexOf(")")).replace(/\"/g, "");
var d = $($.format("
", e));
c.append(d);
d.load(function() {
c.css({
backgroundImage: "none",
backgroundSize: "initial",
height: $(this).height()
})
})
}
}
}
}
function createTitle() {
$("#rptTitle").text(R.RPT.TITLE);
$("#rptDesc").text(R.RPT.DESC);
if (R.RPT.EXP !== "1") {
$("#exportButtons").hide()
}
$("#stage").addClass(isMobile ? "": "layout" + R.RPT.LAY)
}
function fillSubTitle(b, c) {
var d = b.find(".subTitle"),
a = {
today: "[今天]",
week: "[本周]",
month: "[本月]",
year: "[本年]",
last24HR: "[过去24小时]",
last7D: "[过去一周]",
last30D: "[过去30天]",
last12M: "[过去12个月]"
};
if (c.DRANG === "custom") {
if (c.SDATE && c.EDATE) {
d.text("[" + c.SDATE + " to " + c.EDATE + "]")
} else {
d.text("")
}
} else {
if (c.DRANG !== "all") {
d.text(a[c.DRANG])
} else {
d.text("")
}
}
}
function createChart(x, t, h, f) {
if (!D[x].categories) {
return
}
var w = [],
q = [],
a = $("
"),
b,
y = 0,
n = 0,
i = 0,
u = 0,
d,
m = Highcharts.theme.colors,
o;
if (h === "likert") {
var p = x.split("_"),
l = R.WGTS[p[0]][p[1]],
e = D[x].categories,
s = D[x].series[ONLYONESERIENAME];
$(F).each(function(c, z) {
if (z.TYP === "likert") {
$(z.ITMS).each(function(A, B) {
if (B.NM === l.FLD) {
$(B.ITMS).each(function(E, G) {
q.push(G.VAL);
var C = $.inArray(G.VAL, e);
if (C >= 0) {
w.push(s[C])
} else {
w.push(0)
}
})
}
})
}
})
} else {
q = D[x].categories;
w = D[x].series[ONLYONESERIENAME]
}
var g = new Array();
var k = new Array();
$(q).each(function(A, c) {
var z = new Array();
z.push(c);
z.push(w[A]);
g[A] = z
});
$(w).each(function(z, A) {
var c = new Array();
c.push(A);
c.push(q[z]);
k[z] = c
});
function j(C, E) {
for (var z = 0; z < C.length - 1; z++) {
for (var B = z + 1; B < C.length; B++) {
var H = C[z][0];
var G = C[B][0];
if (E && H && G && H > G) {
var I = C[B];
C[B] = C[z];
C[z] = I
} else {
if (E && H && G && H == G) {
var A = C[z][1];
var c = C[B][1];
if (A > c) {
var I = C[B];
C[B] = C[z];
C[z] = I
}
}
}
if (!E && H < G) {
var I = C[B];
C[B] = C[z];
C[z] = I
} else {
if (!E && H == G) {
var A = C[z][1];
var c = C[B][1];
if (A > c) {
var I = C[B];
C[B] = C[z];
C[z] = I
}
}
}
}
}
}
$(q).each(function(z, c) {
if (w[z] !== undefined) {
y += w[z];
u += (z + 1) * w[z]
}
});
var v;
if (f == "count") {
j(g, true);
v = g
} else {
j(k, false);
v = k
}
$(v).each(function(A, z) {
var B;
var c;
if (f == "count") {
c = z[0];
B = z[1]
} else {
c = z[1];
B = z[0]
}
if (A % 2 === 0) {
o = ""
} else {
o = "alt"
}
if (B !== undefined) {
i = B;
d = Highcharts.numberFormat(B * 100 / y, 0) + "%"
} else {
i = 0;
d = "0%"
}
if (h === "likert") {
c += $.format("({0})", A + 1)
}
b = $($.format('{1} | {2} | {4} |
', o, c, d, m[A % m.length], i));
a.append(b)
});
if (h === "likert") {
$(D[x].categories).each(function(z, A) {
var c = false;
$(q).each(function(C, B) {
if (A === B) {
c = true;
return false
}
});
if (!c) {
b = $($.format('{1}(0) | {2} | {4} |
', "alarm", A, "", "", w[z]));
n += w[z];
a.append(b)
}
})
}
var r = $($.format('', y + n, D[x].noAnswer));
if (h === "likert") {
r.find("tfoot").append($.format(' | 平均分 | {0} |
', Highcharts.numberFormat(u / y, 2)))
}
r.append(a);
t.append(r)
}
function createAddressChart(o, k) {
var f = $(""),
l = null,
n,
j = {},
q = o.split("_"),
m = 0,
i = 0,
r = R.WGTS[q[0]][q[1]],
d,
a,
b,
e,
h,
g = D[o].entries || [];
$(F).each(function(c, s) {
if (s.FLDID === r.FLD) {
j.ZIP = s.SUBFLDS.ZIP.NM;
j.PRV = s.SUBFLDS.PRV.NM;
j.CITY = s.SUBFLDS.CITY.NM;
j.DTL = s.SUBFLDS.DTL.NM;
return false
}
});
$(g).each(function(s, t) {
if (! (t[j.COUN] || t[j.ZIP] || t[j.PRV] || t[j.CITY] || t[j.DTL])) {
m++;
return true
} else {
i++
}
if ((i - 1) % 3 === 0) {
if (l !== null) {
f.append(l)
}
l = $("
")
}
if ((i - 1) % 2 === 0) {
n = "alt"
} else {
n = ""
}
a = t[j.ZIP] === undefined ? "": t[j.ZIP];
b = t[j.PRV] === undefined ? "": t[j.PRV];
e = t[j.PRV] === undefined ? "": t[j.CITY];
h = t[j.DTL] === undefined ? "": t[j.DTL];
l.append($.format('{2}{3},{4},{5} | ', n, $.format(mapUrlTxt, b + " " + e + " " + a + " " + h), b, e, a, h));
if (s === g.length - 1) {
if (i % 3 !== 0) {
for (var c = 0; c < 3 - i % 3; c++) {
l.append(" | ")
}
}
f.append(l)
}
});
var p = $($.format('', D[o].lastEntryLimit, i, m));
p.append(f);
k.append(p)
}
function createGrid(n, j) {
var p = n.split("_"),
f = R.WGTS[p[0]][p[1]],
b = [],
a = function() {
var g = {},
c = "";
$(F).each(function(k, s) {
if (s.TYP === "address") {
g[s.SUBFLDS.PRV.NM] = {
title: s.LBL + "(省/自治区/直辖市)"
};
g[s.SUBFLDS.CITY.NM] = {
title: s.LBL + "(市)"
};
g[s.SUBFLDS.ZIP.NM] = {
title: s.LBL + "(区/县)"
};
g[s.SUBFLDS.DTL.NM] = {
title: s.LBL + "(详细地址)"
}
} else {
if (s.TYP === "map") {
g[s.SUBFLDS.TXT.NM] = {
title: s.LBL
}
} else {
if (s.TYP === "file") {
g[s.SUBFLDS.ID.NM] = {
title: s.LBL + "(文件ID)"
};
g[s.SUBFLDS.TYP.NM] = {
title: s.LBL + "(文件类型)"
};
g[s.SUBFLDS.SZ.NM] = {
title: s.LBL + "(文件大小)"
};
g[s.SUBFLDS.NM.NM] = {
title: s.LBL + "(文件名称)"
}
} else {
if (s.TYP === "dropdown2") {
var t = 1;
for (ddn in s.SUBFLDS) {
g[s.SUBFLDS[ddn].NM] = {
title: s.LBL + "(" + (t++) + ")"
}
}
} else {
if (s.TYP === "checkbox") {
$(s.ITMS).each(function(u, v) {
g[v.NM] = {
title: v.VAL
}
})
} else {
if (s.TYP === "likert") {
$(s.ITMS).each(function(u, v) {
g[v.NM] = {
title: v.LBL
}
})
} else {
var r = {
title: s.LBL
};
if (s.TYP === "number" || s.TYP === "money") {
r.align = "right"
}
g[s.NM] = r
}
}
}
}
}
}
});
$.extend(true, g, DataGrid.getCommonFieldsMap());
return g
},
l = function(v, w, u, s, c) {
var t = [];
var r = s;
if (!r) {
r = ["CTIME_-1"]
}
if (!$.isArray(r)) {
console.error("sortString不是个数组!");
return
}
$.each(r,
function(x, y) {
var A = {};
var B = y.substring(0, y.lastIndexOf("_"));
var z = y.substring(y.lastIndexOf("_") + 1);
A[B] = z;
t.push(A)
});
if (!v) {
v = {
FIRST: {},
LAST: {}
}
}
var k = {
PRTID: R._id,
WGTKEY: n,
SORTBY: t,
PAGESIZE: parseInt(u),
PAGEINFO: v,
PREORNEXT: w
};
var g = $("#load" + c.attr("id"));
g.css({
top: "",
left: ""
});
g.position({
of: c.parent().parent(),
at: "center middle",
my: "center middle"
});
g.show();
$.postJSON("/web/reportview/getgriddata.json", k,
function(z) {
var A = z.rows;
if ("LAST" == w) {
A = z.rows.reverse()
}
var y = c.datagrid("option").pageNumber;
var x = {
FIRST: 1,
LAST: Math.ceil(z.total / u),
PRE: y - 1,
NEXT: y + 1
};
y = x[w];
c.datagrid("option", {
pageNumber: y,
pageSize: u
});
c.datagrid("fillData", {
rows: A,
total: z.total
});
g.hide()
})
};
j.append('');
var m = F.slice(0);
if (FRM.VERIFY == "1") {
m.push({
LBL: "核销码",
NM: "VERIFYID",
FLDID: "VERIFYID",
TYP: "text"
});
m.push({
LBL: "核销状态",
NM: "VERIFYSTATUS",
FLDID: "VERIFYSTATUS",
TYP: "text"
});
m.push({
LBL: "核销过期时间",
NM: "VERIFYDATE",
FLDID: "VERIFYDATE",
TYP: "date"
})
}
b = DataGrid.getAllColumns(F, FRM.EX, null);
if (f.ALLFLDS != "1") {
var h = a();
if (f.ISEDT === "1") {
$(b).each(function(k, c) {
var g = true;
$(f.FLDS).each(function(r, s) {
if (c.field === s) {
g = false;
return false
}
});
if (g) {
c.hide = "1"
}
})
} else {
for (var e = b.length - 1; e >= 0; e--) {
var i = true;
$(f.FLDS).each(function(c, g) {
if (b[e].field == g) {
i = false;
return false
}
});
if (i) {
b.splice(e, 1)
}
}
}
}
$(b).each(function(g, c) {
if (f.SORTFLD === c.field) {
c.sort = f.SRT;
return false
}
});
var d = [];
var q = {
rownumbers: "0",
pageSize: f.PGSZ,
columns: b,
query: l,
sort: ["CTIME_-1"]
};
if (f.SORTFLD) {
d[0] = f.SORTFLD + "_" + f.SRT;
q.sort = d
} else {
q.sort = ["CTIME_-1"]
}
j.find("#g" + n).datagrid(q);
var o = $('');
$("body").append(o);
l(null, "FIRST", f.PGSZ, j.find("#g" + n).datagrid("getSortString"), j.find("#g" + n))
}
function createWidgets(e) {
var c, d, b, a = [$("#z1"), $("#z2"), $("#z3")];
$(R.WGTS).each(function(f, g) {
$(g).each(function(k, i) {
b = f + "_" + k;
c = i.TYP;
d = i.GTYP;
if (c === "advanced") {
c = i.ADTYP
}
var l = $('');
if (e) {
e.append(l)
} else {
a[f].append(l)
}
if (c === "grid" || c === "chart") {
l.addClass("noFloat")
}
if (c === "graph") {
l.append(' ");
var h = l.find(".wgtContainer");
if (d === "pie") {
if (i.SZ === "small" || isMobile) {
h.css({
width: "280px",
height: "150px"
})
} else {
if (i.SZ === "large") {
h.css({
width: "600px",
height: "300px"
})
} else {
h.css({
width: "330px",
height: "220px"
})
}
}
} else {
if (i.SZ === "small" || isMobile) {
h.css({
width: "410px",
height: "110px"
})
} else {
if (i.SZ === "large") {
h.css({
width: "1260px",
height: "250px"
})
} else {
h.css({
width: "790px",
height: "160px"
})
}
}
}
} else {
if (c === "number") {
l.attr("id", "w" + b);
l.append('');
l.find(".numDesc").text(i.DESC);
l.find(".val").addClass(i.CLR)
} else {
if (c === "text") {
l.append('');
l.find(".textDesc").html(i.TEXT)
} else {
if (c === "chart") {
if (i.CHTTYP === "address") {
createAddressChart(b, l)
} else {
createChart(b, l, i.CHTTYP, i.COUNTSORT)
}
if (i.FLDDTL === "percent") {
l.find("tfoot").hide();
l.find(".count").hide()
} else {
if (i.FLDDTL === "count") {
l.find(".percent").hide();
l.find(".empty").hide()
}
}
} else {
if (c === "grid") {
createGrid(b, l)
}
}
}
}
}
if (i.TITLE) {
l.find(".title").text(i.TITLE)
}
if (i.DRANG) {
fillSubTitle(l, i)
}
if (d === "pie") {
createPie(b, i.options, i.CNTTYP)
} else {
if (d === "col") {
createCol(b, i.options, i.CNTTYP)
} else {
if (d === "stackcol") {
createStackCol(b, i.options, i.CNTTYP)
} else {
if (d === "area" || d === "areaspline") {
createArea(b, d, i.options, i.CNTTYP)
} else {
if (d === "stackarea") {
createStackArea(b, i.options, i.CNTTYP)
} else {
if (d === "bar") {
createBar(b, i.options, countType)
} else {
if (d === "stackbar") {
createStackBar(b, i.options, i.CNTTYP)
} else {
if (d === "line" || d === "spline") {
i.CATSORT = true;
createLine(b, d, i.CNTTYP, i.XGRPFMT, i.options)
} else {
if (c === "number") {
fillNumber(b, i.CNTTYP, i.FMT, i.CURR, i.options)
}
}
}
}
}
}
}
}
}
})
})
}
function initExportAndRefresh() {
$("#exportButton").click(function() {
if ($.browser.msie && $.browser.version === "6.0") {
$("#lightBox").css("margin-top", $(document).scrollTop() - 210)
}
$.lightBox({
url: "/web/exportoption.jsp?RPTID=" + R._id + "&REPORT=1"
})
});
if (R.ISCACHE) {
$("#cacheInfo").show().find("span").text(R.CACHETM);
$("#refresh").click(function() {
$.showStatus();
$.postJSON("/web/reportview/getrealtimedata", {
RPTID: R._id
},
function(a) {
D = a;
$("#z1,#z2,#z3").empty();
createWidgets();
$.hideStatus()
});
$("#cacheInfo").find("span").text("实时统计");
$(this).hide();
return false
})
} else {
if ("1" === R.RPT.CACHE) {
$("#cacheInfo").show().find("span").text("实时统计");
$("#refresh").hide()
}
}
}
function onBridgeReady() {
WeixinJSBridge.call("hideOptionMenu")
}
function initWeixinShare() {
if (R.DISSHARE === "1") {
if (typeof WeixinJSBridge == "undefined") {
if (document.addEventListener) {
document.addEventListener("WeixinJSBridgeReady", onBridgeReady, false)
} else {
if (document.attachEvent) {
document.attachEvent("WeixinJSBridgeReady", onBridgeReady);
document.attachEvent("onWeixinJSBridgeReady", onBridgeReady)
}
}
} else {
onBridgeReady()
}
}
}
head.ready(function() {
if (isEmbed) {
$("body").css("background", "none");
$("#container").css("width", "100%")
}
$.showStatus();
if ("1" === R.NEEDAJAX) {
var a = "/web/reportview/getrealtimedata";
$.postJSON(a, {
RPTID: R._id
},
function(b) {
D = b;
createTitle();
createWidgets();
initExportAndRefresh();
$.hideStatus()
})
} else {
createTitle();
createWidgets();
initExportAndRefresh();
$.hideStatus()
}
initWeixinShare();
initLogo()
});