添加开班计划图片上传和PDF上传的功能
This commit is contained in:
parent
cd00260c83
commit
284a7b50e8
@ -77,6 +77,10 @@ public class ClassPlanDTO {
|
||||
private String examReason;
|
||||
@ApiModelProperty(name = "examStatus", value = "考点信息分配状态0未分配1已分配")
|
||||
private String examStatus;
|
||||
@ApiModelProperty(name = "planImages", value = "开班申请图片")
|
||||
private String planImages;
|
||||
@ApiModelProperty(name = "planPDF", value = "开班申请PDF")
|
||||
private String planPDF;
|
||||
|
||||
|
||||
public String getPlanNumber() {
|
||||
@ -289,4 +293,20 @@ public class ClassPlanDTO {
|
||||
public void setExamStatus(String examStatus) {
|
||||
this.examStatus = examStatus;
|
||||
}
|
||||
|
||||
public String getPlanImages() {
|
||||
return planImages == null ? "" : planImages;
|
||||
}
|
||||
|
||||
public void setPlanImages(String planImages) {
|
||||
this.planImages = planImages;
|
||||
}
|
||||
|
||||
public String getPlanPDF() {
|
||||
return planPDF == null ? "" : planPDF;
|
||||
}
|
||||
|
||||
public void setPlanPDF(String planPDF) {
|
||||
this.planPDF = planPDF;
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,10 @@ public class ClassPlanVO {
|
||||
private String estimateEnd;
|
||||
@ApiModelProperty(name = "examType", value = "考试申请类型1理论2实操3理论与实操")
|
||||
private String examType;
|
||||
@ApiModelProperty(name = "planImages", value = "开班申请图片")
|
||||
private String planImages;
|
||||
@ApiModelProperty(name = "planPDF", value = "开班申请PDF")
|
||||
private String planPDF;
|
||||
|
||||
public String getPlanNumber() {
|
||||
return planNumber == null ? "" : planNumber.trim();
|
||||
@ -214,4 +218,20 @@ public class ClassPlanVO {
|
||||
public void setEstimateEnd(String estimateEnd) {
|
||||
this.estimateEnd = estimateEnd;
|
||||
}
|
||||
|
||||
public String getPlanImages() {
|
||||
return planImages == null ? "" : planImages;
|
||||
}
|
||||
|
||||
public void setPlanImages(String planImages) {
|
||||
this.planImages = planImages;
|
||||
}
|
||||
|
||||
public String getPlanPDF() {
|
||||
return planPDF == null ? "" : planPDF;
|
||||
}
|
||||
|
||||
public void setPlanPDF(String planPDF) {
|
||||
this.planPDF = planPDF;
|
||||
}
|
||||
}
|
||||
|
@ -143,6 +143,8 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl
|
||||
classPlanVO.setPlanAddress(obj.getString("planAddress"));
|
||||
classPlanVO.setChargePerson(obj.getString("chargePerson"));
|
||||
classPlanVO.setChargePersonTel(obj.getString("chargePersonTel"));
|
||||
classPlanVO.setPlanImages(obj.getString("planImages"));
|
||||
classPlanVO.setPlanPDF(obj.getString("planPDF"));
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(classPlanVO);
|
||||
params.put("classPlanId", classPlanId);
|
||||
setSaveInfo(params);
|
||||
|
@ -178,9 +178,7 @@ public class TeacherServiceImpl extends DefaultBaseService implements ITeacherSe
|
||||
public List<TeacherLessonsTimeDTO> listTeacherLessonsTime(Map<String, Object> params) {
|
||||
List<TeacherLessonsTimeDTO> list = teacherDao.listTeacherLessonsTimeDTO(params);
|
||||
for(TeacherLessonsTimeDTO item : list){
|
||||
// 查询考试机构名称
|
||||
InstitutionDTO institutionDTO = iInstitutionService.get(item.getOrgId());
|
||||
item.setOrgName(institutionDTO.getInstitutionName());
|
||||
item.setOrgName("");
|
||||
// 查询讲师名称
|
||||
TeacherDTO byId = getById(item.getTeacherId());
|
||||
item.setTeacherName(byId.getTeacherName());
|
||||
|
@ -20,6 +20,8 @@
|
||||
<result column="charge_person_tel" property="chargePersonTel"/>
|
||||
<result column="report_type" property="reportType"/>
|
||||
<result column="report_reason" property="reportReason"/>
|
||||
<result column="plan_images" property="planImages"/>
|
||||
<result column="plan_pdf" property="planPDF"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="classPlanBO" type="cn.com.tenlion.materialstore.pojo.bos.classplan.ClassPlanBO">
|
||||
@ -74,6 +76,8 @@
|
||||
charge_person_tel,
|
||||
report_type,
|
||||
report_reason,
|
||||
plan_images,
|
||||
plan_pdf,
|
||||
creator,
|
||||
gmt_create,
|
||||
modifier,
|
||||
@ -95,6 +99,8 @@
|
||||
#{chargePersonTel},
|
||||
#{reportType},
|
||||
#{reportReason},
|
||||
#{planImages},
|
||||
#{planPDF},
|
||||
#{creator},
|
||||
#{gmtCreate},
|
||||
#{modifier},
|
||||
@ -178,6 +184,12 @@
|
||||
</if>
|
||||
<if test="reportReason != null and reportReason != ''">
|
||||
report_reason = #{reportReason},
|
||||
</if>
|
||||
<if test="planImages != null and planImages != ''">
|
||||
plan_images = #{planImages},
|
||||
</if>
|
||||
<if test="planPDF != null and planPDF != ''">
|
||||
plan_pdf = #{planPDF},
|
||||
</if>
|
||||
class_plan_id = class_plan_id
|
||||
WHERE
|
||||
@ -203,7 +215,9 @@
|
||||
t1.charge_person_tel,
|
||||
t1.class_plan_id,
|
||||
t1.report_type,
|
||||
t1.report_reason
|
||||
t1.report_reason,
|
||||
t1.plan_images,
|
||||
t1.plan_pdf
|
||||
FROM
|
||||
e_class_plan t1
|
||||
WHERE
|
||||
@ -289,7 +303,9 @@
|
||||
t1.charge_person,
|
||||
t1.charge_person_tel,
|
||||
t1.report_type,
|
||||
t1.report_reason
|
||||
t1.report_reason,
|
||||
t1.plan_images,
|
||||
t1.plan_pdf
|
||||
FROM
|
||||
e_class_plan t1
|
||||
WHERE
|
||||
|
BIN
src/main/resources/static/assets/images/pdf_icon.jpg
Normal file
BIN
src/main/resources/static/assets/images/pdf_icon.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
@ -108,6 +108,70 @@
|
||||
</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="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>
|
||||
<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="planImagesRemoveFile">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
</a>
|
||||
</div>
|
||||
{{# } }}
|
||||
{{# } }}
|
||||
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
|
||||
<a href="javascript:void(0);" lay-form-button data-explain="图片" data-name="planImages" lay-filter="planImagesUploadFile">
|
||||
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
|
||||
</a>
|
||||
</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>
|
||||
<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="planPDFRemoveFile">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
</a>
|
||||
</div>
|
||||
{{# } }}
|
||||
{{# } }}
|
||||
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
|
||||
<a href="javascript:void(0);" lay-form-button data-explain="PDF" data-name="planPDF" lay-filter="planPDFUploadFile">
|
||||
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<button type="button" id="teacher-lessons-event" class="layui-btn layui-btn layui-btn-info">
|
||||
@ -208,6 +272,7 @@
|
||||
var teacherList = [];
|
||||
var orgId = top.restAjax.params(window.location.href).orgId;
|
||||
var workerCatalog = top.restAjax.params(window.location.href).workerCatalog;
|
||||
var planImagesViewerObj = {};
|
||||
|
||||
// 初始化内容
|
||||
function initData() {
|
||||
@ -215,6 +280,8 @@
|
||||
initPlanStartTimeDateTime();
|
||||
initPlanEndTimeDateTime();
|
||||
initTeacherList();
|
||||
initPlanImagesUploadFile();
|
||||
initPlanPDFUploadFile();
|
||||
}
|
||||
initData();
|
||||
|
||||
@ -403,6 +470,149 @@
|
||||
});
|
||||
});
|
||||
|
||||
// 初始化图片上传
|
||||
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 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 closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
|
||||
// 提交表单
|
||||
form.on('submit(submitForm)', function(formData) {
|
||||
var checkedList = $('input[name="lessonCheckBox"]:checked');
|
||||
@ -431,18 +641,8 @@
|
||||
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);
|
||||
closeBox();
|
||||
},
|
||||
btn2: function() {
|
||||
closeBox();
|
||||
}
|
||||
});
|
||||
top.dialog.close(index);
|
||||
closeBox();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
|
@ -107,6 +107,54 @@
|
||||
</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="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">
|
||||
<table class="layui-table" id="dataTable" lay-filter="dataTable">
|
||||
@ -194,7 +242,8 @@
|
||||
var teacherList = [];
|
||||
var classPlanLessons = [];
|
||||
var classPlanId = top.restAjax.params(window.location.href).classPlanId;
|
||||
var orgId = ''
|
||||
var orgId = '';
|
||||
var planImagesViewerObj = {};
|
||||
|
||||
// 初始化内容
|
||||
function initData() {
|
||||
@ -218,6 +267,8 @@
|
||||
initTeacherList(data.orgId);
|
||||
classPlanLessons = data.classPlanLessons;
|
||||
orgId = data.orgId;
|
||||
initPlanImagesUploadFile();
|
||||
initPlanPDFUploadFile();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
@ -264,6 +315,110 @@
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化图片上传
|
||||
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 reloadLessonsList(){
|
||||
if(typeof (classPlanLessons) != 'undefined' && classPlanLessons.length > 0)
|
||||
$.each(classPlanLessons,function(i,e){
|
||||
@ -281,6 +436,41 @@
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
$('.close').on('click', function() {
|
||||
closeBox();
|
||||
});
|
||||
|
@ -107,6 +107,70 @@
|
||||
</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="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>
|
||||
<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="planImagesRemoveFile">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
</a>
|
||||
</div>
|
||||
{{# } }}
|
||||
{{# } }}
|
||||
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
|
||||
<a href="javascript:void(0);" lay-form-button data-explain="图片" data-name="planImages" lay-filter="planImagesUploadFile">
|
||||
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
|
||||
</a>
|
||||
</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>
|
||||
<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="planPDFRemoveFile">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
</a>
|
||||
</div>
|
||||
{{# } }}
|
||||
{{# } }}
|
||||
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
|
||||
<a href="javascript:void(0);" lay-form-button data-explain="PDF" data-name="planPDF" lay-filter="planPDFUploadFile">
|
||||
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<table class="layui-table" id="dataTable" lay-filter="dataTable">
|
||||
@ -203,6 +267,7 @@
|
||||
var classPlanLessons = [];
|
||||
var classPlanId = top.restAjax.params(window.location.href).classPlanId;
|
||||
var orgId = '';
|
||||
var planImagesViewerObj = {};
|
||||
|
||||
// 初始化内容
|
||||
function initData() {
|
||||
@ -231,6 +296,8 @@
|
||||
initTeacherList(data.orgId);
|
||||
classPlanLessons = data.classPlanLessons;
|
||||
orgId = data.orgId
|
||||
initPlanImagesUploadFile();
|
||||
initPlanPDFUploadFile();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
@ -310,6 +377,145 @@
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化图片上传
|
||||
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 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);
|
||||
});
|
||||
}
|
||||
|
||||
form.on('checkbox(lessonCheckBox)',function(data){
|
||||
var lessonId = $(data.elem).attr('data-lesson-id');
|
||||
var teacherId = $('#select-' + lessonId).val();
|
||||
@ -480,18 +686,8 @@
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.put(top.restAjax.path('api/classplan/update/{classPlanId}', [classPlanId]), 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);
|
||||
closeBox();
|
||||
},
|
||||
btn2: function() {
|
||||
closeBox();
|
||||
}
|
||||
});
|
||||
top.dialog.close(index);
|
||||
closeBox();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
|
@ -211,7 +211,7 @@
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '选择授课工种',
|
||||
closeBtn: 0,
|
||||
closeBtn: 1,
|
||||
area: ['400px', '500px'],
|
||||
shadeClose: false,
|
||||
anim: 2,
|
||||
|
@ -243,7 +243,7 @@
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '选择授课工种',
|
||||
closeBtn: 0,
|
||||
closeBtn: 1,
|
||||
area: ['400px', '500px'],
|
||||
shadeClose: false,
|
||||
anim: 2,
|
||||
|
Loading…
Reference in New Issue
Block a user