bt-yjj-system-examination-s.../src/main/resources/static/route/examplan/save.html
2021-06-17 17:59:16 +08:00

607 lines
31 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-form-item">
<label class="layui-form-label">考试名称<span style="color: red;vertical-align: middle;">*</span></label>
<div class="layui-input-block">
<input type="text" id="name" name="name" class="layui-input" value="" placeholder="请输入考试名称" maxlength="255" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">考点</label>
<input type="hidden" name="siteName" id="siteName"/>
<div class="layui-input-block layui-form" id="siteSelectTemplateBox" lay-filter="siteSelectTemplateBox"></div>
<script id="siteSelectTemplate" type="text/html">
<select id="site" name="site" lay-search lay-filter="site">
<option value="">请选择考试地点</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.institutionId}}">{{item.institutionName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg6">
<label class="layui-form-label">工种类别<span style="color: red;vertical-align: middle;">*</span></label>
<input type="hidden" name="workTypeParent" id="workTypeParent"/>
<div class="layui-input-block layui-form" id="workTypeParentNameSelectTemplateBox" lay-filter="workTypeParentNameSelectTemplateBox" style="width: 1299px;"></div>
<script id="workTypeParentNameSelectTemplate" type="text/html">
<select id="workTypeParentName" name="workTypeParentName" lay-filter="workTypeParentName" lay-verify="required">
<option value="">工种类别</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.id}}">{{item.name}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-col-lg6" style="display: none;" id="workTypeDiv">
<label class="layui-form-label">工种<span style="color: red;vertical-align: middle;">*</span></label>
<input type="hidden" name="workTypeName" id="workTypeName"/>
<div class="layui-input-block layui-form" id="workTypeSelectTemplateBox" lay-filter="workTypeSelectTemplateBox"></div>
<script id="workTypeSelectTemplate" type="text/html">
<select id="workType" name="workType" lay-filter="workType" lay-verify="required">
<option value="">请选择工种</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.id}}">{{item.name}}</option>
{{# } }}
</select>
</script>
</div>
</div>
<div class="layui-form-item" pane>
<label class="layui-form-label">考试类型<span style="color: red;vertical-align: middle;">*</span></label>
<div class="layui-input-block">
<input type="radio" name="examType" value="1" title="知识" checked>
<input type="radio" name="examType" value="2" title="实操">
<input type="radio" name="examType" value="3" title="补考">
</div>
</div>
<!--<div class="layui-form-item layui-row">
<div class="layui-col-lg6">
<label class="layui-form-label" style="width: 120px;">考试开始时间</label>
<div class="layui-input-block" style="margin-left: 120px;">
<input type="text" id="startTime" name="startTime" class="layui-input" value="" placeholder="请选择考试开始时间" readonly style="cursor: pointer;">
</div>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label" style="width: 120px;">考试结束时间</label>
<div class="layui-input-block" style="margin-left: 120px;">
<input type="text" id="endTime" name="endTime" class="layui-input" value="" placeholder="请选择考试结束时间" readonly style="cursor: pointer;">
</div>
</div>
</div>-->
<div class="layui-form-item layui-row">
<!--<div class="layui-col-lg6">
<label class="layui-form-label">考试人数<span style="color: red;vertical-align: middle;">*</span></label>
<div class="layui-input-block">
<input type="number" id="examCount" name="examCount" class="layui-input" value="" placeholder="请输入考试人数" maxlength="10" lay-verify="required">
</div>
</div>-->
<div class="layui-col-lg6" pane>
<label class="layui-form-label" style="width: 120px;">报名截止时间</label>
<div class="layui-input-block" style="margin-left: 120px;">
<input type="text" id="signupTime" name="signupTime" class="layui-input" value="" placeholder="请选择考试开始时间" readonly style="cursor: pointer;">
</div>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label">考试等级</label>
<div class="layui-input-block">
<input type="text" id="level" name="level" class="layui-input" value="" placeholder="请输入考试等级" maxlength="10">
</div>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg6">
<label class="layui-form-label">联系人</label>
<div class="layui-input-block">
<input type="text" id="linkMan" name="linkMan" class="layui-input" value="" placeholder="请输入联系人" maxlength="255">
</div>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label">联系方式</label>
<div class="layui-input-block">
<input type="text" id="linkPhone" name="linkPhone" class="layui-input" value="" placeholder="请输入联系方式" maxlength="50">
</div>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">考试要求<span style="color: red;font-size: 14px;margin-left: 2%;">*主要是对考试需要做的一些准备,例如:携带身份证等</span></label>
<div class="layui-input-block">
<textarea id="demand" name="demand" class="layui-textarea" value="" placeholder="请输入考试要求"></textarea>
</div>
</div>
<div class="layui-form-item" pane>
<label class="layui-form-label">是否发布<span style="color: red;vertical-align: middle;">*</span></label>
<div class="layui-input-block">
<input type="radio" name="isSend" value="0" title="否">
<input type="radio" name="isSend" value="1" title="是" checked>
</div>
</div>
<span style="color: red;font-size: 14px;margin-left: 2%;">*此内容用于发布到网站的考试通知的标题</span>
<div class="layui-form-item">
<label class="layui-form-label">通知标题<span style="color: red;vertical-align: middle;">*</span></label>
<div class="layui-input-block">
<input type="text" id="title" name="title" class="layui-input" value="" placeholder="请输入通知标题" maxlength="255" lay-verify="required">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">通知内容<span style="color: red;font-size: 14px;margin-left: 2%;">*此内容用于发布到网站的考试通知内容</span></label>
<div class="layui-input-block">
<div id="notice" name="notice" ></div>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">附件图片</label>
<div class="layui-input-block">
<input type="hidden" id="picture" name="picture">
<div class="layui-btn-container" id="pictureFileBox" style="border: 1px solid #e6e6e6;"></div>
<script id="pictureFileDownload" type="text/html">
{{# var fileName = 'picture'; }}
{{# if(d[fileName].length > 0) { }}
{{# var files = d[fileName];}}
{{# for(var i = 0, item = files[i]; item = files[i++];) { }}
<div class="upload-image-box">
<span class="upload-image-span">
<img src="route/file/download/false/{{item.fileId}}" align="加载失败">
</span>
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="pictureRemoveFile">
<i class="fa fa-trash-o"></i>
</a>
</div>
{{# } }}
{{# } }}
{{# if(d[fileName].length < 9) { }}
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
<a href="javascript:void(0);" lay-form-button data-explain="附件图片" data-name="picture" lay-filter="pictureUploadFile">
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
</a>
</div>
{{# } }}
</script>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">附件文档</label>
<div class="layui-input-block">
<input type="hidden" id="file" name="file">
<div class="layui-btn-container" id="fileFileBox" style="border: 1px solid #e6e6e6;"></div>
<script id="fileFileDownload" type="text/html">
{{# var fileName = 'file'; }}
{{# if(d[fileName] != '') { }}
{{# var files = d[fileName];}}
{{# for(var i = 0, item = files[i]; item = files[i++];) { }}
<span class="layui-btn-group">
<div class="upload-file-box">
<a class="upload-file-a" href="route/file/download/false/{{item.fileId}}" title="{{item.fileName}} - 点击下载">
{{# if(item.fileType == 'doc' || item.fileType == 'docx') { }}
<img src="assets/images/filetype/word.png"/>
{{# } else if(item.fileType == 'xls' || item.fileType == 'xlsx') { }}
<img src="assets/images/filetype/excel.png"/>
{{# } else if(item.fileType == 'ppt' || item.fileType == 'pptx') { }}
<img src="assets/images/filetype/ppt.png"/>
{{# } else if(item.fileType == 'apk') { }}
<img src="assets/images/filetype/apk.png"/>
{{# } else if(item.fileType == 'pdf') { }}
<img src="assets/images/filetype/pdf.png"/>
{{# } else if(item.fileType == 'rar') { }}
<img src="assets/images/filetype/rar.png"/>
{{# } else if(item.fileType == 'zip') { }}
<img src="assets/images/filetype/zip.png"/>
{{# } else if(item.fileType == 'txt') { }}
<img src="assets/images/filetype/txt.png"/>
{{# } else { }}
<img src="assets/images/filetype/file.png"/>
{{# } }}
</a>
<span class="upload-file-title">{{item.fileName}}</span>
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-file" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="fileRemoveFile">
<i class="fa fa-trash-o"></i>
</a>
</div>
</span>
{{# } }}
{{# } }}
{{# if(d[fileName].length < 9) { }}
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
<a href="javascript:void(0);" lay-form-button data-explain="附件文档" data-name="file" lay-filter="fileUploadFile">
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
</a>
</div>
{{# } }}
</script>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">备注</label>
<div class="layui-input-block">
<textarea id="remake" name="remake" class="layui-textarea" value="" placeholder="请输入备注"></textarea>
</div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<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', 'form', 'laydate', 'laytpl'], function(){
var $ = layui.$;
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var wangEditor = window.wangEditor;
var noticeEditorObj = {};
var viewerObj = {};
// 初始化考点下拉选择
function initSiteSelect() {
top.restAjax.get(top.restAjax.path('api/institution/list?institutionType=考点信息', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('siteSelectTemplate').innerHTML).render(data, function(html) {
console.log(data)
document.getElementById('siteSelectTemplateBox').innerHTML = html;
});
form.render('select', 'siteSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 考点change事件
form.on('select(site)', function(data){
if(data.value) {
$('#siteName').val($("#site").find("option:selected").text());
}
});
// 初始化个人简历富文本
function initNoticeRichText() {
var editor = new wangEditor('#notice');
editor.customConfig.zIndex = 1000;
editor.customConfig.uploadImgMaxSize = 5 * 1024 * 1024;
editor.customConfig.uploadImgMaxLength = 1;
editor.customConfig.uploadFileName = 'image';
editor.customConfig.uploadImgServer = 'api/file/wangeditorimage';
editor.customConfig.uploadImgHooks = {
fail: function (xhr, editor, result) {
top.dialog.msg('系统错误,图片上传失败');
},
error: function (xhr, editor) {
top.dialog.msg('网络异常');
},
timeout: function (xhr, editor) {
top.dialog.msg('网络请求超时');
}
};
editor.create();
noticeEditorObj['notice'] = editor;
}
// 工种类别change事件
form.on('select(workTypeParentName)', function(data){
if(data.value) {
$('#workTypeParent').val($("#workTypeParentName").find("option:selected").val())
$('#workTypeDiv').show();
$('#workTypeParentNameSelectTemplateBox').removeAttr("style");
}else {
$('#workTypeDiv').hide();
$('#workTypeParentNameSelectTemplateBox').css("width", "1299px");
}
initWorkTypeSelect(data.value);
form.render("select");
});
// 工种change事件
form.on('select(workType)', function(data){
if(data.value) {
$('#workTypeName').val($("#workType").find("option:selected").text());
}
});
// 工种类别
function initWorkTypeParentNameSelect() {
top.restAjax.get(top.restAjax.path('api/worktype/listztree', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('workTypeParentNameSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('workTypeParentNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'workTypeParentNameSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 工种
function initWorkTypeSelect(value) {
if(!value) {
var data = [
{
areaId: '',
areaName: '请选择上级数据'
}
];
laytpl(document.getElementById('workTypeSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('workTypeSelectTemplateBox').innerHTML = html;
});
form.render('select', 'workTypeSelectTemplateBox');
}else {
top.restAjax.get(top.restAjax.path('api/worktype/listztree/?id=' + value, []), {}, null, function(code, data, args) {
laytpl(document.getElementById('workTypeSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('workTypeSelectTemplateBox').innerHTML = html;
});
form.render('select', 'workTypeSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
}
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
function refreshDownloadTemplet(fileName, file) {
var dataRander = {};
dataRander[fileName] = file;
laytpl(document.getElementById(fileName +'FileDownload').innerHTML).render(dataRander, function(html) {
document.getElementById(fileName +'FileBox').innerHTML = html;
});
}
// 初始化文件列表
function initFileList(fileName, ids, callback) {
var dataForm = {};
dataForm[fileName] = ids;
form.val('dataForm', dataForm);
if(!ids) {
refreshDownloadTemplet(fileName, []);
if(callback) {
callback(fileName, []);
}
return;
}
top.restAjax.get(top.restAjax.path('api/file/list', []), {
ids: ids
}, null, function(code, data) {
refreshDownloadTemplet(fileName, data);
if(callback) {
callback(fileName, data);
}
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化视频
function initVideo(fileName, data) {
for(var i = 0, item; item = data[i++];) {
var player = new ckplayer({
container: '#'+ fileName + i,
variable: 'player',
flashplayer: false,
video: {
file: 'route/file/download/true/'+ item.fileId,
type: 'video/mp4'
}
});
}
}
// 报名截止时间
function initSignupTimeDateTime() {
laydate.render({
elem: '#signupTime',
type: 'datetime',
value: new Date(),
trigger: 'click'
});
}
// 初始化考试开始时间时间戳
function initStartTimeDateTime() {
laydate.render({
elem: '#startTime',
type: 'datetime',
value: new Date(),
trigger: 'click'
});
}
// 初始化考试结束时间时间戳
function initEndTimeDateTime() {
laydate.render({
elem: '#endTime',
type: 'datetime',
value: new Date(),
trigger: 'click'
});
}
// 初始化附件图片图片上传
function initPictureUploadFile() {
var files = $('#picture').val();
initFileList('picture', files, function(fileName) {
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
viewerObj[fileName] = viewer;
});
form.on('button(pictureUploadFile)', function(obj) {
var name = this.dataset.name;
var explain = this.dataset.explain;
top.dialog.file({
type: 'image',
title: '上传'+ explain,
width: '400px',
height: '420px',
maxFileCount: '1',
onClose: function() {
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
var files = $('#'+ name).val();
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
if(files.length > 0) {
files += ',';
}
files += file.data;
}
initFileList(name, files, function(fileName) {
viewerObj[fileName].update();
});
}
}
});
});
form.on('button(pictureRemoveFile)', function(obj) {
var name = this.dataset.name;
var id = this.dataset.id;
var files = $('#'+ name).val().replace(id, '');
files = files.replace(/\,+/g, ',');
if(files.charAt(0) == ',') {
files = files.substring(1);
}
if(files.charAt(files.length - 1) == ',') {
files = files.substring(0, files.length - 1);
}
initFileList(name, files, function(fileName) {
viewerObj[fileName].update();
});
});
}
// 初始化附件文档文件上传
function initFileUploadFile() {
var files = $('#file').val();
initFileList('file', files);
form.on('button(fileUploadFile)', function(obj) {
var name = this.dataset.name;
var explain = this.dataset.explain;
top.dialog.file({
type: 'file',
title: '上传'+ explain,
width: '400px',
height: '420px',
maxFileCount: '1',
onClose: function() {
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
var files = $('#'+ name).val();
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
if(files.length > 0) {
files += ',';
}
files += file.data;
}
initFileList(name, files, function() {});
}
}
});
});
form.on('button(fileRemoveFile)', function(obj) {
var name = this.dataset.name;
var id = this.dataset.id;
var files = $('#'+ name).val().replace(id, '');
files = files.replace(/\,+/g, ',');
if(files.charAt(0) == ',') {
files = files.substring(1);
}
if(files.charAt(files.length - 1) == ',') {
files = files.substring(0, files.length - 1);
}
initFileList(name, files);
});
}
// 初始化内容
function initData() {
initSignupTimeDateTime();
initStartTimeDateTime();
initEndTimeDateTime();
initPictureUploadFile();
initFileUploadFile();
initNoticeRichText();
initWorkTypeParentNameSelect();
initSiteSelect();
}
initData();
// 提交表单
form.on('submit(submitForm)', function(formData) {
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
formData.field['notice'] = noticeEditorObj['notice'].txt.html();
top.restAjax.post(top.restAjax.path('api/examplan/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;
});
$('.close').on('click', function() {
closeBox();
});
// 校验
form.verify({
});
});
</script>
</body>
</html>