diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js index ef38a18f8..fe525154f 100644 --- a/public/react/config/webpack.config.dev.js +++ b/public/react/config/webpack.config.dev.js @@ -32,7 +32,7 @@ module.exports = { // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s // devtool: "cheap-module-eval-source-map", // 开启调试 - //devtool: "source-map", // 开启调试 + devtool: "source-map", // 开启调试 // These are the "entry points" to our application. // This means they will be the "root" imports that are included in JS bundle. // The first two entry points enable "hot" CSS and auto-refreshes for JS. diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index bc7fa8070..19563052c 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -22,14 +22,14 @@ let hashTimeout // TODO 开发期多个身份切换 let debugType ="" if (isDev) { - const _search = window.location.search; - let parsed = {}; - if (_search) { - parsed = queryString.parse(_search); - } - debugType = window.location.search.indexOf('debug=t') != -1 ? 'teacher' : - window.location.search.indexOf('debug=s') != -1 ? 'student' : - window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin' + const _search = window.location.search; + let parsed = {}; + if (_search) { + parsed = queryString.parse(_search); + } + debugType = window.location.search.indexOf('debug=t') != -1 ? 'teacher' : + window.location.search.indexOf('debug=s') != -1 ? 'student' : + window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin' } window._debugType = debugType; export function initAxiosInterceptors(props) { @@ -217,7 +217,7 @@ function initOnlineOfflineListener() { description: '网络恢复正常,感谢使用。', }) - }); + }); $(window).bind("offline", () => { notification.destroy() diff --git a/public/react/src/modules/ecs/EcSetting/RequirementVsObjective/SelectTable.js b/public/react/src/modules/ecs/EcSetting/RequirementVsObjective/SelectTable.js new file mode 100644 index 000000000..9e357aebd --- /dev/null +++ b/public/react/src/modules/ecs/EcSetting/RequirementVsObjective/SelectTable.js @@ -0,0 +1,124 @@ +import React, { Component } from 'react'; + +import classNames from 'classnames' + +import axios from 'axios'; + +import { Table, Divider, Tag, Checkbox, InputNumber, Spin, Icon, Tooltip } from 'antd'; + +class SelectTable extends Component { + constructor(props) { + super(props) + this.state={ + + } + } + + componentDidMount(){ + + } + + render() { + const { match, columns, tableData } = this.props + if (!tableData || !tableData.length) return ''; + return ( + + + + + + {columns.map((item, index) => { + if (index == 0) return ; + return ( + + + + ) + })} + {/* + + + + */} + + { tableData.map((item, rowIndex) => { + const cells = item.map((cell, colIndex) => { + // placement="bottom" + if(colIndex == 0) return + + + return ( + + ) + }) + return ( + + {cells} + + ) + })} + {/* + + + + + + + */} + {/* + + + + + + + + + + + + + + + */} + +
{columns[0][0]}{columns[0][1]}{this.props.columnName || '目标'}{index}目标1目标2目标3目标4目标5
指标点{this.props.firstColIndexArray ? this.props.firstColIndexArray[rowIndex] : rowIndex + 1} this.props.onCellClick(rowIndex, colIndex , !!cell)}> + +
指标点1 + + + + + + + + + +
指标点2 + + + + + + + + + +
指标点3 + + + + + + + + + +
+ + + ); + } +} + +export default (SelectTable) ; diff --git a/public/react/src/modules/ecs/EcSetting/RequirementVsObjective/index.js b/public/react/src/modules/ecs/EcSetting/RequirementVsObjective/index.js new file mode 100644 index 000000000..ce78eb54f --- /dev/null +++ b/public/react/src/modules/ecs/EcSetting/RequirementVsObjective/index.js @@ -0,0 +1,163 @@ +import React, { Component } from 'react'; + +import classNames from 'classnames' + +import axios from 'axios'; + +import { Table, Divider, Tag, Checkbox, InputNumber, Spin, Icon } from 'antd'; +import SelectTable from './SelectTable' +import update from 'immutability-helper' +const testState = { + "graduation_requirements": [ + { + "id": 1, + "position": 1, + "content": "毕业要求一" + }, + { + "id": 2, + "position": 2, + "content": "毕业要求二" + } + ], + "training_subitems": [ + { + "id": 1, + "content": "培养目标一" + }, + { + "id": 2, + "content": "培养目标二" + } + ], + "requirement_support_objectives": [ + { + "graduation_requirement_id": 1, + "training_subitem_id": 1 + }, + { + "graduation_requirement_id": 2, + "training_subitem_id": 2 + }, + ] +} +class RequirementVsObjective extends Component { + constructor(props) { + super(props) + this.state={ + // ...testState + } + } + + componentDidMount(){ + // this.init() + // return; + + const yearId = this.props.match.params.yearId + const url = `/ec_years/${yearId}/requirement_support_objectives.json` + axios.get(url).then((response) => { + if (response.data.graduation_requirements) { + this.setState( {...response.data} , () => { + this.init() + }) + } + }).catch((e) => { + + }) + } + init = () => { + this.graduationRequirementsIdIndexMap = {} + this.trainingSubitemsIdIndexMap = {} + this.state.graduation_requirements.forEach((item, index) => { + this.graduationRequirementsIdIndexMap[item.id] = index + }) + this.state.training_subitems.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)]) + }) + this.state.requirement_support_objectives.forEach(item => { + tableData[this.graduationRequirementsIdIndexMap[item.graduation_requirement_id]][this.trainingSubitemsIdIndexMap[item.training_subitem_id]] + = true + }) + this.setState({ tableData }) + } + 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 yearId = this.props.match.params.yearId + const url = `/ec_years/${yearId}/requirement_support_objectives.json` + const method = select ? axios.delete : axios.post + method(url, + select ? { + params: { + ec_graduation_requirement_id, + ec_training_subitem_id + } + } : { + ec_graduation_requirement_id, + ec_training_subitem_id + } + ).then((response) => { + if (response.data.status == 0) { + this.setState( + (prevState) => ({ + tableData : update(prevState.tableData, {[rowIndex]: {[colIndex]: {$set: select ? false : true}}}) + }) + ) + this.props.showNotification(`${select ? '取消' : '选择'}成功`) + } + }).catch((e) => { + + }) + if (select) { // 取消 + + } else { // 选择 + + } + } + render() { + const { match, history, current_user } = this.props + const { tableData, training_subitems, graduation_requirements, is_manager } = this.state + + const columns = training_subitems && [['毕业要求', '培养目标'], ...training_subitems.map(item => item.content)] + const columnIdIndexMap = {} + console.log(columns, tableData) + return ( + +
+ +
+

+ 表示支撑 + 表示不支撑 +

+ +
+
+ + ); + } +} + +export default (RequirementVsObjective) ; diff --git a/public/react/src/modules/ecs/EcSetting/RequirementVsStandard/index.js b/public/react/src/modules/ecs/EcSetting/RequirementVsStandard/index.js new file mode 100644 index 000000000..dbc40a621 --- /dev/null +++ b/public/react/src/modules/ecs/EcSetting/RequirementVsStandard/index.js @@ -0,0 +1,134 @@ +import React, { Component } from 'react'; + +import classNames from 'classnames' + +import axios from 'axios'; + +import { Table, Divider, Tag, Checkbox, InputNumber, Spin, Icon } from 'antd'; +import SelectTable from '../RequirementVsObjective/SelectTable' +import update from 'immutability-helper' + +class RequirementVsObjective extends Component { + constructor(props) { + super(props) + this.state={ + + } + } + + componentDidMount(){ + // this.init() + // return; + + const yearId = this.props.match.params.yearId + const url = `/ec_years/${yearId}/subitem_support_standards.json` + axios.get(url).then((response) => { + if (response.data.graduation_subitems) { + this.setState( {...response.data} , () => { + this.init() + }) + } + }).catch((e) => { + + }) + } + init = () => { + this.graduationRequirementsIdIndexMap = {} + this.trainingSubitemsIdIndexMap = {} + this.state.graduation_subitems.forEach((item, index) => { + this.graduationRequirementsIdIndexMap[item.id] = index + }) + this.state.graduation_standards.forEach((item, index) => { + // 对应table的列数 + this.trainingSubitemsIdIndexMap[item.id] = index + 1 + }) + const tableData = [] + 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.subitem_support_standards.forEach(item => { + tableData[this.graduationRequirementsIdIndexMap[item.graduation_subitem_id]][this.trainingSubitemsIdIndexMap[item.graduation_standard_id]] + = true + }) + this.setState({ tableData, firstColIndexArray }) + } + onCellClick = (rowIndex, colIndex, select) => { + console.log( rowIndex, colIndex, select ) + 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}/subitem_support_standards.json` + const method = select ? axios.delete : axios.post + method(url, + select ? { + params: { + ec_graduation_subitem_id, + ec_graduation_standard_id + } + } : { + ec_graduation_subitem_id, + ec_graduation_standard_id + } + ).then((response) => { + if (response.data.status == 0) { + this.setState( + (prevState) => ({ + tableData : update(prevState.tableData, {[rowIndex]: {[colIndex]: {$set: select ? false : true}}}) + }) + ) + this.props.showNotification(`${select ? '取消' : '选择'}成功`) + } + }).catch((e) => { + + }) + if (select) { // 取消 + + } else { // 选择 + + } + } + render() { + const { match, history, current_user } = this.props + const { tableData, graduation_standards, graduation_subitems, is_manager, firstColIndexArray } = this.state + + const columns = graduation_standards && [['毕业要求', '通用标准'], ...graduation_standards.map(item => item.content)] + const columnIdIndexMap = {} + console.log(columns, tableData) + return ( + +
+ +
+

+ 表示支撑 + 表示不支撑 +

+ +
+
+ + ); + } +} + +export default (RequirementVsObjective) ; diff --git a/public/react/src/modules/ecs/EcSetting/index.js b/public/react/src/modules/ecs/EcSetting/index.js index d85d10aec..28c176f01 100644 --- a/public/react/src/modules/ecs/EcSetting/index.js +++ b/public/react/src/modules/ecs/EcSetting/index.js @@ -19,6 +19,11 @@ const Curriculum=Loadable({ loader: () => import('../../../modules/ecs/curriculum/Curriculum'), loading: Loading, }); +const CurriculumSubpage=Loadable({ + loader: () => import('../../../modules/ecs/curriculum/CurriculumSubpage'), + loading: Loading, +}); + const TrainingObjective=Loadable({ loader: () => import('./TrainingObjective/index'), loading: Loading, @@ -31,6 +36,19 @@ const CourseSupports=Loadable({ loader: () => import('./CourseSupports/index'), loading: Loading, }); +const ReachCalculationInfo=Loadable({ + loader: () => import('./reachCalculationInfo/index'), + loading: Loading, +}); +const RequirementVsObjective=Loadable({ + loader: () => import('./RequirementVsObjective/index'), + loading: Loading, +}); +const RequirementVsStandard=Loadable({ + loader: () => import('./RequirementVsStandard/index'), + loading: Loading, +}); + class EcSetting extends React.Component { constructor (props) { @@ -65,11 +83,11 @@ class EcSetting extends React.Component { let type = stepTypes[stepIndex]; this.setState({ stepIndex: stepIndex }); - if(type==="courses"){ - this.props.history.push(`/ecs/major_schools/${majorId}/years/${yearId}/${type}/ec_course_support_setting/1`); - }else { + // if(type==="courses"){ + // this.props.history.push(`/ecs/major_schools/${majorId}/years/${yearId}/${type}/ec_course_support_setting/1`); + // }else { this.props.history.push(`/ecs/major_schools/${majorId}/years/${yearId}/${type}`); - } + // } } setupStep = () => { @@ -122,20 +140,32 @@ class EcSetting extends React.Component { render={ (props) => () }> () }> + () }> - + {/* 毕业要求对培养目标的支撑 */} + () }> + {/* 毕业要求对通用标准的支撑 */} + () }> + {/*学生*/} () }> {/*课程体系*/} - () }> + {/*课程体系资源子页面Subpage*/} + () }> {/*课程体系VS毕业要求*/} () }> + {/*达成度评价结果*/} + () }> - - ) } diff --git a/public/react/src/modules/ecs/EcSetting/reachCalculationInfo/index.js b/public/react/src/modules/ecs/EcSetting/reachCalculationInfo/index.js new file mode 100644 index 000000000..ad0c21ae7 --- /dev/null +++ b/public/react/src/modules/ecs/EcSetting/reachCalculationInfo/index.js @@ -0,0 +1,722 @@ +import React, { Component } from 'react'; + +import classNames from 'classnames' + +import axios from 'axios'; + +import { Table, Divider, Tag, Checkbox, InputNumber, Spin, Icon } from 'antd'; + +// import EcTitleCourseEvaluations from '../ecTitle/ecTitle' +import { ECModalHOC } from '../../common/ECModalHOC' + +import 'antd/lib/style/index.css'; + +import './index.scss' + + +const onCheckBoxClick = (that, rowData) =>{ + console.log(rowData) +} +const testData = {"calculation_data":[{"first_level":1,"first_leval_data":[{"second_level":"1.1","course_data":[{"course_name":"\u9ad8\u7b49\u6570\u5b66","target_value":null,"real_value":null,"status":null},{"course_name":"\u7ebf\u6027\u4ee3\u6570","target_value":null,"real_value":null,"status":null},{"course_name":"\u6982\u7387\u8bba\u4e0e\u6570\u7406\u7edf\u8ba1","target_value":null,"real_value":null,"status":null},{"course_name":"\u79bb\u6563\u6570\u5b66","target_value":null,"real_value":null,"status":null}]},{"second_level":"1.2","course_data":[{"course_name":"\u81ea\u7136\u79d1\u5b66\u54f2\u5b66","target_value":null,"real_value":null,"status":null},{"course_name":"\u5927\u5b66\u7269\u7406","target_value":null,"real_value":null,"status":null},{"course_name":"\u5927\u5b66\u5316\u5b66","target_value":null,"real_value":null,"status":null},{"course_name":"\u751f\u7269\u5b66\u57fa\u7840","target_value":null,"real_value":null,"status":null}]},{"second_level":"1.3","course_data":[{"course_name":"\u5de5\u7a0b\u5236\u56fe\u57fa\u7840\u53ca\u5de5\u7a0b\u5236\u56fe\u57fa\u7840\u5b9e\u9a8c","target_value":null,"real_value":null,"status":null},{"course_name":"\u519b\u4e8b\u4fe1\u606f\u6280\u672f\u57fa\u7840","target_value":null,"real_value":null,"status":null},{"course_name":"\u5927\u5b66\u8ba1\u7b97\u673a\u57fa\u7840B","target_value":null,"real_value":null,"status":null},{"course_name":"\u8ba1\u7b97\u673a\u7a0b\u5e8f\u8bbe\u8ba1B","target_value":null,"real_value":null,"status":null}]},{"second_level":"1.4","course_data":[{"course_name":"\u64cd\u4f5c\u7cfb\u7edf","target_value":null,"real_value":null,"status":null},{"course_name":"\u6570\u636e\u5e93\u539f\u7406","target_value":0,"real_value":0,"status":false},{"course_name":"\u8ba1\u7b97\u673a\u7f51\u7edc","target_value":null,"real_value":null,"status":null},{"course_name":"\u8f6f\u4ef6\u5de5\u7a0b","target_value":null,"real_value":null,"status":null},{"course_name":"\u8ba1\u7b97\u673a\u539f\u7406","target_value":null,"real_value":null,"status":null}]},{"second_level":"1.5","course_data":[{"course_name":"\u4fe1\u53f7\u5206\u6790\u4e0e\u5904\u7406\u5bfc\u8bba","target_value":null,"real_value":null,"status":null},{"course_name":"\u6570\u5b57\u56fe\u50cf\u5904\u7406","target_value":null,"real_value":null,"status":null},{"course_name":"\u5d4c\u5165\u5f0f\u7cfb\u7edf\u8bfe\u7a0b\u8bbe\u8ba1","target_value":null,"real_value":null,"status":null},{"course_name":"\u64cd\u4f5c\u7cfb\u7edf\u7efc\u5408\u5b9e\u8df5","target_value":null,"real_value":null,"status":null}]}]},{"first_level":2,"first_leval_data":[{"second_level":"2.1","course_data":[{"course_name":"\u79bb\u6563\u6570\u5b66","target_value":null,"real_value":null,"status":null},{"course_name":"\u6570\u636e\u7ed3\u6784","target_value":null,"real_value":null,"status":null},{"course_name":"\u7b97\u6cd5\u8bbe\u8ba1\u4e0e\u5206\u6790","target_value":null,"real_value":null,"status":null},{"course_name":"\u6570\u503c\u5206\u6790","target_value":null,"real_value":null,"status":null}]},{"second_level":"2.2","course_data":[{"course_name":"\u81ea\u7136\u79d1\u5b66\u54f2\u5b66","target_value":null,"real_value":null,"status":null},{"course_name":"\u5927\u5b66\u7269\u7406","target_value":null,"real_value":null,"status":null},{"course_name":"\u5927\u5b66\u7269\u7406\u5b9e\u9a8c","target_value":null,"real_value":null,"status":null},{"course_name":"\u7535\u8def\u4e0e\u7535\u5b50\u5b66\u57fa\u7840","target_value":null,"real_value":null,"status":null}]},{"second_level":"2.3","course_data":[{"course_name":"\u8f6f\u4ef6\u5de5\u7a0b","target_value":null,"real_value":null,"status":null},{"course_name":"\u4eba\u5de5\u667a\u80fd\u5bfc\u8bba","target_value":null,"real_value":null,"status":null},{"course_name":"\u6570\u5b57\u7535\u5b50\u6280\u672f\u57fa\u7840B","target_value":null,"real_value":null,"status":null},{"course_name":"\u6570\u5b57\u7cfb\u7edf\u8bbe\u8ba1","target_value":null,"real_value":null,"status":null},{"course_name":"\u8ba1\u7b97\u673a\u56fe\u5f62\u5b66","target_value":null,"real_value":null,"status":null}]}]},{"first_level":3,"first_leval_data":[{"second_level":"3.1","course_data":[{"course_name":"\u5927\u5b66\u8ba1\u7b97\u673a\u57fa\u7840B","target_value":null,"real_value":null,"status":null},{"course_name":"\u8ba1\u7b97\u673a\u7a0b\u5e8f\u8bbe\u8ba1B","target_value":null,"real_value":null,"status":null},{"course_name":"\u8ba1\u7b97\u673a\u539f\u7406\u8bfe\u7a0b\u8bbe\u8ba1","target_value":null,"real_value":null,"status":null},{"course_name":"\u6570\u636e\u5e93\u539f\u7406","target_value":0,"real_value":0,"status":false},{"course_name":"\u7a0b\u5e8f\u8bbe\u8ba1\u8bfe\u7a0b\u8bbe\u8ba1","target_value":null,"real_value":null,"status":null}]},{"second_level":"3.2","course_data":[{"course_name":"\u8f6f\u4ef6\u5de5\u7a0b","target_value":null,"real_value":null,"status":null},{"course_name":"\u5d4c\u5165\u5f0f\u7cfb\u7edf","target_value":null,"real_value":null,"status":null},{"course_name":"\u5d4c\u5165\u5f0f\u7cfb\u7edf\u8bfe\u7a0b\u8bbe\u8ba1","target_value":null,"real_value":null,"status":null},{"course_name":"\u8ba1\u7b97\u673a\u4f53\u7cfb\u7ed3\u6784","target_value":null,"real_value":null,"status":null}]},{"second_level":"3.3","course_data":[{"course_name":"\u4fe1\u606f\u5b89\u5168\u5bfc\u8bba","target_value":null,"real_value":null,"status":null},{"course_name":"\u8f6f\u4ef6\u5de5\u7a0b","target_value":null,"real_value":null,"status":null},{"course_name":"\u8ba1\u7b97\u673a\u4f53\u7cfb\u7ed3\u6784","target_value":null,"real_value":null,"status":null},{"course_name":"\u8ba1\u7b97\u673a\u7f51\u7edc","target_value":null,"real_value":null,"status":null},{"course_name":"\u8ba1\u7b97\u673a\u4e0e\u793e\u4f1a","target_value":null,"real_value":null,"status":null}]},{"second_level":"3.4","course_data":[{"course_name":"\u7f16\u8bd1\u539f\u7406","target_value":null,"real_value":null,"status":null},{"course_name":"\u79bb\u6563\u6570\u5b66","target_value":null,"real_value":null,"status":null},{"course_name":"\u5927\u5b66\u8ba1\u7b97\u673a\u57fa\u7840B","target_value":null,"real_value":null,"status":null}]}]},{"first_level":4,"first_leval_data":[{"second_level":"4.1","course_data":[{"course_name":"\u7b97\u6cd5\u8bbe\u8ba1\u4e0e\u5206\u6790","target_value":null,"real_value":null,"status":null},{"course_name":"\u6570\u503c\u5206\u6790","target_value":null,"real_value":null,"status":null},{"course_name":"\u4fe1\u53f7\u5206\u6790\u4e0e\u5904\u7406","target_value":null,"real_value":null,"status":null},{"course_name":"\u7f16\u8bd1\u539f\u7406","target_value":null,"real_value":null,"status":null},{"course_name":"\u8ba1\u7b97\u673a\u4f53\u7cfb\u7ed3\u6784","target_value":null,"real_value":null,"status":null}]}]},{"first_level":5,"first_leval_data":[{"second_level":"5.1","course_data":[{"course_name":"\u8ba1\u7b97\u673a\u539f\u7406","target_value":null,"real_value":null,"status":null},{"course_name":"\u8ba1\u7b97\u673a\u539f\u7406\u8bfe\u7a0b\u8bbe\u8ba1","target_value":null,"real_value":null,"status":null},{"course_name":"\u64cd\u4f5c\u7cfb\u7edf","target_value":null,"real_value":null,"status":null},{"course_name":"\u64cd\u4f5c\u7cfb\u7edf\u7efc\u5408\u5b9e\u8df5","target_value":null,"real_value":null,"status":null},{"course_name":"\u6570\u636e\u5e93\u539f\u7406","target_value":0,"real_value":0,"status":false}]}]},{"first_level":6,"first_leval_data":[{"second_level":"6.1","course_data":[{"course_name":"\u4fe1\u606f\u5b89\u5168\u5bfc\u8bba","target_value":null,"real_value":null,"status":null},{"course_name":"\u8ba1\u7b97\u673a\u4e0e\u793e\u4f1a","target_value":null,"real_value":null,"status":null},{"course_name":"\u793e\u4f1a\u5b9e\u8df5","target_value":null,"real_value":null,"status":null},{"course_name":"\u8f6f\u4ef6\u5b89\u5168","target_value":null,"real_value":null,"status":null},{"course_name":"\u4eba\u5de5\u667a\u80fd\u5bfc\u8bba","target_value":null,"real_value":null,"status":null}]}]},{"first_level":7,"first_leval_data":[{"second_level":"7.1","course_data":[{"course_name":"\u4fe1\u606f\u5b89\u5168\u5bfc\u8bba","target_value":null,"real_value":null,"status":null},{"course_name":"\u8ba1\u7b97\u673a\u4e0e\u793e\u4f1a","target_value":null,"real_value":null,"status":null},{"course_name":"\u5d4c\u5165\u5f0f\u7cfb\u7edf\u8bfe\u7a0b\u8bbe\u8ba1","target_value":null,"real_value":null,"status":null}]}]},{"first_level":8,"first_leval_data":[{"second_level":"8.1","course_data":[{"course_name":"\u601d\u60f3\u9053\u5fb7\u4fee\u517b\u4e0e\u6cd5\u5f8b\u57fa\u7840","target_value":null,"real_value":null,"status":null},{"course_name":"\u5f53\u4ee3\u4e16\u754c\u7ecf\u6d4e\u4e0e\u653f\u6cbb","target_value":null,"real_value":null,"status":null},{"course_name":"\u96c6\u4e2d\u653f\u6cbb\u6559\u80b2","target_value":null,"real_value":null,"status":null},{"course_name":"\u515a\u56e2\u6d3b\u52a8","target_value":null,"real_value":null,"status":null}]},{"second_level":"8.2","course_data":[{"course_name":"\u81ea\u7136\u79d1\u5b66\u54f2\u5b66","target_value":null,"real_value":null,"status":null},{"course_name":"\u8ba1\u7b97\u673a\u4e0e\u793e\u4f1a","target_value":null,"real_value":null,"status":null},{"course_name":"\u96c6\u4e2d\u653f\u6cbb\u6559\u80b2","target_value":null,"real_value":null,"status":null},{"course_name":"\u6a21\u62df\u5c97\u4f4d\u4efb\u804c","target_value":null,"real_value":null,"status":null}]}]},{"first_level":9,"first_leval_data":[{"second_level":"9.1","course_data":[{"course_name":"\u5d4c\u5165\u5f0f\u7cfb\u7edf\u8bfe\u7a0b\u8bbe\u8ba1","target_value":null,"real_value":null,"status":null},{"course_name":"\u4eba\u673a\u4ea4\u4e92","target_value":null,"real_value":null,"status":null},{"course_name":"\u519b\u4e8b\u4fe1\u606f\u6280\u672f\u57fa\u7840","target_value":null,"real_value":null,"status":null},{"course_name":"\u6a21\u62df\u5c97\u4f4d\u4efb\u804c","target_value":null,"real_value":null,"status":null},{"course_name":"\u519b\u653f\u57fa\u7840\u8bad\u7ec3","target_value":null,"real_value":null,"status":null}]}]},{"first_level":10,"first_leval_data":[{"second_level":"10.1","course_data":[{"course_name":"\u82f1\u8bed\u5e94\u7528\u5199\u4f5cA","target_value":null,"real_value":null,"status":null},{"course_name":"\u8ba1\u7b97\u673a\u4e0e\u793e\u4f1a","target_value":null,"real_value":null,"status":null},{"course_name":"\u793e\u4f1a\u5b9e\u8df5","target_value":null,"real_value":null,"status":null},{"course_name":"\u6a21\u62df\u5c97\u4f4d\u4efb\u804c","target_value":null,"real_value":null,"status":null},{"course_name":"\u515a\u56e2\u6d3b\u52a8","target_value":null,"real_value":null,"status":null}]},{"second_level":"10.2","course_data":[{"course_name":"\u5f53\u4ee3\u4e16\u754c\u7ecf\u6d4e\u4e0e\u653f\u6cbb","target_value":null,"real_value":null,"status":null},{"course_name":"\u5927\u5b66\u82f1\u8bed","target_value":null,"real_value":null,"status":null},{"course_name":"\u82f1\u8bed\u5e94\u7528\u5199\u4f5cA","target_value":null,"real_value":null,"status":null},{"course_name":"\u7ecf\u5e38\u6027\u601d\u60f3\u653f\u6cbb\u6559\u80b2","target_value":null,"real_value":null,"status":null}]}]},{"first_level":11,"first_leval_data":[{"second_level":"11.1","course_data":[{"course_name":"\u5f53\u4ee3\u4e16\u754c\u7ecf\u6d4e\u4e0e\u653f\u6cbb","target_value":null,"real_value":null,"status":null},{"course_name":"\u8ba1\u7b97\u673a\u4e0e\u793e\u4f1a","target_value":null,"real_value":null,"status":null},{"course_name":"\u9a6c\u514b\u601d\u4e3b\u4e49\u57fa\u672c\u539f\u7406","target_value":null,"real_value":null,"status":null}]},{"second_level":"11.2","course_data":[{"course_name":"\u4fe1\u606f\u68c0\u7d22","target_value":null,"real_value":null,"status":null},{"course_name":"\u8ba1\u7b97\u673a\u6545\u969c\u8bca\u65ad\u548c\u7ef4\u62a4","target_value":null,"real_value":null,"status":null},{"course_name":"\u7f51\u7ad9\u8bbe\u8ba1\u4e0e\u7ef4\u62a4","target_value":null,"real_value":null,"status":null},{"course_name":"\u96c6\u4e2d\u653f\u6cbb\u6559\u80b2","target_value":null,"real_value":null,"status":null},{"course_name":"\u7ecf\u5e38\u6027\u601d\u60f3\u653f\u6cbb\u6559\u80b2","target_value":null,"real_value":null,"status":null}]}]},{"first_level":12,"first_leval_data":[{"second_level":"12.1","course_data":[{"course_name":"\u4fe1\u606f\u68c0\u7d22","target_value":null,"real_value":null,"status":null},{"course_name":"\u8ba1\u7b97\u673a\u4e0e\u793e\u4f1a","target_value":null,"real_value":null,"status":null},{"course_name":"\u7f51\u7ad9\u8bbe\u8ba1\u4e0e\u7ef4\u62a4","target_value":null,"real_value":null,"status":null},{"course_name":"\u8ba1\u7b97\u673a\u6545\u969c\u8bca\u65ad\u548c\u7ef4\u62a4","target_value":null,"real_value":null,"status":null},{"course_name":"\u7ecf\u5e38\u6027\u601d\u60f3\u653f\u6cbb\u6559\u80b2","target_value":null,"real_value":null,"status":null}]}]},{"first_level":13,"first_leval_data":[{"second_level":"13.1","course_data":[{"course_name":"\u9a6c\u514b\u601d\u4e3b\u4e49\u57fa\u672c\u539f\u7406","target_value":null,"real_value":null,"status":null},{"course_name":"\u6bdb\u6cfd\u4e1c\u601d\u60f3\u548c\u4e2d\u56fd\u7279\u8272\u793e\u4f1a\u4e3b\u4e49\u7406\u8bba\u4f53\u7cfb\u6982\u8bba","target_value":null,"real_value":null,"status":null},{"course_name":"\u4e2d\u56fd\u8fd1\u73b0\u4ee3\u53f2\u7eb2\u8981","target_value":null,"real_value":null,"status":null},{"course_name":"\u96c6\u4e2d\u653f\u6cbb\u6559\u80b2","target_value":null,"real_value":null,"status":null}]},{"second_level":"13.2","course_data":[{"course_name":"\u601d\u60f3\u9053\u5fb7\u4fee\u517b\u4e0e\u6cd5\u5f8b\u57fa\u7840","target_value":null,"real_value":null,"status":null},{"course_name":"\u9a6c\u514b\u601d\u4e3b\u4e49\u57fa\u672c\u539f\u7406","target_value":null,"real_value":null,"status":null},{"course_name":"\u6bdb\u6cfd\u4e1c\u601d\u60f3\u548c\u4e2d\u56fd\u7279\u8272\u793e\u4f1a\u4e3b\u4e49\u7406\u8bba\u4f53\u7cfb\u6982\u8bba","target_value":null,"real_value":null,"status":null},{"course_name":"\u96c6\u4e2d\u653f\u6cbb\u6559\u80b2","target_value":null,"real_value":null,"status":null}]},{"second_level":"13.3","course_data":[{"course_name":"\u519b\u653f\u57fa\u7840\u8bad\u7ec3","target_value":null,"real_value":null,"status":null},{"course_name":"\u519b\u4e8b\u4fe1\u606f\u6280\u672f\u57fa\u7840","target_value":null,"real_value":null,"status":null},{"course_name":"\u6a21\u62df\u5c97\u4f4d\u4efb\u804c","target_value":null,"real_value":null,"status":null}]}]}],"calculation_value":0.0}; +/** + TODO 根据data计算最大课程数量 + 然后课程数量的列宽是900,然后平均分配给每个列 + */ +function getNumArray(data_args) { + let num_array = []; + if (data_args) { + data_args.forEach(item => { + num_array.push(item.graduation_subitems.length) + }) + } + return num_array; +} +let num_array = [] +// const num_array = [1, 3, 1, 1] + + +let current_num_index = 0; +// 获取位于当前分组之前的总行数 +function getNum(index) { + let sum = 0 + for(let i = 0; i <= current_num_index - 1; i++) { + sum += num_array[i]; + } + sum = sum * 3; + if (index != 0 && index == sum + num_array[current_num_index] * 3 + && current_num_index < num_array.length - 1) { + sum = sum + num_array[current_num_index] * 3 + current_num_index++; + } + return sum +} +const buildColumns = (that) => { + const stdColumnNum = 8; + let rowSum = 0; + current_num_index = 0; + const cols = [{ + title: '毕业要求', + dataIndex: 'firstCol', + key: 'firstCol', + children: [{ + title: '一级', + dataIndex: 'f_l', + key: 'f_l', + width: 65, + render: (value, row, index) => { + rowSum = getNum(index); + + const obj = { + children: current_num_index + 1, + props: {}, + }; + + + if (index - rowSum === 0) { + obj.props.rowSpan = num_array[current_num_index] * 3; + } else { + obj.props.rowSpan = 0; + } + return obj + } + }, { + title: '二级', + dataIndex: 's_l', + key: 's_l', + width: 65, + render: (value, row, index) => { + const _i_remain = index % 3; + const _i = Math.floor( (index - rowSum) / 3) + 1 + const obj = { + children: `${current_num_index + 1}-${_i}`, + props: {}, + }; + if (_i_remain === 0) { + obj.props.rowSpan = 3; + } else { + obj.props.rowSpan = 0; + } + return obj + } + }] + }, { + title: '课程名称', + dataIndex: 'c_n', + key: 'c_n', + children: [{ + title: '课程1', + dataIndex: 'c1', + key: 'c1', + width: 90, + }, { + title: '课程2', + dataIndex: 'c2', + key: 'c2', + width: 90, + }, { + title: '课程3', + dataIndex: 'c3', + key: 'c3', + width: 90, + }, { + title: '课程4', + dataIndex: 'c4', + key: 'c4', + width: 90, + }, { + title: '课程5', + dataIndex: 'c5', + key: 'c5', + width: 90, + }] + }, { + title: +
课程数量
+
∑合格标准
+
∑达成值
+
, + dataIndex: 'g_r', + key: 'g_r', + width: 100, + render: (val, row, index) => { + // if row.c1 是数字 row.c1 + row.c2 + ... + // 不是数字的话,统计一共有几列 + // if (row.c1 && isNaN(parseInt(row.c1))) { + // 每个小组的第一行,统计一共有几列 + if (index % 3 === 0) { + let _newRow = Object.assign({}, row) + delete _newRow.status + return {Object.keys(_newRow).length}; + } else { + let total = 0; + for (var key in row) { + if (row.hasOwnProperty(key) && row[key]) { + total += parseFloat(row[key]) + } + } + return total.toFixed(3); + } + } + }, { + title: '评价结果', + dataIndex: 'e_r', + key: 'e_r', + width: 40, + render: (value, row, index) => { + const _i_remain = index % 3; + // 未达成 + const obj = { + children: row.status ? 达成 + : 未达成, + props: {}, + }; + if (_i_remain === 0) { + obj.props.rowSpan = 3; + } else { + obj.props.rowSpan = 0; + } + return obj + } + }] + const courseColWidth = 900 / maxCouseCount + const courseColArray = [] + for (var courseIndex = 1; courseIndex <= maxCouseCount; courseIndex++) { + courseColArray.push({ + title: `课程${courseIndex}`, + dataIndex: `c${courseIndex}`, + key: `c${courseIndex}`, + width: courseColWidth, + }) + } + if( courseColArray.length) { + cols[1].children = courseColArray; + } + // for (let i = 1; i <= stdColumnNum; i++) { + // cols.push({ + // title: `标准${i}`, + // dataIndex: `std${i}`, + // key: `std${i}`, + // render: (data, row) => { + // return onCheckBoxClick(that, row)}> + // } + // }) + // } + return cols; +} + +/** + innerItem + 0: + course_data: Array(4) + 0: {course_name: "高等数学", target_value: null, real_value: null, status: null} + 1: {course_name: "线性代数", target_value: null, real_value: null, status: null} + 2: {course_name: "概率论与数理统计", target_value: null, real_value: null, status: null} + 3: {course_name: "离散数学", target_value: null, real_value: null, status: null} + length: 4 + __proto__: Array(0) + second_level: "1.1" + */ +let maxCouseCount = 0; + +function getTableData(data_args) { + let tableData = [] + // 最大课程数量,根据这个值动态渲染课程列数 + maxCouseCount = 0; + if (data_args) { + data_args.forEach((item, index) => { + item.first_leval_data.forEach((innerItem, innerIndex) => { + let nameRowData = {}; + let targetValueRowData = {}; + let realValueRowData = {}; + let target_value_total = 0; + let real_value_total = 0; + // 一个course数组的数据组合成三行table数据 + innerItem.course_data.forEach((course, courseIndex) => { + nameRowData[`c${courseIndex + 1}`] = course.course_name; + + targetValueRowData[`c${courseIndex + 1}`] = 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.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 = true + } + maxCouseCount = Math.max(maxCouseCount, innerItem.course_data.length) + tableData.push(nameRowData) + tableData.push(targetValueRowData) + tableData.push(realValueRowData) + }) + }) + } + 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(innerItem.actually_reach) != 0 + // } + maxCouseCount = Math.max(maxCouseCount, innerItem.course_supports.length) + tableData.push(nameRowData) + tableData.push(targetValueRowData) + tableData.push(realValueRowData) + }) + }) + } + return tableData; +} + +let tableData = [] + + +const data = [ + { + key: '1', + + c1: '数学分析 II1', + c2: '数学分析 II2', + c3: '大学物理 V', + c4: '大学物理实验II', + c5: '线性代数 I', + c6: '结合论与数理逻辑', + c7: '复变函数与积分变换I', + c8: '毕业设计', + g_r: '8', + e_r: '未达成' +}, { + key: '2', + c1: '0.140', + c2: '0.150', + c3: '0.110', + c4: '0.120', + c5: '0.163', + c6: '0.063', + c7: '0.053', + c8: '0.053', + g_r: 0.650 +}, { + key: '3', + c1: '', + c2: '', + c3: '', + c4: '', + c5: '', + c6: '', + c7: '', + c8: '', + g_r: '0.000' +}, +{ + key: '4', + + c1: '计算概论', + c2: '概率论与数理统计I', + c3: '图论与组合数学', + c4: '算法设计与分析', + c5: '毕业设计', + + g_r: '5', + e_r: '未达成' +}, { + key: '5', + c1: '0.070', + c2: '0.210', + c3: '0.175', + c4: '0.070', + c5: '0.175', + g_r: '0.700', +}, { + key: '6', + c1: '', + c2: '', + c3: '', + c4: '', + c5: '', + c6: '', + c7: '', + c8: '', + g_r: '0.000', +},{ + key: '7', + + c1: 'C语言程序设计Ⅳ', + c2: '数据结构Ⅰ', + c3: '操作系统', + c4: '计算机网络原理Ⅰ', + c5: '人工智能', + c6: '编译原理', + c7: '数据库原理', + c8: '软件工程Ⅰ', + c9: '面向对象程序设计(C++)', + e_r: '未达成' + +}, { + key: '8', + c1: '0.070', + c2: '0.070', + c3: '0.070', + c4: '0.070', + c5: '0.070', + c6: '0.070', + c7: '0.070', + c8: '0.070', + c9: '0.070', + g_r: '0.630', + +}, { + key: '9', + c1: '', + c2: '', + c3: '', + c4: '', + c5: '', + c6: '', + c7: '0.134', + c8: '', + g_r: '0.134', +},{ + key: '10', + c1: '计算机组成原理Ⅰ', + c2: '数字逻辑与数字电路', + c3: '计算机系统结构', + c4: '汇编语言程序设计Ⅰ', + c5: '接口技术Ⅰ', + c6: '模拟电路应用', + c7: '微机控制技术Ⅰ', + c8: '计算机系统装配与集成', + e_r: '未达成' + +}, { + key: '11', + c1: '0.070', + c2: '0.070', + c3: '0.070', + c4: '0.070', + c5: '0.070', + c6: '0.070', + c7: '0.070', + c8: '0.070', + g_r: '0.560', + +}, { + key: '12', c1: '', c2: '', c3: '', c4: '', c5: '', c6: '', c7: '', c8: '', + g_r: '0.000', + +},{ + key: '13', + c1: '数学分析Ⅱ1', + c2: '数学分析Ⅱ2', + c3: '大学物理Ⅴ', + c4: '线性代数Ⅰ ', + c5: '概率论与数理统计Ⅰ', + c6: '集合论与数理逻辑', c7: '图论与组合数学', c8: '编译原理', c9: '算法设计与分析', + e_r: '未达成' +}, { + key: '14', + c1: '0.035', + c2: '0.056', + c3: '0.070', + c4: '0.084', + c5: '0.035', + c6: '0.105', + c7: '0.014', + c8: '0.084', + c: '0.049', + g_r: '0.700', + +}, { + key: '15', c1: '', c2: '', c3: '', c4: '', c5: '', c6: '', c7: '', c8: '', + g_r: '0.000', + +},{ + key: '16', + c1: '前沿技术讲座', + c2: '毕业设计', + // c3: '课程1', c4: '课程1', c5: '课程1', c6: '课程1', c7: '课程1', c8: '课程1', e_r: '未达成' + e_r: '未达成' +}, { + key: '17', c1: '0.210', c2: '0.490' + //, c3: '0.3', c4: '0.3', c5: '0.3', c6: '0.3', c7: '0.3', c8: '0.3', + ,g_r: '0.700', +}, { + key: '18', c1: '', c2: '', c3: '', c4: '', c5: '', c6: '', c7: '', c8: '', + g_r: '0.000' + +} +]; + +class GraduatesRequirement extends Component { + constructor(props) { + super(props) + this.state={ + schooldata:{}, + ec_year_id:0, + + daChengYuZhiEditableMode: false, + daChengYuZhi: 0.1, + daChengYuZhiSaved: 0.1, + + calculating: false, // 是否在计算中 + } + } + onDaChengYuZhiChange = (value) => { + if ( (!window.event || window.event.type == 'blur') + && this.state.daChengYuZhi > 1 && value == 1) { + this.props.showSingleButtonModal('提示', '达成阈值必须小于等于1') + } + this.setState({ daChengYuZhi: value }); + } + onDaChengYuZhiCancel = () => { + this.setState({ daChengYuZhi: this.state.daChengYuZhiSaved }) + this.setDaChengYuZhiEditableMode(false) + } + setDaChengYuZhiEditableMode = (mode) => { + this.setState({ daChengYuZhiEditableMode: mode }) + } + saveDaChengYuZhi = () => { + let major_school_id =this.props.match.params.major_school_id; + let ec_year_id =this.props.match.params.ec_year_id; + + var url = `/ec_major_schools/${major_school_id}/academic_years/${ec_year_id}/set_calculation_value`; + url = `/ec_years/${this.state.ec_year_id}/reach_criteria.json` + + if (this.state.daChengYuZhi == undefined) { + this.props.showSingleButtonModal('提示', '达成阈值不能为空!') + return; + } else if (this.state.daChengYuZhi == 0) { + this.props.showSingleButtonModal('提示', '达成阈值必须大于0,且小于等于1') + return; + } + axios.post(url, { + reach_criteria : this.state.daChengYuZhi + }).then((response) => { + + if( response.data.status === 0 ) { + this.setState({ daChengYuZhiSaved: this.state.daChengYuZhi }) + this.setDaChengYuZhiEditableMode(false) + }else { + // 其他message + } + }).catch((error) => { + console.log(error) + }) + + + } + componentDidMount(){ + window.document.title = '达成度评价结果'; + let ec_year_id =this.props.match.params.ec_year_id; + this.setState({ + ec_year_id:ec_year_id + }) + this.fetchData(ec_year_id) + + // const Url =`/ec_major_schools/get_navigation_data?ec_year_id=`+ec_year_id; + // axios.get(Url, { + // // withCredentials: true, + // }) + // .then((response) => { + // if(response.status===200){ + // // if(response.data.allow_visit===false){ + // // window.location.href="/403" + // // } + // this.setState({ + // schooldata:response.data + // }) + // } + // }) + // .catch(function (error) { + // console.log(error); + // }); + } + 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_years/${ec_year_id}/reach_evaluation.json` + // num_array = getNumArray(testData.calculation_data); + // tableData = getTableData(testData.calculation_data) + // return + + axios.get(url, { + // withCredentials: true, + }) + .then((response) => { + 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, + daChengYuZhi: response.data.reach_threshold, + daChengYuZhiSaved: response.data.reach_threshold, + course_ids: response.data.course_ids, + is_manager: response.data.is_manager, + calculating: false, + }) + } + + + }) + .catch(function (error) { + console.log(error); + }); + } + onCalculate = () => { + if (!this.state.course_ids || this.state.course_ids.length === 0) { + // 没有课程数据 + this.props.showSingleButtonModal('提示', '请先配置基础数据') + + return; + } + + this.setState({ calculating: true }) + var Url = '/ec_courses/sync_all_course_data'; + /** + # POST: /ec_courses/sync_all_course_data + # 参数: + # course_ids: [1,2,3,4] + */ + axios.post(Url, { + course_ids: this.state.course_ids + }).then((response) => { + // 计算需要一定的时间,让按钮转动 + + if( response.data.status === 1 ) { + let ec_year_id = this.props.match.params.ec_year_id; + this.fetchData(ec_year_id); + this.props.showSingleButtonModal('提示', '计算完毕') + } else { + + } + }).catch((error) => { + this.setState({ calculating: false }) + + console.log(error) + }) + } + render() { + const { match, history, current_user } = this.props + const { daChengYuZhiEditableMode, daChengYuZhi, daChengYuZhiSaved, is_manager } = this.state + let { schooldata } =this.state; + // let { example_major, template_major } = schooldata; + let showCalculateButton = is_manager; + // let showCalculateButton = false; + // if (example_major && current_user.admin || !example_major && template_major) { + // showCalculateButton = true; + // } + return ( + +
+ + + +

+ 达成阈值: + { daChengYuZhiEditableMode ? + + + 确定 + + 取消 + + + : + + {daChengYuZhiSaved} + {/* data-tip-down="编辑" */} + { this.setDaChengYuZhiEditableMode(true) }} + class="iconfont icon-bianjidaibeijing color-green" idkey="0" + style={{ float: 'left', marginTop: '-3px', marginLeft: '3px', cursor: 'pointer' }}> + + } + + {/* + + */} + + 导出 + {/* /ec_major_schools/3/academic_years/5/export_reach_requirements_data.xls + let major_school_id =this.props.match.params.major_school_id; + let ec_year_id =this.props.match.params.ec_year_id; + */} + + { showCalculateButton && ( this.state.calculating === true ? + + 计算中... + : + + 计算 + ) + } + +

+ + {/* { this.state.calculating == true ? + }> + : }   */} +
+ +
+ + ); + } +} + +export default ECModalHOC() (GraduatesRequirement) ; diff --git a/public/react/src/modules/ecs/EcSetting/reachCalculationInfo/index.scss b/public/react/src/modules/ecs/EcSetting/reachCalculationInfo/index.scss new file mode 100644 index 000000000..56a260b5e --- /dev/null +++ b/public/react/src/modules/ecs/EcSetting/reachCalculationInfo/index.scss @@ -0,0 +1,74 @@ +.newMain { + height: 100%; + } + .contentWrap { + height: 100%; + overflow: auto; + } + .bor-bottom-greyE { + border-bottom: 1px solid #EEEEEE!important; + } + .padding20-30 { + padding: 20px 30px; + box-sizing: border-box; + } + .clearfix { + clear: both; + zoom: 1; + } + .bor-bottom-greyE { + border-bottom: 1px solid #EEEEEE!important; + } + .courseSystem, .SystemParameters { + font-family: MicrosoftYaHei; + font-weight: 400; + line-height: 45px; + } + .courseSystem { + font-size: 18px; + color: #05101a; + } + .font-18 { + font-size: 18px!important; + } + .fl { + float: left!important; + } + .backgroundFFF{ + background: #FFF; + } + .ant-table-body table thead tr th{ + background: #FFF; + } + .ant-table-body table .ant-table-thead :nth-child(1) th{ + border-right: 1px solid #e8e8e8; + } + .ant-table-body table .ant-table-thead :nth-child(1) :nth-child(4){ + /* border-right: 1px solid transparent; */ + } + .ant-table-body table .ant-table-thead :nth-child(2) th{ + border-top: 1px solid #e8e8e8; + border-right: 1px solid #e8e8e8; + } + + .ant-table-bordered .ant-table-thead > tr > th, .ant-table-bordered .ant-table-tbody > tr > td { + text-align: center; + } + + .graduatesRequirement .ant-table-wrapper { + padding: 20px 10px; + background: #fff; + margin-top: -16px; + margin-bottom: 40px; + } + + .graduatesRequirement .ant-table-thead > tr.ant-table-row-hover:not(.ant-table-expanded-row) > td, + .graduatesRequirement .ant-table-tbody > tr.ant-table-row-hover:not(.ant-table-expanded-row) > td, + .graduatesRequirement .ant-table-thead > tr:hover:not(.ant-table-expanded-row) > td, + .graduatesRequirement .ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td { + background: transparent !important; + } + + .mt60{ + margin-top:60px; + } \ No newline at end of file diff --git a/public/react/src/modules/ecs/Ecs.js b/public/react/src/modules/ecs/Ecs.js index dab84e8d5..ce5b95982 100644 --- a/public/react/src/modules/ecs/Ecs.js +++ b/public/react/src/modules/ecs/Ecs.js @@ -9,6 +9,61 @@ const Home = CustomLoadable(() => import('./Home/index')); const EcYear = CustomLoadable(() => import('./EcYear/index')); const EcSetting = CustomLoadable(() => import('./EcSetting/index')); +const $ = window.$ +//工程认证各个页面的查看详情弹层 +function elasticLayer(forumId){ + if (window.__memo) { + doElasticLayer(window.__memo, true) + return; + } + if (!forumId) return; + var url = 'https://www.educoder.net/api/memos/' + forumId + $.ajax({ + url: url, + type: 'get', + success: function(res) { + console.log(res) + doElasticLayer(res.memo) + } + }); + + // document.body.addEventListener('touchmove',bodyScroll,false); + // $('body').css({'position':'fixed',"width":"100%"}); +} +function doElasticLayer(memo, rendered){ + if (rendered) { + $(".layerContent").show(); + $(".newMain").hide(); + return; + } + window.__memo = memo + var content = memo.content + var subject = memo.subject + var html='
' + + '

'+ subject +'' + + '返回

' + + '
' + + $(".newMain").after(html).hide(); + + editormd.markdownToHTML("MDContent", { + htmlDecode: "style,script,iframe", // you can filter tags decode + taskList: true, + tex: true, // 默认不解析 + flowChart: true, // 默认不解析 + sequenceDiagram: true // 默认不解析 + }); +} +function removeElasticLayer(){ + $(".layerContent").hide(); + $(".newMain").show(); +} +window.elasticLayer = elasticLayer +window.doElasticLayer = doElasticLayer +window.removeElasticLayer = removeElasticLayer + class Ecs extends React.Component { render() { diff --git a/public/react/src/modules/ecs/common/ECModalHOC.js b/public/react/src/modules/ecs/common/ECModalHOC.js new file mode 100644 index 000000000..650c10cbe --- /dev/null +++ b/public/react/src/modules/ecs/common/ECModalHOC.js @@ -0,0 +1,91 @@ +import React, { Component } from 'react'; +import { Modal } from 'antd'; + + +export function ECModalHOC(options = {}) { + return function wrap(WrappedComponent) { + return class Wrapper extends Component { + constructor(props) { + super(props); + + this.state = { + titlemessage: '', + Modallist: false, + Modallisttype: false, + singleButton: false + } + } + + // 全局的modal this.props.showModal 调用即可 + showModal = (title, content, okCallback) => { + this.okCallback = okCallback; + this.setState({ + titlemessage: title, + Modallist: content, + Modallisttype: true, + singleButton: false, + + }) + } + + showSingleButtonModal = (title, content) => { + this.setState({ + titlemessage: title, + Modallist: content, + Modallisttype: true, + singleButton: true, + }) + } + + onCancel = () => { + this.setState({ + Modallisttype:false + }) + } + hidemodeldelete = () => { + if (this.okCallback) { + this.okCallback() + } + + this.onCancel() + } + render() { + const { titlemessage, Modallisttype, Modallist, singleButton } = this.state; + + return ( + + +
+
{Modallist}
+
+ { singleButton ?
+ 知道啦 +
:
+ 取消 + 确定 +
} +
+ + + +
+ ) + } + } + } +} \ No newline at end of file diff --git a/public/react/src/modules/ecs/css/ecCourseEvaluations.css b/public/react/src/modules/ecs/css/ecCourseEvaluations.css index f27ad7313..cb6c29a01 100644 --- a/public/react/src/modules/ecs/css/ecCourseEvaluations.css +++ b/public/react/src/modules/ecs/css/ecCourseEvaluations.css @@ -9,7 +9,12 @@ font-family:MicrosoftYaHei; font-weight:400; color:#05101A !important; + +} +.marginleft76{ + margin-left: 76px; } + #SystemParameters{ height: 81px; line-height: 40px; @@ -160,6 +165,9 @@ input{ margin-left: 8px; padding-left: 25px !important; } +.percentages{ + margin-left: 8px; +} .Coursetitle{ margin-bottom:0px !important; } @@ -167,6 +175,11 @@ input{ padding-left: 30px !important; width: 70px !important; } +.textaligncenters{ + width: 133px !important; + display: block; + float: left; +} .ml72{ margin-left:72px; } @@ -213,6 +226,10 @@ input{ width: 589px !important; display: inline-block; } +.evaluationdataClassy{ + width: 589px !important; + display: inline-block; +} .absolute{ position:absolute; } @@ -246,12 +263,22 @@ input{ padding: 10px 0px !important; margin: 0px 20px !important; } - +.newSystem .newtarget_scoreclassysl{ + padding: 10px 0px !important; +} +.mynewtarget_scoreclassysls{ + padding: 10px 20px!important; +} .newSystem .newtarget_target{ padding: 10px 0px !important; margin: 0px 30px !important; border-bottom:1px solid transparent !important; } +.newSystem .newtarget_targets{ + padding: 10px 0px !important; + + border-bottom:1px solid transparent !important; +} .nowrap329{ max-width: 329px !important; @@ -263,9 +290,9 @@ input{ min-width: 329px !important; } .ListTableLine li>.column-500{ - max-width: 360px !important; + max-width: 366px !important; text-align: left; - min-width: 360px !important; + min-width: 366px !important; } .color-666{ color:#666666 !important; diff --git a/public/react/src/modules/ecs/css/ecCourseSupports.css b/public/react/src/modules/ecs/css/ecCourseSupports.css index 10b6ebd91..5f53aa0f8 100644 --- a/public/react/src/modules/ecs/css/ecCourseSupports.css +++ b/public/react/src/modules/ecs/css/ecCourseSupports.css @@ -234,6 +234,10 @@ input{ .color-05101A{ color:#05101A !important; } +/*边框*/ +bordertopsolid{ + border:1px solid #000; + } .ec_graduation_name{ margin-right:20px !important; } diff --git a/public/react/src/modules/ecs/curriculum/Curriculum.js b/public/react/src/modules/ecs/curriculum/Curriculum.js index 3dae260de..b0f8bb898 100644 --- a/public/react/src/modules/ecs/curriculum/Curriculum.js +++ b/public/react/src/modules/ecs/curriculum/Curriculum.js @@ -36,7 +36,10 @@ const EcCompletionCalculation =Loadable({ loader: () => import('../subroute/ecCompletion_calculation/EcCompletionCalculation'), loading: Loading, }); - +const EcCourseSupportSetting =Loadable({ + loader: () => import('../subroute/ecCourseSupportSetting/index'), + loading: Loading, +}); class Curriculum extends Component { //课程体系 @@ -56,6 +59,7 @@ class Curriculum extends Component { // window.document.title = '课程达成评价结果'; } componentDidMount(){ + console.log("Curriculum"); console.log(this.props); } sync_course_data=()=>{ @@ -91,7 +95,16 @@ class Curriculum extends Component { // }) } - + bindRef = ref => { + console.log(ref); + // console.log("调用了子对象1"); + this.child = ref + }; + newrightcalculatebuttonysl=(child)=>{ + // console.log("调用了子对象2"); + // console.log(child); + child.newrightcalculatebutton(); + } onAclick=(i)=>{ console.log("onAclick"); console.log(i); @@ -112,6 +125,8 @@ class Curriculum extends Component { }; Ontitine=(s)=>{ + console.log("CurriculumCurriculum"); + console.log(s); if(s==="ec_course_support_setting"){ this.setState({ titine:1, @@ -208,10 +223,10 @@ class Curriculum extends Component { titine===5? - 导出评价详情 + 导出评价详情 计算 + onClick={()=>this.newrightcalculatebuttonysl(this.child)}>计算 :titine===4? (各环节平均得分*占比)之和/(各环节总分*占比)之和 @@ -230,20 +245,20 @@ class Curriculum extends Component { {/*Curriculumtwo 测试用*/} {/*课程目标*/} - (this.Ontitine(i)} />) }> + (this.Ontitine(i)} />) }> {/*课程考核方式与数据来源*/} - (this.Ontitine(i)}/>) }> {/*成绩等级设置*/} - (this.Ontitine(i)}/>) }> - {/*4课程目标评价方法*/} - (this.Ontitine(i)}/>) }> {/*5课程达成评价结果*/} - (this.Ontitine(i)}/>) }> + (this.Ontitine(i)} triggerRef={this.bindRef}/>) }>
diff --git a/public/react/src/modules/ecs/curriculum/CurriculumSubpage.js b/public/react/src/modules/ecs/curriculum/CurriculumSubpage.js new file mode 100644 index 000000000..f7efffd8a --- /dev/null +++ b/public/react/src/modules/ecs/curriculum/CurriculumSubpage.js @@ -0,0 +1,35 @@ +import React, { Component } from 'react'; + +class CurriculumSubpage extends Component { + //测试用 + constructor(props) { + super(props) + // console.log(props); + } + + componentWillMount(){ + } + componentDidMount(){ + // 起始页面 + // console.log(this.props); + console.log("CurriculumSubpage"); + console.log(this.props.match.params); + } + Curriculumstructure=()=>{ + this.props.history.push(`/ecs/major_schools/${this.props.match.params.majorId}/years/${this.props.match.params.yearId}/courses/subpage/ec_course_support_setting/1`); + } + + + render() { + // console.log("Curriculumtwo"); + // console.log(this.props); + return ( +
+ this.Curriculumstructure()}>点我进去课程体系 +
+ ) + } + + +} +export default CurriculumSubpage; \ No newline at end of file diff --git a/public/react/src/modules/ecs/subroute/ecCompletion_calculation/EcCompletionCalculation.js b/public/react/src/modules/ecs/subroute/ecCompletion_calculation/EcCompletionCalculation.js index 4be7c11d3..2b525284a 100644 --- a/public/react/src/modules/ecs/subroute/ecCompletion_calculation/EcCompletionCalculation.js +++ b/public/react/src/modules/ecs/subroute/ecCompletion_calculation/EcCompletionCalculation.js @@ -42,7 +42,12 @@ class EcCompletionCalculation extends Component { course_total_scoreaverage:0, calculatesetype:false, Spintype:false, - ismanager:false + ismanager:false, + course_achievement:"--", + course_rate:"--", + score_levels:[], + score_levelsdata:[], + hife:"/ecs/major_schools/3/years/60/requirement_vs_courses", } } @@ -51,26 +56,55 @@ class EcCompletionCalculation extends Component { } componentDidMount(){ - let ec_course_id =this.props.match.params.ec_course_id; - this.UpdateClassData(true); - const Url =`/ec_major_schools/get_navigation_data?ec_course_id=`+ec_course_id; - axios.get(Url, { - withCredentials: true, - }) + console.log("componentDidMount"); + console.log("EcCompletionCalculation"); + + // console.log(this.props); + // let ec_course_id =this.props.match.params.ec_course_id; + // this.UpdateClassData(true); + + // const url =`/ec_major_schools/get_navigation_data?ec_course_id=`+ec_course_id; + const ec_course_id=706; + const url =`/ec_courses/${ec_course_id}/evaluation.json`; + axios.get(url) .then((response) => { if(response.status===200){ // if(response.data.allow_visit===false){ // window.location.href="/403" // } - this.setState({ - schooldata:response.data, - ec_course_id:ec_course_id - }) + + this.setState({ + schooldata:response.data, + ec_course_id:ec_course_id, + // evaluate_result:response.data.evaluate_result, + // course_total_score:response.data.course_total_score[response.data.course_total_score.length-1].total_rate, + // total_rate_data:response.data.course_total_score[response.data.course_total_score.length-1].total_rate.length, + graduation_list:response.data.graduation_subitem_evaluations, + target_list:response.data.course_targets, + // target_score:response.data.target_score, + ec_course_targets_count:response.data.course_targets.length, + course_achievement:response.data.course_achievement, + course_rate:response.data.course_rate, + score_levels:response.data.score_levels, + // score_levelsdata:response.data.course_targets.score_levels, + // morelisttype:newmorelisttype, + // course_total_scoreaverage:course_total_scoreaverage, + // ismanager:response.data.is_manager + }) + // console.log("componentDidMount"); + // console.log(response.data.score_levels); + // console.log(response.data.course_targets.score_levels); } }) .catch(function (error) { console.log(error); }); + this.props.Ontitine("competition_calculation_info"); + try { + this.props.triggerRef(this); + }catch (e) { + + } } targetsget_navigation_data=(ec_year_id,ec_course_id)=>{ @@ -101,10 +135,11 @@ class EcCompletionCalculation extends Component { } UpdateClassData=(key)=>{ let {calculatetype} =this.state; - let ec_course_id =this.props.match.params.ec_course_id; + // let ec_course_id =this.props.match.params.ec_course_id; this.setState({ ec_course_id:ec_course_id }) + const ec_course_id=706; const Arl =`/ec_courses/`+ec_course_id+`/calculation_info_data`; axios.get(Arl, { withCredentials: true, @@ -138,19 +173,29 @@ class EcCompletionCalculation extends Component { } this.setState({ - evaluate_result:response.data.evaluate_result, - course_total_score:response.data.course_total_score[response.data.course_total_score.length-1].total_rate, - total_rate_data:response.data.course_total_score[response.data.course_total_score.length-1].total_rate.length, - graduation_list:response.data.graduation_list, - target_list:response.data.target_list, - target_score:response.data.target_score, - ec_course_targets_count:response.data.ec_course_targets_count, - morelisttype:newmorelisttype, - course_total_scoreaverage:course_total_scoreaverage, - ismanager:response.data.is_manager - }) - - + // evaluate_result:response.data.evaluate_result, + // course_total_score:response.data.course_total_score[response.data.course_total_score.length-1].total_rate, + // total_rate_data:response.data.course_total_score[response.data.course_total_score.length-1].total_rate.length, + graduation_list:response.data.graduation_subitem_evaluations, + target_list:response.data.course_targets, + // target_score:response.data.target_score, + ec_course_targets_count:response.data.course_targets.length, + course_achievement:response.data.course_achievement, + course_rate:response.data.course_rate, + score_levels:response.data.score_levels, + // score_levelsdata:, + // morelisttype:newmorelisttype, + // course_total_scoreaverage:course_total_scoreaverage, + // ismanager:response.data.is_manager + }); + // console.log("componentDidMount"); + // console.log(response.data.score_levels_map); + // Object.getOwnPropertyNames(response.data.score_levels_map).forEach(function(val) { + // console.log("正在循环"); + // console.log(val); + // }); + // console.log(response.data.course_targets.score_levels); + // ec_course_targets:response.data.ec_course_targets, this.targetsget_navigation_data(response.data.ec_year_id,ec_course_id) if(calculatetype===true){ @@ -263,25 +308,29 @@ class EcCompletionCalculation extends Component { } newrightcalculatebutton=()=>{ + console.log("调用了计算"); this.setState({ Spintype:true }) - let {ec_course_id}=this.state; - const Orl =`/ec_courses/`+ec_course_id+`/sync_data`; - axios.get(Orl, { - withCredentials:true, - }) + // let {ec_course_id}=this.state; + const ec_course_id=706; + // const Orl =`/ec_courses/`+ec_course_id+`/sync_data`; + const Orl =`/ec_courses/${ec_course_id}/evaluation.json`; + axios.get(Orl) .then((response) => { - if(response.data.status===1){ - this.setState({ - calculatetype:true, - completiontype:true, - completionlist:'计算成功', - calculatesetype:true, - Spintype:false - }) - this.UpdateClassData(true); + if(response){ + if(response.data.status===1){ + this.setState({ + calculatetype:true, + completiontype:true, + completionlist:'计算成功', + calculatesetype:true, + Spintype:false + }) + this.UpdateClassData(true); + } } + }) .catch(function (error) { console.log(error) @@ -295,14 +344,14 @@ class EcCompletionCalculation extends Component { }) } render() { - let {Spintype,calculatesetype,ec_course_id,course_total_scoreaverage,ec_course_targets_count,schooldata,ecComponentState,course_total_score,total_rate_data,ec_course_targets,graduation_list,target_list,target_score,evaluate_result,morelisttype,titlemessage,completiontype,completionlist,ismanager} = this.state; + let {Spintype,calculatesetype,ec_course_id,course_total_scoreaverage,score_levels,ec_course_targets_count,course_achievement,schooldata,course_rate,ecComponentState,course_total_score,total_rate_data,ec_course_targets,graduation_list,target_list,target_score,evaluate_result,morelisttype,titlemessage,completiontype,completionlist,ismanager} = this.state; let TargetresList = (length) => { let target_listres = []; for(let i = 0; i < length; i++) { // target_listres.push(目标{length-i}) // target_listres.push(目标{i+1}) - target_listres.push(目标{length-i}) + target_listres.push(目标{i+1}) } return target_listres } @@ -311,28 +360,30 @@ class EcCompletionCalculation extends Component { let target_listress = []; for(let i = 0; i < length; i++) { // target_listres.push(目标{length-i}) - target_listress.push(目标{i+1}) + target_listress.push(目标{i+1}) // target_listres.push(目标{length-i}) } return target_listress } - let TargetresContentList = (length,value) => { - let target_listres = []; - if(value!=undefined){ - for(let i = 0; i < length; i++) { - - if(value[i]===1){ - target_listres.push() - }else{ - target_listres.push() - } - - } - target_listres.reverse() - return target_listres - } - } + let TargetresContentList = (data,value) => { + let target_listres = []; + if(data){ + if(data.length>0){ + for(var i=0;i) + } else{ + target_listres.push() + + } + } + } + } + // target_listres.reverse() + return target_listres + }; @@ -393,7 +444,9 @@ class EcCompletionCalculation extends Component { } return target_listres } - } + }; + // console.log(ec_course_targets_count); + // console.log("EcCompletionCalculation"); return (
-
+
{/**/} {/*
*/} {/*
*/} - + {/*课程目标*/}

@@ -511,10 +564,10 @@ class EcCompletionCalculation extends Component {

  • {key+1} {item.content} - {item.result} - {item.standard_grade} - {item.real_grade} - {item.weigths} + {item.status==="not_achieved"?"未达成":"已达成"} + {item.standard_grade} + {item.actually_grade} + {item.weight}
  • ) @@ -523,7 +576,7 @@ class EcCompletionCalculation extends Component {
    - + {/*毕业要求指标点达成评价结果*/}
    @@ -540,6 +593,7 @@ class EcCompletionCalculation extends Component {

    毕业要求 {5} + 达成结果 达成目标值 达成实际值 @@ -560,52 +614,103 @@ class EcCompletionCalculation extends Component { {"--"} {"--"} {"--"} - 立即配置 + 立即配置 {TargetresContentList(5,[2,2,2,2,2])} :"" } + { Spintype===false?graduation_list.map((item,key)=>{ if(key===0){ return( -

    5 ? (76*(ec_course_targets_count+4)+380+15):1200+"px"}}> - 毕业要求 - {item.ec_subitem_content} - 达成结果 - 达成目标值 - 达成实际值 - 课程权重 +

  • 5 ? (76*(ec_course_targets_count+4)+380+15):1200+"px"}}> +
    + 毕业要求 +
    + {item.ec_subitem_content} +
    {TargetresList(ec_course_targets_count)} -

    +
    +
    + 课程权重 + 达成目标值 + 达成实际值 + 达成结果 +
    +
  • ) } }):"" } + {/*mynewtarget_scoreclassysls*/} + +
    + { + Spintype===false?graduation_list.map((item,key)=>{ + + return( + +
  • 5 ? (76*(ec_course_targets_count+4)+380+15):1200+"px"}}> +
    + {key+1} +
    + {item.content} +
    + {TargetresContentList(target_list,item.support_course_target_ids)} +
    +
    + {item.weights===null||item.weights===undefined||item.weights==="0.00"||item.weights===0.00||item.weights===0?立即配置:{item.weights}} + {item.actually_achievement===null?0:item.actually_achievement} + {item.objective_achievement===null?0:item.objective_achievement} + {item.status==="not_achieved"?"未完成":"完成"} +
    +
  • + + + //
  • 5 ? (76*(ec_course_targets_count+4)+380):1200+"px"}}> + // {/* {item.ec_graduation_name} */} + // {key+1} + // {item.content} + // {item.status==="not_achieved"?"未完成":"完成"} + // {item.objective_achievement===null?0:item.objective_achievement} + // {item.actually_achievement===null?0:item.actually_achievement} + // {item.weights===null||item.weights===0?立即配置:{item.weights}} + // {TargetresContentList(ec_course_targets_count,item.target_position)} + //
  • + ) + + }):"" + } + + +
    - - { - Spintype===false?graduation_list.map((item,key)=>{ - - return( -
  • 5 ? (76*(ec_course_targets_count+4)+380):1200+"px"}}> - {/* {item.ec_graduation_name} */} - {key+1} - {item.ec_subitem_content} - {item.result} - {item.reach_target===null?0:item.reach_target} - {item.reach_real_target===null?0:item.reach_real_target} - {item.weight===null||item.weight===0?立即配置:{item.weight}} - {TargetresContentList(ec_course_targets_count,item.target_position)} -
  • - ) - - }):"" - }
    + {/*课程总评成绩表*/}
    @@ -652,9 +757,9 @@ class EcCompletionCalculation extends Component { {/* 平均数 */} {/* 平均数 */} {Total_rate_dataList(course_total_score)} - { - course_total_score.length===0? --:"" - } + { + course_rate===undefined||course_rate===null||course_rate===""||course_rate==="0"||course_rate===0? --:{course_rate} + } :"" } {/*style={{width: 113*(total_rate_data+4)>1136?113*(total_rate_data+4):1136+"px"}}*/} @@ -687,7 +792,7 @@ class EcCompletionCalculation extends Component { {newTotal_rate_dataList(course_total_score-1,course_total_score)} {/* {course_total_score.length===0?"":course_total_score[course_total_score-1].total_score} */} { - course_total_score.length===0? --:{course_total_scoreaverage} + course_achievement===undefined||course_achievement===null||course_achievement===""||course_achievement==="0"||course_achievement===0? --:{course_achievement} } :"" } @@ -716,47 +821,63 @@ class EcCompletionCalculation extends Component { 平均分 最高分数 最低分数 - 90分以上 - 80-89分 - 70-79分 - 60-69分 - 50-59分 - 低于50分 + { + score_levels&&score_levels.map((i,k)=>{ + return( + {i.description} + ) + }) + }

    { - Spintype===false?target_score.map((i,k)=>{ + Spintype===false?target_list.map((i,k)=>{ return(
  • {k+1} - {i.average_score} - {i.top_score} - {i.low_score} - -
    {i.from90[0]}人
    -
    {(i.from90[1]).toFixed(2)}%
    -
    - -
    {i.from80[0]}人
    -
    {(i.from80[1]).toFixed(2)}%
    -
    - -
    {i.from70[0]}人
    -
    {(i.from70[1]).toFixed(2)}%
    -
    - -
    {i.from60[0]}人
    -
    {(i.from60[1]).toFixed(2)}%
    -
    - -
    {i.from50[0]}人
    -
    {(i.from50[1]).toFixed(2)}%
    -
    - -
    {i.from_down[0]}人
    -
    {(i.from_down[1]).toFixed(2)}%
    -
    + {i.standard_grade} + {i.maximum_score===null || i.maximum_score===undefined ||i.maximum_score===""?"--":i.maximum_score} + {i.minimum_score===null || i.minimum_score===undefined || i.minimum_score===""?"--":i.minimum_score} + { + i.score_levels.map((j,l)=>{ + + return( + +
    {j.count}人
    +
    {j.rate===null||j.rate===undefined||j.rate===""||j.rate===0?0.00:j.rate}%
    +
    + ) + } + ) + } + + {/*}*/} + {/**/} + {/*
    {i.from90[0]}人
    */} + {/*
    {(i.from90[1]).toFixed(2)}%
    */} + {/*
    */} + {/**/} + {/*
    {i.from80[0]}人
    */} + {/*
    {(i.from80[1]).toFixed(2)}%
    */} + {/*
    */} + {/**/} + {/*
    {i.from70[0]}人
    */} + {/*
    {(i.from70[1]).toFixed(2)}%
    */} + {/*
    */} + {/**/} + {/*
    {i.from60[0]}人
    */} + {/*
    {(i.from60[1]).toFixed(2)}%
    */} + {/*
    */} + {/**/} + {/*
    {i.from50[0]}人
    */} + {/*
    {(i.from50[1]).toFixed(2)}%
    */} + {/*
    */} + {/**/} + {/*
    {i.from_down[0]}人
    */} + {/*
    {(i.from_down[1]).toFixed(2)}%
    */} + {/*
    */} +
  • ) @@ -764,8 +885,8 @@ class EcCompletionCalculation extends Component { } { Spintype===true?}/>:"" } - - {target_score.length===0&&Spintype===false? + + {target_list.length===0&&Spintype===false?
  • -- -- diff --git a/public/react/src/modules/ecs/subroute/ecCourseEvaluations/EcCourseEvaluationsbottom.js b/public/react/src/modules/ecs/subroute/ecCourseEvaluations/EcCourseEvaluationsbottom.js index 6e27711b2..3c2014bf2 100644 --- a/public/react/src/modules/ecs/subroute/ecCourseEvaluations/EcCourseEvaluationsbottom.js +++ b/public/react/src/modules/ecs/subroute/ecCourseEvaluations/EcCourseEvaluationsbottom.js @@ -16,7 +16,7 @@ import 'antd/dist/antd.css'; import '../../css/ecCourseEvaluations.css'; import EcTitleCourseEvaluations from "../../ecTitle/ecTitle"; - +import './eccourseevalut.css' const $ = window.$; // 课程目标评价方法 @@ -48,21 +48,23 @@ class EcCourseEvaluationsbottom extends Component { meweacoursetype:false, newshowredvalue:false, percentagetype:false, - ismanager:false + ismanager:true } } getec_course_achievement_methods=()=>{ const {newec_course_idbottom}=this.state; if(newec_course_idbottom!=undefined){ - const url = `/ec_course_achievement_methods?ec_course_id=`+newec_course_idbottom; + // const url ='ec_courses/:course_id/course_targets.json'; + // const url = `/ec_course_achievement_methods?ec_course_id=`+newec_course_idbottom; + const url =`/ec_courses/${course_id}/course_targets/course_achievement_methods.json`; axios.get(url, { withCredentials: true, }) .then((response)=>{ this.setState({ - achievement_list:response.data.achievement_list, + achievement_list:response.data.course_targets, spinningstate:false, - ismanager:response.data.is_manager + ismanager:true }) }).catch(function (error) { console.log(error); @@ -70,11 +72,11 @@ class EcCourseEvaluationsbottom extends Component { } // this.setState({ // achievement_list:[ - // {target_evaluate_data: [ + // {course_achievement_methods: [ // { // evaluate_id: 24, // evaluate_name: "期末考试", - // evaluation_relates_data: [ + // course_evaluation_subitems: [ // {evaluation_relates_id: 31, evaluation_relates_name: "期末考试1目标1考题"}, // {evaluation_relates_id: 32, evaluation_relates_name: "期末考试1目标2考题"} // ], @@ -113,25 +115,27 @@ class EcCourseEvaluationsbottom extends Component { }); } componentDidMount(){ - let ec_course_id=this.props.match.params.ec_course_id; - const url = `/ec_course_achievement_methods?ec_course_id=`+ec_course_id; - axios.get(url, { - withCredentials: true, - }) + let ec_course_id=this.props.match.params.ec_course_id; + const course_id = 706 + const url =`/ec_courses/${course_id}/course_targets/with_achievement_methods.json`; + // /ec_courses//course_targets/course_achievement_methods.json + // const url = `/ec_course_achievement_methods?ec_course_id=`+course_id; + axios.get(url) .then((response)=>{ this.setState({ - achievement_list:response.data.achievement_list, + achievement_list:response.data.course_targets, spinningstate:false, - ismanager:response.data.is_manager + ismanager:true }) }).catch(function (error) { console.log(error); }); - this.getNavigationData(ec_course_id); + // this.getNavigationData(ec_course_id); this.setState({ - newec_course_idbottom:ec_course_id + newec_course_idbottom:course_id }) + this.props.Ontitine("evaluation_methods"); } editecCourseEvaluationslist=(e)=>{ let id =e.target.getAttribute("target_id"); @@ -226,7 +230,7 @@ class EcCourseEvaluationsbottom extends Component { newec_course_target_id:id, methodologytype:true, ec_course_target_name:response.data.ec_course_target_name, - ismanager:response.data.is_manager + ismanager:true }) // this.setState({ @@ -427,15 +431,16 @@ class EcCourseEvaluationsbottom extends Component { EvaluationsSaveonloadgetdata=(id)=>{ - const url = `/ec_course_achievement_methods?ec_course_id=`+id + const course_id = 706; + const url = `/ec_courses/${course_id}/course_targets/with_achievement_methods.json`; axios.get(url, { withCredentials: true, }) .then((response)=>{ this.setState({ - achievement_list:response.data.achievement_list, + achievement_list:response.data.course_targets, spinningstate:false, - ismanager:response.data.is_manager + ismanager:true }) }).catch(function (error) { @@ -554,7 +559,9 @@ class EcCourseEvaluationsbottom extends Component { } - var Url = '/ec_course_achievement_methods/create_evaluation_methods'; + // var Url = '/ec_course_achievement_methods/create_evaluation_methods'; + var Url = '/ec_courses/:course_id/course_targets/:target_id/course_achievement_methods.json'; + axios.post(Url, { ec_course_target_id: newec_course_target_id, achievement_methods:achievement_methods @@ -575,7 +582,7 @@ class EcCourseEvaluationsbottom extends Component { achievement_methods:undefined, eacoursesavetypes:false, newshowredvalue:false, - ismanager:response.data.is_manager + ismanager:true }) // $("#ecCourseEvaluationsbottomsubmit").hide(); // $("#SystemParametersbottom").hide(); @@ -662,6 +669,8 @@ class EcCourseEvaluationsbottom extends Component { percentagetype, ismanager } = this.state; + // console.log("EcCourseEvaluationsbottom12345"); + // console.log(achievement_list); return (
    @@ -760,35 +769,35 @@ class EcCourseEvaluationsbottom extends Component {

    { - achievement_list.length===0?}/>:achievement_list.map((item,key)=>{ + achievement_list===undefined?"":achievement_list&&achievement_list.length===0?}/>:achievement_list&&achievement_list.map((item,key)=>{ return(
    { - item.target_evaluate_data.length===0? -
  • -
    - {key+1} + item.course_achievement_methods.length===0? +
  • +
    + {key+1} - + - +
    - +
    - +
    - +
    @@ -797,9 +806,9 @@ class EcCourseEvaluationsbottom extends Component { {/* 修改start*/}
    -
    +
    {/*
    */} -
    +
    {/* 课程目标{sequenceid}:{ec_course_target_name} */} 课程目标{key+1}:{ec_course_target_name} @@ -883,20 +892,20 @@ class EcCourseEvaluationsbottom extends Component {
  • - :item.target_evaluate_data.map((i,k)=>{ + :item.course_achievement_methods.map((i,k)=>{ return( -
  • -
    - {key-k===key?key+1:""} +
  • +
    + {key-k===key?key+1:""} - - {i.evaluate_name} + + {i.course_evaluation.name} - + { - i.evaluation_relates_data.map((y,e)=>{ + i.course_evaluation_subitems.map((y,e)=>{ return( -
    {y.evaluation_relates_name+" "}
    +
    {y.name+" "}
    ) }) } @@ -919,11 +928,11 @@ class EcCourseEvaluationsbottom extends Component { } - +
    {i.percentage+"%"}
    - +
    {i.score}
    @@ -931,8 +940,8 @@ class EcCourseEvaluationsbottom extends Component {
    {/* 修改start*/}
    -
    -
    +
    +
    {/* 课程目标{sequenceid}:{ec_course_target_name} */} 课程目标{key+1}:{ec_course_target_name} diff --git a/public/react/src/modules/ecs/subroute/ecCourseEvaluations/eccourseevalut.css b/public/react/src/modules/ecs/subroute/ecCourseEvaluations/eccourseevalut.css new file mode 100644 index 000000000..c9a05d7ec --- /dev/null +++ b/public/react/src/modules/ecs/subroute/ecCourseEvaluations/eccourseevalut.css @@ -0,0 +1,8 @@ +.yslinitials{ + + display: flex; + flex-direction:initial; +} +.yslpadding{ + padding: 0px 30px; +} \ No newline at end of file diff --git a/public/react/src/modules/ecs/subroute/ecCourseSupportSetting/EditableCourseSupportSetting.js b/public/react/src/modules/ecs/subroute/ecCourseSupportSetting/EditableCourseSupportSetting.js new file mode 100644 index 000000000..70b39241c --- /dev/null +++ b/public/react/src/modules/ecs/subroute/ecCourseSupportSetting/EditableCourseSupportSetting.js @@ -0,0 +1,476 @@ +import React, { Component } from 'react'; + +import moment from 'moment' +import { getUrl } from 'educoder' +import { Form, Input, Icon, Button, Select, InputNumber } from 'antd'; +const { TextArea } = Input; +const { Option } = Select; + +let _url_origin = getUrl() +const $ = window.$ +// https://www.educoder.net/stylesheets/css/common.css?1546618720 +if (!window['EcLoaded']) { + $('head').append( $('') + .attr('href', `${_url_origin}/stylesheets/css/common.css?1525440977`) ); + window['EcLoaded'] = true +} + +let id = 0; + + +/** + target_id + position + target_weight + target_contents + + subitem_id + index + subitem_contents + +*/ +const data = +[{"position":0,"target_weight":0.02,"target_contents":"12","standard_grade":2,"subitem_id":"65"},{"position":3,"target_id":"0","target_weight":0.1,"target_contents":"理解数据管理技术和数据库技术的发展,区分不同数据模型的作用和特点,描述数据库系统的类型、结构、数据独立性。","standard_grade":60,"subitem_id":"66"},{"position":4,"target_weight":1,"target_contents":"22","standard_grade":33,"subitem_id":"66"},{"position":11,"target_id":"1","target_weight":0.1,"target_contents":"理解数据管理技术和数据库技术的发展,区分不同数据模型的作用和特点,描述数据库系统的类型、结构、数据独立性。","standard_grade":61,"subitem_id":"65"}] +; +let _data = [ + { + target_id: 0, + position: 1, + target_weight: 0.1, + target_contents: '理解数据管理技术和数据库技术的发展,区分不同数据模型的作用和特点,描述数据库系统的类型、结构、数据独立性。', + standard_grade: 60, + // biyeYaoqiuZhibiaodian: ':能够运用相关的工程基础和专业知识辨别材料生产中出现的技术、工艺、质量等问题', + "subitem_id": 64, + "index": "1-1", + "subitem_contents": "能够运用相关的工程基础和专业知识辨别材料生产中出现的技术、工艺、质量等问题" + }, + { + target_id: 1, + position: 2, + target_weight: 0.1, + target_contents: '理解数据管理技术和数据库技术的发展,区分不同数据模型的作用和特点,描述数据库系统的类型、结构、数据独立性。', + standard_grade: 61, + // biyeYaoqiuZhibiaodian: ':能够运用相关的工程基础和专业知识辨别材料生产中出现的技术、工艺、质量等问题', + "subitem_id": 65, + "index": "1-2", + "subitem_contents": "222能够运用相关的工程基础和专业知识辨别材料生产中出现的技术、工艺、质量等问题" + } +] +const item = {} + +class EditableCourseSupportSetting extends Component { + constructor(props) { + super(props) + this.state = { + addOrDeleting: false, + errorMsg: '' + } + } + onRemove = (k) => { + let fValues = this.props.form.getFieldsValue(); + if ( + // fValues.standard_grade[k] && fValues.standard_grade[k] != 75 + // || fValues.subitem_id[k] + // || + fValues.target_contents[k] + // || fValues.target_weight[k] + ) { + this.props.showModal('提示', '确定要删除吗?', () => { + this.remove(k) + }) + } else { + this.remove(k) + } + } + remove = (k) => { + const { form } = this.props; + // can use data-binding to get + const keys = form.getFieldValue('keys'); + // We need at least one passenger + // if (keys.length === 1) { + // return; + // } + if (keys.length === 1) { + this.setState({ errorMsg: '至少得保留一条数据' }) + return; + } + // 清除悬浮tip + window.$('.data-tip-down').hide() + + console.log('remove :' , k , this.position2Target_idMap[k]) + delete this.position2Target_idMap[k] + // can use data-binding to set + form.setFieldsValue({ + keys: keys.filter(key => key !== k), + }); + } + _reverseMap = (map) => { + let newMap = {} + for (var k in map) { + newMap[map[k]] = k; + } + return newMap + } + addIfNewKeyExist = (newKey, index_arg) => { + this.setState({ addOrDeleting: true }) + const { form } = this.props; + const keys = form.getFieldValue('keys'); + /** + [0,1,2,3] + ['11', '22', '33', '44'] + -> + [0,1,2,3,4] + ['11', '22', empty, '33', '44'] + + */ + const target_weight = form.getFieldValue('target_weight'); + const target_contents = form.getFieldValue('target_contents'); + const standard_grade = form.getFieldValue('standard_grade'); + const subitem_id = form.getFieldValue('subitem_id'); + keys.splice(index_arg, 0, newKey); + + // position2Target_idMap + // {1:2, 2:3, 3:4, 4:6 } --> {1:2, 2:3, 3:7, 4:4, 5:6 } + // 更新key/position 映射到target_id的map + // 两次revers,用这个结构,达到给position加1的效果 + let reverseMap = this._reverseMap(this.position2Target_idMap); + for (let i = index_arg ; i < keys.length; i++) { + if(keys[i] === keys[i+1]) { // 找到开始+1的行 + continue; + } + let target_id = this.position2Target_idMap[keys[i]]; + reverseMap[target_id] = parseInt(reverseMap[target_id]) + 1; + keys[i] = keys[i] + 1; + } + for (let i = 0 ; i < keys.length - 1; i++) { + if (keys[i] == keys[i + 1]) { + debugger; + } + } + this.position2Target_idMap = this._reverseMap(reverseMap); + + + target_weight.splice(newKey, 0, undefined); + target_contents.splice(newKey, 0, undefined); + standard_grade.splice(newKey, 0, undefined); + subitem_id.splice(newKey, 0, undefined); + + setTimeout(() => { + form.setFieldsValue({ + target_weight, + target_contents, + standard_grade, + subitem_id + }); + window.$('.data-tip-down').hide() + this.setState({ addOrDeleting: false }) + + }, 300) + form.setFieldsValue({ + keys: keys + }); + + } + add = (k, index) => { + this.setState({ errorMsg: '' }) + + const { form } = this.props; + // can use data-binding to get + const keys = form.getFieldValue('keys'); + let nextKeys ; + let newKey = k + 1; + + const newKeyIndex = keys.indexOf(newKey) + if (newKeyIndex != -1) { + // 新key存在,将新key位置及以后的row后移,直到找到一个之后的空位置 + this.addIfNewKeyExist(newKey, index) + } else { // 如果这个新key不存在 + // keys[newIndex] = newKey + keys.splice(index === 0 && k === -1 ? 0 : index, 0, newKey); + } + // can use data-binding to set + // important! notify form to detect changes + form.setFieldsValue({ + keys: keys, + }); + } + + handleSubmit = (e) => { + if (!this.props.is_manager) { + this.props.showModal('提示', '您没权限编辑,请联系管理员。') + return; + } + this.setState({ errorMsg: '' }) + e.preventDefault && e.preventDefault(); + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + let keysLen = values.keys.length + if (keysLen < 1) { + this.setState({ errorMsg: '至少得保留一条数据' }) + } + var data = [] + while( keysLen-- ) { + data.push({}) + } + for (var valKey in values) { + + let dataIndex = 0 + values[valKey].forEach( (item,index) => { + let _val = values[valKey][index]; + if (_val || _val == 0) { + data[dataIndex][valKey === 'keys' ? 'position' : valKey] = _val + if (valKey === 'keys' && (this.position2Target_idMap[_val] || this.position2Target_idMap[_val] === 0) ) { + data[dataIndex].target_id = this.position2Target_idMap[_val] + } + dataIndex++; + } + }) + } + + console.log('Received values of form: ', values, data); + + let totalWeight = 0; + values.target_weight.forEach(item => { + if (item) { + totalWeight += item + } + }) + // 精度问题 0.2 + 0.7 = 0.8999999999 + if (parseInt((totalWeight * 100).toFixed(1)) != 100) { + this.setState({ errorMsg: '请先保证权重和等于1' }) + return; + } + + this.props.updateCourseTargets(data) + } else { + + const keyRowNumMap = {} + let rowNum = 1; + for (var key in values.target_contents) { + keyRowNumMap[key] = rowNum; + rowNum++; + } + + // err.target_contents[1].errors[0] + // {message: "请填入目标内容", field: "target_contents[1]"} + for (var key in err) { + for (var _k in err[key]) { + let errorObj = err[key][_k].errors[0]; + + let _key = errorObj.field.match(`[(0-9)]`) + this.setState({ errorMsg: `第${keyRowNumMap[_key]}行,${errorObj.message}` }) + return; + // console.log(`第${keyRowNumMap[_key]}行,${errorObj.message}`); + } + } + } + + + }); + } + + componentDidMount = () => { + this.position2Target_idMap = {} + const { form } = this.props; + + const data = this.props.course_targets + + let target_weight = [] + let target_contents = [] + let standard_grade = [] + // let biyeYaoqiuZhibiaodian = [] + let subitem_id = [] + let keys = [] + + data.forEach(item => { + keys.push(item.position); + target_weight[item.position] = (item.target_weight) + target_contents[item.position] = (item.target_contents); + standard_grade[item.position] = (item.standard_grade); + // biyeYaoqiuZhibiaodian[item.position] = (item.biyeYaoqiuZhibiaodian); + + subitem_id[item.position] = item.subitem_id ? (item.subitem_id).toString() : item.subitem_id; + + this.position2Target_idMap[item.position] = item.target_id + }) + form.setFieldsValue({ + keys + }); + setTimeout(() => { + form.setFieldsValue({ + // keys, + target_weight, + target_contents, + standard_grade, + // biyeYaoqiuZhibiaodian, + subitem_id, + }); + // this.forceUpdate() + }, 3000) + + + } + + + render() { + const { getFieldDecorator, getFieldValue } = this.props.form; + const { requirements } = this.props; + const { addOrDeleting } = this.state; + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 4 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 20 }, + }, + }; + const formItemLayoutWithOutLabel = { + wrapperCol: { + xs: { span: 24, offset: 0 }, + sm: { span: 20, offset: 4 }, + }, + }; + getFieldDecorator('keys', { initialValue: [] }); + const keys = getFieldValue('keys'); + const formItems = keys.map((k, index) => ( +
  • + + { index + 1 } + + {getFieldDecorator(`target_weight[${k}]`, { + // validateTrigger: ['onChange', 'onBlur'], + rules: [{ + required: true, + whitespace: true, + type: 'number', + message: "请填入权重", + }], + })( + + )} + + + {getFieldDecorator(`target_contents[${k}]`, { + // validateTrigger: ['onChange', 'onBlur'], + rules: [{ + required: true, + // whitespace: true, + message: "请填入目标内容", + }], + })( +