From ed9b322893fec98c444f62736cb119a68f1fe696 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 20 Sep 2019 17:57:16 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=84=E5=88=86=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CourseSupports/ecCourseSupports.css | 6 + .../ecs/EcSetting/CourseSupports/index.js | 403 +++++++++++------- public/react/src/modules/home/shixunsHome.js | 8 +- .../src/modules/tpm/TPMFork/TPMForklist.js | 2 +- .../src/modules/tpm/shixuns/ShixunCard.js | 8 +- 5 files changed, 266 insertions(+), 161 deletions(-) diff --git a/public/react/src/modules/ecs/EcSetting/CourseSupports/ecCourseSupports.css b/public/react/src/modules/ecs/EcSetting/CourseSupports/ecCourseSupports.css index 7f497b28e..87f87fc8e 100644 --- a/public/react/src/modules/ecs/EcSetting/CourseSupports/ecCourseSupports.css +++ b/public/react/src/modules/ecs/EcSetting/CourseSupports/ecCourseSupports.css @@ -355,4 +355,10 @@ input{ .editlybuttonbox{ margin-bottom: 30px; margin-right: 3%; +} + +.Importclassroomdata{ + top: 30px; + position: absolute; + right: 0px; } \ No newline at end of file diff --git a/public/react/src/modules/ecs/EcSetting/CourseSupports/index.js b/public/react/src/modules/ecs/EcSetting/CourseSupports/index.js index bc848b209..a38bc814a 100644 --- a/public/react/src/modules/ecs/EcSetting/CourseSupports/index.js +++ b/public/react/src/modules/ecs/EcSetting/CourseSupports/index.js @@ -34,7 +34,13 @@ class CourseSupports extends Component { Supportslist:'', Supportssum:false, Supportsclass:false, - Supportsclasskey:undefined + Supportsclasskey:undefined, + neweditcourse:[{"weights": 0, + "ec_course_name":'', + "top_relation": false, + "ec_course_id":'' + }], + max_support_count:0 } } @@ -58,15 +64,25 @@ class CourseSupports extends Component { axios.get(url) .then((response) => { if(response.status===200){ - this.setState({ - data:response.data - }) - console.log(response.data.graduation_subitems.length) if(response.data.graduation_subitems.length===0){ this.setState({ Supportstype:true, + data:response.data, Supportslist:'数据为空,请去毕业要求——>毕业要求指标点分解列表配置数据' }) + }else{ + let datas=response.data.graduation_subitems; + let listlength=[] + datas.map((item,key)=>{ + listlength.push(item.course_supports.length) + }) + + let max_support_count=Math.max(...listlength); + + this.setState({ + max_support_count:max_support_count, + data:response.data + }) } } @@ -108,7 +124,7 @@ class CourseSupports extends Component { id=parseInt(id); let subindex =e.target.getAttribute("subindex"); - debugger + // const url = `/ec_course_supports/edit_require_vs_course?subitem_id=`+id // axios.get(url) // .then((response) => { @@ -155,14 +171,18 @@ class CourseSupports extends Component { if(item.course_supports.length>0){ this.setState({ editcourse:item.course_supports, + neweditcourse:item.course_supports, Editkey:key, index:subindex, + ec_graduation_subitem_id:id, }) }else if(item.course_supports.length===0){ this.setState({ editcourse:[{weights: 0,top_relation: false,ec_course_name:'',ec_course_id:''}], + neweditcourse:[{weights: 0,top_relation: false,ec_course_name:'',ec_course_id:''}], Editkey:key, index:subindex, + ec_graduation_subitem_id:id, }) } @@ -197,7 +217,12 @@ class CourseSupports extends Component { Addcourse=(e)=>{ let {editcourse} =this.state; - let neweditcourse=editcourse; + let arr=new Array(); + editcourse.map((item,key)=>{ + arr.push(item) + }) + + let neweditcourse=arr; let newadd = {weights: 0,top_relation: false,ec_course_name:'',ec_course_id:''}; neweditcourse.push(newadd); this.setState({ @@ -215,29 +240,49 @@ class CourseSupports extends Component { // 删除 // let id =e.target.getAttribute("index"); let {editcourse} = this.state; - let neweditcourse=editcourse; - neweditcourse.splice(e,1); - let newnum=0; - for(var j=0;j{ + arr.push(item) + }) + + let neweditcourse=arr; + if(neweditcourse.length>1){ + neweditcourse.splice(e,1); + let newnum=0; + for(var j=0;j{ let {editcourse} = this.state; - let neweditcourse=editcourse; + let arr=new Array(); + editcourse.map((item,key)=>{ + arr.push(item) + }) + + let neweditcourse=arr; var id=e.target.id; var value=parseFloat(e.target.value); if(isNaN(value)){ @@ -301,9 +346,15 @@ class CourseSupports extends Component { handleChange=(e)=> { let {editcourse} = this.state; - let value=`${e[0]}`; - value=parseInt(value) - let neweditcourse=editcourse; + + let arr=new Array(); + editcourse.map((item,key)=>{ + arr.push(item) + }) + let neweditcourse=arr; + + let value=`${e[0]}`; + value=parseInt(value) let num=`${e[1]}`; num=parseInt(num) @@ -327,7 +378,13 @@ class CourseSupports extends Component { relevancetop=(e)=>{ let {editcourse} = this.state; - let neweditcourse=editcourse; + + let arr=new Array(); + editcourse.map((item,key)=>{ + arr.push(item) + }) + + let neweditcourse=arr; let id =e.target.getAttribute("itindex"); for(var i=0;i<1;i++){ neweditcourse[id].top_relation=false; @@ -339,7 +396,11 @@ class CourseSupports extends Component { relevancebottom=(e)=>{ let {editcourse} = this.state; - let neweditcourse=editcourse; + let arr=new Array(); + editcourse.map((item,key)=>{ + arr.push(item) + }) + let neweditcourse=arr; let id =e.target.getAttribute("itindex"); for(var i=0;i<1;i++){ neweditcourse[id].top_relation=true; @@ -355,14 +416,20 @@ class CourseSupports extends Component { this.inputNumberRef.blur(); } CancelSupports=()=>{ + let{editcourse,neweditcourse}=this.state; + // + // console.log(editcourse) + // console.log(neweditcourse) + this.setState({ Editkey:null, Supportssum:false, Supportsclass:false, + editcourse:neweditcourse }) } SubmitClassData=()=>{ - let {editcourse,editnum,ec_graduation_subitem_id,ec_year_id} = this.state; + let {editcourse,editnum,ec_graduation_subitem_id} = this.state; if(editcourse.length===0){ this.setState({ // Supportstype:true, @@ -409,35 +476,39 @@ class CourseSupports extends Component { } }) - var Url = '/ec_course_supports'; + + + + var Url = `/ec_years/${this.props.match.params.ec_year_id}/graduation_course_supports.json`; axios.post(Url, { - ec_year_id: ec_year_id, - ec_graduation_subitem_id:ec_graduation_subitem_id, - course: editcourse - }, - { - withCredentials: true + graduation_subitem_id :ec_graduation_subitem_id, + course_supports: editcourse } ).then((response) => { - - if(response.data.status===0){ - this.setState({ - Editkey:null, - Supportslist:response.data.messsage, - Supportstype:true, - Supportssum:false, - Supportsclass:false, - Supportsclasskey:undefined, - }) - this.UpdateClassData(); + if(response.data.id===ec_graduation_subitem_id){ + + // this.setState({ + // Editkey:null, + // Supportslist:"保存成功", + // Supportstype:true, + // Supportssum:false, + // Supportsclass:false, + // Supportsclasskey:undefined, + // }) + this.UpdateClassData(); + this.setState({ + Editkey:null, + Supportssum:false, + Supportsclass:false, + }) }else if(response.data.status===-1){ - this.setState({ - Supportslist:"参数错误", - Supportstype:true, - Supportssum:false, - Supportsclass:false, - Supportsclasskey:undefined, - }) + // this.setState({ + // Supportslist:"参数错误", + // Supportstype:true, + // Supportssum:false, + // Supportsclass:false, + // Supportsclasskey:undefined, + // }) } }).catch((error) => { console.log(error) @@ -457,9 +528,37 @@ class CourseSupports extends Component { Supportslist:"", }) } + + confirmysl(url){ + axios.get(url + '?export=true').then((response) => { + if(response.data.status&&response.data.status===-1){ + + }else if(response.data.status&&response.data.status===-2){ + if(response.data.message === "100"){ + // 已超出文件导出的上限数量(100 ),建议: + + this.setState({ + DownloadType:true, + DownloadMessageval:100 + }) + }else { + //因附件资料超过500M + this.setState({ + DownloadType:true, + DownloadMessageval:500 + }) + } + }else { + this.props.showNotification(`正在下载中`); + window.open("/api"+url, '_blank'); + } + }).catch((error) => { + console.log(error) + }); + } render() { const Option = Select.Option; - let {data,ec_courses_list,editcourse,editnum,index,ec_year_id,Supportsclasskey,ecComponentState,hidesupport,supportid,Editkey,titlemessage,Supportstype,Supportslist,Supportssum,Supportsclass,major_school_id} = this.state; + let {max_support_count,data,ec_courses_list,editcourse,editnum,index,ec_year_id,Supportsclasskey,ecComponentState,hidesupport,supportid,Editkey,titlemessage,Supportstype,Supportslist,Supportssum,Supportsclass,major_school_id} = this.state; var list = (length) => { var res = []; for(var i = 0; i < length; i++) { @@ -472,6 +571,11 @@ class CourseSupports extends Component { return res } + let toptiebox={width: 126.6*max_support_count+"px"}; + + let ismidbox={width:123.82*max_support_count+"px",margin:'0px 0px'}; + + console.log(this.props) return (
-
+
@@ -506,8 +610,10 @@ class CourseSupports extends Component {
课程体系对毕业要求的支撑 {/* 导出培养目标 */} + + - 导出课程体系支撑矩阵 + this.confirmysl(`/ec_years/${this.props.match.params.ec_year_id}/graduation_course_supports.xlsx`)}>导出课程体系支撑矩阵
用矩阵图的形式说明本专业课程体系对毕业要求的支撑关系 window.elasticLayer(3534)} >查看详情
@@ -521,9 +627,9 @@ class CourseSupports extends Component {
-

1200? 140*data.max_support_count : 1200+"px"}}> +

毕业要求指标点 - {list(data.max_support_count<5||data.max_support_count===undefined?5:data.max_support_count)} + {list(max_support_count<5||max_support_count===undefined?5:max_support_count)} }/>:data.graduation_subitems.map((item,key)=>{ return ( -

  • 1134 ? 136*data.max_support_count : 1134+"px",margin: '0px 0px'}}> +
  • {item.graduation_requirement_position+"-"+item.position} @@ -550,7 +656,7 @@ class CourseSupports extends Component { display:Editkey!=key?"block":'none', marginRight: '-1px' }}> -
    {t.ec_course_name.length>12?t.ec_course_name.substring(0, 10)+"...":t.ec_course_name}
    {Math.round(item.weights_total*100)/100===0?0:(Math.round(item.weights_total*100)/100)}
  • - {data.is_manager===false?"": - + {data.is_manager===false?"": + }
    - -

    - -

    - 指标点 {index} - 支撑课程 - + + {Editkey===key? +

    +

    +

    + 指标点 {index} + 支撑课程 + 权重(∑=1) (精确到两位小数) - 关联度最高 -

    + 关联度最高 +

    -
    +
    {Supportsclass===true?:""} - { - editcourse.map((it,key)=>{ - - return( -
    - - - - -
    - -
    - - - - -
    - - - -
    - -
    - ) - }) - } - -
    - {Supportslist} -
    + { + editcourse.map((it,key)=>{ + + return( +
    + + + + +
    + +
    + + + + +
    + +
    + {editcourse.length===1?"": + this.Deletcourses(key)}> + } + +
    + +
    + +
    + ) + }) + } + +
    + {Supportslist} +
    合计: {editcourse.length} - 合计: {editnum} -
    - -
    -
    保存
    -
    取消
    -
    - -

    - - + style={{ + width: '580px', + paddingLeft: '37px', + display: 'inline-block' + }} + >合计: {editcourse.length} + 合计: {editnum} +
    + +
    +
    保存
    +
    取消
    +
    +
    +

    :""} ) }) diff --git a/public/react/src/modules/home/shixunsHome.js b/public/react/src/modules/home/shixunsHome.js index 5677193d5..11f17fa3b 100644 --- a/public/react/src/modules/home/shixunsHome.js +++ b/public/react/src/modules/home/shixunsHome.js @@ -14,13 +14,7 @@ import UpgradeModals from '../modals/UpgradeModals'; import { SnackbarHOC , getImageUrl, configShareForIndex} from 'educoder'; -import Slider from '@icedesign/base/lib/slider'; - -import '@icedesign/base/lib/slider/style.js'; - -import Rating from '@icedesign/base/lib/rating'; - -import '@icedesign/base/lib/rating/style.js'; +import { Slider ,Rating} from "@icedesign/base"; import './home.css'; diff --git a/public/react/src/modules/tpm/TPMFork/TPMForklist.js b/public/react/src/modules/tpm/TPMFork/TPMForklist.js index bbe3509a6..c8af10e4d 100644 --- a/public/react/src/modules/tpm/TPMFork/TPMForklist.js +++ b/public/react/src/modules/tpm/TPMFork/TPMForklist.js @@ -6,7 +6,7 @@ import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; // import "antd/dist/antd.css"; -import Rating from '@icedesign/base/lib/rating'; +import { Rating } from "@icedesign/base"; import axios from 'axios'; diff --git a/public/react/src/modules/tpm/shixuns/ShixunCard.js b/public/react/src/modules/tpm/shixuns/ShixunCard.js index 3a0935e66..002471f60 100644 --- a/public/react/src/modules/tpm/shixuns/ShixunCard.js +++ b/public/react/src/modules/tpm/shixuns/ShixunCard.js @@ -10,19 +10,13 @@ import classNames from 'classnames'; import {getImageUrl,setImagesUrl, toPath} from 'educoder'; import { Spin,Icon } from 'antd'; - +import { Rating ,Pagination} from "@icedesign/base"; import 'antd/lib/pagination/style/index.css'; import './shixunCss/shixunCard.css'; -import Rating from '@icedesign/base/lib/rating'; - -import Pagination from '@icedesign/base/lib/pagination'; - // 引入业务组件样式 -import '@icedesign/base/lib/pagination/style.js'; -import '@icedesign/base/lib/rating/style.js'; import { Tooltip } from 'antd';