easyUI
$(function () {
tableData();
});
var data2Arr
function initBgData(data2Arr) {
zkyt.datagrid($("#data"), null, {
columns: getColumnHeader(),
queryParams: {
},
data: data2Arr,
autoRowHeight: true,
nowarp: true,
fitColumns: false,
fit: true,
}, false);
}
function getColumnHeader() {
return [
[
{ field: 'xzqhbm', title: '行政区代码', width: 100, align: 'center', rowspan: 2 },
{ field: 'wrrqfw', title: '污染日期范围', width: 200, align: 'center', rowspan: 2 },
{ field: 'cxwrts', title: '持续污染天数', width: 100, align: 'center', rowspan: 2 },
{ field: 'sywrw', title: '首要污染物', width: 100, align: 'center', rowspan: 2 },
{ title: 'CO', align: 'center', colspan: 3 },
{ title: 'PM10', align: 'center', colspan: 3 },
{ title: 'PM25', align: 'center', colspan: 3 },
{ title: 'NO2', align: 'center', colspan: 3 },
{ title: 'O3', align: 'center', colspan: 3 },
{ title: 'SO2', align: 'center', colspan: 3 },
{ field: 'wd', title: '温度', width: 150, align: 'center', rowspan: 2 },
{ field: 'fs', title: '风速', width: 150, align: 'center', rowspan: 2 },
{ field: 'sd', title: '湿度', width: 150, align: 'center', rowspan: 2 },
{ field: 'fx', title: '风向', width: 150, align: 'center', rowspan: 2 },
],
[
{ field: 'COFz', title: 'CO峰值', width: 100, align: 'center' },
{ field: 'COJz', title: 'CO均值', width: 100, align: 'center' },
{ field: 'COGx', title: 'CO贡献值', width: 100, align: 'center' },
{ field: 'PM10Fz', title: 'PM10峰值', width: 100, align: 'center' },
{ field: 'PM10Jz', title: 'PM10均值', width: 100, align: 'center' },
{ field: 'PM10Gx', title: 'PM10贡献值', width: 100, align: 'center' },
{ field: 'PM25Jz', title: 'PM25峰值', width: 100, align: 'center' },
{ field: 'PM25Jz', title: 'PM25均值', width: 100, align: 'center' },
{ field: 'PM25Gx', title: 'PM25贡献值', width: 100, align: 'center' },
{ field: 'NO2Jz', title: 'NO2均值', width: 100, align: 'center' },
{ field: 'NO2Fz', title: 'NO2峰值', width: 100, align: 'center' },
{ field: 'NO2Gx', title: 'NO2贡献值', width: 100, align: 'center' },
{ field: 'O3Fz', title: 'O3峰值', width: 100, align: 'center' },
{ field: 'O3Jz', title: 'O3均值', width: 100, align: 'center' },
{ field: 'O3Gx', title: 'O3贡献值', width: 100, align: 'center' },
{ field: 'SO2Fz', title: 'SO2峰值', width: 100, align: 'center' },
{ field: 'SO2Jz', title: 'SO2均值', width: 100, align: 'center' },
{ field: 'SO2Gx', title: 'SO2贡献值', width: 100, align: 'center' },
]
];
}
function tableData() {
$.ajax({
type: 'post',
url: 'http://10.82.121.26:8060/airQuality/Analysis/getWrgctj',
data: {
kssj: '2020-11',
jssj: '2020-12',
wrlx: 3,
},
success: function (res) {
initBgData(res.content.data2)
}
})
}
function bzrsjSearch() {
function resetSelect() {
$('#tableForm').form('clear');
startDatBind();
}
function startDatBind() {
$('#startTime').datebox('setValue', setDate(new Date(), true));
$('#endTime').datebox('setValue', setDate(new Date(), false));
$('#zsxs').combobox({
data: [{ "id": 1, "text": "分布表" }, { "id": 2, "text": "柱状图" }, { "id": 3, "text": "饼状图" }],
valueField: 'id',
textField: 'text',
width: 100,
onChange: function () {
initDataBind();
}
});
}
function setDate(date, flag) {
var newDate = new Date(date);
if (flag) {
newDate.setDate(date.getDate() - 7);
}
y = newDate.getFullYear();
m = newDate.getMonth() + 1;
d = newDate.getDate();
m = m < 10 ? "0" + m : m;
d = d < 10 ? "0" + d : d;
if (flag) {
return y + "-" + m + "-" + d;
} else {
return y + "-" + m + "-" + d;
}
}
}