|
|
@ -1,271 +1,281 @@
|
|
|
|
import React,{ Component } from "react";
|
|
|
|
import React,{ Component } from "react";
|
|
|
|
import axios from 'axios';
|
|
|
|
import axios from 'axios';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const $ = window.$;
|
|
|
|
const $ = window.$;
|
|
|
|
const echarts = require('echarts');
|
|
|
|
const echarts = require('echarts');
|
|
|
|
function InitShixunStudyStatistics(yAxisMonth_a, barData_a, mapByNumber, myChart){
|
|
|
|
function InitShixunStudyStatistics(yAxisMonth_a, barData_a, mapByNumber, myChart){
|
|
|
|
let yAxisMonth = yAxisMonth_a
|
|
|
|
let yAxisMonth = yAxisMonth_a
|
|
|
|
// [
|
|
|
|
// [
|
|
|
|
// "1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "3-1",
|
|
|
|
// "1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "3-1",
|
|
|
|
// "1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "3-1",
|
|
|
|
// "1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "3-1",
|
|
|
|
// "1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "3-1", "3-2"];
|
|
|
|
// "1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "3-1", "3-2"];
|
|
|
|
let barData = barData_a
|
|
|
|
let barData = barData_a
|
|
|
|
// [
|
|
|
|
// [
|
|
|
|
// 1164, 739, 784, 720, 726, 556, 381, 432,
|
|
|
|
// 1164, 739, 784, 720, 726, 556, 381, 432,
|
|
|
|
// 1164, 739, 784, 720, 726, 556, 381, 432,
|
|
|
|
// 1164, 739, 784, 720, 726, 556, 381, 432,
|
|
|
|
// 1164, 739, 784, 720, 726, 556, 381, 432, 239];
|
|
|
|
// 1164, 739, 784, 720, 726, 556, 381, 432, 239];
|
|
|
|
|
|
|
|
|
|
|
|
// let yAxisMonth = yAxisMonth_a;
|
|
|
|
// let yAxisMonth = yAxisMonth_a;
|
|
|
|
// let barData = barData_a;
|
|
|
|
// let barData = barData_a;
|
|
|
|
|
|
|
|
|
|
|
|
let barDataTwo = [];
|
|
|
|
let barDataTwo = [];
|
|
|
|
let coordData2 = [];
|
|
|
|
let coordData2 = [];
|
|
|
|
let coordData = [];
|
|
|
|
let coordData = [];
|
|
|
|
for (let i = 0; i < barData.length; i++) {
|
|
|
|
for (let i = 0; i < barData.length; i++) {
|
|
|
|
barDataTwo.push(Math.max.apply(Math, barData) + 5000);
|
|
|
|
barDataTwo.push(Math.max.apply(Math, barData) + 5000);
|
|
|
|
coordData.push({
|
|
|
|
coordData.push({
|
|
|
|
"coord": [Number(barData[i]) - 1, i]
|
|
|
|
"coord": [Number(barData[i]) - 1, i]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
coordData2.push({
|
|
|
|
coordData2.push({
|
|
|
|
"coord": [Math.max.apply(Math, barData) + 5000, i]
|
|
|
|
"coord": [Math.max.apply(Math, barData) + 5000, i]
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var option = {
|
|
|
|
var option = {
|
|
|
|
backgroundColor: "#fff",
|
|
|
|
backgroundColor: "#fff",
|
|
|
|
title: {
|
|
|
|
title: {
|
|
|
|
text: ''
|
|
|
|
text: ''
|
|
|
|
},
|
|
|
|
},
|
|
|
|
legend: null,
|
|
|
|
legend: null,
|
|
|
|
tooltip: {
|
|
|
|
tooltip: {
|
|
|
|
trigger: 'axis',
|
|
|
|
trigger: 'axis',
|
|
|
|
axisPointer: {
|
|
|
|
axisPointer: {
|
|
|
|
type: 'none'
|
|
|
|
type: 'none'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
formatter: function(params) {
|
|
|
|
formatter: function(params) {
|
|
|
|
return params[0].name + ":" + (mapByNumber[params[0].name] && mapByNumber[params[0].name].shixun_name) + "<br/>" + '学习人数: ' + params[0].value;
|
|
|
|
return params[0].name + ":" + (mapByNumber[params[0].name] && mapByNumber[params[0].name].shixun_name) + "<br/>" + '学习人数: ' + params[0].value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
grid: {
|
|
|
|
grid: {
|
|
|
|
containLabel: true,
|
|
|
|
containLabel: true,
|
|
|
|
left: "30px",
|
|
|
|
left: "30px",
|
|
|
|
top: "0",
|
|
|
|
top: "0",
|
|
|
|
bottom:"10px"
|
|
|
|
bottom:"10px"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
yAxis: [{
|
|
|
|
yAxis: [{
|
|
|
|
data: yAxisMonth,
|
|
|
|
data: yAxisMonth,
|
|
|
|
inverse: true,
|
|
|
|
inverse: true,
|
|
|
|
axisLine: {
|
|
|
|
axisLine: {
|
|
|
|
show: false
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
},
|
|
|
|
axisTick: {
|
|
|
|
axisTick: {
|
|
|
|
show: false
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
},
|
|
|
|
axisLabel: {
|
|
|
|
axisLabel: {
|
|
|
|
margin: 10,
|
|
|
|
margin: 10,
|
|
|
|
textStyle: {
|
|
|
|
textStyle: {
|
|
|
|
fontSize: 12,
|
|
|
|
fontSize: 12,
|
|
|
|
color: '#747A7F'
|
|
|
|
color: '#747A7F'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
formatter: function(value) {
|
|
|
|
formatter: function(value) {
|
|
|
|
return '{Sunny|' + value + '}';
|
|
|
|
return '{Sunny|' + value + '}';
|
|
|
|
},
|
|
|
|
},
|
|
|
|
rich: {
|
|
|
|
rich: {
|
|
|
|
value: {
|
|
|
|
value: {
|
|
|
|
lineHeight: 20
|
|
|
|
lineHeight: 20
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Sunny: {
|
|
|
|
Sunny: {
|
|
|
|
height: 25,
|
|
|
|
height: 25,
|
|
|
|
padding: [0, 8, 0, 8],
|
|
|
|
padding: [0, 8, 0, 8],
|
|
|
|
align: 'center',
|
|
|
|
align: 'center',
|
|
|
|
backgroundColor: '#fff'
|
|
|
|
backgroundColor: '#fff'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},{
|
|
|
|
},{
|
|
|
|
data: yAxisMonth,
|
|
|
|
data: yAxisMonth,
|
|
|
|
inverse: true,
|
|
|
|
inverse: true,
|
|
|
|
axisLine: {
|
|
|
|
axisLine: {
|
|
|
|
show: false
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
},
|
|
|
|
axisTick: {
|
|
|
|
axisTick: {
|
|
|
|
show: false
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
},
|
|
|
|
axisLabel: {
|
|
|
|
axisLabel: {
|
|
|
|
show: false
|
|
|
|
show: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
xAxis: [{
|
|
|
|
xAxis: [{
|
|
|
|
type: "value",
|
|
|
|
type: "value",
|
|
|
|
splitLine: {
|
|
|
|
splitLine: {
|
|
|
|
show: false
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
},
|
|
|
|
axisLabel: {
|
|
|
|
axisLabel: {
|
|
|
|
show: false
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
},
|
|
|
|
axisTick: {
|
|
|
|
axisTick: {
|
|
|
|
show: false
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
},
|
|
|
|
axisLine: {
|
|
|
|
axisLine: {
|
|
|
|
show: false
|
|
|
|
show: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
type: "value",
|
|
|
|
type: "value",
|
|
|
|
splitLine: {
|
|
|
|
splitLine: {
|
|
|
|
show: false
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
},
|
|
|
|
axisLabel: {
|
|
|
|
axisLabel: {
|
|
|
|
show: false
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
},
|
|
|
|
axisTick: {
|
|
|
|
axisTick: {
|
|
|
|
show: false
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
},
|
|
|
|
axisLine: {
|
|
|
|
axisLine: {
|
|
|
|
show: false
|
|
|
|
show: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}],
|
|
|
|
}],
|
|
|
|
series: [{
|
|
|
|
series: [{
|
|
|
|
z: 10,
|
|
|
|
z: 10,
|
|
|
|
xAxisIndex: 0,
|
|
|
|
xAxisIndex: 0,
|
|
|
|
yAxisIndex: 0,
|
|
|
|
yAxisIndex: 0,
|
|
|
|
name: '',
|
|
|
|
name: '',
|
|
|
|
type: 'pictorialBar',
|
|
|
|
type: 'pictorialBar',
|
|
|
|
data: barData,
|
|
|
|
data: barData,
|
|
|
|
barCategoryGap: '90%',
|
|
|
|
barCategoryGap: '90%',
|
|
|
|
label: {
|
|
|
|
label: {
|
|
|
|
normal: {
|
|
|
|
normal: {
|
|
|
|
show: true,
|
|
|
|
show: true,
|
|
|
|
position: 'inside',
|
|
|
|
position: 'inside',
|
|
|
|
textStyle: {
|
|
|
|
textStyle: {
|
|
|
|
fontSize: 12,
|
|
|
|
fontSize: 12,
|
|
|
|
color: '#666'
|
|
|
|
color: '#666'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
symbolRepeat: false,
|
|
|
|
symbolRepeat: false,
|
|
|
|
symbolSize: ['100%', 25],
|
|
|
|
symbolSize: ['100%', 25],
|
|
|
|
symbolOffset: [-16.5, 0],
|
|
|
|
symbolOffset: [-16.5, 0],
|
|
|
|
itemStyle: {
|
|
|
|
itemStyle: {
|
|
|
|
normal: {
|
|
|
|
normal: {
|
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
|
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
|
|
|
|
offset: 0,
|
|
|
|
offset: 0,
|
|
|
|
color: '#FFD86E'
|
|
|
|
color: '#FFD86E'
|
|
|
|
}], false),
|
|
|
|
}], false),
|
|
|
|
borderRadius:'10'
|
|
|
|
borderRadius:'10'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
symbolClip: true,
|
|
|
|
symbolClip: true,
|
|
|
|
symbolPosition: 'end',
|
|
|
|
symbolPosition: 'end',
|
|
|
|
symbol: 'rect'
|
|
|
|
symbol: 'rect'
|
|
|
|
}]
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
};
|
|
|
|
myChart.setOption(option);
|
|
|
|
myChart.setOption(option);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
class SecondTab extends Component{
|
|
|
|
class SecondTab extends Component{
|
|
|
|
constructor(props){
|
|
|
|
constructor(props){
|
|
|
|
super(props);
|
|
|
|
super(props);
|
|
|
|
this.state = {
|
|
|
|
this.state = {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount(){
|
|
|
|
componentDidMount(){
|
|
|
|
var pathId = this.props.match.params.pathId;
|
|
|
|
var pathId = this.props.match.params.pathId;
|
|
|
|
|
|
|
|
|
|
|
|
var myCharts = echarts.init(document.getElementById('showloding'));
|
|
|
|
var myChart = echarts.init(document.getElementById('shixunStudyStatistics'));
|
|
|
|
myCharts.showLoading({
|
|
|
|
myChart.showLoading({
|
|
|
|
text: "数据获取中",
|
|
|
|
text: "数据获取中",
|
|
|
|
effect: 'whirling'
|
|
|
|
effect: 'whirling'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
const url = `/paths/${pathId}/shixun_report.json`
|
|
|
|
const url = `/paths/${pathId}/shixun_report.json`
|
|
|
|
axios.get(url, {
|
|
|
|
axios.get(url, {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.then((response) => {
|
|
|
|
.then((response) => {
|
|
|
|
// TODO 没用,404返回的error
|
|
|
|
// TODO 没用,404返回的error
|
|
|
|
if (response.data.status == 404) {
|
|
|
|
if (response.data.status == 404) {
|
|
|
|
this.props.showSnackbar('未找到对应数据,请查看地址是否正确。')
|
|
|
|
this.props.showSnackbar('未找到对应数据,请查看地址是否正确。')
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
let yAxisMonth = ["1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "3-1", "3-2"];
|
|
|
|
let yAxisMonth = ["1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "3-1", "3-2"];
|
|
|
|
let barData = [1164, 739, 784, 720, 726, 556, 381, 432, 239];
|
|
|
|
let barData = [1164, 739, 784, 720, 726, 556, 381, 432, 239];
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"number": "6-1",
|
|
|
|
"number": "6-1",
|
|
|
|
"shixun_name": "网页抓取及信息提取",
|
|
|
|
"shixun_name": "网页抓取及信息提取",
|
|
|
|
"member_count": 0,
|
|
|
|
"member_count": 0,
|
|
|
|
"school_count": 0
|
|
|
|
"school_count": 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
let yAxisMonth = []
|
|
|
|
let yAxisMonth = []
|
|
|
|
let barData = []
|
|
|
|
let barData = []
|
|
|
|
let shixunList = []
|
|
|
|
let shixunList = []
|
|
|
|
let mapByNumber = {}
|
|
|
|
let mapByNumber = {}
|
|
|
|
const _data = response.data.shixun_lists.forEach( (ar, index) => {
|
|
|
|
const _data = response.data.shixun_lists.forEach( (ar, index) => {
|
|
|
|
ar.forEach( (item, itemIndex) => {
|
|
|
|
ar.forEach( (item, itemIndex) => {
|
|
|
|
shixunList.push(item)
|
|
|
|
shixunList.push(item)
|
|
|
|
yAxisMonth.push(item.number)
|
|
|
|
yAxisMonth.push(item.number)
|
|
|
|
barData.push(item.member_count)
|
|
|
|
barData.push(item.member_count)
|
|
|
|
mapByNumber[item.number] = item
|
|
|
|
mapByNumber[item.number] = item
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
this.setState({ shixunList }, () => {
|
|
|
|
this.setState({
|
|
|
|
InitShixunStudyStatistics(yAxisMonth, barData, mapByNumber, myChart);
|
|
|
|
shixunList
|
|
|
|
myChart.hideLoading()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
var myChart = echarts.init(document.getElementById('shixunStudyStatistics'));
|
|
|
|
|
|
|
|
myChart.showLoading({
|
|
|
|
|
|
|
|
text: "数据获取中",
|
|
|
|
})
|
|
|
|
effect: 'whirling'
|
|
|
|
.catch(function (error) {
|
|
|
|
})
|
|
|
|
console.log(error);
|
|
|
|
setTimeout(() => {
|
|
|
|
});
|
|
|
|
InitShixunStudyStatistics(yAxisMonth, barData, mapByNumber, myChart);
|
|
|
|
}
|
|
|
|
myCharts.hideLoading();
|
|
|
|
|
|
|
|
myChart.hideLoading();
|
|
|
|
render(){
|
|
|
|
}, 1000)
|
|
|
|
const { shixunList } = this.state;
|
|
|
|
|
|
|
|
return(
|
|
|
|
})
|
|
|
|
<div className="clearfix panelForm-2">
|
|
|
|
.catch(function (error) {
|
|
|
|
<div className="with60 pr40 fl">
|
|
|
|
console.log(error);
|
|
|
|
<div className="static_shadow edu-back-white">
|
|
|
|
});
|
|
|
|
<p className="font-24 padding30-20">实训使用详情</p>
|
|
|
|
}
|
|
|
|
<div className="minH-440" id="tableHeight">
|
|
|
|
|
|
|
|
<table className="edu-pop-table head-color edu-txt-center bor-top-greyE" cellSpacing="0" cellPadding="0">
|
|
|
|
render(){
|
|
|
|
<thead>
|
|
|
|
const { shixunList } = this.state;
|
|
|
|
<tr>
|
|
|
|
return(
|
|
|
|
<th>章节</th>
|
|
|
|
<div className="clearfix panelForm-2">
|
|
|
|
<th className="edu-txt-left" width="40%">实训名称</th>
|
|
|
|
<div className="with60 pr40 fl">
|
|
|
|
<th>学习人数</th>
|
|
|
|
<div className="static_shadow edu-back-white">
|
|
|
|
<th>受用院校</th>
|
|
|
|
<p className="font-24 padding30-20">实训使用详情</p>
|
|
|
|
</tr>
|
|
|
|
<div className="minH-440" id="tableHeight">
|
|
|
|
</thead>
|
|
|
|
<table className="edu-pop-table head-color edu-txt-center bor-top-greyE" cellSpacing="0" cellPadding="0">
|
|
|
|
<tbody>
|
|
|
|
<thead>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
{
|
|
|
|
<th>章节</th>
|
|
|
|
shixunList && shixunList.map( (shixun, index) => {
|
|
|
|
<th className="edu-txt-left" width="40%">实训名称</th>
|
|
|
|
return (
|
|
|
|
<th>学习人数</th>
|
|
|
|
<tr>
|
|
|
|
<th>受用院校</th>
|
|
|
|
<td>{shixun.number}</td>
|
|
|
|
</tr>
|
|
|
|
<td className="edu-txt-left task-hide" style={{"maxWidth":"272px"}}>{shixun.shixun_name}</td>
|
|
|
|
</thead>
|
|
|
|
<td>{shixun.member_count}</td>
|
|
|
|
<tbody>
|
|
|
|
<td className="color-blue">{shixun.school_count}</td>
|
|
|
|
|
|
|
|
</tr>)
|
|
|
|
{
|
|
|
|
})
|
|
|
|
shixunList && shixunList.map( (shixun, index) => {
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
</tbody>
|
|
|
|
<td>{shixun.number}</td>
|
|
|
|
</table>
|
|
|
|
<td className="edu-txt-left task-hide" style={{"maxWidth":"272px"}}>{shixun.shixun_name}</td>
|
|
|
|
</div>
|
|
|
|
<td>{shixun.member_count}</td>
|
|
|
|
</div>
|
|
|
|
<td className="color-blue">{shixun.school_count}</td>
|
|
|
|
</div>
|
|
|
|
</tr>)
|
|
|
|
<div className="with40 fl static_shadow edu-back-white">
|
|
|
|
})
|
|
|
|
<p className="font-24 padding30-20">实训学习统计</p>
|
|
|
|
}
|
|
|
|
<div id="shixunStudyStatistics"
|
|
|
|
|
|
|
|
style={{"width":"480px","height": shixunList ? `${shixunList.length * 35 + 100}px` : "440px"}}></div>
|
|
|
|
</tbody>
|
|
|
|
</div>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
<div className="with40 fl static_shadow edu-back-white">
|
|
|
|
|
|
|
|
<p className="font-24 padding30-20">实训学习统计</p>
|
|
|
|
|
|
|
|
{shixunList===undefined?<div id="showloding"
|
|
|
|
|
|
|
|
style={{"width":"480px","height":"440px"}}></div>:""}
|
|
|
|
|
|
|
|
{shixunList===undefined?"":<div id="shixunStudyStatistics"
|
|
|
|
|
|
|
|
style={{"width":"480px","minHeight":`${shixunList&&shixunList.length *50}px`}}></div>}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
export default SecondTab;
|
|
|
|
export default SecondTab;
|