修改选择授课讲师时不再关联所选工种

This commit is contained in:
wans 2022-02-16 11:14:27 +08:00
parent cbe93c4f53
commit 8a7c42b4d8

View File

@ -62,9 +62,13 @@
<div class="layui-input-block" id="teacherBox"></div> <div class="layui-input-block" id="teacherBox"></div>
<script type="text/html" id="teacherTemplate"> <script type="text/html" id="teacherTemplate">
<select id="teacherId" name="teacherId" lay-verify="required" lay-search> <select id="teacherId" name="teacherId" lay-verify="required" lay-search>
<option value="">选择讲师</option> <option value="">选择讲师(支持姓名或手机号搜索)</option>
{{# for(var i = 0, item; item = d[i++];){ }} {{# for(var i = 0, item; item = d[i++];){ }}
{{# if(item.telephone == '' || item.telephone == null ){ }}
<option value="{{item.teacherId}}">{{item.teacherName}}</option> <option value="{{item.teacherId}}">{{item.teacherName}}</option>
{{# } else { }}
<option value="{{item.teacherId}}">{{item.teacherName}} ({{item.telephone}})</option>
{{# } }}
{{# } }} {{# } }}
</select> </select>
</script> </script>
@ -133,10 +137,7 @@
max: '23:00:00' max: '23:00:00'
}); });
initLessons(); initLessons();
laytpl(document.getElementById('teacherTemplate').innerHTML).render([], function(html) { initTeacherList();
document.getElementById('teacherBox').innerHTML = html;
});
form.render(null, 'dataForm');
$('.layui-card').height($(window).height()); $('.layui-card').height($(window).height());
} }
initData(); initData();
@ -160,25 +161,9 @@
}); });
} }
form.on('select(changeLesson)',function(data){
if(data.value == ''){
laytpl(document.getElementById('teacherTemplate').innerHTML).render([], function(html) {
document.getElementById('teacherBox').innerHTML = html;
});
form.render(null, 'dataForm');
return;
}
var lessonWorkType = $(data.elem).find('option:selected').data().lessonWorkType;
initTeacherList(lessonWorkType);
});
//查询讲师列表 //查询讲师列表
function initTeacherList(lessonWorkType){ function initTeacherList(){
top.restAjax.get(top.restAjax.path('api/teacher/list',[]), {workerCategoryId : lessonWorkType}, null, function(code,data){ top.restAjax.get(top.restAjax.path('api/teacher/list',[]), {}, null, function(code,data){
if(typeof (data) === 'undefined' || data.length == 0){
layer.msg('当前专业还没有讲师,请联系应急管理局进行添加');
return;
}
laytpl(document.getElementById('teacherTemplate').innerHTML).render(data, function(html) { laytpl(document.getElementById('teacherTemplate').innerHTML).render(data, function(html) {
document.getElementById('teacherBox').innerHTML = html; document.getElementById('teacherBox').innerHTML = html;
}); });