|
@@ -1,3 +1,4 @@
|
|
|
+
|
|
|
<!--加载公共头部文件-->
|
|
|
{include file='Base/top'}
|
|
|
<!--加载公共左侧文件-->
|
|
@@ -6,9 +7,12 @@
|
|
|
{include file='Base/fotter'}
|
|
|
|
|
|
|
|
|
-<!-- 内容显示部分 -->
|
|
|
+
|
|
|
+
|
|
|
+<!-- 内容主体区域 -->
|
|
|
<div class="layui-body">
|
|
|
- <!--面包屑导航-->
|
|
|
+
|
|
|
+ <!--面包屑导航-->
|
|
|
<blockquote class="layui-elem-quote">
|
|
|
<span class="layui-breadcrumb" style="visibility: visible;">
|
|
|
<a >导航栏管理</a>
|
|
@@ -20,48 +24,61 @@
|
|
|
</blockquote>
|
|
|
<!--面包屑导航 结束-->
|
|
|
|
|
|
- <div class="layui-row layui-col-space10" style="margin:0 10px;">
|
|
|
- <div class="search" style="margin:10px 0px 5px -5px;"><!-- 搜索 -->
|
|
|
- <div class="layui-inline">
|
|
|
- <input type="text" class="layui-input" name="id" id="refund" autocomplete="off" placeholder="请输入导航栏id">
|
|
|
- </div>
|
|
|
- <button class="layui-btn layui-btn-primary" data-type="reload">搜索</button>
|
|
|
- </div>
|
|
|
- <table class="layui-hide" id="list" lay-filter="list"></table><!-- 表格数据 -->
|
|
|
-
|
|
|
- </div>
|
|
|
-</div>
|
|
|
-
|
|
|
-<!-- <script type="text/html" id="status">
|
|
|
- {{# if(d.show_status == 0){ }}
|
|
|
- <div class="layui-badge layui-bg-green">隐藏</div>
|
|
|
- {{# } else if(d.show_status == 1){ }}
|
|
|
- <div class="layui-badge layui-bg-read">显示</div>
|
|
|
- {{# } }}
|
|
|
-</script> -->
|
|
|
+ <div >
|
|
|
+ <button class="layui-btn" id="add">
|
|
|
+ <i class="layui-icon"></i>添加
|
|
|
+ </button>
|
|
|
+
|
|
|
+ <button class="layui-btn" id="up">
|
|
|
+ <i class="layui-icon"></i> 更新排序
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <form class="layui-form" action="{:url('Column/sort')}" method="post" id="vo_form">
|
|
|
+ <table class="layui-table" id="deleteds">
|
|
|
+ <thead>
|
|
|
+ <tr width="100">
|
|
|
+ <th width="6%" style="text-align: center;">导航栏ID</th>
|
|
|
+ <th width="10%" style="text-align: center;">导航栏名称</th>
|
|
|
+ <th width="10%" style="text-align: center;">权重</th>
|
|
|
+ <th width="30">操作</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+
|
|
|
+ {volist name='list' id='vo'}
|
|
|
+ <tr>
|
|
|
+ <td align="center">{$vo.id}</td>
|
|
|
|
|
|
+ <td align="center">{$vo.catename}</td>
|
|
|
|
|
|
+ <td>
|
|
|
+ <input type="text" class="layui-input x-sort" name="sort[{$vo['id']}]" value="{$vo.sort}">
|
|
|
+ </td>
|
|
|
|
|
|
+ <td>
|
|
|
+ <div class="layui-btn-group">
|
|
|
+ <a class="layui-btn layui-btn-xs" onclick="edit({$vo['id']})" >编辑</a>
|
|
|
|
|
|
-
|
|
|
-<!-- 表格操作栏模块 -->
|
|
|
-<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>
|
|
|
-</script>
|
|
|
+ <a href="javascript:;" class="layui-btn layui-btn-danger layui-btn-xs delete" id="{$vo.id}" style="margin-right: 0;font-size:12px;">删除
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
|
|
|
+ </tr>
|
|
|
+ {/volist}
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
|
|
|
+ <!-- 分页 -->
|
|
|
+ <div class="pages" style="text-align:center;">
|
|
|
+ <div class="plist" >{$list->render()}</div>
|
|
|
+ </div>
|
|
|
|
|
|
-<!-- 头部工具栏模块 -->
|
|
|
-<script type="text/html" id="toolbarDemo"><!-- 表格自定义操作按钮 -->
|
|
|
- <a class="layui-btn layui-btn-xs" lay-event="add">添加</a>
|
|
|
-
|
|
|
- <div class="layui-btn-group demoTable">
|
|
|
- <button class="layui-btn layui-btn-xs" data-type="pdel">批量删除</button>
|
|
|
- </div>
|
|
|
-
|
|
|
-</script>
|
|
|
+ </form>
|
|
|
|
|
|
+</div>
|
|
|
+<!-- 内容主体区域 结束-->
|
|
|
|
|
|
|
|
|
|
|
@@ -72,180 +89,87 @@ layui.use(['table','layer','laypage','jquery'], function(){
|
|
|
laypage = layui.laypage,
|
|
|
$ = layui.jquery;
|
|
|
|
|
|
+ //点击添加
|
|
|
+ $("#add").click(function () {
|
|
|
+ layer.open({
|
|
|
+ type: 2, //open类型
|
|
|
+ title: false, //新开窗口标题 无
|
|
|
+ offset: 'auto', //上下左右居中
|
|
|
+ area: ['800px','700px'], //新开add页面窗口大小
|
|
|
+ content: '{:url("column/add")}', //这里content是一个URL,如果你不想让iframe出现滚动条,你还可以content: ['http://sentsin.com', 'no']
|
|
|
+ end: function () {
|
|
|
+ location.reload();
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- //数据表格
|
|
|
- table.render({
|
|
|
- elem: '#list'
|
|
|
- ,id:'idSystem'
|
|
|
- ,url:'{:url("lst_data")}'//数据接口(专门处理数据)
|
|
|
- ,height:'full'
|
|
|
- // ,toolbar: 'default' //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
|
|
|
- ,toolbar: '#toolbarDemo'
|
|
|
-
|
|
|
- //分页
|
|
|
- ,page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
|
|
|
- layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
|
|
|
- ,curr: 1 //设定初始在第 5 页
|
|
|
- ,limit:10 //一页显示多少条
|
|
|
- ,limits:[10,20,30]//每页条数的选择项
|
|
|
- ,groups: 3 //只显示 2 个连续页码
|
|
|
- ,first: "首页" //不显示首页
|
|
|
- ,last: "尾页" //不显示尾页
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- ,cols: [[
|
|
|
- {type: 'checkbox', fixed: 'left'}
|
|
|
- ,{field: 'id', title: '导航栏ID',sort:true, align:'center',width: 100}
|
|
|
- ,{field: 'catename', title: '导航栏名称',align:'center', width: 150}
|
|
|
- ,{field:'actions',title: '操作',toolbar: '#barDemo',align:'left',width:300 ,fixed:'right'}
|
|
|
-
|
|
|
- ]]
|
|
|
});
|
|
|
|
|
|
|
|
|
- // 执行搜索,表格重载
|
|
|
- $('.search .layui-btn-primary').on('click',function () {
|
|
|
- // 搜索条件
|
|
|
- var id = $('#refund').val();
|
|
|
- if(id==''){
|
|
|
- layer.msg('搜索条件不能为空');
|
|
|
- return false;
|
|
|
+ //更新排序
|
|
|
+ $("#up").click(function () {
|
|
|
+ $.ajax({
|
|
|
+ type:'post',
|
|
|
+ url:'{:url("sort")}',
|
|
|
+ data: $('#vo_form').serialize(), //获取表单提交的所有数据
|
|
|
+ success: function(data) {
|
|
|
+ layer.msg('规则排序成功!',{time:1000,icon: 1},function () {
|
|
|
+ location.reload(true);//刷新当前页面
|
|
|
+ });
|
|
|
+ },
|
|
|
+ error: function(err) {
|
|
|
+ layer.msg(err, {time:1000,icon: 2},function () {
|
|
|
+ location.reload(true);//刷新当前页面
|
|
|
+ });
|
|
|
}
|
|
|
- table.reload('idSystem', {
|
|
|
- page: {
|
|
|
- curr: 1
|
|
|
- }
|
|
|
- ,where: {
|
|
|
- id: id
|
|
|
+ });
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ //删除
|
|
|
+ $('.delete').click(function(){
|
|
|
+ var id = $(this).attr('id');
|
|
|
+ layer.confirm('确定要删除?',{icon: 5}, function(index) {
|
|
|
+ $.ajax({
|
|
|
+ url:"{:url('admin/Column/del')}?id="+id,
|
|
|
+ data:{id:id},
|
|
|
+ success:function(res) {
|
|
|
+ layer.msg(res.msg);
|
|
|
+ if(res.data == 200) {
|
|
|
+ setTimeout(function(){
|
|
|
+ window.location.reload();
|
|
|
+ },1000)
|
|
|
}
|
|
|
-
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
|
|
|
+});
|
|
|
|
|
|
- //监听头工具栏事件
|
|
|
- table.on('toolbar(list)', function(obj){
|
|
|
- var checkStatus = table.checkStatus(obj.config.id)
|
|
|
- ,data = checkStatus.data; //获取选中的数据
|
|
|
- switch(obj.event){
|
|
|
- case 'add'://添加
|
|
|
- var index = layer.open({
|
|
|
- type:2,
|
|
|
- title:"添加栏目",
|
|
|
- maxmin:true,
|
|
|
- width:'auto',
|
|
|
- offset : '100px',
|
|
|
- area :['1000px','600px'],
|
|
|
- content:"{:url('Column/add')}"
|
|
|
- });
|
|
|
-
|
|
|
|
|
|
- break;
|
|
|
|
|
|
-
|
|
|
- };
|
|
|
+</script>
|
|
|
+<script type="text/javascript">
|
|
|
+ //点击编辑
|
|
|
+ function edit($id) {
|
|
|
+ layer.open({
|
|
|
+ type: 2, //open类型
|
|
|
+ title: false, //新开窗口标题 无
|
|
|
+ offset: 'auto', //上下左右居中
|
|
|
+ area: ['800px','700px'], //新开add页面窗口大小
|
|
|
+ content: '{:url("edit")}?id='+$id, //这里content是一个URL,传递要编辑的参数
|
|
|
+ end: function () {
|
|
|
+ location.reload();
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
+ };
|
|
|
|
|
|
- });
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- //监听行工具事件
|
|
|
- table.on('tool(list)', function(obj){ //注:tool是工具条事件名,test是table原始容器的属性 lay-filter="对应的值"
|
|
|
- var data = obj.data; //获得当前行数据
|
|
|
- var layEvent = obj.event; //获得 lay-event 对应的值
|
|
|
- var tr = obj.tr; //获得当前行 tr 的DOM对象
|
|
|
-
|
|
|
- switch(layEvent){
|
|
|
- case 'edit'://编辑
|
|
|
- var index = layer.open({
|
|
|
- type:2,
|
|
|
- title:"编辑信息",
|
|
|
- maxmin:true,
|
|
|
- width:'auto',
|
|
|
- offset : '100px',
|
|
|
- area :['1000px','600px'],
|
|
|
- content:"{:url('Column/edit')}?id="+data.id
|
|
|
- });
|
|
|
- break;
|
|
|
-
|
|
|
- case 'del'://删除
|
|
|
- layer.confirm('确定要删除吗?',{icon: 5},function(index){
|
|
|
- $.post("{:url('Column/del')}?id="+data.id,function(res){
|
|
|
- if(res == 1){
|
|
|
- obj.del();
|
|
|
- layer.msg('删除成功!');
|
|
|
- }else{
|
|
|
- layer.msg('删除失败!');
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
- });
|
|
|
- break;
|
|
|
-
|
|
|
-
|
|
|
- };
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- //批量删除————————————————————————————————————————
|
|
|
- var $ = layui.$, active = {
|
|
|
- pdel: function(){ //获取选中数据
|
|
|
- var checkStatus = table.checkStatus('idSystem')
|
|
|
- ,data = checkStatus.data;
|
|
|
- if(data==""){
|
|
|
- layer.msg('请选择需要删除的数据',{icon:2});
|
|
|
- return;
|
|
|
- }
|
|
|
- var ids = [];
|
|
|
- if(data.length>0){
|
|
|
- for(var i=0;i<data.length;i++){
|
|
|
- ids+=data[i].id+",";
|
|
|
- }
|
|
|
- }
|
|
|
- layer.confirm('确定要删除id为'+ids+'的用户信息吗?',function(index){
|
|
|
- $.ajax({
|
|
|
- type:'POST',
|
|
|
- url:'{:url("Column/pdel")}',
|
|
|
- data:{"ids":ids},
|
|
|
- success:function(data){
|
|
|
- if(data==1){
|
|
|
- // layer.msg('删除成功',{icon:1});
|
|
|
- layer.msg('批量删除成功',{icon:1},function () {
|
|
|
- var index = parent.layer.getFrameIndex(window.name);// 获得frame索引
|
|
|
- parent.layer.close(index);//关闭当前frame
|
|
|
- parent.layui.table.reload('idSystem');//成功刷新父窗口的 table
|
|
|
- });
|
|
|
- }else{
|
|
|
- layer.msg('没有批量删除权限!',{icon:2});
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- $('.demoTable .layui-btn-xs').on('click', function(){
|
|
|
- var type = $(this).data('type');
|
|
|
- active[type] ? active[type].call(this) : '';
|
|
|
- });
|
|
|
- //批量删除结束————————————————————————————————————————————————————
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
+</script>
|
|
|
|
|
|
-});
|
|
|
|
|
|
|
|
|
|
|
|
-</script>
|