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.

192 lines
6.8 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">
<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>
</div>
<script src="../../lib/layui/layui.js"></script>
<script>
layui.extend({
admin: '{/}../../static/js/admin'
});
layui.use(['form','jquery','admin','table'], function() {
var form = layui.form,
admin = layui.admin,
$ = layui.jquery,
table=layui.table;
$(function () {
getPrintAreaManager();
})
// 获取市级管理员账号密码
function getPrintAreaManager(){
table.render({
elem: '#idTest'
,url:'/dsBase/loginPerson/getPrintAreaManager'
,cols: [[
// {type: 'checkbox', fixed: 'left',align:'center'}
{field:'', title:'序号',align:'center',type:'numbers',width:80,fixed:true}
,{field:'city_name', title:'市/州',align:'center'}
,{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 ="/dsBase/loginPerson/getPrintAreaManagerForExcel";
})
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: "/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.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: "/dsBase/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>