考试申请、开班计划详情新增图片查看和PDF文件查看。

This commit is contained in:
Renpc-kilig 2021-06-04 17:52:32 +08:00
parent 49e2820855
commit 4f4ced4c9c
3 changed files with 657 additions and 105 deletions

View File

@ -308,6 +308,13 @@
return rowData; return rowData;
} }
}, },
{field: 'examMsg', fixed: 'right', width: 180, title: '查看考试信息', align:'center',
templet: function(row) {
var rowData;
rowData = '<a class="layui-btn layui-btn-xs" lay-event="examMsg">查看考试信息</a>';
return rowData;
}
},
{field: 'teacher', fixed: 'right', width: 180, title: '查看讲师信息', align:'center', {field: 'teacher', fixed: 'right', width: 180, title: '查看讲师信息', align:'center',
templet: function(row) { templet: function(row) {
var rowData; var rowData;
@ -563,6 +570,19 @@
}); });
} }
// 查看考试信息
function examMsg(data) {
top.dialog.open({
url: top.restAjax.path('route/examapply/update-check.html?classPlanId={classPlanId}&isView={isView}', [data.examId, 'yes']),
title: "考试信息",
width: '92%',
height: '92%',
onClose: function() {
reloadTable();
}
});
}
//监听行单击事件 //监听行单击事件
table.on('tool(dataTable)', function(obj){ table.on('tool(dataTable)', function(obj){
var data = obj.data; var data = obj.data;
@ -576,6 +596,8 @@
addressShow(data) addressShow(data)
}else if('teacher' == obj.event) { }else if('teacher' == obj.event) {
teacher(data) teacher(data)
}else if('examMsg' == obj.event) {
examMsg(data)
} }
}); });
}); });

View File

