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.
209 lines
5.4 KiB
209 lines
5.4 KiB
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title></title>
|
|
<link rel="stylesheet" href="../../../component/pear/css/pear.css" />
|
|
<style>
|
|
.require-star {
|
|
position: absolute;
|
|
width: 3px;
|
|
height: 14px;
|
|
background-color: #ea4335;
|
|
top: 12px;
|
|
right: 8px;
|
|
border-radius: 1.5px;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
|
|
|
|
<form class="layui-form" action="">
|
|
<div class="mainBox">
|
|
<div class="main-container">
|
|
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label" style="width: 100px !important;"><span class="require-star"></span>入学年份</label>
|
|
<div class="layui-input-inline" id="yearView"></div>
|
|
<script id="yearScript" type="text/html">
|
|
<select id="year" lay-filter="year">
|
|
{{# layui.each(d, function(index, item){ }}
|
|
<option value="{{item.id}}">{{item.name}}</option>
|
|
{{# }); }}
|
|
</select>
|
|
</script>
|
|
</div>
|
|
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label" style="width: 100px !important;"><span class="require-star"></span>班级</label>
|
|
<div class="layui-input-inline" id="classView"></div>
|
|
<script id="classScript" type="text/html">
|
|
<select id="class" lay-filter="class">
|
|
{{# layui.each(d.data, function(index, item){ }}
|
|
<option value="{{item.class_id}}">{{item.class_name}}</option>
|
|
{{# }); }}
|
|
{{# if(d.data.length === 0){ }}
|
|
<option value="-1">暂无班级</option>
|
|
{{# } }}</p>
|
|
</select>
|
|
</script>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="bottom">
|
|
<div class="button-container">
|
|
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="save">
|
|
<i class="layui-icon layui-icon-ok"></i>
|
|
提交
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
|
|
|
|
<script src="../../../component/layui/layui.js"></script>
|
|
<script src="../../../component/pear/pear.js"></script>
|
|
<script src="../../../component/pear/base64.js"></script>
|
|
|
|
<script>
|
|
layui.use(['form', 'jquery', 'laytpl'], function () {
|
|
var form = layui.form;
|
|
var $ = layui.jquery;
|
|
var laytpl = layui.laytpl;
|
|
|
|
|
|
var bureauId = GetQueryString("bureau_id");
|
|
var stageId = GetQueryString('stage_id');
|
|
var personIds = GetQueryString('person_ids');
|
|
|
|
|
|
getEntryYear();
|
|
|
|
|
|
//获取入学年份
|
|
function getEntryYear() {
|
|
var len = "";
|
|
if (stageId == 4) {
|
|
len = 5;
|
|
} else {
|
|
len = 2;
|
|
}
|
|
var date = new Date();
|
|
var year = date.getFullYear();
|
|
var data = {};
|
|
var lis = [];
|
|
for (var i = len; i >= 0; i--) {
|
|
lis.push({
|
|
id: year - i,
|
|
name: year - i
|
|
});
|
|
}
|
|
lis.push({
|
|
id: year + 1,
|
|
name: year + 1
|
|
});
|
|
|
|
data = {
|
|
data: lis
|
|
}
|
|
|
|
var yearTpl = yearScript.innerHTML;
|
|
var yearView = document.getElementById('yearView');
|
|
laytpl(yearTpl).render(data.data, function (html) {
|
|
yearView.innerHTML = html;
|
|
});
|
|
|
|
form.render();
|
|
|
|
getClass();
|
|
|
|
}
|
|
|
|
//获取班级
|
|
function getClass() {
|
|
//学部
|
|
$.ajax({
|
|
type: "GET",
|
|
async: false,
|
|
url: '/dsBase/class/getClassList?bureau_id=' + bureauId + '&stage_id=' + stageId + '&entry_year=' + $("#year").val() + '&page=1&limit=9999',
|
|
success: function (res) {
|
|
if (res.data.length > 0) {
|
|
$('#add').prop('disabled', true);
|
|
} else {
|
|
$('#add').prop('disabled', false);
|
|
}
|
|
var classTpl = classScript.innerHTML;
|
|
var classView = document.getElementById('classView');
|
|
laytpl(classTpl).render(res, function (html) {
|
|
classView.innerHTML = html;
|
|
});
|
|
form.render();
|
|
}
|
|
});
|
|
}
|
|
|
|
form.on('select(year)', function (data) {
|
|
getClass();
|
|
});
|
|
|
|
|
|
form.on('submit(save)', function () {
|
|
|
|
if ($("#class").val() == "-1") {
|
|
layer.alert('该入学年份下暂无班级,请先创建班级', { icon: 0 });
|
|
return false;
|
|
} else {
|
|
$.ajax({
|
|
url: '/dsBase/student/changeClass',
|
|
data: {
|
|
class_id: $("#class").val(),
|
|
person_ids: personIds
|
|
},
|
|
type: 'post',
|
|
success: function (result) {
|
|
if (result.success) {
|
|
layer.msg("调整成功!", {
|
|
icon: 1,
|
|
time: 1300
|
|
}, function () {
|
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
|
parent.layui.table.reload("data-table");
|
|
});
|
|
} else {
|
|
layer.msg(result.message, {
|
|
icon: 2,
|
|
time: 2000
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
return false;
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
function GetQueryString(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;
|
|
}
|
|
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html> |