|
|
|
@ -11,7 +11,7 @@ import { ECModalHOC } from '../../common/ECModalHOC'
|
|
|
|
|
|
|
|
|
|
import 'antd/lib/style/index.css';
|
|
|
|
|
|
|
|
|
|
import './style.scss'
|
|
|
|
|
import './index.scss'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const onCheckBoxClick = (that, rowData) =>{
|
|
|
|
@ -26,7 +26,7 @@ function getNumArray(data_args) {
|
|
|
|
|
let num_array = [];
|
|
|
|
|
if (data_args) {
|
|
|
|
|
data_args.forEach(item => {
|
|
|
|
|
num_array.push(item.first_leval_data.length)
|
|
|
|
|
num_array.push(item.graduation_subitems.length)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
return num_array;
|
|
|
|
@ -258,6 +258,49 @@ function getTableData(data_args) {
|
|
|
|
|
}
|
|
|
|
|
return tableData;
|
|
|
|
|
}
|
|
|
|
|
// new
|
|
|
|
|
function getTableData(data_args) {
|
|
|
|
|
let tableData = []
|
|
|
|
|
// 最大课程数量,根据这个值动态渲染课程列数
|
|
|
|
|
maxCouseCount = 0;
|
|
|
|
|
if (data_args) {
|
|
|
|
|
data_args.forEach((item, index) => {
|
|
|
|
|
item.graduation_subitems.forEach((innerItem, innerIndex) => {
|
|
|
|
|
let nameRowData = {};
|
|
|
|
|
let targetValueRowData = {};
|
|
|
|
|
let realValueRowData = {};
|
|
|
|
|
let target_value_total = 0;
|
|
|
|
|
let real_value_total = 0;
|
|
|
|
|
// 一个course数组的数据组合成三行table数据
|
|
|
|
|
innerItem.course_supports.forEach((course, courseIndex) => {
|
|
|
|
|
nameRowData[`c${courseIndex + 1}`] = course.course_name;
|
|
|
|
|
|
|
|
|
|
targetValueRowData[`c${courseIndex + 1}`] = course.reach_criteria
|
|
|
|
|
// course.target_value && course.target_value.toFixed
|
|
|
|
|
// ? course.target_value.toFixed(3) : course.target_value ;
|
|
|
|
|
// if (course.target_value) {
|
|
|
|
|
// target_value_total = target_value_total + course.target_value
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
realValueRowData[`c${courseIndex + 1}`] = course.actually_reach
|
|
|
|
|
// course.real_value && course.real_value.toFixed
|
|
|
|
|
// ? course.real_value.toFixed(3) : course.real_value ;
|
|
|
|
|
// if (course.real_value) {
|
|
|
|
|
// real_value_total = real_value_total + course.real_value
|
|
|
|
|
// }
|
|
|
|
|
})
|
|
|
|
|
// if (real_value_total >= target_value_total && real_value_total != 0) {
|
|
|
|
|
nameRowData.status = innerItem.status != "not_achieved" && parseFloat(course.actually_reach) != 0
|
|
|
|
|
// }
|
|
|
|
|
maxCouseCount = Math.max(maxCouseCount, innerItem.course_supports.length)
|
|
|
|
|
tableData.push(nameRowData)
|
|
|
|
|
tableData.push(targetValueRowData)
|
|
|
|
|
tableData.push(realValueRowData)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
return tableData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let tableData = []
|
|
|
|
|
|
|
|
|
@ -522,8 +565,8 @@ class GraduatesRequirement extends Component {
|
|
|
|
|
}
|
|
|
|
|
fetchData(ec_year_id) {
|
|
|
|
|
// const url = `ec_courses/7/get_calculation_data`
|
|
|
|
|
const url = `/ec_courses/get_calculation_data?ec_year_id=${ec_year_id}`
|
|
|
|
|
|
|
|
|
|
// const url = `/ec_courses/get_calculation_data?ec_year_id=${ec_year_id}`
|
|
|
|
|
const url = `/ec_years/${ec_year_id}/reach_evaluation.json`
|
|
|
|
|
// num_array = getNumArray(testData.calculation_data);
|
|
|
|
|
// tableData = getTableData(testData.calculation_data)
|
|
|
|
|
// return
|
|
|
|
@ -532,9 +575,9 @@ class GraduatesRequirement extends Component {
|
|
|
|
|
// withCredentials: true,
|
|
|
|
|
})
|
|
|
|
|
.then((response) => {
|
|
|
|
|
if (response.data.calculation_data) {
|
|
|
|
|
num_array = getNumArray(response.data.calculation_data);
|
|
|
|
|
tableData = getTableData(response.data.calculation_data)
|
|
|
|
|
if (response.data.graduation_requirements) {
|
|
|
|
|
num_array = getNumArray(response.data.graduation_requirements);
|
|
|
|
|
tableData = getTableData(response.data.graduation_requirements)
|
|
|
|
|
// 先计算,再触发render
|
|
|
|
|
this.setState({
|
|
|
|
|
calculationData: response.data.calculation_data,
|
|
|
|
|