add
parent
aeba4c8f34
commit
4714be6d5c
|
|
@ -31,22 +31,6 @@
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<!--工具栏-->
|
|
||||||
<okToolbar>
|
|
||||||
<button class="layui-btn layui-btn-normal" id="batchEnabled">
|
|
||||||
<i class="iconfont icon-shangsheng"></i>批量启用
|
|
||||||
</button>
|
|
||||||
<button class="layui-btn layui-btn-warm" id="batchDisabled">
|
|
||||||
<i class="iconfont icon-web-icon-"></i>批量停用
|
|
||||||
</button>
|
|
||||||
<button class="layui-btn layui-btn-danger" id="batchDel">
|
|
||||||
<i class="layui-icon layui-icon-delete"></i>批量删除
|
|
||||||
</button>
|
|
||||||
<button class="layui-btn" id="addUser">
|
|
||||||
<i class="layui-icon"></i>添加用户
|
|
||||||
</button>
|
|
||||||
<span>共有数据:<i id="countNum"></i> 条</span>
|
|
||||||
</okToolbar>
|
|
||||||
<!--数据表格-->
|
<!--数据表格-->
|
||||||
<table class="layui-hide" id="tableId" lay-filter="tableFilter"></table>
|
<table class="layui-hide" id="tableId" lay-filter="tableFilter"></table>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -80,7 +64,7 @@
|
||||||
limit: 10,
|
limit: 10,
|
||||||
page: true,
|
page: true,
|
||||||
toolbar: true,
|
toolbar: true,
|
||||||
toolbar: "default",
|
toolbar: "#toolbarTpl",
|
||||||
cols: [[
|
cols: [[
|
||||||
{type: "checkbox"},
|
{type: "checkbox"},
|
||||||
{field: "id", title: "ID", width: 80, sort: true},
|
{field: "id", title: "ID", width: 80, sort: true},
|
||||||
|
|
@ -95,7 +79,7 @@
|
||||||
{title: "操作", width: 200, align: 'center', templet: "#operationTpl"}
|
{title: "操作", width: 200, align: 'center', templet: "#operationTpl"}
|
||||||
]],
|
]],
|
||||||
done: function (res, curr, count) {
|
done: function (res, curr, count) {
|
||||||
$("#countNum").text(count);
|
console.log(res, curr, count)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -104,6 +88,24 @@
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
table.on("toolbar(tableFilter)", function (obj) {
|
||||||
|
var data = obj.data;
|
||||||
|
switch (obj.event) {
|
||||||
|
case "batchEnabled":
|
||||||
|
batchEnabled();
|
||||||
|
break;
|
||||||
|
case "batchDisabled":
|
||||||
|
batchDisabled();
|
||||||
|
break;
|
||||||
|
case "batchDel":
|
||||||
|
batchDel();
|
||||||
|
break;
|
||||||
|
case "add":
|
||||||
|
add();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
table.on("tool(tableFilter)", function (obj) {
|
table.on("tool(tableFilter)", function (obj) {
|
||||||
var data = obj.data;
|
var data = obj.data;
|
||||||
switch (obj.event) {
|
switch (obj.event) {
|
||||||
|
|
@ -113,18 +115,13 @@
|
||||||
case "del":
|
case "del":
|
||||||
del(data.id);
|
del(data.id);
|
||||||
break;
|
break;
|
||||||
case "add":
|
|
||||||
layer.msg("编辑");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#batchEnabled").click(function () {
|
function batchEnabled () {
|
||||||
okLayer.confirm("确定要批量启用吗?", function (index) {
|
okLayer.confirm("确定要批量启用吗?", function (index) {
|
||||||
layer.close(index);
|
layer.close(index);
|
||||||
var idsStr = okUtils.table.batchCheck(table);
|
var idsStr = okUtils.table.batchCheck(table);
|
||||||
console.log("idsStr-->" + idsStr)
|
|
||||||
// ajax请求后台api
|
|
||||||
if (idsStr) {
|
if (idsStr) {
|
||||||
okUtils.ajax("/user/batchNormal", "post", {idsStr: idsStr}).done(function (response) {
|
okUtils.ajax("/user/batchNormal", "post", {idsStr: idsStr}).done(function (response) {
|
||||||
console.log(response)
|
console.log(response)
|
||||||
|
|
@ -134,9 +131,9 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
}
|
||||||
|
|
||||||
$("#batchDisabled").click(function () {
|
function batchDisabled () {
|
||||||
okLayer.confirm("确定要批量停用吗?", function (index) {
|
okLayer.confirm("确定要批量停用吗?", function (index) {
|
||||||
layer.close(index);
|
layer.close(index);
|
||||||
var idsStr = okUtils.table.batchCheck(table);
|
var idsStr = okUtils.table.batchCheck(table);
|
||||||
|
|
@ -149,9 +146,9 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
}
|
||||||
|
|
||||||
$("#batchDel").click(function () {
|
function batchDel () {
|
||||||
okLayer.confirm("确定要批量删除吗?", function (index) {
|
okLayer.confirm("确定要批量删除吗?", function (index) {
|
||||||
layer.close(index);
|
layer.close(index);
|
||||||
var idsStr = okUtils.table.batchCheck(table);
|
var idsStr = okUtils.table.batchCheck(table);
|
||||||
|
|
@ -164,13 +161,13 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
}
|
||||||
|
|
||||||
$("#addUser").click(function () {
|
function add () {
|
||||||
okLayer.open("添加用户", "user-add.html", "90%", "90%", function () {
|
okLayer.open("添加用户", "user-add.html", "90%", "90%", function () {
|
||||||
$(".layui-laypage-btn")[0].click();
|
$(".layui-laypage-btn")[0].click();
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
|
|
||||||
function edit (id) {
|
function edit (id) {
|
||||||
okLayer.open("编辑用户", "user-edit.html?id=" + id, "90%", "90%", function () {
|
okLayer.open("编辑用户", "user-edit.html?id=" + id, "90%", "90%", function () {
|
||||||
|
|
@ -190,13 +187,24 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<!--模板-->
|
<!-- 头工具栏模板 -->
|
||||||
|
<script type="text/html" id="toolbarTpl">
|
||||||
|
<div class="layui-btn-container">
|
||||||
|
<button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="batchEnabled"><i class="iconfont icon-shangsheng"></i>批量启用</button>
|
||||||
|
<button class="layui-btn layui-btn-sm layui-btn-warm" lay-event="batchDisabled"><i class="iconfont icon-web-icon-"></i>批量停用</button>
|
||||||
|
<button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="batchDel"><i class="layui-icon layui-icon-delete"></i>批量删除</button>
|
||||||
|
<button class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon"></i>添加用户</button>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
<!-- 启用|停用模板 -->
|
||||||
<script type="text/html" id="statusTpl">
|
<script type="text/html" id="statusTpl">
|
||||||
<input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch" lay-text="启用|停用" {{ d.status== 0 ? 'checked' : ''}}>
|
<input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch" lay-text="启用|停用" {{ d.status== 0 ? 'checked' : ''}}>
|
||||||
</script>
|
</script>
|
||||||
|
<!-- 角色模板 -->
|
||||||
<script type="text/html" id="roleTpl">
|
<script type="text/html" id="roleTpl">
|
||||||
{{ d.role == 0 ? '管理员' : '普通用户 '}}
|
{{ d.role == 0 ? '管理员' : '普通用户 '}}
|
||||||
</script>
|
</script>
|
||||||
|
<!-- 行工具栏模板 -->
|
||||||
<script type="text/html" id="operationTpl">
|
<script type="text/html" id="operationTpl">
|
||||||
<a href="javascript:;" title="编辑" lay-event="edit"><i class="layui-icon"></i></a>
|
<a href="javascript:;" title="编辑" lay-event="edit"><i class="layui-icon"></i></a>
|
||||||
<a href="javascript:;" title="删除" lay-event="del"><i class="layui-icon"></i></a>
|
<a href="javascript:;" title="删除" lay-event="del"><i class="layui-icon"></i></a>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue