You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

290 lines
11 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>批次维护</title>
<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="../../static/css/font.css">
<link rel="stylesheet" href="../../static/css/weadmin.css">
<link rel="stylesheet" href="../../lib/ztree/zTreeStyle.css">
<!-- 让IE8/9支持媒体查询从而兼容栅格 -->
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
select {
width: 180px;
height: 38px;
line-height: 38px;
border: 1px solid #ccc;
border-radius: 3px;
font-size: 15px;
padding-left: 6px;
color: #666;
}
.inline {
display: inline-block;
vertical-align: top;
}
.disabled {
pointer-events: none;
border: 1px solid #e6e6e6;
background: #FBFBFB;
color: #C9C9C9;
cursor: not-allowed;
opacity: 1;
}
.searchTxt {
width: 194px;
border: 1px solid #dedede;
border-radius: 3px;
height: 37px;
padding-left: 13px;
vertical-align: top;
}
.search {
border: none;
margin-left: 12px;
}
.iconDel {
position: absolute;
right: 92px;
top: 10px;
display: none;
}
.aaa {
background-color: #FBFBFB;
border: 1px solid #e6e6e6;
color: #C9C9C9;
cursor: not-allowed;
opacity: 1;
}
</style>
</head>
<body>
<form class="layui-form">
<div class="weadmin-body">
<div class="layui-form-item">
<label for="" class="layui-form-label" style="padding:9px 0;text-align: left;width:80px">
批次名称
</label>
<input type="text" id="searchTxt" value="" class="searchTxt" placeholder="请输入批次名称">
</div>
<div class="layui-form-item">
<label for="" class="layui-form-label" style="padding:9px 0;text-align: left;width:80px">
考试时间
</label>
<input type="text" id="kaoshiTxt" value="" class="searchTxt" placeholder="请输入考试时间">
</div>
<div class="layui-form-item">
<label for="" class="layui-form-label" style="padding:9px 0;text-align: left;width:80px">
报到时间
</label>
<input type="text" id="baodaoTxt" value="" class="searchTxt" placeholder="请输入报到时间">
</div>
<div class="layui-form-item">
<label class="layui-form-label" style="padding:9px 0;text-align: left;width:80px">
学生类别
</label>
<div class="layui-input-block" id="view">
</div>
<script type="text/html" id="test1">
{{# layui.each(d.data, function(index,item){ }}
<input type="checkbox" name="person_type" lay-skin="primary" title={{item.person_type_name}}
value={{item.person_type_id}} lay-filter="oneChoose" class="checkboxOne">
{{# }); }}
</script>
</div>
<div class="layui-form-item" align="center">
<buttin class="layui-btn" id="save">保存</buttin>
</div>
</div>
<script src="../../lib/layui/layui.js"></script>
<script src="../../lib/template.js"></script>
<script src="../../lib/base64.js"></script>
<script>
//获取url传参的办法
window.GetQueryString = function (name, istop) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (typeof (istop) != "undefined") r = top.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
};
layui.extend({
admin: '{/}../../static/js/admin'
});
layui.use(['form', 'jquery', 'admin', 'table', 'laytpl'], function () {
var form = layui.form,
$ = layui.jquery,
admin = layui.admin,
laytpl = layui.laytpl;
//是增加还是修改?
var batch_id = GetQueryString("batch_id");
var type_id = 0;
if (batch_id == null) {
type_id = 1;
} else {
type_id = 2;
}
var zhaosheng_type = GetQueryString("zhaosheng_type");
var url;
if (batch_id != null) {
url = '/baseService/xueji/common_batchWaitSelectPersonType?batch_id=' + batch_id;
} else {
url = '/baseService/xueji/common_batchWaitSelectPersonType?zhaosheng_type=' + zhaosheng_type;
}
//绑定可选择的人群
$.ajax({
type: 'GET',
dataType: 'json',
async: false,
url: url,
success: function (data) {
var getTpl = document.getElementById('test1').innerHTML;
var view = document.getElementById('view');
laytpl(getTpl).render(data, function (html) {
view.innerHTML = html;
form.render();
});
}
});
//提取已有数据
if (type_id == 2) {
$.ajax({
type: "GET",
dataType: "json",
async: false,
url: "/baseService/xueji/common_getBatchInfoById?batch_id=" + batch_id,
success: function (data) {
$("#searchTxt").val(data.batch_name);
$("#kaoshiTxt").val(data.kaoshi_time);
$("#baodaoTxt").val(data.baodao_time);
//哪些学生类别(先取消,后设置)
$(".checkboxOne").removeAttr("checked");
//设置上
var person_type_array = data.person_type;
$(".checkboxOne").each(function () {
for (var i = 0; i < person_type_array.length; i++) {
if (parseInt($(this).val()) === person_type_array[i].person_type_id) {
$(this).prop("checked", true);
break;
}
}
});
form.render('checkbox');
}
});
}
$(document).on('click', '#save', function (data) {
var batch_name = $("#searchTxt").val();
var kaoshi = $("#kaoshiTxt").val();
var baodao = $("#baodaoTxt").val();
var zhaosheng_type = GetQueryString("zhaosheng_type");
//名称是不是为空
if (batch_name == null || batch_name == undefined || batch_name == '') {
layer.msg('批次名称不能为空!', {icon: 2, time: 2000, shade: 0.1});
return;
}
//考试时间是不是为空
if (kaoshi == null || kaoshi == undefined || kaoshi == '') {
//layer.msg('考试时间不能为空!', {icon: 2, time: 2000, shade: 0.1});
//return;
kaoshi="待定";
}
//报到时间是不是为空
if (baodao == null || baodao == undefined || baodao == '') {
// layer.msg('报到时间不能为空!', {icon: 2, time: 2000, shade: 0.1});
// return;
baodao="待定";
}
//选中了哪些学生类别
var person_type = "";
$("input[name='person_type']:checked").each(function (index, item) {
if ($("input[name='person_type']:checked").length - 1 == index) {
person_type += $(this).val();
} else {
person_type += $(this).val() + ",";
}
});
if (person_type === "") {
layer.msg('学生类别至少选择一个!', {icon: 2, time: 2000, shade: 0.1});
return;
}
var data = {};
//增加
var year=GetQueryString("year");
var type_id;
if(year==null)
{
type_id=2
}
else
{
type_id=1
}
if (type_id == 1) {
data = {
"type_id": 1,
"batch_year": year,
"batch_name": batch_name,
"zhaosheng_type": zhaosheng_type,
"kaoshi_time": kaoshi,
"baodao_time": baodao,
"person_type": person_type
};
} else//修改
{
data = {
"type_id": 2,
"batch_id": batch_id,
"batch_name": batch_name,
"zhaosheng_type": zhaosheng_type,
"kaoshi_time": kaoshi,
"baodao_time": baodao,
"person_type": person_type
};
}
//正确
$.ajax({
type: "POST",
dataType: "json",
async: false,
data: data,
url: "/baseService/xueji/common_saveBatchInfo",
success: function (data) {
layer.msg("保存成功", {icon: 1, time: 1000, shade: [0.5, '#000', true]}, function () {
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
parent.layui.table.reload('idTest', {page: {curr: 1}});
});
}
});
});
})
</script>
</form>
</body>
</html>