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.

577 lines
21 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="../../../component/ztree/zTreeStyle.css">
<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-row layui-col-space10">
<div class="layui-col-md2">
<div class="layui-card">
<div class="layui-card-body" id="cardBody">
<div class='ztree' id='mytree'></div>
</div>
</div>
</div>
<div class="layui-col-md10">
<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: 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>
</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>
{{# if(d.resetLogin == 1){ }}
<i class="woo-tool-text-delimiter"></i>
<span class="woo-tool-span woo-tool-text-span" lay-event="updateLoginName"><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="../../../admin/js/jquery-3.6.0.min.js"></script>
<script src="../../../component/ztree/jquery.ztree.core-3.5.min.js"></script>
<script src="../../../component/ztree/jquery.ztree.exedit-3.5.min.js"></script>
<script src="../../../component/pear/resize.js"></script>
<script>
layui.use(['table', 'form', 'jquery', 'common', 'dropdown', 'upload'], function () {
var table = layui.table;
var form = layui.form;
var $ = layui.jquery;
var common = layui.common;
var dropdown = layui.dropdown;
var upload = layui.upload;
// $("#cardBody").height($(window).height() - 47);
var zTreeObj;
var bureauId = "";
var orgId = "";
var loginPersonInfo = getPersonLoginInfo($);
if (loginPersonInfo.identity_id == "4") {
bureauId = loginPersonInfo.bureau_id;
orgId = bureauId;
} else {
bureauId = GetQueryString("bureau_id");
orgId = bureauId;
}
var ztreeSetting = {
view: {
selectedMulti: false
},
data: {
simpleData: {
enable: true,
idKey: "org_id",
pIdKey: "parent_id",
rootPId: 0
},
key: {
name: "org_name"
}
},
callback: {
onClick: zTreeOnClick,
}
};
loadZtree();
function loadZtree() {
$.ajax({
type: "GET",
async: false,
url: '/QingLong/organization/getOrgTreeByBureauId?bureau_id=' + orgId,
dataType: "json",
success: function (data) {
if (data.code == 0) {
zTreeObj = $.fn.zTree.init($("#mytree"), ztreeSetting, data.data);
zTreeObj.expandAll(true);
// //展开根节点
// var rootNode = zTreeObj.getNodeByParam("level", 0);
// zTreeObj.expandNode(rootNode, true, false, true);
}
}
});
}
tableRender();
function tableRender() {
table.render({
elem: '#data-table',
url: '/QingLong/teacher/getTeacherListByOrgId',
where: {
org_id: orgId,
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', type: 'numbers', width: "5%" },
{ title: '教师姓名', field: 'person_name', align: 'center', width: "15%" },
{ title: '性别', field: 'xb_name', align: 'center', width: "5%" },
{ title: '登录名', field: 'login_name', align: 'center', width: "20%" },
{ title: '初始密码', field: 'original_pwd', align: 'center', width: "15%" },
{ title: '操作', toolbar: '#table-bar', align: 'center', width: "35%" }
]],
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 = '女';
}
res.data[i].resetLogin = 0;
if(loginPersonInfo.identity_id == "1"){
res.data[i].resetLogin = 1;
}
}
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: 'changeOrg',
title: '调整部门'
}, {
id: 'downTemplate',
title: '下载导入模板'
}, {
id: 'importExcel',
title: '导入Excel'
}, {
id: 'exportAccess',
title: '导出全部账号'
}],
// 菜单被点击的事件
click: function (obj) {
switch (obj.id) {
case 'changeOrg':
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: '调整部门',
shade: 0.1,
area: ['300px', '500px'],
content: './tree1.html?ids=' + personIdsStr + '&bureau_id=' + bureauId
});
} else {
layer.msg("请选择要调整部门的人员!", {
icon: 2,
time: 1500
});
return;
}
break;
case 'downTemplate':
window.location.href = '/QingLong/teacher/getImportTemplate';
break;
case 'importExcel':
layer.open({
type: 2,
title: '导入Excel',
shade: 0.1,
area: ['550px', '240px'],
content: './import.html?bureau_id=' + bureauId + '&identity=1'
});
break;
case 'exportAccess':
window.location.href = "/QingLong/teacher/getTeacherListByBureauIdForExcel?bureau_id=" + bureauId;
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 === 'updateLoginName') {
window.updateLoginName(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 === 'refresh') {
window.refresh();
} else if (obj.event === 'batchRemove') {
window.batchRemove(obj);
}
});
window.add = function () {
layer.open({
type: 2,
title: '新增',
offset: 'r',
anim: 'slideLeft',
area: ['650px', '100%'],
shade: 0.1,
shadeClose: true,
content: './add.html?bureau_id=' + bureauId + '&org_id=' + orgId
});
}
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 + '&bureau_id=' + bureauId + '&org_id=' + orgId
});
}
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.updateLoginName = function (obj) {
layer.open({
type: 2,
title: '修改登录名',
shade: 0.1,
area: ['650px', '175px'],
content: './updateLN.html?oldLoginName=' + obj.data.login_name
});
}
//调转申请
window.turnApplyFor = function (obj) {
$.ajax({
type: "GET",
async: false,
url: '/QingLong/teacherYd/getPersonStatus?person_id=' + obj.data.person_id,
dataType: "json",
success: function (res) {
if (res.success) {
var loginPersonInfo = getPersonLoginInfo($);
var contentUrl = "";
if (loginPersonInfo.identity_id == "1") {
contentUrl = './turn_sys.html?person_id=' + obj.data.person_id;
} else {
contentUrl = './turn.html?person_id=' + obj.data.person_id;
}
layer.open({
type: 2,
title: '调转申请',
offset: 'r',
anim: 'slideLeft',
area: ['690px', '100%'],
shade: 0.1,
shadeClose: true,
content: contentUrl,
end: function () {
table.reload("data-table");
}
});
} else {
layer.msg(res.message, {
icon: 2,
time: 2500
});
return;
}
}
});
}
//异动处理
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
});
}
window.remove = function (obj) {
layer.confirm('确定要删除该人员吗?', {
icon: 3,
title: '提示'
}, function (index) {
layer.close(index);
let loading = layer.load();
$.ajax({
url: "/QingLong/teacher/deleteTeacher",
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/teacher/deleteTeacher",
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
});
}
}
});
});
}
function zTreeOnClick(event, treeId, treeNode) {
orgId = treeNode.org_id;
tableRender();
}
form.on('input-affix(clear)', function (data) {
tableRender();
});
form.on('submit(user-query)', function () {
tableRender();
// 阻止表单的默认提交行为
return false;
});
window.refresh = function (param) {
loadZtree();
table.reload('data-table');
}
window.ztreeRefresh = function () {
}
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>