var school_name = GetQueryString('school_name')
var school_id = GetQueryString('school_id')
$(function () {
// 渲染年份列表 在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', "schoolTeacherStaff.html?year=" + $(this).text() + "&area_name=" + area_name + "&school_id=" + school_id + "&school_name=" + school_name);
let on_year = $(this).text();
echartSizeInfo(on_year);
});
let schoolName = document.querySelector("h1");
var url = decodeURI(window.location.href);
var schoolIndex = url.split("&school_name=");
schoolName.innerHTML = school_name + "-教师队伍";
(function ($) {
$.getUrlParam = function (name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
}
})(jQuery);
var schoolID = $.getUrlParam('school_id');
$('h1').prepend(config_now_year)
echarts_1(config_now_year);
echarts_2(config_now_year);
echarts_3(config_now_year);
echarts_4(config_now_year);
echarts_51(config_now_year);
echarts_7(config_now_year);
function echarts_1(year) {
$.post(config_serverIp + "dataex/report/QuerySimpleGP", JSON.stringify({
"access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab",
"query": {
"query_id": "A069",
"query_param": [
year, schoolID
]
},
"query_cache": 0,
"query_count": [
"teacherno"
],
"query_format": "json",
"query_group": [
"didgroup", "stage"
]
}), function (resport) {
var data = resport.result;
var indata = JSON.parse(data);
newData = dataMoreBar(indata);
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('echart1'));
option = {
tooltip: {
trigger: 'item',
formatter: "{a}
{b}: {c} ({d}%)",
position: function (p) { //其中p为当前鼠标的位置
return [p[0] + 10, p[1] - 10];
}
},
legend: {
type: 'scroll',
orient: 'vertical',
right: 0,
top: '30%',
bottom: 20,
textStyle: {
color: 'rgba(255,255,255,.5)',
fontSize: '12',
},
},
series: [
{
name: '',
type: 'pie',
center: ['40%', '50%'],
color: ['#168EFE', '#8882F7', '#FFA06C', '#FFDB65', '#2CD1C0', '#FF88A8'],
label: { show: false },
labelLine: { show: false },
data: newData,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}, 'json');
}
function echarts_2(year) {
$.post(config_serverIp + "dataex/report/QuerySimpleGP", JSON.stringify({
"access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab",
"query": {
"query_id": "A065",
"query_param": [
year, schoolID
]
},
"query_cache": 0,
"query_count": [
"teacherno"
],
"query_format": "json",
"query_group": [
"didgroup", "stage"
]
}), function (resport) {
var data = resport.result;
var indata = JSON.parse(data);
newData = dataMoreBar(indata);
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('echart2'));
option = {
tooltip: {
trigger: 'item',
formatter: "{a}
{b}: {c} ({d}%)",
position: function (p) { //其中p为当前鼠标的位置
return [p[0] + 10, p[1] - 10];
}
},
legend: {
type: 'scroll',
orient: 'vertical',
right: 0,
top: '20%',
bottom: 20,
textStyle: {
color: 'rgba(255,255,255,.5)',
fontSize: '12',
},
},
series: [
{
name: '',
type: 'pie',
center: ['40%', '50%'],
radius: ['40%', '60%'],
color: ['#168EFE', '#8882F7', '#FFA06C', '#FFDB65', '#2CD1C0', '#FF88A8'],
label: { show: false },
labelLine: { show: false },
data: newData,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}, 'json');
}
function echarts_3(year) {
$.post(config_serverIp + "dataex/report/QuerySimpleGP", JSON.stringify({
"access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab",
"query": {
"query_id": "A064",
"query_param": [
year, schoolID
]
},
"query_cache": 0,
"query_count": [
"teacherno"
],
"query_format": "json",
"query_group": [
"didgroup", "stage"
]
}), function (resport) {
var data = resport.result;
var indata = JSON.parse(data);
var allTotal = indata[0].total;
var manTotal = Number(allTotal) - Number(indata[0].nvno);
var womanTotal = indata[0].nvno;
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('echart3'));
option = {
tooltip: {
trigger: 'item',
formatter: "{a}
{b}: {c} ({d}%)",
position: function (p) { //其中p为当前鼠标的位置
return [p[0] + 10, p[1] - 10];
}
},
legend: {
type: 'scroll',
orient: 'vertical',
right: 0,
top: '30%',
bottom: 20,
textStyle: {
color: 'rgba(255,255,255,.5)',
fontSize: '12',
},
},
series: [
{
name: '',
type: 'pie',
center: ['40%', '50%'],
color: ['#168EFE', '#8882F7', '#FFA06C', '#FFDB65', '#2CD1C0', '#FF88A8'],
label: { show: false },
labelLine: { show: false },
data: [
{ value: manTotal, name: '男' },
{ value: womanTotal, name: '女' },
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}, 'json');
}
function echarts_4(year) {
$.post(config_serverIp + "dataex/report/QuerySimpleGP", JSON.stringify({
"access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab",
"query": {
"query_id": "A066",
"query_param": [
year, schoolID
]
},
"query_cache": 0,
"query_count": [
"total"
],
"query_format": "echarts",
"query_group": [
"didgroup"
]
}), function (resport) {
var data = resport.result;
var newData = JSON.parse(data);
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('echart4')); // 情况
option = {
// backgroundColor: '#00265f',
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
grid: {
left: '0%',
top: '14%',
right: '0%',
bottom: '4%',
containLabel: true
},
legend: {
show: false,
},
xAxis: [{
type: 'category',
data: newData.groups[0],
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)",
type: 'dashed'
}
}
}],
series: [
{
name: '',
type: 'bar',
data: newData.datas[0],
barWidth: '25%', //柱子宽度
// barGap: 1, //柱子之间间距
label: {
show: true,
position: 'top'
},
itemStyle: {
normal: {
color: '#168EFE',
opacity: 1,
barBorderRadius: 5,
}
}
},
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}, 'json');
}
function echarts_51(year) {
$.post(config_serverIp + "dataex/report/QuerySimpleGP", JSON.stringify({
"access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab",
"query": {
"query_id": "A068",
"query_param": [
year, schoolID
]
},
"query_cache": 0,
"query_count": [
"total"
],
"query_format": "echarts",
"query_group": [
"didgroup"
]
}), function (resport) {
var data = resport.result;
var indata = JSON.parse(data);
newData = dataToChar(indata);
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('echart5'));
option = {
tooltip: {
trigger: 'item',
formatter: "{a}
{b}: {c} ({d}%)",
position: function (p) { //其中p为当前鼠标的位置
return [p[0] + 10, p[1] - 10];
}
},
legend: {
type: 'scroll',
orient: 'vertical',
right: 0,
top: '30%',
bottom: 20,
data: indata.groups[0],
textStyle: {
color: 'rgba(255,255,255,.5)',
fontSize: '12',
},
},
series: [
{
name: '小学',
type: 'pie',
center: ['40%', '50%'],
color: ['#168EFE', '#8882F7', '#FFA06C', '#FFDB65', '#2CD1C0', '#FF88A8'],
label: { show: false },
labelLine: { show: false },
data: newData,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}, 'json');
}
function echarts_7(year) {
$.post(config_serverIp + "dataex/report/QuerySimpleGP", JSON.stringify({
"access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab",
"query": {
"query_id": "A067",
"query_param": [
year, schoolID
]
},
"query_cache": 0,
"query_count": [
"total"
],
"query_format": "json",
"query_group": [
""
]
}), function (resport) {
var data = resport.result;
var newData = JSON.parse(data);
var allNum = newData[0];
var fullTime = 0;
newData.map((item, index) => {
if (item.didgroup === "教职工总人数") {
// 教职工总数
allNum = Number(newData[index].total);
let teacherAll = document.querySelector("#teacharAll");
var numberArr = (allNum + "").split("");
numberArr.map((res) => {
teacherAll.innerHTML += `