bt-yjj-system-examination-s.../src/main/resources/static/route/classplan/save.html
2021-05-05 15:56:38 +08:00

441 lines
21 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<base href="/signup/">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
<a href="javascript:void(0);"><cite>新增内容</cite></a>
</span>
</div>
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-form-item">
<label class="layui-form-label">培训机构</label>
<div class="layui-input-block">
<input type="hidden" id="orgId" name="orgId">
<input type="text" id="orgName" name="orgName" class="layui-input" value="" readonly="readonly" maxlength="100">
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md6">
<div class="layui-form-item">
<label class="layui-form-label">计划编号</label>
<div class="layui-input-block">
<input type="text" id="planNumber" name="planNumber" class="layui-input" value="" placeholder="请输入培训计划编号" maxlength="100">
</div>
</div>
</div>
<div class="layui-col-md6">
<div class="layui-form-item">
<label class="layui-form-label">计划名称</label>
<div class="layui-input-block">
<input type="text" id="planName" name="planName" class="layui-input" value="" placeholder="请输入培训计划名称" maxlength="255">
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">培训类型</label>
<div class="layui-input-block">
<select id="planType" name="planType">
<option value="1">初训</option>
<option value="2">复训</option>
<option value="3">换证</option>
</select>
</div>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">培训项目</label>
<div class="layui-input-block">
<input type="hidden" id="projectCatalogId" name="projectCatalogId" value="">
<input type="text" id="projectCatalogName" name="projectCatalogName" class="layui-input" value="" style="cursor: pointer;" placeholder="请选择培训项目" readonly="readonly">
</div>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">培训工种</label>
<div class="layui-input-block">
<input type="hidden" id="workerCatalog" name="workerCatalog" value="">
<input type="text" id="workerCatalogName" name="workerCatalogName" class="layui-input" value="" style="cursor: pointer;" placeholder="请选择培训工种" readonly="readonly">
</div>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">计划人数</label>
<div class="layui-input-block">
<input type="number" id="planPersonNum" name="planPersonNum" class="layui-input" value="0" placeholder="请输入计划人数" lay-verify="required">
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">开始时间</label>
<div class="layui-input-block">
<input type="text" id="planStartTime" name="planStartTime" class="layui-input" value="" placeholder="请选择培训开始时间" readonly style="cursor: pointer;" lay-verify="required">
</div>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">结束时间</label>
<div class="layui-input-block">
<input type="text" id="planEndTime" name="planEndTime" class="layui-input" value="" placeholder="请选择培训结束时间" readonly style="cursor: pointer;" lay-verify="required">
</div>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">报名时间</label>
<div class="layui-input-block">
<input type="text" id="signUpStartTime" name="signUpStartTime" class="layui-input" value="" placeholder="请选择报名时间开始" readonly style="cursor: pointer;" lay-verify="required">
</div>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">报名截止</label>
<div class="layui-input-block">
<input type="text" id="signUpEndTime" name="signUpEndTime" class="layui-input" value="" placeholder="请选择报名时间截止" readonly style="cursor: pointer;" lay-verify="required">
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md6">
<div class="layui-form-item">
<label class="layui-form-label">负责人</label>
<div class="layui-input-block">
<input type="text" id="chargePerson" name="chargePerson" class="layui-input" value="" placeholder="请输入负责人" maxlength="50">
</div>
</div>
</div>
<div class="layui-col-md6">
<div class="layui-form-item">
<label class="layui-form-label">联系方式</label>
<div class="layui-input-block">
<input type="text" id="chargePersonTel" name="chargePersonTel" class="layui-input" value="" placeholder="请输入联系方式" maxlength="255">
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-form-item">
<label class="layui-form-label">培训地点</label>
<div class="layui-input-block">
<input type="text" id="planAddress" name="planAddress" class="layui-input" value="" placeholder="请输入培训地点" maxlength="255">
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md12">
<table class="layui-table" id="dataTable" lay-filter="dataTable">
<thead>
<tr>
<th style="width: 50px; text-align: center"><b>确认课程</b></th>
<th style="width: 200px; text-align: center"><b>选择讲师</b></th>
<th style="width: 260px; text-align: center"><b>课程名称</b></th>
<th style="width: 100px; text-align: center"><b>课程类型</b></th>
<th style="width: 100px; text-align: center"><b>授课方式</b></th>
</tr>
</thead>
<tbody id="lessonTbodyBox"></tbody>
<script type="text/html" id="lessonTbodyTemplate">
{{# for(var i = 0, item; item = d.lesson[i++];) { }}
<tr id="lesson-{{item.lessonId}}" data-lesson-id="{{item.lessonId}}">
<td style="text-align: center">
<input data-lesson-id="{{item.lessonId}}" type="checkbox" name="lessonCheckBox" lay-skin="primary" lay-filter="lessonCheckBox">
</td>
<td style="text-align: center">
<select id="select-{{item.lessonId}}">
<option value="">请选择</option>
{{# for(var j = 0, teacher; teacher = d.teacher[j++];) { }}
<option value="{{teacher.teacherId}}">{{teacher.teacherName}}</option>
{{# } }}
</select>
</td>
<td style="text-align: center">
{{item.lessonName}}
</td>
<td style="text-align: center">
{{# if(item.lessonType == '1'){ }}
必修
{{# } }}
{{# if(item.lessonType == '2'){ }}
选修
{{# } }}
</td>
<td style="text-align: center">
{{# if(item.teachWay == '1'){ }}
面授
{{# } }}
</td>
</tr>
{{# } }}
</script>
</table>
</div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;z-index: 10">
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交新增</button>
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
<script src="assets/js/vendor/ckplayer/ckplayer/ckplayer.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'table', 'form', 'laydate', 'laytpl'], function(){
var $ = layui.$;
var $win = $(window);
var table = layui.table;
var form = layui.form;
var admin = layui.admin;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var wangEditor = window.wangEditor;
var wangEditorObj = {};
var viewerObj = {};
var teacherList = [];
var orgId = top.restAjax.params(window.location.href).orgId;
var orgName = top.restAjax.params(window.location.href).orgName;
// 初始化内容
function initData() {
var dataObj = {}
dataObj['orgId'] = orgId;
dataObj['orgName'] = orgName;
form.val('dataForm',dataObj);
form.render();
initPlanStartTimeDateTime();
initPlanEndTimeDateTime();
initSignUpStartTimeDateTime();
initSignUpEndTimeDateTime();
initTeacherList();
}
initData();
//查询课程列表
function initLessonsList(){
var dataObj = {};
var projectCatalogId = $('#projectCatalogId').val();
if(projectCatalogId == ''){
dataObj['lesson'] = [];
dataObj['teacher'] = [];
laytpl(document.getElementById('lessonTbodyTemplate').innerHTML).render(dataObj, function(html) {
document.getElementById('lessonTbodyBox').innerHTML = html;
});
form.render();
return;
}
top.restAjax.get(top.restAjax.path('api/lessons/list',[]), {projectCatalogId : projectCatalogId}, null, function(code,data){
dataObj['lesson'] = data;
dataObj['teacher'] = teacherList;
laytpl(document.getElementById('lessonTbodyTemplate').innerHTML).render(dataObj, function(html) {
document.getElementById('lessonTbodyBox').innerHTML = html;
});
form.render();
},function(code,data){
top.dialog.msg(data.msg);
});
}
//查询讲师列表
function initTeacherList(){
top.restAjax.get(top.restAjax.path('api/teacher/list',[]), {orgId : orgId}, null, function(code,data){
teacherList = data;
},function(code,data){
top.dialog.msg(data.msg);
});
}
form.on('checkbox(lessonCheckBox)',function(data){
var lessonId = $(data.elem).attr('data-lesson-id');
var teacherId = $('#select-' + lessonId).val();
if(data.elem.checked == false){
$('#select-' + lessonId).removeAttr("disabled");
form.render();
return;
}
if(teacherId == ''){
data.elem.checked = false;
form.render();
layer.msg('先选择讲师');
return;
}
$('#select-' + lessonId).attr("disabled","disabled");
form.render();
});
$(document).on('click', '#projectCatalogName', function() {
var dataUrl = 'api/data/listztree';
layer.open({
type: 2,
title: '选择培训项目',
closeBtn: 1,
area: ['200px', '400px'],
shadeClose: false,
anim: 2,
content: top.restAjax.path('route/classplan/select-tree.html?parentId={parentId}&dataUrl={dataUrl}',
['9c57f832-0606-48eb-94bb-9b3f90ca0cb2',dataUrl]),
end: function() {
var obj = {};
obj['projectCatalogId'] = top.dialog.dialogTreeData.selectedNodes['id'];
obj['projectCatalogName'] = top.dialog.dialogTreeData.selectedNodes['name'];
form.val('dataForm',obj);
form.render(null, 'dataForm');
top.dialog.dialogTreeData.selectedNodes = {};
initLessonsList();
}
});
});
$(document).on('click', '#workerCatalogName', function() {
var dataUrl = 'api/worktype/listztree';
layer.open({
type: 2,
title: '选择工种',
closeBtn: 1,
area: ['200px', '400px'],
shadeClose: false,
anim: 2,
content: top.restAjax.path('route/classplan/select-tree.html?parentId={parentId}&dataUrl={dataUrl}', ['0',dataUrl]),
end: function() {
var obj = {};
obj['workerCatalog'] = top.dialog.dialogTreeData.selectedNodes['id'];
obj['workerCatalogName'] = top.dialog.dialogTreeData.selectedNodes['name'];
form.val('dataForm',obj);
form.render(null, 'dataForm');
top.dialog.dialogTreeData.selectedNodes = {};
}
});
});
// 初始化培训开始时间时间戳
function initPlanStartTimeDateTime() {
laydate.render({
elem: '#planStartTime',
type: 'date',
trigger: 'click'
});
}
// 初始化培训结束时间时间戳
function initPlanEndTimeDateTime() {
laydate.render({
elem: '#planEndTime',
type: 'date',
trigger: 'click'
});
}
// 初始化报名时间开始时间戳
function initSignUpStartTimeDateTime() {
laydate.render({
elem: '#signUpStartTime',
type: 'date',
trigger: 'click'
});
}
// 初始化报名时间截止时间戳
function initSignUpEndTimeDateTime() {
laydate.render({
elem: '#signUpEndTime',
type: 'date',
trigger: 'click'
});
}
// 提交表单
form.on('submit(submitForm)', function(formData) {
var checkedList = $('input[name="lessonCheckBox"]:checked');
var lessonList = [];
$.each(checkedList,function(i,e){
var obj = {};
obj['lessonId'] = $(e).attr('data-lesson-id');
obj['teacherId'] = $('#select-' + obj['lessonId']).val();
lessonList.push(obj);
});
formData.field['lessonList'] = lessonList;
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.post(top.restAjax.path('api/classplan/save', []), formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function(index) {
top.dialog.close(index);
window.location.reload();
},
btn2: function() {
closeBox();
}
});
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
return false;
});
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
$('.close').on('click', function() {
closeBox();
});
// 校验
form.verify({
});
});
</script>
</body>
</html>