|
|
@@ -0,0 +1,411 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html>
|
|
|
+<head>
|
|
|
+ <meta charset="utf-8">
|
|
|
+ <title>充值规则管理</title>
|
|
|
+ <script src="../../js/min-loader-next.js"></script>
|
|
|
+</head>
|
|
|
+<body class="content">
|
|
|
+ <div class="order-body">
|
|
|
+ <div class="order-tiaojian back-gray">
|
|
|
+ <div class="tiaojian-part1" id = "conditions">
|
|
|
+ <div class="fl f12-gray4-op mt4">所选条件:</div>
|
|
|
+ </div>
|
|
|
+ <div class="tiaojian-part2 fr demoTable">
|
|
|
+ <button class="layui-btn order-bnt1" data-type="reload" >搜索</button>
|
|
|
+ <button class="layui-btn order-bnt2" data-type="reset">重置</button>
|
|
|
+ <button class="layui-btn order-bnt2" id = "addUser">添加</button>
|
|
|
+ <a href="#" id="toggle" class="top">收起</a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <form class="layui-form" action="javascript:void(0)" id = "formName">
|
|
|
+ <div class="order-select back-border" id="content">
|
|
|
+ <div class="layui-inline">
|
|
|
+ <label class="f12-gray4">登录名:</label>
|
|
|
+ <input onchange = "changeSelectCon(0,this,'inp')" class="search-select" type="tel" name="logonname" id ="logonname" value="" placeholder="请输入登录名" />
|
|
|
+ </div>
|
|
|
+ <div class="layui-inline">
|
|
|
+ <label class="f12-gray4">日期:</label>
|
|
|
+ <input class="search-select" type="text" id="dates" placeholder="日期(区间)" readonly />
|
|
|
+ </div>
|
|
|
+ <div class="layui-inline">
|
|
|
+ <label class="f12-gray4">状态:</label>
|
|
|
+ <div class="" style="display:inline-block" id = 'state'></div>
|
|
|
+ </div>
|
|
|
+ <div class="d-dashed" style="margin: 10px 0;"></div>
|
|
|
+ <div class="layui-inline">
|
|
|
+ <label class="f12-gray4">姓名:</label>
|
|
|
+ <input onchange = "changeSelectCon(3,this,'inp')" class="search-select" type="tel" name="name" id ="name" value="" placeholder="请输入姓名" />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="layui-inline">
|
|
|
+ <label class="f12-gray4">角色:</label>
|
|
|
+ <div class="" style="display:inline-block" id = 'seleRoleid'></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="shadow-content" style="margin:1.5rem;">
|
|
|
+ <table id="userManage" lay-filter="tableFilter"></table>
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+ <!--操作功能-->
|
|
|
+ <script type="text/html" id="barDemo">
|
|
|
+ <a class="layui-btn layui-btn-xs" lay-event="detail">查看</a>
|
|
|
+ <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
|
|
+ {{# if(d.stt == '0'){ }}
|
|
|
+ <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">冻结</a>
|
|
|
+ {{# }; }}
|
|
|
+ <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="esetLogin">重置登录密码</a>
|
|
|
+ {{# if(d.stt != '0'){ }}
|
|
|
+ <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="enable">解冻</a>
|
|
|
+ {{# }; }}
|
|
|
+ </script>
|
|
|
+<script>
|
|
|
+ $("#toggle").click(function() {
|
|
|
+ $(this).html($("#content").is(":hidden") ? "收起" + "<i class='iconfont up iconSelect_drop-down'/></i>" : "展开" +
|
|
|
+ "<i class='iconfont up iconSelect_drop-down'/></i>");
|
|
|
+ $("#content").slideToggle();
|
|
|
+ });
|
|
|
+ layui.use(['table','laydate','form'], function(){
|
|
|
+ var laydate = layui.laydate;
|
|
|
+ //日期范围
|
|
|
+ laydate.render({
|
|
|
+ elem: '#dates'
|
|
|
+ ,range: true
|
|
|
+ ,format:'yyyyMMdd'
|
|
|
+ ,done: function(value, date, endDate){
|
|
|
+ changeSelectCon(1,"dates",'date',value)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ form = layui.form;
|
|
|
+ initSelect('state', "IM_USER_STATE", "state", ' ', true);
|
|
|
+ form.on('select(state)', function(data){
|
|
|
+ changeSelectCon(2, data.elem, "sel","state");
|
|
|
+ });
|
|
|
+ $.request({
|
|
|
+ action : '../../RoleManageAction/roleQueryByBranchId',
|
|
|
+ data : { },
|
|
|
+ success : function(data) {
|
|
|
+ var selectName ="roleid";
|
|
|
+ var html = '<select name="';
|
|
|
+ html = html + selectName;
|
|
|
+ html = html + '" lay-filter="';
|
|
|
+ html = html + selectName;
|
|
|
+ html = html + '"';
|
|
|
+ html = html + '><option value="">全部</option>';
|
|
|
+ $.each(data.MINQueryResult, function(i, j) {
|
|
|
+ html = html + '<option ';
|
|
|
+ html = html + 'value="';
|
|
|
+ html = html + j.id + '">';
|
|
|
+ html = html + j.name+ '</option>';
|
|
|
+ })
|
|
|
+ html = html + '</select>';
|
|
|
+ $("#seleRoleid").html(html);
|
|
|
+ form.render();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ form.on('select(roleid)', function(data){
|
|
|
+ changeSelectCon(4, data.elem, "sel","roleid");
|
|
|
+ });
|
|
|
+
|
|
|
+ form.render();
|
|
|
+ })
|
|
|
+
|
|
|
+ /* layui.use('form', function(){
|
|
|
+ var form = layui.form; //只有执行了这一步,部分表单元素才会自动修饰成功
|
|
|
+
|
|
|
+ }) */
|
|
|
+ var table;
|
|
|
+ layui.use('table', function(){
|
|
|
+ table = layui.table;
|
|
|
+ table.render({
|
|
|
+ //tbname:'userManage',
|
|
|
+ id : 'userManage'
|
|
|
+ ,elem: '#userManage'
|
|
|
+ ,limit:10
|
|
|
+ ,url: 'UserManageAction/userQuery' //数据接口
|
|
|
+ ,method: 'post'
|
|
|
+ ,where:{MINView:"JSON", token: 'sasasas'}
|
|
|
+ ,page: true //开启分页
|
|
|
+ ,cols: [[ //表头
|
|
|
+ {type:'numbers',title: '序号',width:'5%'}
|
|
|
+ ,{field: 'id', title: '编号', width:'10%', sort: true}
|
|
|
+ ,{field: 'logonname', title: '登录名', width:'12%'}
|
|
|
+ ,{field: 'name', title: '姓名', width:'12%'}
|
|
|
+ ,{field: 'rolename', title: '角色', width:'15%'}
|
|
|
+ ,{field: 'createdate', title: '创建日期',width:'15%'}
|
|
|
+ ,{field: 'lastlogon', title: '最后登录日期',width:'15%'}
|
|
|
+ ,{field: 'sttdesc', title: '状态',width:'8%'}
|
|
|
+ ,{field: 'operate', title: '操作', width: '25%', toolbar: '#barDemo',fixed: 'right'}
|
|
|
+ ]]
|
|
|
+ ,done: function(res, curr, count){
|
|
|
+ //如果是异步请求数据方式,res即为你接口返回的信息。
|
|
|
+ console.log(res);
|
|
|
+ //得到当前页码
|
|
|
+ console.log(curr);
|
|
|
+ //得到数据总量
|
|
|
+ console.log(count);
|
|
|
+ }
|
|
|
+ ,even: true //开启隔行背景
|
|
|
+ });
|
|
|
+
|
|
|
+ // 监听工具条(操作)
|
|
|
+ table.on('tool(tableFilter)', function(obj){ //注:tool是工具条事件名,tableFilter是table原始容器的属性 lay-filter="对应的值"
|
|
|
+ var data = obj.data; //获得当前行数据
|
|
|
+ var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值)
|
|
|
+ var tr = obj.tr; //获得当前行 tr 的DOM对象
|
|
|
+ var id = data.id;
|
|
|
+ if(layEvent == 'detail'){ //查看
|
|
|
+ showDetail(data);
|
|
|
+ } else if(layEvent == 'del'){ //删除
|
|
|
+ layer.confirm('真的要注销吗', function(index){
|
|
|
+ $.request({
|
|
|
+ action : '../../UserManageAction/userDelete',
|
|
|
+ data : {
|
|
|
+ id : id //用户名
|
|
|
+ },
|
|
|
+ success : function(data) {
|
|
|
+ //成功后刷新
|
|
|
+ var btn=$(".layui-laypage-btn")[0];
|
|
|
+ btn.click();
|
|
|
+ layer.alert('操作成功!', {
|
|
|
+ icon: 6,
|
|
|
+ title: "提示"
|
|
|
+ });
|
|
|
+ },
|
|
|
+ error : function(data) {
|
|
|
+ layer.alert('操作失败!', {
|
|
|
+ icon: 5,
|
|
|
+ title: "提示"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ } else if(layEvent == 'edit'){ //编辑
|
|
|
+ editDetail(data);
|
|
|
+ } else if(layEvent == 'esetLogin'){//重置登陆密码
|
|
|
+ layer.confirm('确定要重置密码吗?', function(index){
|
|
|
+ $.request({
|
|
|
+ action : '../../UserManageAction/resetLoginPassword',
|
|
|
+ data : {
|
|
|
+ id : id //用户名
|
|
|
+ },
|
|
|
+ success : function(data) {
|
|
|
+ layer.alert('操作成功!', {
|
|
|
+ icon: 6,
|
|
|
+ title: "提示"
|
|
|
+ });
|
|
|
+ },
|
|
|
+ error : function(data) {
|
|
|
+ layer.alert('操作失败!', {
|
|
|
+ icon: 5,
|
|
|
+ title: "提示"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }else if(layEvent =='enable'){
|
|
|
+ layer.confirm('确定要解冻吗?', function(index){
|
|
|
+ $.request({
|
|
|
+ action : '../../UserManageAction/userThaw',
|
|
|
+ data : {
|
|
|
+ id : id,
|
|
|
+ state : '0'
|
|
|
+ },
|
|
|
+ success : function(data) {
|
|
|
+ //成功后刷新
|
|
|
+ $(".layui-laypage-btn")[0].click();
|
|
|
+ layer.alert('操作成功!', {
|
|
|
+ icon: 6,
|
|
|
+ title: "提示"
|
|
|
+ });
|
|
|
+ },
|
|
|
+ error : function(data) {
|
|
|
+ layer.alert(data.MINErrorMessage, {
|
|
|
+ icon: 5,
|
|
|
+ title: "提示"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ var $ = layui.$, active = {
|
|
|
+ reload: function(){
|
|
|
+ reLoadFun();
|
|
|
+ }
|
|
|
+ ,reset: function(){
|
|
|
+ $('#formName')[0].reset()
|
|
|
+ }
|
|
|
+ };
|
|
|
+ $('.layui-btn').on('click', function(){
|
|
|
+ var type = $(this).data('type');
|
|
|
+ active[type] ? active[type].call(this) : '';
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ function reLoadFun() {
|
|
|
+ var name = $('#name').val();
|
|
|
+ var logonname = $('#logonname').val();
|
|
|
+ var state = $("select[name='state']").val();
|
|
|
+ var roleid = $("select[name='roleid']").val();
|
|
|
+ var dates = $("#dates").val();
|
|
|
+ //执行重载
|
|
|
+ table.reload('userManage', {
|
|
|
+ page: {
|
|
|
+ curr: 1 //重新从第 1 页开始
|
|
|
+ }
|
|
|
+ ,where: {
|
|
|
+ name : name,
|
|
|
+ logonname : logonname,
|
|
|
+ roleid : roleid,
|
|
|
+ stt : state,
|
|
|
+ dates :dates
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function showDetail(data) {
|
|
|
+ var params = {};
|
|
|
+ params.columnNumber = 2; //每行显示两个字段
|
|
|
+ // 要显示的数据
|
|
|
+ params.fields = [
|
|
|
+ {field: 'id', title: 'ID'}
|
|
|
+ ,{field: 'logonname', title: '登录名'}
|
|
|
+ ,{field: 'name', title: '姓名'}
|
|
|
+ ,{field: 'rolename', title: '角色'}
|
|
|
+ ,{field: 'phone', title: '手机号'}
|
|
|
+ ,{field: 'createdate', title: '创建日期'}
|
|
|
+ ,{field: 'lastlogon', title: '最后登录日期'}
|
|
|
+ ,{field: 'sttdesc', title: '状态'}
|
|
|
+ ];
|
|
|
+ // 寄存当前数据
|
|
|
+ setNowRowData(data, params);
|
|
|
+ layer.open({
|
|
|
+ type: 2,
|
|
|
+ title: '用户详情',
|
|
|
+ shadeClose: true,
|
|
|
+ shade: 0.8,
|
|
|
+ //maxmin: true, //开启最大化最小化按钮
|
|
|
+ area: ['800px', '500px'],
|
|
|
+ content: '../../web/showDetail.html'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //添加操作员
|
|
|
+ $(document).on('click','#addUser',function(){
|
|
|
+ openMainTabPage('315002-01', ' 增加操作员', 'userManage/addUser.html', '', '315002', reLoadFun);
|
|
|
+ });
|
|
|
+ //编辑
|
|
|
+ function editDetail(data) {
|
|
|
+ // 寄存当前数据
|
|
|
+ layui.sessionData("ROW_DATA", {key:"NOW_ROW", value:data});
|
|
|
+ openMainTabPage('315002-02', ' 编辑操作员', 'userManage/editUser.html', '', '315002', reLoadFun);
|
|
|
+ }
|
|
|
+ function changeSelectCon(index, t, type, dateValue){
|
|
|
+ if (type == "date") {
|
|
|
+ if (isEmpty(dateValue)) {
|
|
|
+ $("#search" + index).remove();
|
|
|
+ } else {
|
|
|
+ $("#search" + index).remove();
|
|
|
+ if (isEmpty($("#search" + index).attr("name"))) {
|
|
|
+ $("#conditions").append(getSelectConHtml(index, t, type,dateValue));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (type == 'inp') {
|
|
|
+ if (isEmpty($(t).val())) {
|
|
|
+ $("#search" + index).remove();
|
|
|
+ } else {
|
|
|
+ $("#search" + index).remove();
|
|
|
+ if (isEmpty($("#search" + index).attr("name"))) {
|
|
|
+ $("#conditions").append(getSelectConHtml(index, t, type));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (isEmpty($(t).val())) {
|
|
|
+ $("#search" + index).remove();
|
|
|
+ } else {
|
|
|
+ $("#search" + index).remove();
|
|
|
+ if (isEmpty($("#search" + index).attr("name"))) {
|
|
|
+ $(t).attr("id",dateValue);
|
|
|
+ $("#conditions").append(getSelectConHtml(index, t, type,dateValue));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var array = new Array('登录名','日期','状态','姓名','角色');
|
|
|
+ function getSelectConHtml(index, t, type,dateValue){
|
|
|
+ var name;
|
|
|
+ var value;
|
|
|
+ if(type == "inp"){
|
|
|
+ value = t.value.substr(0,5)+"..";
|
|
|
+ }
|
|
|
+ if (type == "date") {
|
|
|
+ value = dateValue;
|
|
|
+ }
|
|
|
+ if(type == "sel" && dateValue =="state"){
|
|
|
+ value = $("#state").find("option:selected").text();
|
|
|
+ }
|
|
|
+ if(type == "sel" && dateValue =="roleid"){
|
|
|
+ value = $("#roleid").find("option:selected").text();
|
|
|
+ }
|
|
|
+ if (type == "date") {
|
|
|
+ name = $("#"+t).attr("id");
|
|
|
+ } else {
|
|
|
+ name = $(t).attr("id");
|
|
|
+ }
|
|
|
+ var html = '<div class="fl xuanzhong-active" id = "search' + index + '" name = "' + name + '" onclick = "removeSearch(this)">' +
|
|
|
+ '<div class="fl">' + array[index] + '</div>' +
|
|
|
+ ':<i class="iconfont">'+value+'</i>' +
|
|
|
+ '<svg class="icon" aria-hidden="true">' +
|
|
|
+ '<use xlink:href="#iconicon_close1"></use>' +
|
|
|
+ '</svg>' +
|
|
|
+ '</div>';
|
|
|
+ return html;
|
|
|
+ }
|
|
|
+ function removeSearch(t) {
|
|
|
+ if ($(t).attr("name") == 'state') {
|
|
|
+ initSelect('state', "IM_USER_STATE", "state", ' ', true);
|
|
|
+ form.render();
|
|
|
+ $(t).remove();
|
|
|
+ } if ($(t).attr("name") == 'roleid') {
|
|
|
+ $.request({
|
|
|
+ action : '../../RoleManageAction/roleQueryByBranchId',
|
|
|
+ data : { },
|
|
|
+ success : function(data) {
|
|
|
+ var selectName ="roleid";
|
|
|
+ var html = '<select name="';
|
|
|
+ html = html + selectName;
|
|
|
+ html = html + '" lay-filter="';
|
|
|
+ html = html + selectName;
|
|
|
+ html = html + '"';
|
|
|
+ html = html + '><option value="">全部</option>';
|
|
|
+ $.each(data.MINQueryResult, function(i, j) {
|
|
|
+ html = html + '<option ';
|
|
|
+ html = html + 'value="';
|
|
|
+ html = html + j.id + '">';
|
|
|
+ html = html + j.name+ '</option>';
|
|
|
+ })
|
|
|
+ html = html + '</select>';
|
|
|
+ $("#seleRoleid").html(html);
|
|
|
+ form.render();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ form.on('select(roleid)', function(data){
|
|
|
+ changeSelectCon(4, data.elem, "sel","roleid");
|
|
|
+ });
|
|
|
+
|
|
|
+ $(t).remove();
|
|
|
+ } else {
|
|
|
+ $("#"+$(t).attr("name")).val('');
|
|
|
+ $(t).remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+</body>
|
|
|
+</html>
|