$(function () { var loadingHtml = `
` var switchTime = "all" let l1xueduan = "0" let l1Type = "teacher" l1(l1xueduan, l1Type, switchTime); l2(switchTime) let r1_xueduan = "0" let c2_peple = "teacher" let r2Type = 1 let c2Type = 0 let c1xueduan = "0" let l3xueduan = "0" // let l1Type = 1 // l1(l1Type, switchTime); // l2_paihang("4") // c1(); // c2(c2Type, switchTime); // c2_huizong(c2Type, switchTime); r2_jspaihang(r2Type, switchTime) r2_jgpaihang(r2Type, switchTime) $('body').on('click', '#switch_day', function (e) { switchTime = "day" $('.switch-time').children().removeClass("act") $('#switch_day').addClass("act") l1(l1xueduan, l1Type, switchTime); l2(switchTime) l3(l3xueduan, switchTime) c1(c1xueduan, switchTime) c2(c2_peple, switchTime); C2B(switchTime, c2Type) r1(r1_xueduan, switchTime); r2_jspaihang(r2Type, switchTime); r2_jgpaihang(r2Type, switchTime); }) $('body').on('click', '#switch_month', function (e) { switchTime = "month" $('.switch-time').children().removeClass("act") $('#switch_month').addClass("act") l1(l1xueduan, l1Type, switchTime); l2(switchTime) l3(l3xueduan, switchTime) c1(c1xueduan, switchTime) c2(c2_peple, switchTime); C2B(switchTime, c2Type) r1(r1_xueduan, switchTime); r2_jspaihang(r2Type, switchTime); r2_jgpaihang(r2Type, switchTime); }) $('body').on('click', '#switch_all', function (e) { switchTime = "all" $('.switch-time').children().removeClass("act") $('#switch_all').addClass("act") l1(l1xueduan, l1Type, switchTime); l2(switchTime) l3(l3xueduan, switchTime) c1(c1xueduan, switchTime) c2(c2_peple, switchTime); C2B(switchTime, c2Type) r1(r1_xueduan, switchTime); r2_jspaihang(r2Type, switchTime); r2_jgpaihang(r2Type, switchTime); }) // 资源建设情况监测 $('#hdktfw').on('change', function () { l1xueduan = $(this).val() + "" l1(l1xueduan, l1Type, switchTime); }) $('body').on('click', '#l1_hdkt', function (e) { l1Type = "teacher" $('#l1_xuezhi a').removeClass("act") $('#l1_hdkt').addClass("act") l1(l1xueduan, l1Type, switchTime); }) $('body').on('click', '#l1_lxxt', function (e) { l1Type = "student" $('#l1_xuezhi a').removeClass("act") $('#l1_lxxt').addClass("act") l1(l1xueduan, l1Type, switchTime); }) function l1(xueduan, type, time) { let query_id = "org_" + type + "_login_num_" + time var myChart = echarts.init(document.getElementById('l1')); // 各阶段学校数量 myChart.showLoading(chartsLoadindStyle); if (time == "all") { query_param = [xueduan, xueduan] } else if (time == "month") { query_param = [xueduan, xueduan, nowYear] } else if (time == "day") { query_param = [xueduan, xueduan, nowYear, nowMonth] } let serviceName = "" if (type == "teacher") { serviceName = "互动课堂" } else if (type == "student") { serviceName = "理想学堂" } axios({ ...axiosConf, data: { "access_token": "TSKP##20211130104505##a6ce11eab94df48a6ce11eab", "query": { "query_id": query_id, "query_param": query_param }, "query_cache": 0, "query_count": [ "total" ], "query_format": "echarts", "query_group": [ "org_name" ] } }).then((res) => { const resport = res.data; const resData = JSON.parse(resport.result) let seriesData = [] let legendName = [] let xAxisName = [] let data = [] let dataZoom = [ { type: "slider",   //slider:滑块  inside:内置,依靠鼠标滚轮或者双击缩放 xAxisIndex: 0,   //显示x轴滑块 height: "15px", end: 80, top: "85%" } ] if (!resData.datas) { legendName = [] myChart.showLoading(chartsLoadindNodataStyle); myChart.clear() dataZoom = [{ show: false }] } else { xAxisName = resData.groups[0].map((e, i) => { return e.replace("唐山市", "") }) legendName = resData.groups[1] myChart.hideLoading(); data = resData.datas[0] } option = { // height: "100px", tooltip: { trigger: 'axis', axisPointer: { type: 'cross', crossStyle: { color: '#999' } } }, textStyle: { color: '#01DFF4' }, grid: { top: 50, bottom: 65, right: 20 }, color: ["#0BCAEA", "#FE8E3A", "#3FDB94", "#4992FF", "#FF6E76"], legend: { data: legendName, top: 20, right: 10, itemWidth: 8, itemHeight: 8, textStyle: { color: '#01DFF4' }, formatter: "{name}(人次)" }, xAxis: [ { type: 'category', data: xAxisName, axisLine: { lineStyle: { color: '#01DFF4' //更改坐标轴颜色 } }, axisLabel: { interval: 0, textStyle: { color: '#ffffff' }, fontSize: 9, rotate: "35" }, }, ], yAxis: [ { type: 'value', axisLine: { lineStyle: { color: '#01DFF4' //更改坐标轴颜色 } }, splitLine: {//分割线配置 lineStyle: { color: "#00ffff50", } }, axisLabel: { color: "white" } }, ], dataZoom: dataZoom, series: { name: serviceName, type: 'bar', stack: 'total', barMaxWidth: 18, data: data } }; // 使用刚指定的配置项和数据显示图表。 myChart.setOption(option); }).catch(() => { legendName = [] myChart.showLoading(chartsLoadindNodataStyle); myChart.clear() dataZoom = [{ show: false }] }) window.addEventListener("resize", function () { myChart.resize(); }); } function l2(time) { var danwei = "" if (time == "all") { query_param = [] query_group = ["year_name"] danwei = "年" } else if (time == "month") { query_param = [nowYear] query_group = ["month_name"] danwei = "月" } else if (time == "day") { query_param = [nowYear, nowMonth] query_group = ["day_name"] danwei = "日" } var myChart = echarts.init(document.getElementById('l2')); // 各阶段学校数量 myChart.showLoading(chartsLoadindStyle); axios({ ...axiosConf, data: { "access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab", "query": { "query_id": "teacher_student_login_num_" + time, "query_param": query_param }, "query_cache": 0, "query_count": [ "total", "total2" ], "query_format": "echarts", "query_group": query_group } }).then((res) => { const resport = res.data; const resData = JSON.parse(resport.result) let xAxisData = [] let data1 = [] let data2 = [] if (!resData.datas) { myChart.showLoading(chartsLoadindNodataStyle); myChart.clear() } else { xAxisData = resData.groups[0] data1 = resData.datas data2 = resData.datas2 myChart.hideLoading(); } option = { // height: "100px", tooltip: { trigger: 'axis', axisPointer: { type: 'cross', crossStyle: { color: '#999' } } }, textStyle: { color: '#01DFF4' }, grid: { top: 20, bottom: 40, right: 25 }, color: ["#fcff00", "#01f0ff"], legend: { textStyle: { color: '#01DFF4' }, formatter: "{name}(人次)" }, xAxis: [ { name: danwei, nameTextStyle: { padding: [0, 0, 0, -10] // 四个数字分别为上右下左与原位置距离 }, type: 'category', data: xAxisData, axisLine: { lineStyle: { color: '#01DFF4' //更改坐标轴颜色 } }, axisLabel: { color: "white", }, splitLine: {//分割线配置 lineStyle: { color: "rgba(219,225,255,1)", } } }, ], yAxis: [ { type: 'value', axisLine: { lineStyle: { color: '#01DFF4' //更改坐标轴颜色 } }, splitLine: {//分割线配置 lineStyle: { color: "#00ffff50", } }, axisLabel: { color: "white", formatter: "{value}人" } } ], series: [ { name: "教师", type: 'line', areaStyle: { color: { type: 'linear', x: 0, y: 0, x2: 0, y2: 1, colorStops: [{ offset: 0, color: '#fcff00' // 100% 处的颜色 }, { offset: 1, color: '#fcff0000' // 0% 处的颜色 }], global: false // 缺省为 false } }, data: data1[0], smooth: true }, { name: "学生", type: 'line', areaStyle: { color: { type: 'linear', x: 0, y: 0, x2: 0, y2: 1, colorStops: [{ offset: 0, color: '#01f0ff' // 100% 处的颜色 }, { offset: 1, color: '#01f0ff00' // 0% 处的颜色 }], global: false // 缺省为 false } }, data: data2[0], smooth: true } ] }; // 使用刚指定的配置项和数据显示图表。 myChart.setOption(option); }).catch(() => { myChart.showLoading(chartsLoadindNodataStyle); myChart.clear() }) window.addEventListener("resize", function () { myChart.resize(); }); } $('#l3_xueduan').on('change', function () { l3xueduan = $(this).val() + "" l3(l3xueduan, switchTime) }) l3(l3xueduan, switchTime) function l3(xueduan, time) { if (time == "all" || time == "month") { query_id = "student_use_num_year" query_param = [xueduan, xueduan, nowYear, xueduan, xueduan, xueduan, xueduan, nowYear, xueduan, xueduan, xueduan, xueduan, nowYear, xueduan, xueduan, xueduan, xueduan, nowYear, xueduan, xueduan, xueduan, xueduan, nowYear, xueduan, xueduan] } else if (time == "day") { query_id = "student_use_num_month" query_param = [xueduan, xueduan, nowYear, nowMonth, xueduan, xueduan, xueduan, xueduan, nowYear, nowMonth, xueduan, xueduan, xueduan, xueduan, nowYear, nowMonth, xueduan, xueduan, xueduan, xueduan, nowYear, nowMonth, xueduan, xueduan, xueduan, xueduan, nowYear, nowMonth, xueduan, xueduan] } axios({ ...axiosConf, data: { "access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab", "query": { "query_id": query_id, "query_param": query_param }, "query_cache": 0, "query_count": [ "total" ], "query_format": "json", "query_group": [ "subname", "item" ] } }).then((response) => { const resData = JSON.parse(response.data.result) resData.map((e, index) => { switch (e.no) { case 1: $("#kttiwenmonth").html(e.total) break; case 2: $("#kttiwentotal").html(e.total) break; case 3: $("#ktqiangdamonth").html(e.total) break; case 4: $("#ktqiangdatotal").html(e.total) break; case 5: $("#kttoupiaomonth").html(e.total) break; case 6: $("#kttoupiaototal").html(e.total) break; case 7: $("#kttupianmonth").html(e.total) break; case 8: $("#kttupiantotal").html(e.total) break; case 9: $("#ktnowtotal").html(e.total) break; case 10: $("#kttotal").html(e.total) break; default: break; } }) }).catch(() => { }) } $('#c1_xueduan').on('change', function () { c1xueduan = $(this).val() + "" c1(c1xueduan, switchTime) }) c1(c1xueduan, switchTime) function formatSeconds(value) { var theTime = parseInt(value);// 秒 var theTime1 = 0;// 分 var theTime2 = 0;// 小时 // alert(theTime); if (theTime > 60) { theTime1 = parseInt(theTime / 60); theTime = parseInt(theTime % 60); // alert(theTime1+"-"+theTime); if (theTime1 > 60) { theTime2 = parseInt(theTime1 / 60); theTime1 = parseInt(theTime1 % 60); } } var result = ""; if (theTime1 > 0) { result = "" + parseInt(theTime1) + "分" + result; } if (theTime2 > 0) { result = "" + parseInt(theTime2) + "小时" + result; } return result; } function c1(xueduan, time = "all") { if (time == "all" || time == "month") { query_id = "stage_interact_res_num_year" query_param = [xueduan, xueduan, nowYear, xueduan, xueduan, xueduan, xueduan, nowYear, xueduan, xueduan, xueduan, xueduan, nowYear, xueduan, xueduan, xueduan, xueduan, nowYear, xueduan, xueduan] $(".hdktname1").html("本年") $(".hdktname2").html("总量") } if (time == "day") { query_id = "stage_interact_res_num_month" query_param = [xueduan, xueduan, nowYear, nowMonth, xueduan, xueduan, xueduan, xueduan, nowYear, nowMonth, xueduan, xueduan, xueduan, xueduan, nowYear, nowMonth, xueduan, xueduan, xueduan, xueduan, nowYear, nowMonth, xueduan, xueduan] $(".hdktname1").html("本月") $(".hdktname2").html("总量") } axios({ ...axiosConf, data: { "access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab", "query": { "query_id": query_id, "query_param": query_param }, "query_cache": 0, "query_count": [ "total" ], "query_format": "json", "query_group": [ "subname", "item" ] } }).then((res) => { const resport = res.data; const data = JSON.parse(resport.result); let html = "" console.log(data, 'c1'); total1 = 0 total2 = 0 data.map((e, i) => { if (e.item.indexOf("本") > -1) { total1 += Number(e.total) } if (e.item.indexOf("总") > -1) { total2 += Number(e.total) } switch (e.no) { case 1: $("#ktzx1num").html(e.total != 0 ? formatSeconds(e.total) : 0) break; case 2: $("#ktzx2num").html(e.total != 0 ? formatSeconds(e.total) : 0) break; case 3: $("#xtzx1num").html(e.total != 0 ? formatSeconds(e.total) : 0) break; case 4: $("#xtzx2num").html(e.total != 0 ? formatSeconds(e.total) : 0) break; case 5: $("#yysc1num").html(e.total != 0 ? formatSeconds(e.total) : 0) break; case 6: $("#yysc2num").html(e.total != 0 ? formatSeconds(e.total) : 0) break; case 7: $("#kthd1num").html(e.total != 0 ? formatSeconds(e.total) : 0) break; case 8: $("#kthd2num").html(e.total != 0 ? formatSeconds(e.total) : 0) break; default: break; } }) $("#hdkttotal1").html(total1 ? formatSeconds(total1) : total1) $("#hdkttotal2").html(total2 ? formatSeconds(total2) : total2) }).catch(() => { }) } c2(c2_peple, switchTime); function c2(peple, time) { var myChart = echarts.init(document.getElementById('c3')); // 各阶段学校数量 myChart.showLoading(chartsLoadindStyle); if (time === "all") { query_param = [] } else if (time === "month") { query_id = "social_topic_chart_month" query_param = [nowYear, nowYear, nowYear, nowYear, nowYear] } else if (time === "day") { query_id = "social_topic_chart_day" query_param = [nowYear, nowMonth, nowYear, nowMonth, nowYear, nowMonth, nowYear, nowMonth, nowYear, nowMonth,] } console.log(peple, time, { "access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab", "query": { "query_id": peple + "_use_chart_" + time, "query_param": query_param }, "query_cache": 0, "query_count": [ "total" ], "query_format": "echarts", "query_group": [ "item" ] }); axios({ ...axiosConf, data: { "access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab", "query": { "query_id": peple + "_use_chart_" + time, "query_param": query_param }, "query_cache": 0, "query_count": [ "total" ], "query_format": "echarts", "query_group": [ "item" ] } }).then((response) => { console.log(response, 'resData1'); const resData = JSON.parse(response.data.result) let pieData = [] let legendData = [] let a = [] if (!resData.datas) { myChart.showLoading(chartsLoadindNodataStyle); myChart.clear() } else { resData.groups[0].map((e, i) => { pieData.push({ name: e, value: resData.datas[0][i] }) }) legendData = resData.groups[0] myChart.hideLoading(); } option = { // height: "100px", tooltip: { trigger: 'item' }, color: ["#0BCAEA", "#FE8E3A", "#3FDB94"], legend: { data: legendData, itemWidth: 8, itemHeight: 8, right: 40, top: 40, orient: "vertical", textStyle: { color: '#01DFF4' }, }, color: ["#e1e600", "#FE8E3A", "#3FDB94", "#4992FF", "#FF6E76"], series: [ { type: 'pie', radius: '50%', data: pieData, selectedMode: 'single', center: ['35%', '50%'], }, ] }; // 使用刚指定的配置项和数据显示图表。 myChart.setOption(option); myChart.on('click', function (param) { //param.name x轴值,param.data y轴值 c2Type = param.dataIndex C2B(switchTime, param.dataIndex) }); }).catch(() => { myChart.showLoading(chartsLoadindNodataStyle); myChart.clear() }) window.addEventListener("resize", function () { myChart.resize(); }); } C2B(switchTime, c2Type) function C2B(time, type) { var myChart = echarts.init(document.getElementById('c4')); // 各阶段学校数量 myChart.showLoading(chartsLoadindStyle); if (time === "all") { query_param = [] query_group = ["year_name"] danwei = "年" } else if (time === "month") { query_param = [nowYear] query_group = ["month_name"] danwei = "月" } else if (time === "day") { query_param = [nowYear, nowMonth] query_group = ["day_name"] danwei = "日" } console.log({ "access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab", "query": { "query_id": "teacher_use_num_" + time, "query_param": query_param }, "query_cache": 0, "query_count": [ "total", "total2", "total3", "total4", "total5" ], "query_format": "echarts", "query_group": query_group }, "c2json" ); axios({ ...axiosConf, data: { "access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab", "query": { "query_id": "teacher_use_num_" + time, "query_param": query_param }, "query_cache": 0, "query_count": [ "total", "total2", "total3", "total4", "total5" ], "query_format": "echarts", "query_group": query_group } }).then((response) => { const resData = JSON.parse(response.data.result) console.log(resData, 'c2'); let series = {} let name = "" let xAxisName = [] if (!resData.datas) { name = "" series = { name: name, type: 'line', data: [] } xAxisName = [] myChart.showLoading(chartsLoadindNodataStyle); } else { xAxisName = resData.groups[0] switch (type) { case 0: name = '提问' series = { name: name, type: 'line', data: resData.datas[0] } break; case 1: name = '投票' series = { name: name, type: 'line', data: resData.datas2[0] } break; case 2: name = '抢答' series = { name: name, type: 'line', data: resData.datas3[0] } break; case 3: name = '图片分享' series = { name: name, type: 'line', data: resData.datas4[0] } break; case 4: name = '收集图片' series = { name: name, type: 'line', data: resData.datas5[0] } break; default: break; } myChart.hideLoading(); } option = { // height: "100px", tooltip: { trigger: 'axis', axisPointer: { type: 'cross', crossStyle: { color: '#999' } } }, textStyle: { color: '#01DFF4' }, grid: { right: 30, top: 25, bottom: 30, }, color: ["#0BCAEA", "#FE8E3A", "#3FDB94"], title: { show: true, left: 'center', text: name, textStyle: { fontSize: 16, color: "white", } }, xAxis: [ { name: danwei, nameTextStyle: { padding: [0, 0, 0, -10] // 四个数字分别为上右下左与原位置距离 }, type: 'category', data: xAxisName, axisLine: { lineStyle: { color: '#01DFF4' //更改坐标轴颜色 } }, axisLabel: { rotate: 30, fontSize: 10 }, }, ], yAxis: [ { type: 'value', axisLine: { lineStyle: { color: '#01DFF4' //更改坐标轴颜色 } }, splitLine: {//分割线配置 lineStyle: { color: "#00ffff50", } }, axisLabel: { color: "white" } } ], // dataZoom: [ // { // type: "slider",   //slider:滑块  inside:内置,依靠鼠标滚轮或者双击缩放 // xAxisIndex: 0,   //显示x轴滑块 // height: "15px", // end: 80, // top: "90%" // } // ], series: series }; // 使用刚指定的配置项和数据显示图表。 myChart.setOption(option); }).catch(() => { name = "" series = { name: name, type: 'line', data: [] } xAxisName = [] myChart.showLoading(chartsLoadindNodataStyle); }) window.addEventListener("resize", function () { myChart.resize(); }); } $('#r1_xueduan').on('change', function () { r1_xueduan = $(this).val() + "" r1(r1_xueduan, switchTime); }) r1(r1_xueduan, switchTime); function r1(xueduan, time) { var myChart = echarts.init(document.getElementById('r1')); // 各阶段学校数量 myChart.showLoading(chartsLoadindStyle); if (time === "all") { query_id = "stage_org_social_all" query_param = [xueduan, xueduan] } else if (time === "month") { query_id = "stage_org_social_month" query_param = [xueduan, xueduan, nowYear] } else if (time === "day") { query_id = "stage_org_social_day" query_param = [xueduan, xueduan, nowYear, nowMonth] } axios({ ...axiosConf, data: { "access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab", "query": { "query_id": "teacher_class_time_" + time, "query_param": query_param }, "query_cache": 0, "query_count": [ "total" ], "query_format": "echarts", "query_group": [ "org_name" ] } }) .then((response) => { const resData = JSON.parse(response.data.result) let xAxisName = [] let legendData = [] let datas = [] let dataZoom = [ { type: "slider",   //slider:滑块  inside:内置,依靠鼠标滚轮或者双击缩放 xAxisIndex: 0,   //显示x轴滑块 height: "14px", end: 80, top: "87%" } ] if (!resData.datas) { myChart.showLoading(chartsLoadindNodataStyle); myChart.clear() dataZoom = { show: false } } else { xAxisName = resData.groups[0].map((e, i) => { return e.replace("唐山市", "") }) legendData = resData.groups[1] // resData.datas[0] datas = resData.datas[0].map((e, i) => { return Math.floor(e / 60 / 60) }) myChart.hideLoading(); } option = { // height: "100px", tooltip: { trigger: 'axis', axisPointer: { type: 'cross', crossStyle: { color: '#999' } }, formatter: "{c}小时" }, textStyle: { color: '#01DFF4' }, grid: { top: 55, bottom: 85, right: 10, left: 80 }, color: ["#0BCAEA", "#FE8E3A", "#3FDB94", "#4992FF", "#FF6E76"], legend: { data: legendData, top: 15, right: 10, itemWidth: 8, itemHeight: 8, textStyle: { color: '#01DFF4' }, formatter: "{name}(小时)" }, xAxis: [ { type: 'category', data: xAxisName, axisLine: { lineStyle: { color: '#01DFF4' //更改坐标轴颜色 } }, axisLabel: { interval: 0, fontSize: 10, rotate: "35", color: 'white', }, }, ], yAxis: [ { type: 'value', axisLine: { lineStyle: { color: '#01DFF4' //更改坐标轴颜色 } }, splitLine: {//分割线配置 lineStyle: { color: "#00ffff50", } }, axisLabel: { color: "white", formatter: "{value}小时" }, }, { type: 'value', axisLine: { lineStyle: { color: '#01DFF4' //更改坐标轴颜色 } } } ], dataZoom: dataZoom, series: { name: "互动课堂", type: 'bar', stack: "all", data: datas, barMaxWidth: 40, } }; // 使用刚指定的配置项和数据显示图表。 myChart.setOption(option); }).catch(() => { myChart.showLoading(chartsLoadindNodataStyle); myChart.clear() dataZoom = { show: false } }) window.addEventListener("resize", function () { myChart.resize(); }); } $('body').on('click', '#r2_zysc', function (e) { r2Type = 1 $('#r2_paihang').children().removeClass("act") $('#r2_zysc').addClass("act") r2_jspaihang(r2Type, switchTime) r2_jgpaihang(r2Type, switchTime) }) $('body').on('click', '#r2_zyxz', function (e) { r2Type = 2 $('#r2_paihang').children().removeClass("act") $('#r2_zyxz').addClass("act") r2_jspaihang(r2Type, switchTime) r2_jgpaihang(r2Type, switchTime) }) // 学科资源共建共享排行榜 function r2_jspaihang(type = 1, time = "all") { $("#gjgx_js_paihang").html(loadingHtml) $("#gjgx_jg_paihang").html(loadingHtml) let params = {} if (time == "all") { query_id = "teacher_use_top_all" query_param = [] } else if (time == "month") { query_id = "teacher_use_top_month" query_param = [nowYear] } else if (time == "day") { query_id = "teacher_use_top_day" query_param = [nowYear, nowMonth] } axios({ ...axiosConf, data: { "access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab", "query": { "query_id": "teacher_use_top_" + time, "query_param": query_param }, "query_cache": 0, "query_count": [ "total" ], "query_format": "json", "query_group": [ "person_name", "org_name" ] } }).then((res) => { const resport = res.data; if (resport.result == "") { $("#gjgx_js_paihang").html(`
暂无数据
`); return } const data = JSON.parse(resport.result); let html = "" data.map((item, index) => { if (type == 1) { total = item.upload_total } else if (type == 2) { total = item.download_total } html += `
${item.person_name}

${item.org_name}

${item.total}
当前累计
` }) $("#gjgx_js_paihang").html(html) }).catch(() => { $("#gjgx_js_paihang").html(`
暂无数据
`); return }) } function r2_jgpaihang(type = 1, time = "year") { if (time === "all") { query_param = [] query_param1 = [] } else if (time === "month") { query_param = [nowYear, nowYear] query_param1 = [nowYear] } else if (time === "day") { query_param = [nowYear, nowMonth] query_param1 = [nowYear, nowMonth, nowYear, nowMonth] } axios.all([ axios({ ...axiosConf, data: { "access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab", "query": { "query_id": "org_use_top_" + time, "query_param": query_param }, "query_cache": 0, "query_count": [ "total" ], "query_format": "json", "query_group": [ "org_name" ] } }), axios({ ...axiosConf, data: { "access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab", "query": { "query_id": "org_use_top_total_" + time, "query_param": query_param1 }, "query_cache": 0, "query_count": [ "total" ], "query_format": "json", "query_group": [ "org_name" ] } }) ]).then(axios.spread(function (orgUseTopNum, orgUsUopTotalNum) { if (orgUseTopNum.data.success === false || orgUseTopNum.data.result === "") { $("#gjgx_jg_paihang").html(`
暂无数据
`); return } const orgUserTop = JSON.parse(orgUseTopNum.data.result) const orgUsUopTotal = JSON.parse(orgUsUopTotalNum.data.result) console.log(orgUserTop, orgUsUopTotal); let school = [] orgUserTop.map((item) => { school.push({ name: item.org_name }); }) // 去重 schoolFil = school.filter((item, index) => { return school.findIndex(_item => _item.name == item.name) == index; }) schoolFil.map((e) => { e.children = [] orgUserTop.map((item) => { if (item.org_name == e.name) { e.children.push({ item: item.item, total: item.total }) } }) orgUsUopTotal.map((item) => { if (item.org_name == e.name) { e.total = item.total } }) }) let html = "" schoolFil.map((item, index) => { html += `
${item.name}
${item.children[0].total}投票
${item.children[1].total}收集
${item.children[2].total}提问
${item.children[3].total}抢答
${item.children[4].total}分享
${item.total}
` }) $("#gjgx_jg_paihang").html(html); })).catch(() => { $("#gjgx_jg_paihang").html(`
暂无数据
`); return }) } })