@ -6,18 +6,7 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
courseInfoMap = { } , //课程map
courseInfoMap = { } , //课程map
zjMap = { } , //章节map
zjMap = { } , //章节map
selectMap = { } , //已经生成过select的map
selectMap = { } , //已经生成过select的map
courseLabelTypes = Common . getAjax ( "/jlw/courseInfo/getTreeByCourseLabelTypes.json" , {
courseLabelTypes : "应用课程类,考证课程类,理论课程类" ,
rankLimit : 3
} ) . data ,
/ * c o u r s e L a b e l T y p e s = f u n c t i o n ( v a l , s o u r c e T y p e ) {
var data = Common . getAjax ( "/jlw/courseInfo/getChapterSystemOAndUniversities.json" , {
courseInfoParentId : val ,
sourceType : sourceType ,
courseInfoType : 3
} ) . data
return data ;
} , //获取课程数据*/
htmY = '<optgroup label="应用课程类">' ,
htmY = '<optgroup label="应用课程类">' ,
htmL = '<optgroup label="理论课程类">' ,
htmL = '<optgroup label="理论课程类">' ,
htmK = '<optgroup label="考证课程类">' ,
htmK = '<optgroup label="考证课程类">' ,
@ -30,15 +19,7 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
var theoryCourseList = currentAuthCourseInfoDetails . theoryCourseList || [ ] ;
var theoryCourseList = currentAuthCourseInfoDetails . theoryCourseList || [ ] ;
// 考证课程类
// 考证课程类
var textualResearchCourseList = currentAuthCourseInfoDetails . textualResearchCourseList || [ ] ; * /
var textualResearchCourseList = currentAuthCourseInfoDetails . textualResearchCourseList || [ ] ; * /
/ * f u n c t i o n c o u r s e L a b e l T y p e s ( c o u r s e I n f o I d ) {
var data = Common . getAjax ( "/jlw/courseInfo/getChapterSystemOAndUniversities.json" , {
courseInfoParentId : courseInfoId ,
sourceType : 1 ,
courseInfoType : 3
} ) . data ; //获取课程数据
return data
} * /
// 应用课程类
// 应用课程类
var applicationCourseList = [ ] ;
var applicationCourseList = [ ] ;
// 理论课程类
// 理论课程类
@ -47,21 +28,16 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
var textualResearchCourseList = [ ] ;
var textualResearchCourseList = [ ] ;
// 理论课程类+开课课程
// 理论课程类+开课课程
var openCourseList = [ ] ;
var openCourseList = [ ] ;
/ * v a r a = C o m m o n . g e t A j a x ( " / j l w / c o u r s e I n f o / g e t C h a p t e r S y s t e m O A n d U n i v e r s i t i e s . j s o n " , {
courseInfoParentId : val ,
function childCourseList ( courseInfoId , courseInfoType , sourceType ) {
sourceType : sourceType ,
courseInfoType : 3
} ) . data * /
function alist ( courseInfoId , sourceType ) {
var data = Common . getAjax ( "/jlw/courseInfo/getChapterSystemOAndUniversities.json" , {
var data = Common . getAjax ( "/jlw/courseInfo/getChapterSystemOAndUniversities.json" , {
courseInfoParentId : courseInfoId ,
courseInfoParentId : courseInfoId ,
sourceType: source Type,
courseInfoType : courseInfoType ,
courseInfoType: 3
sourceType : sourceType
} ) . data ; //获取课程数据
} ) . data ; //获取课程数据
return data
return data
}
}
console . log ( alist ( "1656147211031060480" , 1 ) , "ddd" )
currentAuthCourseInfoDetails . forEach ( function ( e , i ) {
currentAuthCourseInfoDetails . forEach ( function ( e , i ) {
if ( e . sourceType == 2 ) {
if ( e . sourceType == 2 ) {
if ( e . courseLabelType == '考证课程类' ) {
if ( e . courseLabelType == '考证课程类' ) {
@ -75,17 +51,40 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
openCourseList . push ( e )
openCourseList . push ( e )
}
}
} ) ;
} ) ;
console . log ( currentAuthCourseInfoDetails )
var selectList = "<select lay-filter='select_courseInfoIds_'><option value=''>请选择</option>" ;
console . log ( theoryCourseList )
var selectedHandler = function ( val ) {
for ( let currentAuthCourseInfoDetail of applicationCourseList ) {
return defaultValue . trim ( ) == val . trim ( ) ? 'selected = "selected"' : '' ;
htmY += '<option value="' + ( currentAuthCourseInfoDetail . courseInfoId || '-1' ) + '" status="' + currentAuthCourseInfoDetail . sourceType + '">' + ( currentAuthCourseInfoDetail . courseInfoName || '未查询到数据' ) + '</option>' ;
}
for ( let currentAuthCourseInfoDetail of theoryCourseList ) {
htmL += '<option value="' + ( currentAuthCourseInfoDetail . courseInfoId || '-1' ) + '" status="' + currentAuthCourseInfoDetail . sourceType + '">' + ( currentAuthCourseInfoDetail . courseInfoName || '未查询到数据' ) + '</option>' ;
}
for ( let currentAuthCourseInfoDetail of textualResearchCourseList ) {
htmK += '<option value="' + ( currentAuthCourseInfoDetail . courseInfoId || '-1' ) + '" status="' + currentAuthCourseInfoDetail . sourceType + '">' + ( currentAuthCourseInfoDetail . courseInfoName || '未查询到数据' ) + '</option>' ;
}
for ( let currentAuthCourseInfoDetail of openCourseList ) {
htmO += '<option value="' + ( currentAuthCourseInfoDetail . courseInfoId || '-1' ) + '" status="' + currentAuthCourseInfoDetail . sourceType + '">' + ( currentAuthCourseInfoDetail . courseInfoName || '未查询到数据' ) + '</option>' ;
}
}
$ . each ( courseLabelTypes , function ( key , value ) {
if ( $ ( "#isUser" ) . val ( ) === "true" ) {
selectList += htmY + '</optgroup>' + htmK + '</optgroup>' + htmL + '</optgroup>' + htmO + '</optgroup>' + "</select>" ;
//console.log($("#isUser").val())
} else {
selectList += htmL + '</optgroup>' + htmO + '</optgroup>' + "</select>" ;
}
function selectedHandler ( val , val1 ) {
return val == val1 ? 'selected = "selected"' : '' ;
}
/ * $ . e a c h ( c o u r s e L a b e l T y p e s , f u n c t i o n ( k e y , v a l u e ) {
courseInfoMap [ value . courseInfoId ] = { courseInfoName : value . courseInfoName , children : value . children } ;
courseInfoMap [ value . courseInfoId ] = { courseInfoName : value . courseInfoName , children : value . children } ;
$ . each ( value . children , function ( k , v ) {
$ . each ( value . children , function ( k , v ) {
zjMap [ v . courseInfoId ] = { courseInfoName : v . courseInfoName , children : v . children } ;
zjMap [ v . courseInfoId ] = { courseInfoName : v . courseInfoName , children : v . children } ;
} ) ;
} ) ;
} ) ;
} ) ; * /
var view = {
var view = {
init : function ( ) {
init : function ( ) {
@ -118,28 +117,6 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
field : 'courseInfoParentParentName' ,
field : 'courseInfoParentParentName' ,
title : '归属课程' ,
title : '归属课程' ,
templet : function ( d ) {
templet : function ( d ) {
var selectList = "<select lay-filter='select_courseInfoIds_'><option value=''>请选择</option>" ;
for ( let currentAuthCourseInfoDetail of applicationCourseList ) {
htmY += '<option value="' + ( currentAuthCourseInfoDetail . courseInfoId || '-1' ) + selectedHandler ( d . courseInfoId ) + '">' + ( currentAuthCourseInfoDetail . courseInfoName || '未查询到数据' ) + '</option>' ;
}
for ( let currentAuthCourseInfoDetail of theoryCourseList ) {
htmL += '<option value="' + ( currentAuthCourseInfoDetail . courseInfoId || '-1' ) + selectedHandler ( d . courseInfoId ) + '">' + ( currentAuthCourseInfoDetail . courseInfoName || '未查询到数据' ) + '</option>' ;
}
for ( let currentAuthCourseInfoDetail of textualResearchCourseList ) {
htmK += '<option value="' + ( currentAuthCourseInfoDetail . courseInfoId || '-1' ) + selectedHandler ( d . courseInfoId ) + '">' + ( currentAuthCourseInfoDetail . courseInfoName || '未查询到数据' ) + '</option>' ;
}
for ( let currentAuthCourseInfoDetail of openCourseList ) {
htmO += '<option value="' + ( currentAuthCourseInfoDetail . courseInfoId || '-1' ) + selectedHandler ( d . courseInfoId ) + '">' + ( currentAuthCourseInfoDetail . courseInfoName || '未查询到数据' ) + '</option>' ;
}
if ( $ ( "#isUser" ) . val ( ) === "true" ) {
selectList += htmY + '</optgroup>' + htmK + '</optgroup>' + htmL + '</optgroup>' + htmO + '</optgroup>' + "</select>" ;
//console.log($("#isUser").val())
} else {
selectList += htmL + '</optgroup>' + htmO + '</optgroup>' + "</select>" ;
}
return selectList ; //一级
return selectList ; //一级
}
}
} ,
} ,
@ -150,19 +127,19 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
templet : function ( d ) {
templet : function ( d ) {
var htm = "<select lay-filter='select_courseInfoIds_1'><option value=''>请选择</option>" ;
var htm = "<select lay-filter='select_courseInfoIds_1'><option value=''>请选择</option>" ;
if ( ! $ . isEmpty ( d . courseInfoParentId ) ) {
if ( ! $ . isEmpty ( d . courseInfoParentId ) ) {
if ( $ . isEmpty ( selectMap [ d . courseInfoParent Id] ) ) {
if ( $ . isEmpty ( selectMap [ d . courseInfoParent Parent Id] ) ) {
var h = htm ;
var h = htm ;
if ( ! $ . isEmpty ( courseInfoMap [ d . courseInfoParentParentId ] ) ) {
var courseInfoChildtList = childCourseList ( d . courseInfoParentParentId , 2 , d . sourceType ) ;
$ . each ( courseInfoMap [ d . courseInfoParentParentId ] . children , function ( key , v ) {
if ( ! $ . isEmpty ( courseInfoChildtList ) ) {
courseInfoMap [ d . courseInfoParentParentId ] = courseInfoChildtList ;
$ . each ( courseInfoChildtList , function ( key , v ) {
h += "<option value='" + v . courseInfoId + "'>" + v . courseInfoName + "</option>" ;
h += "<option value='" + v . courseInfoId + "'>" + v . courseInfoName + "</option>" ;
} ) ;
} ) ;
}
}
selectMap [ d . courseInfoParentId ] = h + "</select>" ;
selectMap [ d . courseInfoParentParentId ] = h + "</select>" ;
console . log ( h , 'h' )
return h ;
return h ;
} else {
} else {
return selectMap [ d . courseInfoParentId ] ;
return selectMap [ d . courseInfoParentParentId ] ;
console . log ( selectMap )
}
}
} else {
} else {
return htm + "</select>" ; //二级
return htm + "</select>" ; //二级
@ -174,21 +151,25 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
field : 'courseInfoName' , title : '归属小节' , align : "center" , width : 200 , templet : function ( d ) {
field : 'courseInfoName' , title : '归属小节' , align : "center" , width : 200 , templet : function ( d ) {
var htm = "<select lay-filter='select_courseInfoIds_2'><option value=''>请选择</option>" ;
var htm = "<select lay-filter='select_courseInfoIds_2'><option value=''>请选择</option>" ;
if ( ! $ . isEmpty ( d . courseInfoId ) ) {
if ( ! $ . isEmpty ( d . courseInfoId ) ) {
if ( $ . isEmpty ( selectMap [ d . courseInfo Id] ) ) {
if ( $ . isEmpty ( selectMap [ d . courseInfo Parent Id] ) ) {
var h = htm ;
var h = htm ;
if ( ! $ . isEmpty ( zjMap [ d . courseInfoParentId ] ) ) {
var courseInfoChildtChildList = childCourseList ( d . courseInfoParentId , 3 , d . sourceType ) ;
$ . each ( zjMap [ d . courseInfoParentId ] . children , function ( key , v ) {
if ( ! $ . isEmpty ( courseInfoChildtChildList ) ) {
zjMap [ d . courseInfoParentId ] = courseInfoChildtChildList ;
$ . each ( courseInfoChildtChildList , function ( key , v ) {
h += "<option value='" + v . courseInfoId + "'>" + v . courseInfoName + "</option>" ;
h += "<option value='" + v . courseInfoId + "'>" + v . courseInfoName + "</option>" ;
} ) ;
} ) ;
}
}
selectMap [ d . courseInfo Id] = h + "</select>" ;
selectMap [ d . courseInfo Parent Id] = h + "</select>" ;
return h ;
return h ;
} else {
} else {
return selectMap [ d . courseInfo Id] ;
return selectMap [ d . courseInfo Parent Id] ;
}
}
} else {
} else {
return htm + "</select>" ; //三级
return htm + "</select>" ; //三级
}
}
}
}
} ,
} ,
{
{
@ -372,12 +353,18 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
//选择归属课程 并且根据选择的课程查询章节 resourcesQuestionIdsIsNotNull:查询题目不为空的章节
//选择归属课程 并且根据选择的课程查询章节 resourcesQuestionIdsIsNotNull:查询题目不为空的章节
form . on ( 'select(select_courseInfoIds)' , function ( obj ) {
form . on ( 'select(select_courseInfoIds)' , function ( obj ) {
Lib . getCourseInfo ( $ ( "select[name='courseInfoId_2']" ) , obj . value , 1 ) ;
let sourceType = $ ( "select[name='courseInfoId_0']" ) . find ( 'option:selected' ) . attr ( "status" ) ;
let courseInfoType = 2 ; //courseInfoType( 2 章节, 3 节)
Lib . getCourseInfo ( $ ( "select[name='courseInfoId_1']" ) , obj . value , courseInfoType , sourceType , 1 ) ;
$ ( "select[name='courseInfoId_2']" ) . empty ( ) ;
layui . form . render ( ) ;
} ) ;
} ) ;
//选择归属课程 并且根据选择的课程查询章节
//选择归属课程 并且根据选择的课程查询章节
form . on ( 'select(select_courseInfoIds_Node)' , function ( obj ) {
form . on ( 'select(select_courseInfoIds_Node)' , function ( obj ) {
Lib . getCourseInfo ( $ ( "select[name='courseInfoId_3']" ) , obj . value ) ;
let sourceType = $ ( "select[name='courseInfoId_0']" ) . find ( 'option:selected' ) . attr ( "status" ) ;
let courseInfoType = 3 ; //courseInfoType( 2 章节, 3 节)
Lib . getCourseInfo ( $ ( "select[name='courseInfoId_2']" ) , obj . value , courseInfoType , sourceType ) ;
} ) ;
} ) ;
//选择归属课程 并且根据选择的课程查询章节
//选择归属课程 并且根据选择的课程查询章节
form . on ( 'select(select_courseId)' , function ( obj ) {
form . on ( 'select(select_courseId)' , function ( obj ) {
@ -417,9 +404,22 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
$ ( this ) . parents ( "td" ) . next ( ) . next ( ) . find ( "select" ) . empty ( ) ;
$ ( this ) . parents ( "td" ) . next ( ) . next ( ) . find ( "select" ) . empty ( ) ;
$ ( this ) . parents ( "td" ) . next ( ) . next ( ) . find ( "select" ) . append ( "<option value=''>请选择</option>" ) ;
$ ( this ) . parents ( "td" ) . next ( ) . next ( ) . find ( "select" ) . append ( "<option value=''>请选择</option>" ) ;
if ( ! $ . isEmpty ( obj . value ) ) {
if ( ! $ . isEmpty ( obj . value ) ) {
$ . each ( courseInfoMap [ obj . value ] . children , function ( key , v ) {
if ( ! $ . isEmpty ( courseInfoMap [ obj . value ] ) ) {
this _ . append ( "<option value='" + v . courseInfoId + "'>" + v . courseInfoName + "</option>" ) ;
$ . each ( courseInfoMap [ obj . value ] , function ( key , v ) {
} ) ;
this _ . append ( "<option value='" + v . courseInfoId + "'>" + v . courseInfoName + "</option>" ) ;
} ) ;
} else {
let sourceType = $ ( obj . elem ) . find ( "option:selected" ) . attr ( "status" ) ;
var courseInfoChildtList = childCourseList ( obj . value , 2 , sourceType ) ;
if ( ! $ . isEmpty ( courseInfoChildtList ) ) {
courseInfoMap [ obj . value ] = courseInfoChildtList ;
$ . each ( courseInfoChildtList , function ( key , v ) {
this _ . append ( "<option value='" + v . courseInfoId + "'>" + v . courseInfoName + "</option>" ) ;
} ) ;
}
selectMap [ obj . value ] = this _ . html ( ) ;
}
}
}
form . render ( ) ;
form . render ( ) ;
} ) ;
} ) ;
@ -430,9 +430,23 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
this _ . empty ( ) ;
this _ . empty ( ) ;
this _ . append ( "<option value=''>请选择</option>" ) ;
this _ . append ( "<option value=''>请选择</option>" ) ;
if ( ! $ . isEmpty ( obj . value ) ) {
if ( ! $ . isEmpty ( obj . value ) ) {
$ . each ( zjMap [ obj . value ] . children , function ( key , v ) {
if ( ! $ . isEmpty ( zjMap [ obj . value ] ) ) {
this _ . append ( "<option value='" + v . courseInfoId + "'>" + v . courseInfoName + "</option>" ) ;
$ . each ( zjMap [ obj . value ] , function ( key , v ) {
} ) ;
this _ . append ( "<option value='" + v . courseInfoId + "'>" + v . courseInfoName + "</option>" ) ;
} ) ;
} else {
let sourceType = $ ( obj . elem ) . parents ( "td" ) . prevAll ( 'td' ) . find ( "option:selected" ) . attr ( "status" ) ; ;
var courseInfoChildtChildList = childCourseList ( obj . value , 3 , sourceType ) ;
if ( ! $ . isEmpty ( courseInfoChildtChildList ) ) {
zjMap [ obj . value ] = courseInfoChildtChildList ;
$ . each ( courseInfoChildtChildList , function ( key , v ) {
this _ . append ( "<option value='" + v . courseInfoId + "'>" + v . courseInfoName + "</option>" ) ;
} ) ;
}
selectMap [ obj . value ] = this _ . html ( ) ;
}
}
}
form . render ( ) ;
form . render ( ) ;
} ) ;
} ) ;