@ -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 < neweditcourse . length ; j ++ ) {
if ( neweditcourse [ j ] . weights === undefined ) {
newnum = 0
} else {
newnum = newnum + neweditcourse [ j ] . weights ;
}
}
newnum = Math . round ( newnum * 100 ) / 100 ;
this . setState ( {
Supportstype : false ,
supportid : null ,
Supportslist : "" ,
editcourse : neweditcourse ,
editnum : newnum
} )
let arr = new Array ( ) ;
editcourse . map ( ( item , key ) => {
arr . push ( item )
} )
let neweditcourse = arr ;
if ( neweditcourse . length > 1 ) {
neweditcourse . splice ( e , 1 ) ;
let newnum = 0 ;
for ( var j = 0 ; j < neweditcourse . length ; j ++ ) {
if ( neweditcourse [ j ] . weights === undefined ) {
newnum = 0
} else {
newnum = newnum + neweditcourse [ j ] . weights ;
}
}
newnum = Math . round ( newnum * 100 ) / 100 ;
this . setState ( {
Supportstype : false ,
supportid : null ,
Supportslist : "" ,
editcourse : neweditcourse ,
editnum : newnum
} )
} else {
this . setState ( {
// Supportstype:true,
Supportslist : '删除失败,至少保留一个课程' ,
} )
}
}
enterweight = ( e ) => {
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,41 @@ 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 )
} ) ;
}
toforums = ( url ) => {
window . open ( url , '_blank' ) ;
}
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 +575,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.year&&this.props.year.can_manager)
return (
< div className = "newMain clearfix" >
< Modal
@ -497,7 +605,7 @@ class CourseSupports extends Component {
< / M o d a l >
< div className = "educontent mb2 9 0">
< div className = "educontent mb2 0">
@ -506,24 +614,26 @@ class CourseSupports extends Component {
< div className = "clearfix padding20-30 bor-bottom-greyE" style = { { position : 'relative' } } >
< span className = "font-18 courseSystem" > 课程体系对毕业要求的支撑 < / s p a n >
{ /* <a href="javascript:void(0)" className="fr white-btn edu-blueback-btn mt4">导出培养目标</a> */ }
< span className = { data . is _manager === false ? "none" : "Importclassroomdata" } style = { { top : '29px' } } >
< a className = "white-btn edu-blueback-btn fr mb10 mr10" target = "_blank" href = { '/ec_major_schools/' + major _school _id + '/academic_years/' + ec _year _id + '/export_course_requirements?format=xls' } > 导出课程体系支撑矩阵 < / a >
< span className = { this . props . year && this . props . year . can _manager === false ? "none" : "Importclassroomdata" } style = { { top : '29px' } } >
< a className = "white-btn edu-blueback-btn fr mb10 mr10" onClick = { ( ) => this . confirmysl ( ` /ec_years/ ${ this . props . match . params . ec _year _id } /graduation_course_supports.xlsx ` ) } > 导出课程体系支撑矩阵 < / a >
< / s p a n >
< div className = "color-grey-9 mr10" > 用矩阵图的形式说明本专业课程体系对毕业要求的支撑关系 < a className = { "color-blue" } onClick = { ( ) => window . elasticLayer ( 3534 ) } > 查看详情 < / a > < / d i v >
< div className = "color-grey-9 mr10" > 用矩阵图的形式说明本专业课程体系对毕业要求的支撑关系 < a className = { "color-blue" } onClick = { ( ) => this . toforums ( ` /forums/ ${ 3534 } ` ) } > 查看详情 < / a > < / d i v >
< / d i v >
< div className = "padding20-30" id = "training_objective_contents" >
< span className = "fl SystemParameters" > 毕业要求指标点 ( < a href = { data . subitems _url } > < span className = "Systemnum" > { data . count } < / s p a n > < / a > ) < / s p a n >
< span className = "fl ml20 SystemParameters" > 课程体系 ( < a href = { data . course _url } > < span className = "Systemnum" > { data . course _count } < / s p a n > < / a > ) < / s p a n >
< span className = "fl SystemParameters" > 毕业要求指标点 ( < Link to = { ` /ecs/major_schools/ ${ this . props . match . params . major _school _id } /years/ ${ this . props . match . params . ec _year _id } /graduation_requirement ` } > < span className = "Systemnum" > { data . count } < / s p a n > < / Li n k > ) < / s p a n >
< span className = "fl ml20 SystemParameters" > 课程体系 ( < Link to = { ` /ecs/major_schools/ ${ this . props . match . params . major _school _id } /years/ ${ this . props . match . params . ec _year _id } /courses/ec_course_support_setting/1 ` } > < span className = "Systemnum" > { data . course _count } < / s p a n > < / Li n k > ) < / s p a n >
< / d i v >
< / d i v >
< div className = "ListTableLine" id = "school_major_list" style = { { overflow : 'auto' } } >
< p className = "clearfix" style = { { width : 120 * data . max _support _count > 1200 ? 140 * data . max _support _count : 1200 + "px" } } >
< p className = "clearfix" style = { toptiebox } >
< span className = "color-666 finishtarget" > 毕业要求指标点 < / s p a n >
{ list( data . max _support _count < 5 || data . max _support _count === undefined ? 5 : data . max _support _count ) }
{ data. graduation _subitems === undefined ? "" : list ( max _support _count < 5 || max _support _count === undefined ? 5 : max _support _count ) }
< span className = "column-1 operationright color-666"
style = { {
paddingLeft : '28px'
@ -535,7 +645,7 @@ class CourseSupports extends Component {
data . graduation _subitems === undefined ? < Spin delay = { 500 } className = "Spinlarge" indicator = { < Icon type = "loading" style = { { fontSize : 30 } } spin / > } / > : data . graduation _subitems . map ( ( item , key ) => {
return (
< li className = { data . graduation _subitems . length === key + 1 ? "clearfix mb10" : "clearfix" } key = { key } style = { { width : 120 * data . max _support _count > 1134 ? 136 * data . max _support _count : 1134 + "px" , margin : '0px 0px' } } >
< li className = { data . graduation _subitems . length === key + 1 ? "clearfix mb10" : "clearfix" } key = { key } style = { ismidbox } >
< Tooltip placement = "bottom" title = { item . sequence _title } >
< span className = "column-1 columnlocation" style = { { display : Editkey != key ? "block" : 'none' , width : '95px' , paddingLeft : '23px' } } > { item . graduation _requirement _position + "-" + item . position } < / s p a n >
< / T o o l t i p >
@ -550,7 +660,7 @@ class CourseSupports extends Component {
display : Editkey != key ? "block" : 'none' ,
marginRight : '-1px'
} } >
< div data- tip - down = { t . ec _course _name } className = { t . top _relation === true ? "DDred columnbox" : "columnbox" }
< div title = { t . ec _course _name } className = { t . top _relation === true ? "DDred columnbox" : "columnbox" }
style = { { textAlign : 'center' } }
> { t . ec _course _name . length > 12 ? t . ec _course _name . substring ( 0 , 10 ) + "..." : t . ec _course _name } < / d i v >
< div className = { t . top _relation === true ? "DDred" : "" }
@ -569,27 +679,34 @@ class CourseSupports extends Component {
< div className = "width20" > { Math . round ( item . weights _total * 100 ) / 100 === 0 ? 0 : ( Math . round ( item . weights _total * 100 ) / 100 ) } < / d i v >
< / d i v >
< div className = "left operationalter" >
{ data . is _manager === false ? "" : < a className = "editSubentry" data- tip - down = "编辑" >
< i className = "iconfont icon-bianjidaibeijing color-green" id = { item . ec_graduation _subitem _ id} subindex = { item . graduation _requirement _position + "-" + item . position } onClick = { this . EditSupportCourse . bind ( this , key ) } > < / i >
{ this . props . year && this . props . year . can _manager === false ? "" : < a className = "editSubentry" title = "编辑" >
< i className = "iconfont icon-bianjidaibeijing color-green" id = { item . id} subindex = { item . graduation _requirement _position + "-" + item . position } onClick = { this . EditSupportCourse . bind ( this , key ) } > < / i >
< / a > }
< / d i v >
< / d i v >
< / s p a n >
< p className = "ListTableLine" id = "school_ListTableLine" style = { { width : '1134px' , display : Editkey === key ? "block" : 'none' } } >
< p className = "clearfix SystemModifythelist" >
< span className = "ml6" style = { { width : '77px' } } > 指标点 { index } < / s p a n >
< span className = "column-4" > 支撑课程 < / s p a n >
< span className = "column-2 ml93" >
< style >
{
`
. ListTableLine li { background : rgb ( 255 , 255 , 255 ) ; }
`
}
< / s t y l e >
{ Editkey === key ?
< p className = "ListTableLine" id = "school_ListTableLine" style = { ismidbox } >
< div style = { { width : '1134px' } } >
< p className = "clearfix SystemModifythelist" >
< span className = "ml6" style = { { width : '77px' } } > 指标点 { index } < / s p a n >
< span className = "column-4" > 支撑课程 < / s p a n >
< span className = "column-2 ml93" >
< span > 权重 ( ∑ = 1 ) < / s p a n >
< span className = "Systempoint" > ( 精确到两位小数 ) < / s p a n >
< / s p a n >
< span className = "column-1 ml50" > 关联度最高 < / s p a n >
< / p >
< span className = "column-1 ml50" > 关联度最高 < / s p a n >
< / p >
< div className = "clearfix editorModify" >
< div className = "clearfix editorModify" >
{ Supportsclass === true ? < style >
{
`
@ -599,77 +716,75 @@ class CourseSupports extends Component {
`
}
< / s t y l e > : " " }
{
editcourse . map ( ( it , key ) => {
return (
< div className = "mb15" key = { key } >
< Select className = { Supportsclasskey === key ? "showredfont heightimportant" : "heightimportant" } showSearch value = { it . ec _course _name } onChange = { this . handleChange } >
{
ec _courses _list . map ( ( qva , qk ) => {
return (
< Option value = { [ qva . id , key , qva . name ] } key = { [ qva . id , key , qva . name ] } > { qva . name } < / O p t i o n >
)
} )
}
< / S e l e c t >
< Input
type = "number"
size = "large"
className = { Supportssum === true ? "inputWeight bor-red" : "inputWeight" }
id = { key }
value = { it . weights }
onInput = { this . enterweight . bind ( this ) }
/ >
< div className = "SetTheAssociated" >
< div className = "SetTheAssociatedchild" >
< i className = "iconfont icon-gouxuan gouxuanbule" style = { { display : it . top _relation === false ? 'none' : 'block' } } itindex = { key } onClick = { this . relevancetop . bind ( this ) } > < / i >
< i className = "iconfont icon-gouxuan gouxuanwhite" style = { { display : it . top _relation === false ? 'block' : 'none' } } itindex = { key } onClick = { this . relevancebottom . bind ( this ) } > < / i >
< / d i v >
< div className = "left operatebutton" >
< a className = "mr15 delSubentry" data - tip - down = "删除" >
< i className = "iconfont icon-shanchu color-grey-c font-15" onClick = { ( ) => this . Deletcourses ( key ) } > < / i >
< / a >
< a className = "newAddSubentry" data - tip - down = "添加"
style = { { display : key === editcourse . length - 1 ? "inline-block" : 'none' } }
> < i className = "iconfont icon-tianjiafangda color-green" onClick = { this . Addcourse } > < / i > < / a >
< / d i v >
< / d i v >
< / d i v >
)
} )
}
< / d i v >
< span className = "c_red none ml35 color-red" id = "error_tip" style = { { display : Supportssum === true || Supportsclass === true ? 'inline' : 'none' } } > { Supportslist } < / s p a n >
< div className = "clearfix editorModify" >
{
editcourse . map ( ( it , key ) => {
return (
< div className = "mb15" key = { key } >
< Select className = { Supportsclasskey === key ? "showredfont heightimportant" : "heightimportant" } showSearch value = { it . ec _course _name } onChange = { this . handleChange } >
{
ec _courses _list . map ( ( qva , qk ) => {
return (
< Option value = { [ qva . id , key , qva . name ] } key = { [ qva . id , key , qva . name ] } > { qva . name } < / O p t i o n >
)
} )
}
< / S e l e c t >
< Input
type = "number"
size = "large"
className = { Supportssum === true ? "inputWeight bor-red" : "inputWeight" }
id = { key }
value = { it . weights }
onInput = { this . enterweight . bind ( this ) }
/ >
< div className = "SetTheAssociated" >
< div className = "SetTheAssociatedchild" >
< i className = "iconfont icon-gouxuan gouxuanbule" style = { { display : it . top _relation === false ? 'none' : 'block' } } itindex = { key } onClick = { this . relevancetop . bind ( this ) } > < / i >
< i className = "iconfont icon-gouxuan gouxuanwhite" style = { { display : it . top _relation === false ? 'block' : 'none' } } itindex = { key } onClick = { this . relevancebottom . bind ( this ) } > < / i >
< / d i v >
< div className = "left operatebutton" >
{ editcourse . length === 1 ? "" : < a className = "mr15 delSubentry" title = "删除" >
< i className = "iconfont icon-shanchu color-grey-c font-15" onClick = { ( ) => this . Deletcourses ( key ) } > < / i >
< / a > }
< a className = "newAddSubentry" title = "添加"
style = { { display : key === editcourse . length - 1 ? "inline-block" : 'none' } }
> < i className = "iconfont icon-tianjiafangda color-green" onClick = { this . Addcourse } > < / i > < / a >
< / d i v >
< / d i v >
< / d i v >
)
} )
}
< / d i v >
< span className = "c_red none ml35 color-red" id = "error_tip" style = { { display : Supportssum === true || Supportsclass === true ? 'inline' : 'none' } } > { Supportslist } < / s p a n >
< div className = "clearfix editorModify" >
< span className = "column-1"
style = { {
width : '580px' ,
paddingLeft : '37px' ,
display : 'inline-block'
} }
> 合计 : < span > { editcourse . length } < / s p a n > < / s p a n >
< span className = "ml30" > 合计 : < span > { editnum } < / s p a n > < / s p a n >
< / d i v >
< div className = "right editlybuttonbox" >
< div className = "defalutSubmitbtn fr" onClick = { this . SubmitClassData } > 保存 < / d i v >
< div className = "defalutCancelbtn fr mr20" onClick = { this . CancelSupports } > 取消 < / d i v >
< / d i v >
< / p >
style = { {
width : '580px' ,
paddingLeft : '37px' ,
display : 'inline-block'
} }
> 合计 : < span > { editcourse . length } < / s p a n > < / s p a n >
< span className = "ml30" > 合计 : < span > { editnum } < / s p a n > < / s p a n >
< / d i v >
< div className = "right editlybuttonbox" >
< div className = "defalutSubmitbtn fr" onClick = { this . SubmitClassData } > 保存 < / d i v >
< div className = "defalutCancelbtn fr mr20" onClick = { this . CancelSupports } > 取消 < / d i v >
< / d i v >
< / d i v >
< / p > : " " }
< / l i >
)
} )