|
|
// 班额情况
|
|
|
$(function () {
|
|
|
// 标题增加年份
|
|
|
$('#title_text').prepend(config_now_year)
|
|
|
|
|
|
// 渲染年份列表 在nav.js中获取select_year
|
|
|
$('#select-year').append(select_year)
|
|
|
$('.select').on('click', '.placeholder', function (e) {
|
|
|
var parent = $(this).closest('.select');
|
|
|
if (!parent.hasClass('is-open')) {
|
|
|
parent.addClass('is-open');
|
|
|
$('.select.is-open').not(parent).removeClass('is-open');
|
|
|
} else {
|
|
|
parent.removeClass('is-open');
|
|
|
}
|
|
|
e.stopPropagation();
|
|
|
}).on('click', 'ul>li', function () {
|
|
|
var parent = $(this).closest('.select');
|
|
|
parent.removeClass('is-open').find('.placeholder').text($(this).text());
|
|
|
$(window).attr('location', "classesOf.html?year=" + $(this).text());
|
|
|
let on_year = $(this).text();
|
|
|
echartSizeInfo(on_year);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
var tableDate = [];
|
|
|
|
|
|
var typeOfBe = '小学';
|
|
|
|
|
|
$('#Sxiaoxue').click(function (event) {
|
|
|
$(this).addClass('active');
|
|
|
$(this).siblings().removeClass('active');
|
|
|
typeOfBe = '小学';
|
|
|
tableDate = [];
|
|
|
echartSizeInfo(config_now_year);
|
|
|
})
|
|
|
|
|
|
$('#Schuzhong').click(function (event) {
|
|
|
$(this).addClass('active');
|
|
|
$(this).siblings().removeClass('active');
|
|
|
typeOfBe = '初中';
|
|
|
tableDate = [];
|
|
|
echartSizeInfo(config_now_year);
|
|
|
})
|
|
|
|
|
|
$('#Sgaozhong').click(function (event) {
|
|
|
$(this).addClass('active');
|
|
|
$(this).siblings().removeClass('active');
|
|
|
typeOfBe = '高中';
|
|
|
tableDate = [];
|
|
|
echartSizeInfo(config_now_year);
|
|
|
})
|
|
|
|
|
|
|
|
|
echartSizeInfo(config_now_year);
|
|
|
|
|
|
|
|
|
function echartSizeInfo(year) {
|
|
|
|
|
|
$.post(config_serverIp + "dataex/report/QuerySimpleGP", JSON.stringify({
|
|
|
"access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab",
|
|
|
"query": {
|
|
|
"query_id": "A024",
|
|
|
"query_param": [
|
|
|
year
|
|
|
]
|
|
|
},
|
|
|
"query_cache": 0,
|
|
|
"query_count": [
|
|
|
"total"
|
|
|
],
|
|
|
"query_format": "json",
|
|
|
"query_group": [
|
|
|
"gatherregionc"
|
|
|
]
|
|
|
}), function (resport) {
|
|
|
|
|
|
var data = resport.result;
|
|
|
var indata = JSON.parse(data);
|
|
|
var nameData = [];
|
|
|
var smallClasses = [];
|
|
|
var bigClasses = [];
|
|
|
var sbigClasser = [];
|
|
|
|
|
|
indata.forEach((item, index) => {
|
|
|
if (item.stage === typeOfBe) {
|
|
|
if (item.didgroup === '小班额') {
|
|
|
nameData.push(item.gatherregionc);
|
|
|
if (item.total == 0) {
|
|
|
smallClasses.push(0);
|
|
|
} else {
|
|
|
smallClasses.push(Math.round(((item.classno / item.total).toFixed(4)) * 100));
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (item.didgroup === '大班额') {
|
|
|
if (item.total == 0) {
|
|
|
bigClasses.push(0);
|
|
|
} else {
|
|
|
bigClasses.push(Math.round(((item.classno / item.total).toFixed(4)) * 100));
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (item.didgroup === '超大班额') {
|
|
|
if (item.total == 0) {
|
|
|
sbigClasser.push(0);
|
|
|
} else {
|
|
|
sbigClasser.push(Math.round(((item.classno / item.total).toFixed(4)) * 100));
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
console.log(nameData);
|
|
|
console.log(smallClasses);
|
|
|
console.log(bigClasses);
|
|
|
console.log(sbigClasser);
|
|
|
|
|
|
nameData.forEach((item, index) => {
|
|
|
tableDate.push({
|
|
|
name: item,
|
|
|
smallClasses: `${smallClasses[index]}%`,
|
|
|
bigClasses: `${bigClasses[index]}%`,
|
|
|
sbigClasser: `${sbigClasser[index]}%`,
|
|
|
})
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 基于准备好的dom,初始化echarts实例
|
|
|
var myChart = echarts.init(document.getElementById('echartClassesOf')); // 学校规模情况柱状图
|
|
|
|
|
|
|
|
|
option = {
|
|
|
// backgroundColor: '#00265f',
|
|
|
tooltip: {
|
|
|
trigger: 'axis',
|
|
|
axisPointer: {
|
|
|
type: 'shadow'
|
|
|
}
|
|
|
},
|
|
|
|
|
|
legend: {
|
|
|
data: ['小班额', '大班额', '超大班额'],
|
|
|
textStyle: {
|
|
|
color: '#fff'
|
|
|
}
|
|
|
},
|
|
|
|
|
|
grid: {
|
|
|
left: '0%',
|
|
|
top: '8%',
|
|
|
right: '0%',
|
|
|
bottom: '4%',
|
|
|
containLabel: true
|
|
|
},
|
|
|
xAxis: [{
|
|
|
type: 'category',
|
|
|
data: nameData,
|
|
|
axisLine: {
|
|
|
show: true,
|
|
|
lineStyle: {
|
|
|
color: "rgba(255,255,255,.1)",
|
|
|
width: 1,
|
|
|
type: "solid"
|
|
|
},
|
|
|
},
|
|
|
|
|
|
axisTick: {
|
|
|
show: false,
|
|
|
},
|
|
|
axisLabel: {
|
|
|
interval: 0,
|
|
|
// rotate:50,
|
|
|
show: true,
|
|
|
splitNumber: 15,
|
|
|
textStyle: {
|
|
|
color: "rgba(255,255,255,.6)",
|
|
|
fontSize: '12',
|
|
|
},
|
|
|
},
|
|
|
}],
|
|
|
yAxis: [{
|
|
|
type: 'value',
|
|
|
axisLabel: {
|
|
|
formatter: '{value} %',
|
|
|
show: true,
|
|
|
textStyle: {
|
|
|
color: "rgba(255,255,255,.6)",
|
|
|
fontSize: '12',
|
|
|
},
|
|
|
},
|
|
|
axisTick: {
|
|
|
show: false,
|
|
|
},
|
|
|
axisLine: {
|
|
|
show: true,
|
|
|
lineStyle: {
|
|
|
color: "rgba(255,255,255,.1 )",
|
|
|
width: 1,
|
|
|
type: "solid"
|
|
|
},
|
|
|
},
|
|
|
splitLine: {
|
|
|
lineStyle: {
|
|
|
color: "rgba(255,255,255,.1)",
|
|
|
}
|
|
|
}
|
|
|
}],
|
|
|
series: [
|
|
|
{
|
|
|
name: '小班额',
|
|
|
type: 'bar',
|
|
|
data: smallClasses,
|
|
|
barWidth: '15%', //柱子宽度
|
|
|
// barGap: 1, //柱子之间间距
|
|
|
label: {
|
|
|
show: true,
|
|
|
position: 'top'
|
|
|
},
|
|
|
itemStyle: {
|
|
|
normal: {
|
|
|
color: '#168EFE',
|
|
|
opacity: 1,
|
|
|
barBorderRadius: 5,
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
name: '大班额',
|
|
|
type: 'bar',
|
|
|
data: bigClasses,
|
|
|
barWidth: '15%', //柱子宽度
|
|
|
// barGap: 1, //柱子之间间距
|
|
|
label: {
|
|
|
show: true,
|
|
|
position: 'top'
|
|
|
},
|
|
|
itemStyle: {
|
|
|
normal: {
|
|
|
color: '#2CD1C0',
|
|
|
opacity: 1,
|
|
|
barBorderRadius: 5,
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
name: '超大班额',
|
|
|
type: 'bar',
|
|
|
data: sbigClasser,
|
|
|
barWidth: '15%', //柱子宽度
|
|
|
// barGap: 1, //柱子之间间距
|
|
|
label: {
|
|
|
show: true,
|
|
|
position: 'top'
|
|
|
},
|
|
|
itemStyle: {
|
|
|
normal: {
|
|
|
color: '#FFDB65',
|
|
|
opacity: 1,
|
|
|
barBorderRadius: 5,
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
|
|
|
]
|
|
|
};
|
|
|
|
|
|
// 使用刚指定的配置项和数据显示图表。
|
|
|
myChart.setOption(option);
|
|
|
window.addEventListener("resize", function () {
|
|
|
myChart.resize();
|
|
|
});
|
|
|
getTable();
|
|
|
}, 'json');
|
|
|
|
|
|
}
|
|
|
|
|
|
function getTable() {
|
|
|
$('#sizeTable').empty();
|
|
|
$('#sizeTable').append(
|
|
|
'<tr style="line-height: 0.35rem;"><th style="text-align: center; color: #fff; border-right: 1px solid rgba(255,255,255,.2); width: 10%; background: #0044bb;">序号</th><th style="text-align: center; color: #fff; border-right: 1px solid rgba(255,255,255,.2); width: 20%; background: #0044bb;">县域名称</th><th style="text-align: center; color: #fff; border-right: 1px solid rgba(255,255,255,.2); width: 23%; background: #0044bb;">小班额</th><th style="text-align: center; color: #fff; border-right: 1px solid rgba(255,255,255,.2); width: 23%; background: #0044bb;">大班额</th><th style="text-align: center; color: #fff; width: 23%; background: #0044bb;">超大班额</th></tr>'
|
|
|
)
|
|
|
tableDate.forEach((item, index) => {
|
|
|
var newIndex = index + 1;
|
|
|
$('#sizeTable').append(
|
|
|
"<tr style='line-height: 0.35rem; border-bottom: 1px solid rgba(255,255,255,.2)'><td style='text-align: center; color: rgba(255,255,255,.6); border-right: 1px solid rgba(255,255,255,.2); width: 10%;'>" + newIndex + "</td><td style='text-align: center; color: rgba(255,255,255,.6); border-right: 1px solid rgba(255,255,255,.2); width: 20%;'>" + item.name + "</td><td style='text-align: center; color: rgba(255,255,255,.6); width: 23%; border-right: 1px solid rgba(255,255,255,.2);'>" + item.smallClasses + "</td><td style='text-align: center; color: rgba(255,255,255,.6); width: 23%; border-right: 1px solid rgba(255,255,255,.2);'>" + item.bigClasses + "</td><td style='text-align: center; color: rgba(255,255,255,.6); width: 23%;'>" + item.sbigClasser + "</td></tr>"
|
|
|
)
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}) |