@ -25,40 +25,46 @@
考试申请基本信息 考试申请基本信息
</blockquote> </blockquote>
<form class="layui-form layui-form-pane" lay-filter="initDataForm"> <form class="layui-form layui-form-pane" lay-filter="initDataForm">
<div class="layui-form-item"> <div class="layui-form-item layui-row">
<label class="layui-form-label">培训计划</label> <div class="layui-col-lg6">
<div class="layui-input-block"> <label class="layui-form-label">培训计划</label>
<input type="text" id="plan" name="plan" class="layui-input" value="培训计划" placeholder="请输入培训计划" maxlength="255" readonly> <div class="layui-input-block">
<input type="text" id="plan" name="plan" class="layui-input" value="培训计划" placeholder="请输入培训计划" maxlength="255" readonly>
</div>
</div>
<div class="layui-col-lg6">
<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" readonly>
</div>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item layui-row">
<label class="layui-form-label">计划名称</label> <div class="layui-col-lg6">
<div class="layui-input-block"> <label class="layui-form-label">计划类型</label>
<input type="text" id="planName" name="planName" class="layui-input" value="" placeholder="请输入计划名称" maxlength="255" readonly> <div class="layui-input-block">
<input type="text" id="planType" name="planType" class="layui-input" value="" placeholder="请输入计划名称" maxlength="255" readonly>
</div>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label">考试机构</label>
<div class="layui-input-block">
<input type="text" id="orgName" name="orgName" class="layui-input" value="" placeholder="请输入考试机构" maxlength="255" readonly>
</div>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item layui-row">
<label class="layui-form-label">计划类型</label> <div class="layui-col-lg6">
<div class="layui-input-block"> <label class="layui-form-label" style="width: 120px;">计划开始时间</label>
<input type="text" id="planType" name="planType" class="layui-input" value="" placeholder="请输入计划名称" maxlength="255" readonly> <div class="layui-input-block" style="margin-left: 120px;">
<input type="text" id="planStartTime" name="planStartTime" class="layui-input" value="" placeholder="请输入计划人数" maxlength="255" readonly>
</div>
</div> </div>
</div> <div class="layui-col-lg6">
<div class="layui-form-item"> <label class="layui-form-label" style="width: 120px;">计划结束时间</label>
<label class="layui-form-label">考试机构</label> <div class="layui-input-block" style="margin-left: 120px;">
<div class="layui-input-block"> <input type="text" id="planEndTime" name="planEndTime" class="layui-input" value="" placeholder="请输入计划人数" maxlength="255" readonly>
<input type="text" id="orgName" name="orgName" class="layui-input" value="" placeholder="请输入考试机构" maxlength="255" readonly> </div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label" style="width: 120px;">计划开始时间</label>
<div class="layui-input-block" style="margin-left: 120px;">
<input type="text" id="planStartTime" name="planStartTime" class="layui-input" value="" placeholder="请输入计划人数" maxlength="255" readonly>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label" style="width: 120px;">计划结束时间</label>
<div class="layui-input-block" style="margin-left: 120px;">
<input type="text" id="planEndTime" name="planEndTime" class="layui-input" value="" placeholder="请输入计划人数" maxlength="255" readonly>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
@ -67,23 +73,121 @@
<input type="text" id="planAddress" name="planAddress" class="layui-input" value="" placeholder="请输入计划人数" maxlength="255" readonly> <input type="text" id="planAddress" name="planAddress" class="layui-input" value="" placeholder="请输入计划人数" maxlength="255" readonly>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item layui-row">
<label class="layui-form-label">负责人</label> <div class="layui-col-lg6">
<div class="layui-input-block"> <label class="layui-form-label">负责人</label>
<input type="text" id="chargePerson" name="chargePerson" class="layui-input" value="" placeholder="请输入计划人数" maxlength="255" readonly> <div class="layui-input-block">
<input type="text" id="chargePerson" name="chargePerson" class="layui-input" value="" placeholder="请输入计划人数" maxlength="255" readonly>
</div>
</div>
<div class="layui-col-lg6">
<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" readonly>
</div>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-row">
<label class="layui-form-label">联系方式</label> <div class="layui-col-md12">
<div class="layui-input-block"> <div class="layui-form-item layui-form-text">
<input type="text" id="chargePersonTel" name="chargePersonTel" class="layui-input" value="" placeholder="请输入计划人数" maxlength="255" readonly> <label class="layui-form-label">开班申请图片</label>
<div class="layui-input-block">
<input type="hidden" id="planImages" name="planImages">
<div class="layui-btn-container" id="planImagesFileBox" style="border: 1px solid #e6e6e6;"></div>
<script id="planImagesFileDownload" type="text/html">
{{# var fileName = 'planImages'; }}
{{# 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>
</div>
{{# } }}
{{# } }}
</script>
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">开班申请PDF</label>
<div class="layui-input-block">
<input type="hidden" id="planPDF" name="planPDF">
<div class="layui-btn-container" id="planPDFFileBox" style="border: 1px solid #e6e6e6;"></div>
<script id="planPDFFileDownload" type="text/html">
{{# var fileName = 'planPDF'; }}
{{# 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="assets/images/pdf_icon.jpg" title="{{item.fileName}}" data-id="{{item.fileId}}" align="加载失败" class="pdf-open-show">
</span>
</div>
{{# } }}
{{# } }}
</script>
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">考试申请图片</label>
<div class="layui-input-block">
<input type="hidden" id="examImages" name="examImages">
<div class="layui-btn-container" id="examImagesFileBox" style="border: 1px solid #e6e6e6;"></div>
<script id="examImagesFileDownload" type="text/html">
{{# var fileName = 'examImages'; }}
{{# 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>
</div>
{{# } }}
{{# } }}
</script>
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">考试申请PDF</label>
<div class="layui-input-block">
<input type="hidden" id="examPDF" name="examPDF">
<div class="layui-btn-container" id="examPDFFileBox" style="border: 1px solid #e6e6e6;"></div>
<script id="examPDFFileDownload" type="text/html">
{{# var fileName = 'examPDF'; }}
{{# 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="assets/images/pdf_icon.jpg" title="{{item.fileName}}" data-id="{{item.fileId}}" align="加载失败" class="pdf-open-show">
</span>
</div>
{{# } }}
{{# } }}
</script>
</div>
</div>
</div> </div>
</div> </div>
</form> </form>
<blockquote class="site-text layui-elem-quote"> <blockquote class="site-text layui-elem-quote" id="checkDiv">
审核信息 审核信息
</blockquote> </blockquote>
<form class="layui-form layui-form-pane" lay-filter="dataForm"> <form class="layui-form layui-form-pane" lay-filter="dataForm" id="FormDiv">
<div class="layui-form-item" pane> <div class="layui-form-item" pane>
<label class="layui-form-label">审核状态</label> <label class="layui-form-label">审核状态</label>
<div class="layui-input-block layui-form"> <div class="layui-input-block layui-form">
@ -103,7 +207,7 @@
<textarea type="text" id="reason" name="reason" class="layui-textarea" value="" placeholder="请输入审核结果,审核失败原因"></textarea> <textarea type="text" id="reason" name="reason" class="layui-textarea" value="" placeholder="请输入审核结果,审核失败原因"></textarea>
</div> </div>
</div> </div>
<div class="layui-form-item layui-layout-admin"> <div class="layui-form-item layui-layout-admin" id="submitDiv">
<div class="layui-input-block"> <div class="layui-input-block">
<div class="layui-footer" style="left: 0;"> <div class="layui-footer" style="left: 0;">
<button type="button" class="layui-btn" id="subBtn" lay-submit lay-filter="submitForm">审核</button> <button type="button" class="layui-btn" id="subBtn" lay-submit lay-filter="submitForm">审核</button>
@ -131,10 +235,23 @@
var laydate = layui.laydate; var laydate = layui.laydate;
var examApplyId = top.restAjax.params(window.location.href).examApplyId; var examApplyId = top.restAjax.params(window.location.href).examApplyId;
var classPlanId = top.restAjax.params(window.location.href).classPlanId; var classPlanId = top.restAjax.params(window.location.href).classPlanId;
var isView = top.restAjax.params(window.location.href).isView;
var wangEditor = window.wangEditor; var wangEditor = window.wangEditor;
var wangEditorObj = {}; var wangEditorObj = {};
var viewerObj = {}; var viewerObj = {};
var planImagesViewerObj = {};
var examImagesViewerObj = {};
if('yes' == isView) {
$('#submitDiv').hide();
$('#FormDiv').hide();
$('#checkDiv').hide();
}else {
$('#submitDiv').show();
$('#FormDiv').show();
$('#checkDiv').show();
}
form.on('radio(checkStatus)', function (data) { form.on('radio(checkStatus)', function (data) {
var val = data.value; var val = data.value;
@ -147,8 +264,238 @@
} }
}); });
function closeBox() { // 初始化图片上传
parent.layer.close(parent.layer.getFrameIndex(window.name)); function initPlanImagesUploadFile() {
var files = $('#planImages').val();
initFileList('planImages', files, function(fileName) {
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
planImagesViewerObj[fileName] = viewer;
});
form.on('button(planImagesUploadFile)', 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) {
planImagesViewerObj[fileName].update();
});
}
}
});
});
form.on('button(planImagesRemoveFile)', 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) {
planImagesViewerObj[fileName].update();
});
});
}
// 初始化PDF上传
function initPlanPDFUploadFile() {
var files = $('#planPDF').val();
initFileList('planPDF', files, function(fileName) {
$(document).on('click', '.pdf-open-show', function(obj){
var fileId = this.dataset.id;
window.open('route/file/download/true/' + fileId);
})
});
form.on('button(planPDFUploadFile)', 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(fileName) {
});
}
}
});
});
form.on('button(planPDFRemoveFile)', 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) {
});
});
}
// 初始化图片上传
function initExamImagesUploadFile() {
var files = $('#examImages').val();
initFileList('examImages', files, function(fileName) {
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
examImagesViewerObj[fileName] = viewer;
});
form.on('button(examImagesUploadFile)', 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) {
examImagesViewerObj[fileName].update();
});
}
}
});
});
form.on('button(examImagesRemoveFile)', 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) {
examImagesViewerObj[fileName].update();
});
});
}
// 初始化PDF上传
function initExamPDFUploadFile() {
var files = $('#examPDF').val();
initFileList('examPDF', files, function(fileName) {
$(document).on('click', '.pdf-open-show', function(obj){
var fileId = this.dataset.id;
window.open('route/file/download/true/' + fileId);
})
});
form.on('button(examPDFUploadFile)', 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(fileName) {
});
}
}
});
});
form.on('button(examPDFRemoveFile)', 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) {
});
});
}
// 初始化文件列表
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 refreshDownloadTemplet(fileName, file) { function refreshDownloadTemplet(fileName, file) {
@ -160,6 +507,10 @@
}); });
} }
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
// 初始化内容 // 初始化内容
function initData() { function initData() {
initExamBaseInfo(); initExamBaseInfo();
@ -210,6 +561,10 @@
} }
form.val('initDataForm', dataFormData); form.val('initDataForm', dataFormData);
form.render(null, 'initDataForm'); form.render(null, 'initDataForm');
initPlanImagesUploadFile();
initPlanPDFUploadFile();
initExamImagesUploadFile();
initExamPDFUploadFile();
}) })
}, function (code, data) { }, function (code, data) {
top.dialog.msg(data.msg); top.dialog.msg(data.msg);

View File

@ -25,40 +25,46 @@
考试申请基本信息 考试申请基本信息
</blockquote> </blockquote>
<form class="layui-form layui-form-pane" lay-filter="initDataForm"> <form class="layui-form layui-form-pane" lay-filter="initDataForm">
<div class="layui-form-item"> <div class="layui-form-item layui-row">
<label class="layui-form-label">培训计划</label> <div class="layui-col-lg6">
<div class="layui-input-block"> <label class="layui-form-label">培训计划</label>
<input type="text" id="plan" name="plan" class="layui-input" value="培训计划" placeholder="请输入培训计划" maxlength="255" readonly> <div class="layui-input-block">
<input type="text" id="plan" name="plan" class="layui-input" value="培训计划" placeholder="请输入培训计划" maxlength="255" readonly>
</div>
</div>
<div class="layui-col-lg6">
<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" readonly>
</div>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item layui-row">
<label class="layui-form-label">计划名称</label> <div class="layui-col-lg6">
<div class="layui-input-block"> <label class="layui-form-label">计划类型</label>
<input type="text" id="planName" name="planName" class="layui-input" value="" placeholder="请输入计划名称" maxlength="255" readonly> <div class="layui-input-block">
<input type="text" id="planType" name="planType" class="layui-input" value="" placeholder="请输入计划名称" maxlength="255" readonly>
</div>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label">考试机构</label>
<div class="layui-input-block">
<input type="text" id="orgName" name="orgName" class="layui-input" value="" placeholder="请输入考试机构" maxlength="255" readonly>
</div>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item layui-row">
<label class="layui-form-label">计划类型</label> <div class="layui-col-lg6">
<div class="layui-input-block"> <label class="layui-form-label" style="width: 120px;">计划开始时间</label>
<input type="text" id="planType" name="planType" class="layui-input" value="" placeholder="请输入计划名称" maxlength="255" readonly> <div class="layui-input-block" style="margin-left: 120px;">
<input type="text" id="planStartTime" name="planStartTime" class="layui-input" value="" placeholder="请输入计划人数" maxlength="255" readonly>
</div>
</div> </div>
</div> <div class="layui-col-lg6">
<div class="layui-form-item"> <label class="layui-form-label" style="width: 120px;">计划结束时间</label>
<label class="layui-form-label">考试机构</label> <div class="layui-input-block" style="margin-left: 120px;">
<div class="layui-input-block"> <input type="text" id="planEndTime" name="planEndTime" class="layui-input" value="" placeholder="请输入计划人数" maxlength="255" readonly>
<input type="text" id="orgName" name="orgName" class="layui-input" value="" placeholder="请输入考试机构" maxlength="255" readonly> </div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label" style="width: 120px;">计划开始时间</label>
<div class="layui-input-block" style="margin-left: 120px;">
<input type="text" id="planStartTime" name="planStartTime" class="layui-input" value="" placeholder="请输入计划人数" maxlength="255" readonly>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label" style="width: 120px;">计划结束时间</label>
<div class="layui-input-block" style="margin-left: 120px;">
<input type="text" id="planEndTime" name="planEndTime" class="layui-input" value="" placeholder="请输入计划人数" maxlength="255" readonly>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
@ -67,16 +73,66 @@
<input type="text" id="planAddress" name="planAddress" class="layui-input" value="" placeholder="请输入计划人数" maxlength="255" readonly> <input type="text" id="planAddress" name="planAddress" class="layui-input" value="" placeholder="请输入计划人数" maxlength="255" readonly>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item layui-row">
<label class="layui-form-label">负责人</label> <div class="layui-col-lg6">
<div class="layui-input-block"> <label class="layui-form-label">负责人</label>
<input type="text" id="chargePerson" name="chargePerson" class="layui-input" value="" placeholder="请输入计划人数" maxlength="255" readonly> <div class="layui-input-block">
<input type="text" id="chargePerson" name="chargePerson" class="layui-input" value="" placeholder="请输入计划人数" maxlength="255" readonly>
</div>
</div>
<div class="layui-col-lg6">
<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" readonly>
</div>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-row">
<label class="layui-form-label">联系方式</label> <div class="layui-col-md12">
<div class="layui-input-block"> <div class="layui-form-item layui-form-text">
<input type="text" id="chargePersonTel" name="chargePersonTel" class="layui-input" value="" placeholder="请输入计划人数" maxlength="255" readonly> <label class="layui-form-label">图片文件</label>
<div class="layui-input-block">
<input type="hidden" id="planImages" name="planImages">
<div class="layui-btn-container" id="planImagesFileBox" style="border: 1px solid #e6e6e6;"></div>
<script id="planImagesFileDownload" type="text/html">
{{# var fileName = 'planImages'; }}
{{# 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>
</div>
{{# } }}
{{# } }}
</script>
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">PDF文件</label>
<div class="layui-input-block">
<input type="hidden" id="planPDF" name="planPDF">
<div class="layui-btn-container" id="planPDFFileBox" style="border: 1px solid #e6e6e6;"></div>
<script id="planPDFFileDownload" type="text/html">
{{# var fileName = 'planPDF'; }}
{{# 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="assets/images/pdf_icon.jpg" title="{{item.fileName}}" data-id="{{item.fileId}}" align="加载失败" class="pdf-open-show">
</span>
</div>
{{# } }}
{{# } }}
</script>
</div>
</div>
</div> </div>
</div> </div>
</form> </form>
@ -135,6 +191,8 @@
var wangEditor = window.wangEditor; var wangEditor = window.wangEditor;
var wangEditorObj = {}; var wangEditorObj = {};
var viewerObj = {}; var viewerObj = {};
var planImagesViewerObj = {};
var examImagesViewerObj = {};
form.on('radio(checkStatus)', function (data) { form.on('radio(checkStatus)', function (data) {
var val = data.value; var val = data.value;
@ -147,6 +205,146 @@
} }
}); });
// 初始化图片上传
function initPlanImagesUploadFile() {
var files = $('#planImages').val();
debugger
initFileList('planImages', files, function(fileName) {
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
planImagesViewerObj[fileName] = viewer;
});
form.on('button(planImagesUploadFile)', 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) {
planImagesViewerObj[fileName].update();
});
}
}
});
});
form.on('button(planImagesRemoveFile)', 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) {
planImagesViewerObj[fileName].update();
});
});
}
// 初始化PDF上传
function initPlanPDFUploadFile() {
var files = $('#planPDF').val();
initFileList('planPDF', files, function(fileName) {
$(document).on('click', '.pdf-open-show', function(obj){
var fileId = this.dataset.id;
window.open('route/file/download/true/' + fileId);
})
});
form.on('button(planPDFUploadFile)', 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(fileName) {
});
}
}
});
});
form.on('button(planPDFRemoveFile)', 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) {
});
});
}
// 初始化文件列表
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 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 closeBox() { function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name)); parent.layer.close(parent.layer.getFrameIndex(window.name));
} }
@ -160,32 +358,6 @@
}); });
} }
// 初始化文件列表
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 initData() { function initData() {
initExamBaseInfo(); initExamBaseInfo();
@ -222,6 +394,7 @@
var loadLayerIndex; var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/classplan/get/{classPlanId}', [classPlanId]), {}, null, function (code, data) { top.restAjax.get(top.restAjax.path('api/classplan/get/{classPlanId}', [classPlanId]), {}, null, function (code, data) {
orgNameFun.getOrgName(data.orgId, function(nameData) { orgNameFun.getOrgName(data.orgId, function(nameData) {
console.log(data)
data['orgName'] = nameData.institutionName; data['orgName'] = nameData.institutionName;
if ('1' == data.planType) { if ('1' == data.planType) {
data.planType = '初训'; data.planType = '初训';
@ -236,6 +409,8 @@
} }
form.val('initDataForm', dataFormData); form.val('initDataForm', dataFormData);
form.render(null, 'initDataForm'); form.render(null, 'initDataForm');
initPlanImagesUploadFile();
initPlanPDFUploadFile();
}) })
}, function (code, data) { }, function (code, data) {
top.dialog.msg(data.msg); top.dialog.msg(data.msg);