bt-yjj-system-examination-s.../src/main/resources/static/route/examination/distribution/update.html

387 lines
19 KiB
HTML
Raw Normal View History

2021-05-02 18:23:26 +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-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>
2021-05-15 20:24:03 +08:00
<a href="javascript:void(0);"><cite>分配考场与考试时间</cite></a>
2021-05-02 18:23:26 +08:00
</span>
</div>
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<input type="hidden" readonly id="stationId" name="stationId" class="layui-input" value="" maxlength="36">
2021-05-15 15:36:33 +08:00
<div class="layui-form-item" style="text-align: center;width:100% !important;font-size: 17px">
2021-06-19 18:27:14 +08:00
<b>考试计划申请列表</b>
2021-05-02 18:23:26 +08:00
</div>
2021-05-15 19:11:09 +08:00
<div class="layui-input-block layui-form" id="distributionClassPlansBox" lay-filter="distributionClassPlansBox" pane="" style="margin-left: 0px !important;" ></div>
2021-05-15 15:36:33 +08:00
<script id="distributionClassPlansBoxTemplate" type="text/html">
{{# for(var j = 0, classPlan; classPlan = d[j++];) { }}
<div class="layui-form-item layui-row ">
2021-06-19 18:27:14 +08:00
<div class="layui-col-lg3" >
<label class="layui-form-label">培训机构</label>
2021-05-15 15:36:33 +08:00
<div class="layui-input-block">
2021-06-19 18:27:14 +08:00
<input type="text" readonly class="layui-input" value="{{classPlan.orgName}}" placeholder="" lay-verify="required">
2021-05-15 15:36:33 +08:00
</div>
</div>
2021-06-16 18:29:38 +08:00
<div class="layui-col-lg4" >
2021-06-19 18:27:14 +08:00
<label class="layui-form-label">申请名称</label>
2021-05-15 15:36:33 +08:00
<div class="layui-input-block">
2021-06-19 18:27:14 +08:00
<input type="text" readonly class="layui-input" value="{{classPlan.planName}}" placeholder="" lay-verify="required">
2021-05-15 15:36:33 +08:00
</div>
</div>
2021-06-16 18:29:38 +08:00
<div class="layui-col-lg3" >
2021-06-19 18:27:14 +08:00
<label class="layui-form-label">培训科目</label>
2021-05-15 15:36:33 +08:00
<div class="layui-input-block">
2021-06-19 18:27:14 +08:00
<input type="text" readonly class="layui-input" value="{{classPlan.workerCatalogName}}" placeholder="" lay-verify="required">
2021-05-15 15:36:33 +08:00
</div>
</div>
2021-06-19 18:27:14 +08:00
<div class="layui-col-lg2">
<label class="layui-form-label">参考人员</label>
2021-05-15 15:36:33 +08:00
<div class="layui-input-block">
2021-06-19 18:27:14 +08:00
<input type="text" readonly class="layui-input" value="{{classPlan.applyCount}}人" placeholder="" lay-verify="required">
2021-05-15 15:36:33 +08:00
</div>
</div>
</div>
{{# } }}
</script>
<div class="layui-input-block layui-form" id="distributionFieldsBox" lay-filter="distributionFieldsBox" pane="" style="margin-left: 0px !important;" ></div>
<script id="distributionFieldsBoxTemplate" type="text/html">
{{# if(d.length == 0) { }}
<div class="layui-form-item" style="text-align: center;width:100% !important;font-size: 17px">
<b>暂无考试机构可以分配</b>
</div>
{{# } }}
{{# if(d.length > 0) { }}
<div class="layui-form-item" style="text-align: center;width:100% !important;font-size: 17px">
<b>考试考场分配</b>
2021-05-02 18:23:26 +08:00
</div>
2021-05-15 15:36:33 +08:00
{{# } }}
{{# for(var j = 0, station; station = d[j++];) { }}
<div class="layui-form-item" pane="">
<label class="layui-form-label">{{ station.stationName }}</label>
<div class="layui-input-block">
{{# for(var i = 0, item; item = station.fieldArray[i++];) { }}
<input type="checkbox" name="distributionFields[{{item.organizationId}}]" value="{{item.organizationId}}" title="{{item.organizationName}}【 {{item.organizationDesc == 1 ? '理论考场' : item.organizationDesc == 2 ? '实操考场' : '混合考场'}}】(可容纳{{item.organizationUserNum}}人)" lay-verify="required">
{{# } }}
</div>
</div>
{{# } }}
</script>
<div class="layui-form-item layui-row ">
<!-- <div class="layui-col-lg2" >-->
<!-- <label class="layui-form-label">考试总人数</label>-->
<!-- <div class="layui-input-block">-->
<!-- <input type="text" readonly id="distributionNumber" name="distributionNumber" class="layui-input" value="" placeholder="请输入考试总人数" lay-verify="required">-->
<!-- </div>-->
<!-- </div>-->
<div class="layui-col-lg6" >
<label class="layui-form-label">考试开始<span style="color:red">*</span></label>
<div class="layui-input-block">
<input type="text" id="distributionAllotTime" readonly name="distributionAllotTime" style="cursor:pointer;" class="layui-input" value="" placeholder="请输入考试开始时间" maxlength="25" lay-verify="required">
</div>
2021-05-05 13:11:10 +08:00
</div>
2021-05-15 15:36:33 +08:00
<div class="layui-col-lg6" >
<label class="layui-form-label">考试结束<span style="color:red">*</span></label>
<div class="layui-input-block">
<input type="text" id="distributionAllotEndTime" readonly name="distributionAllotEndTime" style="cursor:pointer;" class="layui-input" value="" placeholder="请输入考试结束时间" maxlength="25" lay-verify="required">
</div>
2021-05-02 18:23:26 +08:00
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">备注信息</label>
<div class="layui-input-block">
<textarea id="distributionRemark" name="distributionRemark" class="layui-textarea" placeholder="请输入备注信息"></textarea>
</div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
2021-05-15 19:11:09 +08:00
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">审核确认分配</button>
2021-05-02 18:23:26 +08:00
<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;
2021-05-15 15:36:33 +08:00
var planId = top.restAjax.params(window.location.href).planId;
2021-05-02 18:23:26 +08:00
var wangEditor = window.wangEditor;
var wangEditorObj = {};
var viewerObj = {};
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
2021-05-15 15:36:33 +08:00
var stationArray;
var classPlanArray;
// 初始化开班计划
function initDistributionClassPlans() {
classPlanArray = new Array();
2021-06-19 18:27:14 +08:00
var planIdArray = planId.split(",");
// 批量分配
for(var i = 0 ; i < planIdArray.length; i++) {
$.ajax({
// url:'api/examplan/list?examPlanIdList=' + planId,
url:'api/classplan/get/' + planIdArray[i],
async:false,
type:'get',
dataType:'json',
success: function (data) {
2021-05-15 20:06:50 +08:00
$.ajax({
2021-06-19 18:27:14 +08:00
url: 'api/applystudents/list-by-classid/' + planIdArray[i],
2021-05-15 20:06:50 +08:00
async: false,
type: 'get',
dataType: 'json',
success: function (userData) {
2021-06-19 18:27:14 +08:00
data.applyCount = userData.length;
2021-05-15 20:06:50 +08:00
}
});
2021-06-19 18:27:14 +08:00
classPlanArray.push(data);
2021-05-15 20:06:50 +08:00
}
2021-06-19 18:27:14 +08:00
});
}
laytpl(document.getElementById('distributionClassPlansBoxTemplate').innerHTML).render(classPlanArray, function (html) {
console.log(classPlanArray);
document.getElementById('distributionClassPlansBox').innerHTML = html;
2021-05-15 15:36:33 +08:00
});
2021-06-19 18:27:14 +08:00
form.render('checkbox', 'distributionClassPlansBox');
2021-05-15 15:36:33 +08:00
}
2021-05-02 18:23:26 +08:00
// 初始化考场
2021-05-15 15:36:33 +08:00
function initDistributionFields() {
stationArray = new Array();
2021-05-15 20:06:50 +08:00
$.ajax({
url:'api/institution/list?institutionType=考点信息',
async:false,
type:'get',
dataType:'json',
success: function (data) {
for (var i = 0; i < data.length; i++) {
$.ajax({
url: 'api/organization/list?organizationType=' + data[i].institutionId,
async: false,
type: 'get',
dataType: 'json',
success: function (orgData) {
var stationData = {stationName: data[i].institutionName, fieldArray: orgData};
stationArray.push(stationData);
}
});
}
laytpl(document.getElementById('distributionFieldsBoxTemplate').innerHTML).render(stationArray, function (html) {
console.log(stationArray);
document.getElementById('distributionFieldsBox').innerHTML = html;
2021-05-15 15:36:33 +08:00
});
2021-05-15 20:06:50 +08:00
form.render('checkbox', 'distributionFieldsBox');
2021-05-15 15:36:33 +08:00
}
2021-05-02 18:23:26 +08:00
});
}
2021-05-15 20:06:50 +08:00
// var stationArray;
// var classPlanArray;
// var dataLength = 0;
// var planLength = 0;
//
// // 初始化开班计划
// function initDistributionClassPlans() {
// classPlanArray = new Array();
// top.restAjax.get(top.restAjax.path('api/classplan/list?classPlanIdListIds={classPlanIds}', [ planId ]), {}, null, function (code, data, args) {
// planLength = data.length;
// for (var i = 0; i < data.length; i++) {
// var planData = {index: i, data: data[i]};
// top.restAjax.get(top.restAjax.path('api/applystudents/list-by-classid/{planId}', [ data[i].classPlanId ]), {}, planData, function (code, userData, args) {
// var user = args.data;
// user.applyCount = userData.length;
// classPlanArray.push(user);
// if (args.index == planLength - 1) {
// laytpl(document.getElementById('distributionClassPlansBoxTemplate').innerHTML).render(classPlanArray, function (html) {
// console.log(classPlanArray);
// document.getElementById('distributionClassPlansBox').innerHTML = html;
// });
// form.render('checkbox', 'distributionClassPlansBox');
// }
// }, function (code, data) {
// top.dialog.msg(data.msg);
// });
// }
// }, function (code, data) {
// top.dialog.msg(data.msg);
// });
// }
//
// // 初始化考场
// function initDistributionFields() {
// stationArray = new Array();
// top.restAjax.get(top.restAjax.path('api/institution/list?institutionType=考点信息', []), {}, null, function(code, data, args) {
// dataLength = data.length;
// for(var i = 0 ; i < data.length ; i++) {
// var institutionData = {index:i, data:data[i]};
// top.restAjax.get(top.restAjax.path('api/organization/list?organizationType={organizationType}', [data[i].institutionId]), {}, institutionData, function(code, orgData, args) {
// var stationData = {stationName:args.data.institutionName, fieldArray:orgData};
// stationArray.push(stationData);
// if(args.index == dataLength - 1) {
// laytpl(document.getElementById('distributionFieldsBoxTemplate').innerHTML).render(stationArray, function(html) {
// console.log(stationArray);
// document.getElementById('distributionFieldsBox').innerHTML = html;
// });
// form.render('checkbox', 'distributionFieldsBox');
// }
// }, function(code, data) {
// top.dialog.msg(data.msg);
// });
// }
// }, function(code, data) {
// top.dialog.msg(data.msg);
// });
// }
2021-05-02 18:23:26 +08:00
// 初始化成立日期时间戳
function initDistributionAllotTime() {
laydate.render({
elem: '#distributionAllotTime',
type: 'datetime',
2021-05-12 14:07:02 +08:00
min:1,
2021-05-02 18:23:26 +08:00
trigger: 'click'
2021-05-05 13:11:10 +08:00
});
}
// 初始化成立日期时间戳
2021-05-05 14:40:03 +08:00
function initDistributionAllotEndTime() {
2021-05-05 13:11:10 +08:00
laydate.render({
elem: '#distributionAllotEndTime',
type: 'datetime',
2021-05-12 14:07:02 +08:00
min:1,
2021-05-05 13:11:10 +08:00
trigger: 'click'
2021-05-02 18:23:26 +08:00
});
}
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 initData() {
2021-05-15 15:36:33 +08:00
// form.val('dataForm', dataFormData);
// form.render(null, 'dataForm');
initDistributionClassPlans();
initDistributionAllotTime();
initDistributionFields();
initDistributionAllotEndTime();
2021-05-02 18:23:26 +08:00
}
initData();
// 提交表单
form.on('submit(submitForm)', function(formData) {
top.layer.msg("分配后不可修改,是否确定提交", {
time: 0,
btnAlign: 'c',
btn: ['确定', '取消'],
shade: 0.3,
yes: function (index) {
top.dialog.close(index);
var loadLayerIndex;
formData.field['distributionFields'] = top.restAjax.checkBoxToString(formData.field, 'distributionFields');
2021-05-15 15:36:33 +08:00
formData.field['planId'] = planId;
2021-05-02 18:23:26 +08:00
formData.field.distributionStatus = "1";
2021-05-15 15:36:33 +08:00
top.restAjax.put(top.restAjax.path('api/distribution/update/{distributionId}', [planId]), formData.field, null, function(code, data) {
2021-05-02 18:23:26 +08:00
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);
});
},
btn1: function () {
}
});
});
$('.close').on('click', function() {
closeBox();
});
// 校验
form.verify({
});
});
</script>
</body>
</html>