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.
593 lines
19 KiB
593 lines
19 KiB
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title></title>
|
|
<link rel="stylesheet" href="../../../component/pear/css/pear.css" />
|
|
<style>
|
|
.woo-tool-text-delimiter {
|
|
width: 1px;
|
|
height: 12px;
|
|
background: #EEEEEE;
|
|
display: inline-block;
|
|
margin: 0 6px 0 4px;
|
|
}
|
|
|
|
.woo-theme-color {
|
|
color: #1e9fff !important;
|
|
}
|
|
|
|
.woo-tool-span {
|
|
margin: 0 3px;
|
|
position: relative;
|
|
top: -1px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.layui-card-body .layui-form {
|
|
margin-top: 0 !important;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body class="pear-container layui-form">
|
|
|
|
<div class="layui-card" style="margin-bottom: 10px !important;">
|
|
<div class="layui-card-body">
|
|
<div class="layui-form-item" style="margin: 10px 0 5px 0 !important;">
|
|
<div class="layui-form-item layui-inline">
|
|
<label class="layui-form-label" style="width: 45px;">学部</label>
|
|
<div class="layui-input-inline" id="xbView"></div>
|
|
<script id="xbScript" type="text/html">
|
|
<select id="xb" lay-filter="xb">
|
|
{{# layui.each(d, function(index, item){ }}
|
|
<option value="{{item.stage_id}}">{{item.stage_name}}</option>
|
|
{{# }); }}
|
|
</select>
|
|
</script>
|
|
</div>
|
|
<div class="layui-form-item layui-inline">
|
|
<label class="layui-form-label">入学年份</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 layui-inline">
|
|
<label class="layui-form-label" style="width: 45px;">班级</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 class="layui-form-item layui-inline">
|
|
<label class="layui-form-label" style="width: 65px;">学生姓名</label>
|
|
<div class="layui-input-inline">
|
|
<input type="text" id="personName" lay-affix="clear" lay-filter="clear" placeholder="请输入学生姓名"
|
|
class="layui-input">
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item layui-inline">
|
|
<button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="user-query">
|
|
<i class="layui-icon layui-icon-search"></i>
|
|
查询
|
|
</button>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="layui-card">
|
|
<div class="layui-card-body">
|
|
<table id="data-table"></table>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/html" id="table-toolbar">
|
|
|
|
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
|
|
<i class="layui-icon layui-icon-add-1"></i>
|
|
新增
|
|
</button>
|
|
|
|
<button class="pear-btn pear-btn-danger pear-btn-md" lay-event="batchRemove">
|
|
<i class="layui-icon layui-icon-delete"></i>
|
|
删除
|
|
</button>
|
|
<button class="pear-btn pear-btn-success pear-btn-md" id="dropdownButton" style="background-color: #1e9fff !important;">
|
|
更多功能
|
|
<i class="layui-icon layui-icon-down layui-font-12"></i>
|
|
</button>
|
|
</script>
|
|
|
|
<script type="text/html" id="table-bar">
|
|
<span class="woo-tool-span woo-tool-text-span" lay-event="edit"><a
|
|
class="woo-theme-color">编辑</a></span>
|
|
|
|
<i class="woo-tool-text-delimiter"></i>
|
|
<span class="woo-tool-span woo-tool-text-span" lay-event="remove"><a
|
|
class="woo-theme-color">删除</a></span>
|
|
|
|
<i class="woo-tool-text-delimiter"></i>
|
|
<span class="woo-tool-span woo-tool-text-span" lay-event="restPwd"><a
|
|
class="woo-theme-color">重置密码</a></span>
|
|
|
|
<i class="woo-tool-text-delimiter"></i>
|
|
<span class="woo-tool-span woo-tool-text-span" lay-event="turnApplyFor"><a
|
|
class="woo-theme-color">调转申请</a></span>
|
|
|
|
<i class="woo-tool-text-delimiter"></i>
|
|
<span class="woo-tool-span woo-tool-text-span" lay-event="statusMgmt"><a
|
|
class="woo-theme-color">异动处理</a></span>
|
|
</script>
|
|
|
|
<script src="../../../component/layui/layui.js"></script>
|
|
<script src="../../../component/pear/pear.js"></script>
|
|
<script src="../../../component/pear/base64.js"></script>
|
|
|
|
<script>
|
|
layui.use(['table', 'form', 'jquery', 'common', 'dtree', 'laytpl', 'dropdown'], function () {
|
|
var table = layui.table;
|
|
var form = layui.form;
|
|
var $ = layui.jquery;
|
|
var common = layui.common;
|
|
var dtree = layui.dtree;
|
|
var laytpl = layui.laytpl;
|
|
var dropdown = layui.dropdown;
|
|
|
|
var bureauId = "";
|
|
|
|
var loginPersonInfo = getPersonLoginInfo($);
|
|
if (loginPersonInfo.identity_id == "4") {
|
|
bureauId = loginPersonInfo.bureau_id;
|
|
} else {
|
|
bureauId = GetQueryString('bureau_id');
|
|
}
|
|
|
|
//学部
|
|
$.ajax({
|
|
type: "GET",
|
|
async: false,
|
|
url: "/QingLong/class/getStageList?bureau_id=" + bureauId,
|
|
success: function (res) {
|
|
var xbTpl = xbScript.innerHTML;
|
|
var xbView = document.getElementById('xbView');
|
|
laytpl(xbTpl).render(res.list, function (html) {
|
|
xbView.innerHTML = html;
|
|
});
|
|
form.render();
|
|
getEntryYear();
|
|
tableRender();
|
|
}
|
|
});
|
|
|
|
|
|
//获取入学年份
|
|
function getEntryYear() {
|
|
var id = $("#xb").val();
|
|
var len = "";
|
|
if (id == 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();
|
|
|
|
$("#year").val(year);
|
|
|
|
getClass();
|
|
|
|
}
|
|
|
|
//获取班级
|
|
function getClass() {
|
|
//学部
|
|
$.ajax({
|
|
type: "GET",
|
|
async: false,
|
|
url: '/QingLong/class/getClassList?bureau_id=' + bureauId + '&stage_id=' + $("#xb").val() + '&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(xb)', function (data) {
|
|
getEntryYear();
|
|
tableRender();
|
|
});
|
|
|
|
form.on('select(year)', function (data) {
|
|
getClass();
|
|
tableRender();
|
|
});
|
|
|
|
form.on('select(class)', function (data) {
|
|
tableRender();
|
|
});
|
|
|
|
form.on('submit(user-query)', function () {
|
|
tableRender();
|
|
|
|
// 阻止表单的默认提交行为
|
|
return false;
|
|
});
|
|
|
|
form.on('input-affix(clear)', function (data) {
|
|
tableRender();
|
|
});
|
|
|
|
function tableRender() {
|
|
table.render({
|
|
elem: '#data-table',
|
|
url: '/QingLong/student/getStudentList',
|
|
where: {
|
|
class_id: $("#class").val(),
|
|
person_name: $("#personName").val()
|
|
},
|
|
height: 'full-135',
|
|
page: {
|
|
limit: 15
|
|
, layout: ['count', 'prev', 'page', 'next', 'skip']
|
|
, prev: "上一页"
|
|
, next: "下一页"
|
|
},
|
|
cols: [[
|
|
{ type: 'checkbox', width: "5%" },
|
|
{ title: '序号', align: 'center', width: "5%", type: 'numbers' },
|
|
{ title: '学生姓名', field: 'person_name', align: 'center' },
|
|
{ title: '性别', field: 'xb_name', align: 'center', width: "5%" },
|
|
{ title: '登录名', field: 'login_name', align: 'center', width: "15%" },
|
|
{ title: '初始密码', field: 'original_pwd', align: 'center', width: "15%" },
|
|
{ title: '操作', toolbar: '#table-bar', align: 'center', width: "25%" }
|
|
]],
|
|
parseData: function (res) {
|
|
var array = res.data;
|
|
for (var i = 0; i < array.length; i++) {
|
|
if (array[i].xb == 1) {
|
|
res.data[i].xb_name = '男';
|
|
} else {
|
|
res.data[i].xb_name = '女';
|
|
}
|
|
}
|
|
return res;
|
|
},
|
|
skin: 'line',
|
|
toolbar: '#table-toolbar',
|
|
defaultToolbar: [{
|
|
title: '刷新',
|
|
layEvent: 'refresh',
|
|
icon: 'layui-icon-refresh',
|
|
}, 'filter', 'print', 'exports'],
|
|
done: function () {
|
|
var id = this.id;
|
|
dropdown.render({
|
|
elem: '#dropdownButton',
|
|
data: [{
|
|
id: 'changeClass',
|
|
title: '调整班级'
|
|
}, {
|
|
id: 'downTemplate',
|
|
title: '下载导入模板'
|
|
}, {
|
|
id: 'importExcel',
|
|
title: '导入Excel'
|
|
}, {
|
|
id: 'exportAccess',
|
|
title: '导出全部账号'
|
|
}],
|
|
// 菜单被点击的事件
|
|
click: function (obj) {
|
|
switch (obj.id) {
|
|
case 'changeClass':
|
|
var checkStatus = table.checkStatus(id)
|
|
var checkObj = checkStatus.data;
|
|
if (checkObj.length > 0) {
|
|
var personIds = checkObj.map(item => item.person_id);
|
|
var personIdsStr = personIds.join(",");
|
|
layer.open({
|
|
type: 2,
|
|
title: '调整班级',
|
|
offset: 'r',
|
|
anim: 'slideLeft',
|
|
area: ['500px', '100%'],
|
|
shade: 0.1,
|
|
shadeClose: true,
|
|
content: './changeClass.html?person_ids=' + personIdsStr + '&bureau_id=' + bureauId + '&stage_id=' + $("#xb").val()
|
|
});
|
|
|
|
} else {
|
|
layer.msg("请选择要调整班级的学生!", {
|
|
icon: 2,
|
|
time: 1800
|
|
});
|
|
return;
|
|
}
|
|
|
|
break;
|
|
case 'downTemplate':
|
|
window.location.href = '/QingLong/student/getImportTemplate?school_id=' + bureauId;
|
|
break;
|
|
case 'importExcel':
|
|
layer.open({
|
|
type: 2,
|
|
title: '导入Excel',
|
|
shade: 0.1,
|
|
area: ['510px', '240px'],
|
|
content: './import.html?bureau_id=' + bureauId + '&identity=1'
|
|
});
|
|
break;
|
|
case 'exportAccess':
|
|
window.location.href = "/QingLong/student/exportStudentInfo?class_id=" + $("#class").val();
|
|
break;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
table.on('tool(data-table)', function (obj) {
|
|
if (obj.event === 'remove') {
|
|
window.remove(obj);
|
|
} else if (obj.event === 'edit') {
|
|
window.edit(obj);
|
|
} else if (obj.event === 'restPwd') {
|
|
window.restPwd(obj);
|
|
} else if (obj.event === 'turnApplyFor') {
|
|
window.turnApplyFor(obj);
|
|
} else if (obj.event === 'statusMgmt') {
|
|
window.statusMgmt(obj);
|
|
}
|
|
});
|
|
|
|
table.on('toolbar(data-table)', function (obj) {
|
|
if (obj.event === 'add') {
|
|
window.add();
|
|
} else if (obj.event === 'batchRemove') {
|
|
window.batchRemove(obj);
|
|
} else if (obj.event === 'refresh') {
|
|
window.refresh();
|
|
}
|
|
});
|
|
|
|
window.add = function () {
|
|
if ($("#class").val() == "-1") {
|
|
layer.msg("请先维护班级,再新增学生!", {
|
|
icon: 2,
|
|
time: 1800
|
|
});
|
|
} else {
|
|
layer.open({
|
|
type: 2,
|
|
title: '新增',
|
|
offset: 'r',
|
|
anim: 'slideLeft',
|
|
area: ['650px', '100%'],
|
|
shade: 0.1,
|
|
shadeClose: true,
|
|
content: './add.html?class_id=' + $("#class").val()
|
|
});
|
|
}
|
|
}
|
|
|
|
window.edit = function (obj) {
|
|
layer.open({
|
|
type: 2,
|
|
title: '编辑',
|
|
offset: 'r',
|
|
anim: 'slideLeft',
|
|
area: ['650px', '100%'],
|
|
shade: 0.1,
|
|
shadeClose: true,
|
|
content: './update.html?person_id=' + obj.data.person_id
|
|
});
|
|
}
|
|
|
|
//重置密码
|
|
window.restPwd = function (obj) {
|
|
layer.confirm('确定要重置密码吗?', {
|
|
icon: 3,
|
|
title: '提示'
|
|
}, function (index) {
|
|
layer.close(index);
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
dataType: "json",
|
|
url: "/QingLong/loginPerson/ResetPwd",
|
|
data: {
|
|
person_id: obj.data['person_id']
|
|
},
|
|
success: function (data) {
|
|
if (data.success) {
|
|
layer.msg('重置密码成功!', {
|
|
icon: 1,
|
|
time: 1000
|
|
}, function () {
|
|
table.reload('data-table');
|
|
});
|
|
} else {
|
|
layer.msg(result.message, {
|
|
icon: 2,
|
|
time: 1000
|
|
});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
//调转申请
|
|
window.turnApplyFor = function (obj) {
|
|
layer.open({
|
|
type: 2,
|
|
title: '调转申请',
|
|
offset: 'r',
|
|
anim: 'slideLeft',
|
|
area: ['690px', '100%'],
|
|
shade: 0.1,
|
|
shadeClose: true,
|
|
content: './turn.html?person_id=' + obj.data.person_id,
|
|
end: function () {
|
|
table.reload("data-table");
|
|
}
|
|
});
|
|
}
|
|
|
|
//异动处理
|
|
window.statusMgmt = function (obj) {
|
|
layer.open({
|
|
type: 2,
|
|
title: '异动处理',
|
|
offset: 'r',
|
|
anim: 'slideLeft',
|
|
area: ['500px', '100%'],
|
|
shade: 0.1,
|
|
shadeClose: true,
|
|
content: './status.html?person_id=' + obj.data.person_id + '&stu=1'
|
|
});
|
|
}
|
|
|
|
window.remove = function (obj) {
|
|
layer.confirm('确定要删除该学生吗?', {
|
|
icon: 3,
|
|
title: '提示'
|
|
}, function (index) {
|
|
layer.close(index);
|
|
let loading = layer.load();
|
|
$.ajax({
|
|
url: "/QingLong/student/deleteStudent",
|
|
data: { person_ids: obj.data.person_id },
|
|
type: 'post',
|
|
success: function (result) {
|
|
layer.close(loading);
|
|
if (result.success) {
|
|
layer.msg('成功删除!', {
|
|
icon: 1,
|
|
time: 1000
|
|
}, function () {
|
|
table.reload('data-table');
|
|
});
|
|
} else {
|
|
layer.msg(result.message, {
|
|
icon: 2,
|
|
time: 1000
|
|
});
|
|
}
|
|
},
|
|
error: function (xhr, status, error) {
|
|
layer.close(loading);
|
|
console.log('请求出错:' + error + ',' + status);
|
|
}
|
|
})
|
|
});
|
|
}
|
|
|
|
window.batchRemove = function (obj) {
|
|
var personIds = common.checkField(obj, 'person_id');
|
|
if (personIds === "") {
|
|
layer.msg("请选择要删除的学生!", {
|
|
icon: 2,
|
|
time: 1500
|
|
});
|
|
return false;
|
|
}
|
|
layer.confirm('确定要删除选择的学生吗?', {
|
|
icon: 3,
|
|
title: '提示'
|
|
}, function (index) {
|
|
layer.close(index);
|
|
let loading = layer.load();
|
|
$.ajax({
|
|
url: "/QingLong/student/deleteStudent",
|
|
data: { person_ids: personIds },
|
|
type: 'post',
|
|
success: function (result) {
|
|
layer.close(loading);
|
|
if (result.success) {
|
|
layer.msg('成功删除!', {
|
|
icon: 1,
|
|
time: 1000
|
|
}, function () {
|
|
table.reload('data-table');
|
|
});
|
|
} else {
|
|
layer.msg(result.message, {
|
|
icon: 2,
|
|
time: 1000
|
|
});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
window.refresh = function (param) {
|
|
table.reload('data-table');
|
|
}
|
|
|
|
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> |