From 6f142a850060ff6b4ac533aba704f3290822c389 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Thu, 26 Sep 2019 17:22:54 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../RequirementVsObjective/SelectTable.js | 4 +-
.../EcSetting/RequirementVsStandard/index.js | 40 ++++++++++---------
2 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/public/react/src/modules/ecs/EcSetting/RequirementVsObjective/SelectTable.js b/public/react/src/modules/ecs/EcSetting/RequirementVsObjective/SelectTable.js
index 81021cf88..9e357aebd 100644
--- a/public/react/src/modules/ecs/EcSetting/RequirementVsObjective/SelectTable.js
+++ b/public/react/src/modules/ecs/EcSetting/RequirementVsObjective/SelectTable.js
@@ -31,7 +31,7 @@ class SelectTable extends Component {
if (index == 0) return
this.props.onCellClick(rowIndex, colIndex , !!cell)}>
diff --git a/public/react/src/modules/ecs/EcSetting/RequirementVsStandard/index.js b/public/react/src/modules/ecs/EcSetting/RequirementVsStandard/index.js
index 45ea17811..a1d652cf2 100644
--- a/public/react/src/modules/ecs/EcSetting/RequirementVsStandard/index.js
+++ b/public/react/src/modules/ecs/EcSetting/RequirementVsStandard/index.js
@@ -21,9 +21,9 @@ class RequirementVsObjective extends Component {
// return;
const yearId = this.props.match.params.yearId
- const url = `/ec_years/${yearId}/requirement_support_objectives.json`
+ const url = `/ec_years/${yearId}/subitem_support_standards.json`
axios.get(url).then((response) => {
- if (response.data.graduation_requirements) {
+ if (response.data.graduation_subitems) {
this.setState( {...response.data} , () => {
this.init()
})
@@ -35,39 +35,41 @@ class RequirementVsObjective extends Component {
init = () => {
this.graduationRequirementsIdIndexMap = {}
this.trainingSubitemsIdIndexMap = {}
- this.state.graduation_requirements.forEach((item, index) => {
+ this.state.graduation_subitems.forEach((item, index) => {
this.graduationRequirementsIdIndexMap[item.id] = index
})
- this.state.training_subitems.forEach((item, index) => {
+ this.state.graduation_standards.forEach((item, index) => {
// 对应table的列数
this.trainingSubitemsIdIndexMap[item.id] = index + 1
})
const tableData = []
- this.state.graduation_requirements.forEach((item, index) => {
- tableData.push([item.content, ...Array(this.state.training_subitems.length)])
+ const firstColIndexArray = []
+ this.state.graduation_subitems.forEach((item, index) => {
+ tableData.push([item.content, ...Array(this.state.graduation_standards.length)])
+ firstColIndexArray.push(`${item.position}-${item.graduation_requirement_position}`)
})
- this.state.requirement_support_objectives.forEach(item => {
- tableData[this.graduationRequirementsIdIndexMap[item.graduation_requirement_id]][this.trainingSubitemsIdIndexMap[item.training_subitem_id]]
+ this.state.subitem_support_standards.forEach(item => {
+ tableData[this.graduationRequirementsIdIndexMap[item.graduation_subitem_id]][this.trainingSubitemsIdIndexMap[item.graduation_standard_id]]
= true
})
- this.setState({ tableData })
+ this.setState({ tableData, firstColIndexArray })
}
onCellClick = (rowIndex, colIndex, select) => {
console.log( rowIndex, colIndex, select )
- const ec_graduation_requirement_id = this.state.graduation_requirements[rowIndex].id
- const ec_training_subitem_id = this.state.training_subitems[colIndex - 1].id
+ const ec_graduation_subitem_id = this.state.graduation_subitems[rowIndex].id
+ const ec_graduation_standard_id = this.state.graduation_standards[colIndex - 1].id
const yearId = this.props.match.params.yearId
- const url = `/ec_years/${yearId}/requirement_support_objectives.json`
+ const url = `/ec_years/${yearId}/subitem_support_standards.json`
const method = select ? axios.delete : axios.post
method(url,
select ? {
params: {
- ec_graduation_requirement_id,
- ec_training_subitem_id
+ ec_graduation_subitem_id,
+ ec_graduation_standard_id
}
} : {
- ec_graduation_requirement_id,
- ec_training_subitem_id
+ ec_graduation_subitem_id,
+ ec_graduation_standard_id
}
).then((response) => {
if (response.data.status == 0) {
@@ -89,9 +91,9 @@ class RequirementVsObjective extends Component {
}
render() {
const { match, history, current_user } = this.props
- const { tableData, training_subitems, graduation_requirements, is_manager } = this.state
+ const { tableData, graduation_standards, graduation_subitems, is_manager, firstColIndexArray } = this.state
- const columns = training_subitems && [['毕业要求', '培养目标'], ...training_subitems.map(item => item.content)]
+ const columns = graduation_standards && [['毕业要求', '通用标准'], ...graduation_standards.map(item => item.content)]
const columnIdIndexMap = {}
console.log(columns, tableData)
return (
@@ -116,7 +118,9 @@ class RequirementVsObjective extends Component {
|