From 2eba1000636280cb8ad602ff47831aae5122ab15 Mon Sep 17 00:00:00 2001 From: gongdi <410827992@qq.com> Date: Fri, 16 Sep 2022 13:33:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B9=98=E6=BD=AD=E5=A4=A7=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E9=80=BB=E8=BE=91=E5=AE=B9=E9=94=99=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/areaTeachingStaff.js | 34 +++++++++++++++++----------------- js/fulltimeTeachersAge.js | 6 ++++-- js/teachingStaff.js | 2 -- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/js/areaTeachingStaff.js b/js/areaTeachingStaff.js index 762cae0..9d0fcf8 100644 --- a/js/areaTeachingStaff.js +++ b/js/areaTeachingStaff.js @@ -62,7 +62,6 @@ $(function () { }), function (resport) { var data = resport.result; var newData = JSON.parse(data); - // 基于准备好的dom,初始化echarts实例 var myChart = echarts.init(document.getElementById('echart1')); // 城乡专任教师师生比 @@ -75,7 +74,7 @@ $(function () { } }, legend: { - data: newData.groups[1], + data: newData.groups && newData.groups.length > 1?newData.groups[1]:[], textStyle: { color: '#fff' } @@ -89,7 +88,7 @@ $(function () { }, xAxis: [{ type: 'category', - data: newData.groups[0], + data: newData.groups && newData.groups.length > 0?newData.groups[0]:[], axisLine: { show: true, lineStyle: { @@ -143,9 +142,9 @@ $(function () { }], series: [ { - name: newData.groups[1][0], + name: newData.groups && newData.groups.length > 1?newData.groups[1][0]:"", type: 'bar', - data: newData.datas[0], + data: newData.datas && newData.datas.length > 1?newData.datas[0]:[], barWidth: '15%', //柱子宽度 // barGap: 1, //柱子之间间距 itemStyle: { @@ -157,9 +156,9 @@ $(function () { } }, { - name: newData.groups[1][1], + name: newData.groups && newData.groups.length > 1?newData.groups[1][1]:"", type: 'bar', - data: newData.datas[1], + data: newData.datas && newData.datas.length > 1?newData.datas[1]:[], barWidth: '15%', //柱子宽度 // barGap: 1, //柱子之间间距 itemStyle: { @@ -171,9 +170,9 @@ $(function () { } }, { - name: newData.groups[1][2], + name: newData.groups && newData.groups.length > 1?newData.groups[1][2]:"", type: 'bar', - data: newData.datas[2], + data: newData.datas && newData.datas.length > 2?newData.datas[2]:[], barWidth: '15%', //柱子宽度 // barGap: 1, //柱子之间间距 itemStyle: { @@ -560,14 +559,14 @@ $(function () { containLabel: true }, legend: { - data: newData.groups[1], + data: newData.groups && newData.groups.length > 1?newData.groups[1]:[], textStyle: { color: '#fff' } }, xAxis: [{ type: 'category', - data: newData.groups[0], + data: newData.groups && newData.groups.length > 0?newData.groups[0]:[], axisLine: { show: true, lineStyle: { @@ -623,7 +622,7 @@ $(function () { { name: '小学', type: 'bar', - data: newData.datas[0], + data: newData.datas && newData.datas.length > 0?newData.datas[0]:[], barWidth: '15%', //柱子宽度 // barGap: 1, //柱子之间间距 itemStyle: { @@ -637,7 +636,7 @@ $(function () { { name: '初中', type: 'bar', - data: newData.datas[1], + data: newData.datas && newData.datas.length > 1?newData.datas[1]:[], barWidth: '15%', //柱子宽度 // barGap: 1, //柱子之间间距 itemStyle: { @@ -651,7 +650,7 @@ $(function () { { name: '高中', type: 'bar', - data: newData.datas[2], + data: newData.datas && newData.datas.length > 2?newData.datas[2]:[], barWidth: '15%', //柱子宽度 // barGap: 1, //柱子之间间距 itemStyle: { @@ -828,27 +827,28 @@ $(function () { }), function (resport) { var data = resport.result; var newData = JSON.parse(data); + console.log("newData:",newData) var allNum; newData.map((item, index) => { if (item.didgroup === "教职工人数") { // 教职工人数 allNum = Number(newData[index].total); let TeachingStaffNumber = document.querySelector("#TeachingStaffNumber"); - var numberArr = (newData[index].total).split(""); + var numberArr = (newData[index].total + "").split(""); numberArr.map((item) => { TeachingStaffNumber.innerHTML += `