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.
360 lines
10 KiB
360 lines
10 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: #2d8cf0 !important;
|
|
}
|
|
|
|
.woo-tool-span {
|
|
margin: 0 3px;
|
|
position: relative;
|
|
top: -1px;
|
|
cursor: pointer;
|
|
}
|
|
</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>
|
|
</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>
|
|
</script>
|
|
|
|
<script type="text/html" id="table-bar">
|
|
|
|
<span class="woo-tool-span woo-tool-text-span" data-tool-sort="120" 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" data-tool-sort="120" lay-event="remove"><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'], 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 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;
|
|
});
|
|
|
|
$("#year").val(year);
|
|
|
|
form.render();
|
|
|
|
}
|
|
|
|
|
|
form.on('select(xb)', function (data) {
|
|
getEntryYear();
|
|
tableRender();
|
|
});
|
|
|
|
form.on('select(year)', function (data) {
|
|
tableRender();
|
|
});
|
|
|
|
|
|
|
|
function tableRender() {
|
|
table.render({
|
|
elem: '#data-table',
|
|
url: '/QingLong/class/getClassList',
|
|
where: {
|
|
bureau_id: bureauId,
|
|
stage_id: $("#xb").val(),
|
|
entry_year: $("#year").val()
|
|
},
|
|
height: 'full-150',
|
|
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: 'class_name', align: 'center' },
|
|
{ title: '班级别名', field: 'altas_name', align: 'center', width: "15%" },
|
|
{ title: '入学年份', field: 'entry_year', align: 'center', width: "15%" },
|
|
{ title: '学生总数', field: 'studentcount', align: 'center', width: "10%" },
|
|
{ title: '操作', toolbar: '#table-bar', align: 'center', width: "20%" }
|
|
]],
|
|
parseData: function (res) {
|
|
var array = res.data;
|
|
for (var i = 0; i < array.length; i++) {
|
|
if (array[i].altas_name == "" || array[i].altas_name == null) {
|
|
res.data[i].altas_name = '--';
|
|
}
|
|
}
|
|
return res;
|
|
},
|
|
skin: 'line',
|
|
toolbar: '#table-toolbar',
|
|
defaultToolbar: [{
|
|
title: '刷新',
|
|
layEvent: 'refresh',
|
|
icon: 'layui-icon-refresh',
|
|
}, 'filter', 'print', 'exports']
|
|
});
|
|
}
|
|
|
|
|
|
table.on('tool(data-table)', function (obj) {
|
|
if (obj.event === 'remove') {
|
|
window.remove(obj);
|
|
} else if (obj.event === 'edit') {
|
|
window.edit(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 () {
|
|
layer.open({
|
|
type: 2,
|
|
title: '新增',
|
|
shade: 0.1,
|
|
area: ['650px', '385px'],
|
|
content: './add.html?bureau_id=' + bureauId + '&stage_id=' + $("#xb").val() + '&entry_year=' + $("#year").val()
|
|
});
|
|
}
|
|
|
|
window.edit = function (obj) {
|
|
layer.open({
|
|
type: 2,
|
|
title: '编辑班级别名',
|
|
shade: 0.1,
|
|
area: ['650px', '175px'],
|
|
content: './update.html?class_id=' + obj.data.class_id + '&altas_name=' + obj.data.altas_name
|
|
});
|
|
}
|
|
|
|
window.remove = function (obj) {
|
|
layer.confirm('确定要删除该班级吗?', {
|
|
icon: 3,
|
|
title: '提示'
|
|
}, function (index) {
|
|
layer.close(index);
|
|
let loading = layer.load();
|
|
$.ajax({
|
|
url: "/QingLong/class/deleteClass",
|
|
data: { class_ids: obj.data.class_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 classIds = common.checkField(obj, 'class_id');
|
|
if (classIds === "") {
|
|
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/class/deleteClass",
|
|
data: { class_ids: classIds },
|
|
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> |