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.

552 lines
24 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">
<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>
.inline {
display: inline-block;
vertical-align: top;
}
.layui-table-body {
/*max-height: 400px;*/
overflow-y: auto;
}
#searchTxt {
width: 180px;
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>
<div class="weadmin-nav">
<span class="layui-breadcrumb" id="super">
<a href="">首页</a>
<a href="">业务管理</a>
<a href="">单位维护</a>
<a>
<cite>职工信息管理</cite></a>
</span>
<span class="layui-breadcrumb" id="other">
<a href="">首页</a>
<a href="">业务管理</a>
<a>
<cite>职工信息管理</cite></a>
</span>
<a class="layui-btn layui-btn-sm" style="line-height:1.6em;margin-top:3px;float:right"
href="javascript:location.replace(location.href);" title="刷新">
<i class="layui-icon layui-icon-refresh-3" style="line-height:30px"></i>
</a>
</div>
<div class="weadmin-body">
<table border=0 align=left width="100%">
<tr>
<td align=left valign=top style="BORDER-RIGHT: #999999 1px dashed;width:170px" id="first_td">
<div class="selectModel" id="treeDiv">
<div class='pc_selectModel_tree'>
<div class='ztree' id='mytree'></div>
</div>
</div>
</td>
<td align=left valign=top style="padding-left:10px">
<form class="layui-form" lay-filter="listForm">
<div class="layui-input-inline" style="float: left;margin:0 0 5px 0">
<input type="text" value="" id="searchTxt" placeholder="请输入职工姓名"><i class="layui-icon"
id="iconDel">×</i>
<buttin class="layui-btn" id="search">搜索</buttin>
</div>
<div style="float:right">
<div class="layui-btn add" onclick="addOrg();" type="button"><i class="layui-icon"></i>添加
</div>
<div class="layui-btn layui-btn-warm switchBtn" data-type="switchDepartMent" type="button">
<span class="layui-icon layui-icon-shrink-right"></span>调整部门
</div>
<div class="layui-btn layui-btn-danger delBtn" data-type="getCheckLength" type="button"><i
class="layui-icon"></i>批量删除
</div>
<div class="layui-btn layui-btn-normal exportBtn" data-type="export" type="button">
<span class="layui-icon layui-icon-download-circle"></span>导出全部账号
</div>
<span id="importAcc" style="display:none;">
<div class="layui-btn add" onclick="importTemplate();" type="button"><i
class="layui-icon"></i>下载导入模板</div>
<div class="layui-btn layui-btn-warm" type="button" onclick="importExcel();">
<span class="layui-icon layui-icon-shrink-right"></span>导入excel
</div>
</span>
<!--
<div class="layui-btn layui-btn-normal" onclick="backList();" >
<span class="layui-icon layui-icon-return hide"></span>返回
</div>
-->
</div>
<div class="layui-form-item">
<table class="layui-table" lay-filter="demo" id="idTest"></table>
<script type="text/html" id="barDemo">
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="res">配置资源</a>
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="resetpwd">重置密码</a>
{{#if(d.apply_status==1){ }}
<a class="layui-btn layui-btn-normal layui-btn-xs aaa" title="正在进行调转,不能进行其它操作">调转申请</a>
<a class="layui-btn layui-btn-normal layui-btn-xs aaa" title="正在进行调转,不能进行其它操作">异动处理</a>
{{#}else{ }}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="transferApply">调转申请</a>
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="changeStatus">异动处理</a>
{{#} }}
</script>
</div>
<input type="hidden" value="" id="dep_id">
<input type="hidden" value="" id="click_id">
</form>
</td>
</tr>
</table>
</div>
<script src="../../lib/layui/layui.js"></script>
<script>
layui.extend({
admin: '{/}../../static/js/admin'
});
layui.use(['form', 'jquery', 'admin', 'table', 'laytpl'], function () {
var form = layui.form,
$ = layui.jquery,
admin = layui.admin,
table = layui.table,
laytpl = layui.laytpl;
var org_id = "";
var area_id = GetQueryString('area_id');
var org_type_id = GetQueryString('org_type_id');//单位类型iD
var setting1 = {
view: {
selectedMulti: false
},
data: {
simpleData: {
enable: true,
idKey: "org_id",
pIdKey: "parent_id",
rootPId: 0
}
},
callback: {
onClick: zTreeOnClick,
}
};
var org_id = "";
var info = getcookie();
// 超管 单位管理员 显示教师导入
if (info.identity_id == 1 || info.identity_id == 4) {
$("#importAcc").show();
}
// 加载部门树
$(function () {
if (getcookie().identity_id == 4) {//单位管理员
org_id = getcookie().bureau_id;
$("#super").hide();
$("#other").show();
} else {
org_id = GetQueryString('org_id');
$("#super").show();
$("#other").hide();
}
$.getScript("../../lib/jquery-3.6.0.min.js").done(function () {
$.getScript("../../lib/ztree/jquery.ztree.core-3.5.min.js").done(function () {
$.ajax({
type: "GET",
async: false,
url: '/dsBase/organization/getOrgTreeByBureauId?bureau_id=' + org_id,
dataType: "json",
success: function (data) {
if (data.code == 0) {
for (var i = 0; i < data.data.length; i++) {
data.data[i].name = data.data[i].org_name;
}
var zNodes = data.data;
var jquery = window.$.fn.zTree;
jquery.init($("#mytree"), setting1, zNodes);
var treeObj = jquery.getZTreeObj("mytree");
$("#dep_id").val(org_id);
var parentNode = "";
if ($("#click_id").val() !== "") {
getTeaList($("#click_id").val());
parentNode = treeObj.getNodeByParam("org_id", $("#click_id").val());// 选中指定节点
} else {
parentNode = treeObj.getNodeByParam("org_id", $("#dep_id").val());// 选中指定节点
getTeaList(org_id);
}
treeObj.selectNode(parentNode);
// var firNodeId = treeObj.getNodes()[0].id;
// var t = jquery.init($("#mytree"), setting1, zNodes);
// var node = t.getNodeByParam("id", org_id);
// console.log(node);
// t.selectNode(node, true);
treeObj.expandAll(true);
// var nodes = treeObj.getSelectedNodes();
//getList(nodes[0].bureau_id);
}
}
});
})
})
});
$("#treeDiv").height($(window).height() - 80);
// 点击区划树
function zTreeOnClick(event, treeId, treeNode) {
console.log(treeNode.org_id);
$("#dep_id").val(treeNode.org_id);
$("#click_id").val(treeNode.org_id);
getTeaList(treeNode.org_id);
}
// 根节点 bureau_id获取列表
function getList(id) {
table.render({
elem: '#idTest'
, url: '/dsBase/teacher/getTeacherListByBureauId'
, where: {
bureau_id: id
}
, cols: [[
{ type: 'checkbox', fixed: 'left', align: 'center' }
, { field: '', title: '序号', align: 'center', type: 'numbers', width: 80, fixed: true }
, { field: 'person_name', title: '职工姓名', align: 'center' }
, { field: 'xb', title: '性别', align: 'center' }
, { field: 'login_name', title: '登录名', align: 'center' }
, { field: 'original_pwd', title: '初始密码', align: 'center' }
, { fixed: 'right', title: '操作', toolbar: '#barDemo', align: 'center', width: 280, fixed: 'right' }
]]
, page: true
, height: 'full'
, done: function () {
$("[data-field='xb']").children().each(function () {
if ($(this).text() == '1') {
$(this).text("男")
} else if ($(this).text() == '2') {
$(this).text("女")
}
})
}
});
}
// org_id获取列表
function getTeaList(id) {
// 教师列表渲染
table.render({
elem: '#idTest'
, url: '/dsBase/teacher/getTeacherListByOrgId'
, where: {
org_id: id,
person_name: $("#searchTxt").val()
}
, cols: [[
{ type: 'checkbox', fixed: 'left', align: 'center' }
, { field: '', title: '序号', align: 'center', type: 'numbers', width: 80, fixed: true }
, { field: 'person_name', title: '职工姓名', align: 'center' }
, { field: 'xb', title: '性别', align: 'center' }
, { field: 'login_name', title: '登录名', align: 'center' }
, { field: 'original_pwd', title: '初始密码', align: 'center' }
, { fixed: 'right', title: '操作', toolbar: '#barDemo', align: 'center', width: 400, fixed: 'right' }
]]
, page: true
, done: function () {
$("[data-field='xb']").children().each(function () {
if ($(this).text() == '1') {
$(this).text("男")
} else if ($(this).text() == '2') {
$(this).text("女")
}
})
$(".aaa").hover(function () {
$(this).css('color', '#C9C9C9')
}, function () {
})
}
});
}
window.backList = function () {
window.location.href = document.referrer;
return false;
}
table.on('tool(demo)', function (obj) {
var data = obj.data;
console.log(data)
if (obj.event === 'del') {
layer.confirm('确定删除 ' + data.person_name + ' 吗?', { icon: 0 }, function (index) {
del(data.person_id);
});
} else if (obj.event === 'edit') {
WeAdminShow('编辑', './edit.html?person_id=' + data.person_id + '&dep_id=' + $("#dep_id").val() + '&bureau_id=' + org_id, 550, window.height);
} else if (obj.event === 'res') {
WeAdminShow('配置资源', './duty.html?person_id=' + data.person_id, 800, 600);
} else if (obj.event === 'resetpwd') {
layer.confirm('确定重置 ' + data.person_name + ' 密码吗?', { icon: 0 }, function (index) {
resetPwd(data.person_id);
});
} else if (obj.event === 'transferApply') {
var info = getcookie();
if (info.identity_id == 1) {
WeAdminShow('调转申请', './superTransferApply.html?person_id=' + data.person_id + '&bureau_id=' + org_id, 800, 630);
} else {
WeAdminShow('调转申请', './transferApply.html?person_id=' + data.person_id + '&bureau_id=' + org_id, 800, 630);
}
} else if (obj.event === 'changeStatus') {
WeAdminShow('异动处理', './changeStatus.html?person_id=' + data.person_id + '&bureau_id=' + org_id, 450, 330);
}
});
form.on('select(sel1)', function (data) {
$("#sel4").val(data.value);
table.reload('idTest', {
where: {
org_id: $("#sel1").val(),
person_name: $("#searchTxt").val()
}
, page: {
curr: 1
}
});
});
// 表格重载
window.reloadtable = function () {
console.log("sel1=" + $("#sel1").val())
table.reload('idTest', {
where: {
org_id: $("#sel1").val(),
person_name: $("#searchTxt").val()
}
, page: {
curr: 1
}
});
}
// 添加教师
window.addOrg = function () {
WeAdminShow('添加', './add.html?dep_id=' + $("#dep_id").val() + '&bureau_id=' + org_id, 550, window.height);
}
// 删除教师
function del(ids) {
$.ajax({
type: "POST",
dataType: "json",
url: "/dsBase/teacher/deleteTeacher",
data: {
person_ids: ids
},
success: function (data) {
if (data.success) {
layer.msg("删除成功", { icon: 1, time: 2000, shade: 0.1 });
reloadtable();
} else {
layer.alert("删除失败", { icon: 0, time: 2000, shade: 0.1 });
}
},
error: function (data) {
return;
}
})
}
//重置密码
function resetPwd(ids) {
$.ajax({
type: "POST",
dataType: "json",
url: "/dsBase/loginPerson/ResetPwd",
data: {
person_id: ids
},
success: function (data) {
if (data.success) {
layer.msg("重置密码成功!", { icon: 1, time: 2000, shade: 0.1 });
reloadtable();
} else {
layer.alert(data.message, { icon: 0, time: 2000, shade: 0.1 });
}
}
})
}
// 批量删除教师
var active = {
getCheckLength: function () { //获取选中数目
var checkStatus = table.checkStatus('idTest')
, data = checkStatus.data;
console.log(data);
if (data.length == 0) {
layer.msg("请先选择要删除的教师!", { icon: 5, time: 2000 })
} else if (data.length > 0) {
var systemIds = "";
for (var i = 0; i < data.length; i++) {
if (i == data.length - 1) {
systemIds += data[i].person_id;
} else {
systemIds += data[i].person_id + ",";
}
}
if (data.length == 1) {
layer.confirm('确定删除 ' + data[0].person_name + ' 吗?', { icon: 0 }, function (index) {
del(systemIds);
});
} else {
layer.confirm('确定要批量删除' + data.length + '个教师吗?', { icon: 0 }, function (index) {
del(systemIds);
});
}
}
},
switchDepartMent: function () { //获取选中数目
var checkStatus = table.checkStatus('idTest')
, data = checkStatus.data;
console.log(data);
if (data.length == 0) {
layer.msg("请先选择要调整部门的教师!", { icon: 5, time: 2000 })
} else if (data.length > 0) {
var systemIds = "";
for (var i = 0; i < data.length; i++) {
if (i == data.length - 1) {
systemIds += data[i].person_id;
} else {
systemIds += data[i].person_id + ",";
}
}
WeAdminShow('调整部门', './setDepList.html?org_id=' + org_id + '&ids=' + systemIds, 350, window.height);
}
},
export: function () {
window.location.href = "/dsBase/teacher/getTeacherListByBureauIdForExcel?bureau_id=" + org_id;
}
};
$('.delBtn').on('click', function () {
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
$('.switchBtn').on('click', function () {
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
$('.exportBtn').on('click', function () {
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
// 搜索
$("#search").click(function () {
reloadtable();
})
$("#iconDel").click(function () {
if ($("#searchTxt").val() !== "") {
$("#searchTxt").val("");
$(this).hide();
}
reloadtable();
})
$("#searchTxt").blur(function () {
if ($("#searchTxt").val() !== "") {
$("#iconDel").show();
} else {
$("#iconDel").hide();
}
})
// 回车搜索
$("#searchTxt").keyup(function (e) {
if (e.keyCode == 13) {
reloadtable();
}
})
// 下载模板
window.importTemplate = function () {
window.location.href = '/dsBase/teacher/getImportTemplate';
}
// 导入excel
window.importExcel = function () {
WeAdminShow('导入教工', './importExcel.html?org_id=' + $("#dep_id").val() + "&identity=" + info.identity_id, 600, 300);
}
$(window).resize(function () {
console.log(window.height);
console.log(window.innerWidth);
$(".layui-table-view").css('width', window.innerWidth - 235);
$(".layui-table-view").height(window.height)
})
})
</script>
</body>
</html>