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.

268 lines
9.7 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">
<!-- 让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;
}
</style>
</head>
<body>
<div class="weadmin-nav">
<span class="layui-breadcrumb">
<a href="">首页</a>
<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">
<form class="layui-form">
<div style="float:left;margin-bottom: 5px;display: none" id="div1">
<label for="" class="layui-form-label" style="width: 40px;text-align: left;padding:9px 15px 9px 0">
&nbsp;地区
</label>
<div class="layui-input-inline" id="select_1"></div>
<script type="text/html" id="test1">
<select name="service_type" id="sel1" lay-filter="sel1">
{{#layui.each(d.data,function(index,item){ }}
<option value={{item.id}} >{{item.area_name}}</option>
{{#}) }}
</select>
</script>
</div>
<div style="float:right;margin-bottom:5px">
<div class="layui-btn layui-btn-warm" id="export" type="button">
<span class="layui-icon layui-icon-shrink-right"></span>导出全部账号
</div>
<div class="layui-btn layui-btn-normal resetpwd hide" data-type="getCheckLength" type="button">
<span class="layui-icon layui-icon-download-circle"></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-normal layui-btn-xs" lay-event="resetpwd">重置密码</a>
</script>
</div>
</form>
</div>
<script src="../../lib/layui/layui.js"></script>
<script>
// 1--超级管理员 2---市级管理员 3--区县级管理员 4---单位学校管理员
layui.extend({
admin: '{/}../../static/js/admin'
});
layui.use(['jquery','form','admin','table','laytpl'], function() {
var form = layui.form,
$ = layui.jquery,
admin = layui.admin,
laytpl = layui.laytpl,
table=layui.table;
var area_id="";
var data=getcookie();
if(data.identity_id==1){
var result=getGlobalByCodes("install_area");
$.ajax({
type: "GET",
dataType: "json",
url : '/FengHuang/dm/getAreaByParentId?parent_id='+result[0].global_value,
success: function (data) {
$("#div1").show();
var getTpl = test1.innerHTML
, select_1 = document.getElementById('select_1');
laytpl(getTpl).render(data, function (html) {
select_1.innerHTML = html;
});
form.render();
area_id=$("#sel1").val()
getPrintAreaBureau(area_id);
}
})
}else if(data.identity_id==4){
$.ajax({
type: "GET",
dataType: "json",
url : '/FengHuang/organization/getOrgInfoById?org_id='+data.bureau_id,
success: function (data) {
area_id=data.data[0].area_id;
getPrintAreaBureau(area_id);
}
})
}else if(data.identity_id==2){
$.ajax({
type: "GET",
dataType: "json",
url : '/FengHuang/dm/getAreaById?area_id='+data.city_id,
success: function (data) {
area_id=data.data[0].area_id;
getPrintAreaBureau(area_id);
}
})
}else if(data.identity_id==3){
$.ajax({
type: "GET",
dataType: "json",
url : '/FengHuang/dm/getAreaById?area_id='+data.area_id,
success: function (data) {
area_id=data.data[0].area_id;
getPrintAreaBureau(area_id);
}
})
}
form.on('select(sel1)',function (data) {
area_id=data.value;
getPrintAreaBureau(area_id);
})
// 获取市级管理员账号密码
window.getPrintAreaBureau=function(id){
table.render({
elem: '#idTest'
,url:'/FengHuang/loginPerson/getPrintAreaBureau'
,where:{
"area_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:'login_name', title:'登录名',align:'center'}
,{field:'original_pwd', title:'初始密码',align:'center'}
, {fixed: 'right', title: '操作', toolbar: '#barDemo', align: 'center'}
]]
,page: true
,done:function () {
}
});
}
// 表格重载
window.reloadtable=function(){
table.reload('idTest',{
page: {
curr: 1
}
});
}
// 导出excel
$("#export").click(function () {
window.location.href ="/FengHuang/loginPerson/getPrintAreaBureauForExcel?area_id="+area_id;
})
table.on('tool(demo)', function (obj) {
var data = obj.data;
console.log(data)
if (obj.event === 'resetpwd') {
layer.confirm('确定重置 ' + data.person_name + ' 密码吗?', {icon: 0}, function (index) {
resetPwd(data.person_id);
});
}
});
//重置密码
function resetPwd(ids) {
$.ajax({
type: "POST",
dataType: "json",
url: "/FengHuang/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.alert("请选择教师", {
icon: 6
})
}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+",";
}
}
$.ajax({
type: "POST",
dataType: "json",
url: "/FengHuang/loginPerson/ResetPwd",
data: {
person_id: systemIds
},
success: function (data) {
if (data.success) {
layer.msg(data.message, {icon: 1, time: 2000, shade: 0.1});
reloadtable();
} else {
layer.alert("密码重置失败", {icon: 0, time: 2000, shade: 0.1});
}
},
error: function (data) {
return;
}
})
}
}
};
$('.resetpwd').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
})
</script>
</body>
</html>