123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- {extend name="common/base"/}
- <!-- 主体 -->
- {block name="body"}
- <div class="p-3">
- <table class="layui-hide" id="sitemap_cate" lay-filter="sitemap_cate"></table>
- </div>
- <script type="text/html" id="status">
- <i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
- </script>
- <script type="text/html" id="toolbarDemo">
- <div class="layui-btn-container">
- <button class="layui-btn layui-btn-sm add-menu">+ 添加网站地图</button>
- <button class="layui-btn layui-btn-primary layui-btn-sm add-back">返回</button>
- </div>
- </script>
- <script type="text/html" id="barDemo">
- <div class="layui-btn-group"><button class="layui-btn layui-btn-xs" lay-event="edit">编辑</button><button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button></div>
- </script>
- {/block}
- <!-- /主体 -->
- <!-- 脚本 -->
- {block name="script"}
- <script>
- var sitemap_cate_id = '{$sitemap_cate_id}';
- const moduleInit = ['tool'];
- function gouguInit() {
- var table = layui.table, tool = layui.tool;
- layui.pageTable = table.render({
- elem: '#sitemap_cate',
- title: '网站地图列表',
- toolbar: '#toolbarDemo',
- url: '/admin/sitemap/sitemap_info', //数据接口
- where: {
- id: sitemap_cate_id
- },
- page: false, //开启分页
- cols: [
- [
- {
- field: 'id',
- title: 'ID号',
- align: 'center',
- width: 80
- }, {
- field: 'sort',
- title: '排序',
- width: 80,
- align: 'center'
- }, {
- field: 'name',
- title: '标题',
- width: 200
- }, {
- field: 'pc_src',
- title: 'pc端链接'
- }, {
- field: 'mobile_src',
- title: '移动端链接'
- }, {
- field: 'right',
- title: '操作',
- toolbar: '#barDemo',
- width: 100,
- align: 'center'
- }
- ]
- ]
- });
- //表头工具栏事件
- $('body').on('click','.add-menu',function(){
- tool.side("/admin/sitemap/sitemap_info_add?cid="+sitemap_cate_id);
- return;
- });
-
- //监听返回
- $('body').on('click','.add-back',function () {
- history.back(-1);
- return false;
- });
- //监听行工具事件
- table.on('tool(sitemap_cate)', function (obj) {
- var data = obj.data;
- if (obj.event === 'edit') {
- tool.side('/admin/sitemap/sitemap_info_add?id='+obj.data.id);
- return;
- }
- if (obj.event === 'del') {
- layer.confirm('确定要删除该数据吗?', {
- icon: 3,
- title: '提示'
- }, function (index) {
- let callback = function (e) {
- layer.msg(e.msg);
- if (e.code == 0) {
- obj.del();
- }
- }
- tool.delete("/admin/sitemap/sitemap_info_delete", { id: data.id }, callback);
- layer.close(index);
- });
- }
- });
- }
- </script>
- {/block}
- <!-- /脚本 -->
|