bt-yjj-system-examination-s.../src/main/resources/static/route/classplan/save-user-register2.html

879 lines
48 KiB
HTML
Raw Normal View History

2021-08-16 14:38:50 +08:00
<!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-anim layui-anim-fadein">
<div class="layui-card">
<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-md2 layui-col-sm2">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">一寸免冠照片</label>
<div class="layui-input-block">
<input type="hidden" id="applyUserCardPhoto" name="applyUserCardPhoto">
<div class="layui-btn-container" id="applyUserCardPhotoFileBox" style="border: 1px solid #e6e6e6;height: 122px;"></div>
<script id="applyUserCardPhotoFileDownload" type="text/html">
{{# var fileName = 'applyUserCardPhoto'; }}
{{# 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="applyUserCardPhotoRemoveFile">
<i class="fa fa-trash-o"></i>
</a>
</div>
{{# } }}
{{# } }}
{{# if(d[fileName].length < 1) { }}
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
<a href="javascript:void(0);" lay-form-button data-explain="一寸免冠证件照片" data-name="applyUserCardPhoto" lay-filter="applyUserCardPhotoUploadFile">
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
</a>
</div>
{{# } }}
</script>
</div>
</div>
</div>
<div class="layui-col-md2 layui-col-sm2">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">身份证(正)</label>
<div class="layui-input-block">
<input type="hidden" id="idCardFrontPhoto" name="idCardFrontPhoto">
<div class="layui-btn-container" id="idCardFrontPhotoFileBox" style="border: 1px solid #e6e6e6;height: 122px;"></div>
<script id="idCardFrontPhotoFileDownload" type="text/html">
{{# var fileName = 'idCardFrontPhoto'; }}
{{# 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="idCardFrontPhotoRemoveFile">
<i class="fa fa-trash-o"></i>
</a>
</div>
{{# } }}
{{# } }}
{{# if(d[fileName].length < 1) { }}
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
<a href="javascript:void(0);" lay-form-button data-explain="身份证(正)" data-name="idCardFrontPhoto" lay-filter="idCardFrontPhotoUploadFile">
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
</a>
</div>
{{# } }}
</script>
</div>
</div>
</div>
<div class="layui-col-md2 layui-col-sm2">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">身份证(反)</label>
<div class="layui-input-block">
<input type="hidden" id="idCardBackPhoto" name="idCardBackPhoto">
<div class="layui-btn-container" id="idCardBackPhotoFileBox" style="border: 1px solid #e6e6e6;height: 122px;"></div>
<script id="idCardBackPhotoFileDownload" type="text/html">
{{# var fileName = 'idCardBackPhoto'; }}
{{# 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="idCardBackPhotoRemoveFile">
<i class="fa fa-trash-o"></i>
</a>
</div>
{{# } }}
{{# } }}
{{# if(d[fileName].length < 1) { }}
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
<a href="javascript:void(0);" lay-form-button data-explain="身份证(反)" data-name="idCardBackPhoto" lay-filter="idCardBackPhotoUploadFile">
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
</a>
</div>
{{# } }}
</script>
</div>
</div>
</div>
<div class="layui-col-md2 layui-col-sm2">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">学历证书</label>
<div class="layui-input-block">
<input type="hidden" id="educationPhoto" name="educationPhoto">
<div class="layui-btn-container" id="educationPhotoFileBox" style="border: 1px solid #e6e6e6;height: 122px;"></div>
<script id="educationPhotoFileDownload" type="text/html">
{{# var fileName = 'educationPhoto'; }}
{{# 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="educationPhotoRemoveFile">
<i class="fa fa-trash-o"></i>
</a>
</div>
{{# } }}
{{# } }}
{{# if(d[fileName].length < 1) { }}
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
<a href="javascript:void(0);" lay-form-button data-explain="学历证书" data-name="educationPhoto" lay-filter="educationPhotoUploadFile">
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
</a>
</div>
{{# } }}
</script>
</div>
</div>
</div>
<div class="layui-col-md2 layui-col-sm2 fuxun-upload" style="display: none;">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">证书个人信息页</label>
<div class="layui-input-block">
<input type="hidden" id="applyTakeCardPhoto" name="applyTakeCardPhoto">
<div class="layui-btn-container" id="applyTakeCardPhotoFileBox" style="border: 1px solid #e6e6e6;height: 122px;"></div>
<script id="applyTakeCardPhotoFileDownload" type="text/html">
{{# var fileName = 'applyTakeCardPhoto'; }}
{{# 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="applyTakeCardPhotoRemoveFile">
<i class="fa fa-trash-o"></i>
</a>
</div>
{{# } }}
{{# } }}
{{# if(d[fileName].length < 1) { }}
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
<a href="javascript:void(0);" lay-form-button data-explain="证书个人信息页" data-name="applyTakeCardPhoto" lay-filter="applyTakeCardPhotoUploadFile">
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
</a>
</div>
{{# } }}
</script>
</div>
</div>
</div>
<div class="layui-col-md2 layui-col-sm2 fuxun-upload" style="display: none;">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">再培训证明</label>
<div class="layui-input-block">
<input type="hidden" id="applyRePeiXunPhoto" name="applyRePeiXunPhoto">
<div class="layui-btn-container" id="applyRePeiXunPhotoFileBox" style="border: 1px solid #e6e6e6;height: 122px;"></div>
<script id="applyRePeiXunPhotoFileDownload" type="text/html">
{{# var fileName = 'applyRePeiXunPhoto'; }}
{{# 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="applyRePeiXunPhotoRemoveFile">
<i class="fa fa-trash-o"></i>
</a>
</div>
{{# } }}
{{# } }}
{{# if(d[fileName].length < 1) { }}
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
<a href="javascript:void(0);" lay-form-button data-explain="再培训证明" data-name="applyRePeiXunPhoto" lay-filter="applyRePeiXunPhotoUploadFile">
<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-md6 layui-col-sm6">
<div class="layui-form-item" pane>
<label class="layui-form-label"><span style="color: red">*</span>培训分类</label>
<div class="layui-input-block">
<input type="radio" name="applyFenLei" value="1" title="初训" checked lay-filter="applyFenLeiFilter">
<input type="radio" name="applyFenLei" value="2" title="复训" lay-filter="applyFenLeiFilter">
</div>
</div>
</div>
<div class="layui-col-md6 layui-col-sm6">
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>培训类别</label>
<div class="layui-input-block">
<input type="text" id="applyLeiBie" name="applyLeiBie" class="layui-input" value="" placeholder="例如:负责人 或 安全员" maxlength="100" >
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md6 layui-col-sm6">
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>姓名</label>
<div class="layui-input-block">
<input type="text" id="applyName" name="applyName" class="layui-input" value=""maxlength="50" placeholder="请输入姓名" lay-verify="required" >
</div>
</div>
</div>
<div class="layui-col-md6 layui-col-sm6">
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>性别</label>
<div class="layui-input-block layui-form">
<select id="applySex" name="applySex" lay-verify="required" >
<option value="">请选择性别</option>
<option value="46bec29f-2368-44f7-98d0-b33246e5e16d"></option>
<option value="4a5f549a-d339-4403-8d26-9058e80499b1"></option>
</select>
</div>
</div>
</div>
<div class="layui-col-md6 layui-col-sm6">
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>联系电话</label>
<div class="layui-input-block">
<input type="text" id="applyPhone" name="applyPhone" class="layui-input" value="" placeholder="联系电话" lay-verify="required" >
</div>
</div>
</div>
<div class="layui-col-md6 layui-col-sm6">
<div class="layui-form-item">
<label class="layui-form-label">学历</label>
<div class="layui-input-block layui-form" id="applyCultureLevelSelectTemplateBox" lay-filter="applyCultureLevelSelectTemplateBox"></div>
<script id="applyCultureLevelSelectTemplate" type="text/html">
<select id="applyCultureLevel" name="applyCultureLevel">
<option value="">请选择学历</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dataId}}">{{item.dataName}}</option>
{{# } }}
</select>
</script>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md6 layui-col-sm6">
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>证件类型</label>
<div class="layui-input-block layui-form" id="applyCardTypeSelectTemplateBox" lay-filter="applyCardTypeSelectTemplateBox"></div>
<script id="applyCardTypeSelectTemplate" type="text/html">
<select id="applyCardType" name="applyCardType" lay-verify="required" >
<option value="">请选择证件类型</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dataId}}">{{item.dataName}}</option>
{{# } }}
</select>
</script>
</div>
</div>
<div class="layui-col-md6 layui-col-sm6">
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>证件号码</label>
<div class="layui-input-block">
<input type="text" id="applyCardNumber" name="applyCardNumber" class="layui-input" value="" placeholder="请输入证件号码" maxlength="50" lay-verify="required" >
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md4 layui-col-sm4">
<div class="layui-form-item">
<label class="layui-form-label">职称</label>
<div class="layui-input-block">
<input type="text" id="applyZhiCheng" name="applyZhiCheng" class="layui-input" placeholder="请填写职称">
</div>
</div>
</div>
<div class="layui-col-md4 layui-col-sm4">
<div class="layui-form-item">
<label class="layui-form-label">毕业院校</label>
<div class="layui-input-block">
<input type="text" id="applySchool" name="applySchool" class="layui-input" placeholder="请填写毕业院校">
</div>
</div>
</div>
<div class="layui-col-md4 layui-col-sm4">
<div class="layui-form-item">
<label class="layui-form-label">所学专业</label>
<div class="layui-input-block">
<input type="text" id="applySubject" name="applySubject" class="layui-input" placeholder="请填写专业">
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md4 layui-col-sm4">
<div class="layui-form-item">
<label class="layui-form-label">工作单位</label>
<div class="layui-input-block">
<input type="text" id="applyUnitName" name="applyUnitName" class="layui-input" value="" placeholder="请输入单位名称" maxlength="100" >
</div>
</div>
</div>
<div class="layui-col-md4 layui-col-sm4">
<div class="layui-form-item">
<label class="layui-form-label">单位类型</label>
<div class="layui-input-block">
<input type="text" id="applyUnitType" name="applyUnitType" class="layui-input" value="" placeholder="请输入单位类型" maxlength="100" >
</div>
</div>
</div>
<div class="layui-col-md4 layui-col-sm4">
<div class="layui-form-item">
<label class="layui-form-label">职务</label>
<div class="layui-input-block">
<input type="text" id="applyUnitWork" name="applyUnitWork" class="layui-input" value="" placeholder="请输入职务" maxlength="100" >
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md12 layui-col-sm12">
<div class="layui-form-item">
<label class="layui-form-label" style="width: 190px">单位所在区域或隶属部门</label>
<div class="layui-input-block" style="margin-left: 190px;">
<input type="text" id="applyUnitBelong" name="applyUnitBelong" class="layui-input" value="" placeholder="单位所在区域或隶属部门" maxlength="100" >
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md6 layui-col-sm6">
<div class="layui-form-item">
<label class="layui-form-label" style="width: 190px">取得安全资格证时间</label>
<div class="layui-input-block" style="margin-left: 190px;">
<input type="text" id="takeCardTime" name="takeCardTime" class="layui-input" value="" placeholder="例2020-01-01" maxlength="100" >
</div>
</div>
</div>
<div class="layui-col-md6 layui-col-sm6">
<div class="layui-form-item">
<label class="layui-form-label">证件有效期</label>
<div class="layui-input-block">
<input type="text" id="cardTimeLimit" name="cardTimeLimit" class="layui-input" value="" placeholder="例2020-01-01" maxlength="100" >
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md6 layui-col-sm6">
<div class="layui-form-item">
<label class="layui-form-label">证件号码</label>
<div class="layui-input-block">
<input type="text" id="takeCardNumber" name="takeCardNumber" class="layui-input" value="" placeholder="证件号码" maxlength="100" >
</div>
</div>
</div>
<div class="layui-col-md6 layui-col-sm6">
<div class="layui-form-item">
<label class="layui-form-label">再培训时间</label>
<div class="layui-input-block">
<input type="text" id="rePeiXunDate" name="rePeiXunDate" class="layui-input" value="" placeholder="例2020-01-01" maxlength="100" >
</div>
</div>
</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/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 viewerObj = {};
var orgId = top.restAjax.params(window.location.href).orgId;
var workerCatalog = top.restAjax.params(window.location.href).workerCatalog;
// 初始化内容
function initData() {
if(typeof (orgId) === 'undefined' || orgId == ''){
top.dialog.msg('机构参数缺失');
closeBox();
return;
}
if(typeof (workerCatalog) === 'undefined' || workerCatalog == ''){
top.dialog.msg('工种参数缺失');
closeBox();
return;
}
initApplyCardTypeSelect();
initApplyCultureLevelSelect();
initApplyUserCardPhotoUploadFile();
initApplyTakeCardPhotoUploadFile();
initApplyRePeiXunPhotoUploadFile();
initIdCardFrontPhotoUploadFile();
initIdCardBackPhotoUploadFile();
initEducationPhotoUploadFile();
}
initData();
// 初始化报名人证件类型
function initApplyCardTypeSelect() {
top.restAjax.get(top.restAjax.path('api/data/listbyparentid/76c5044f-805a-4313-b1e8-79e966b97c0d', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('applyCardTypeSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('applyCardTypeSelectTemplateBox').innerHTML = html;
});
form.render('select', 'applyCardTypeSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
form.on('radio(applyFenLeiFilter)', function(data){
var val = data.value;//被点击的radio的value值
if(val == 1){
$('.fuxun-upload').hide();
$('#applyTakeCardPhoto').val('');
$('#applyRePeiXunPhoto').val('');
}
if(val == 2){
$('.fuxun-upload').show();
initApplyTakeCardPhotoUploadFile();
initApplyRePeiXunPhotoUploadFile();
}
});
// 初始化报名人文化程度
function initApplyCultureLevelSelect() {
top.restAjax.get(top.restAjax.path('api/data/listbyparentid/d6b9f026-6ea9-456a-b48b-0c18d502523b', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('applyCultureLevelSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('applyCultureLevelSelectTemplateBox').innerHTML = html;
});
form.render('select', 'applyCultureLevelSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化头像图片上传
function initApplyUserCardPhotoUploadFile() {
var files = $('#applyUserCardPhoto').val();
initFileList('applyUserCardPhoto', files, function(fileName) {
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
viewerObj[fileName] = viewer;
});
form.on('button(applyUserCardPhotoUploadFile)', 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(applyUserCardPhotoRemoveFile)', 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 initIdCardFrontPhotoUploadFile() {
var files = $('#idCardFrontPhoto').val();
initFileList('idCardFrontPhoto', files, function(fileName) {
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
viewerObj[fileName] = viewer;
});
form.on('button(idCardFrontPhotoUploadFile)', 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(idCardFrontPhotoRemoveFile)', 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 initIdCardBackPhotoUploadFile() {
var files = $('#idCardBackPhoto').val();
initFileList('idCardBackPhoto', files, function(fileName) {
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
viewerObj[fileName] = viewer;
});
form.on('button(idCardBackPhotoUploadFile)', 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(idCardBackPhotoRemoveFile)', 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 initEducationPhotoUploadFile() {
var files = $('#educationPhoto').val();
initFileList('educationPhoto', files, function(fileName) {
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
viewerObj[fileName] = viewer;
});
form.on('button(educationPhotoUploadFile)', 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(educationPhotoRemoveFile)', 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 initApplyTakeCardPhotoUploadFile() {
var files = $('#applyTakeCardPhoto').val();
initFileList('applyTakeCardPhoto', files, function(fileName) {
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
viewerObj[fileName] = viewer;
});
form.on('button(applyTakeCardPhotoUploadFile)', 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(applyTakeCardPhotoRemoveFile)', 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 initApplyRePeiXunPhotoUploadFile() {
var files = $('#applyRePeiXunPhoto').val();
initFileList('applyRePeiXunPhoto', files, function(fileName) {
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
viewerObj[fileName] = viewer;
});
form.on('button(applyRePeiXunPhotoUploadFile)', 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(applyRePeiXunPhotoRemoveFile)', 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 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) {
formData.field.applyWorkTypeId = workerCatalog;
formData.field.applyInstitutionId = orgId;
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.post(top.restAjax.path('api/apply/save-relation', []), 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>