total value

dev_SaaS
hjm 6 years ago
parent 9d245f3922
commit 537a3cbf2e

@ -228,17 +228,22 @@ function getTableData(data_args) {
let nameRowData = {}; let nameRowData = {};
let targetValueRowData = {}; let targetValueRowData = {};
let realValueRowData = {}; let realValueRowData = {};
let target_value_total = 0;
let real_value_total = 0;
// 一个course数组的数据组合成三行table数据 // 一个course数组的数据组合成三行table数据
innerItem.course_data.forEach((course, courseIndex) => { innerItem.course_data.forEach((course, courseIndex) => {
nameRowData[`c${courseIndex + 1}`] = course.course_name; nameRowData[`c${courseIndex + 1}`] = course.course_name;
if (course.status) {
nameRowData.status = course.status
}
targetValueRowData[`c${courseIndex + 1}`] = course.target_value && course.target_value.toFixed targetValueRowData[`c${courseIndex + 1}`] = course.target_value && course.target_value.toFixed
? course.target_value.toFixed(3) : course.target_value ; ? course.target_value.toFixed(3) : course.target_value ;
target_value_total = target_value_total + targetValueRowData[`c${courseIndex + 1}`]
realValueRowData[`c${courseIndex + 1}`] = course.real_value && course.real_value.toFixed realValueRowData[`c${courseIndex + 1}`] = course.real_value && course.real_value.toFixed
? course.real_value.toFixed(3) : course.real_value ; ? course.real_value.toFixed(3) : course.real_value ;
real_value_total = real_value_total + realValueRowData[`c${courseIndex + 1}`]
}) })
if (real_value_total >= target_value_total) {
nameRowData.status = true
}
maxCouseCount = Math.max(maxCouseCount, innerItem.course_data.length) maxCouseCount = Math.max(maxCouseCount, innerItem.course_data.length)
tableData.push(nameRowData) tableData.push(nameRowData)
tableData.push(targetValueRowData) tableData.push(targetValueRowData)

Loading…
Cancel
Save