12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- {extend name="common/base"/}
- <!-- 主体 -->
- {block name="body"}
- <div class="p-3">
- <div>
- <table class="layui-hide" id="treeTable" lay-filter="treeTable"></table>
- </div>
- </div>
- {/block}
- <!-- /主体 -->
- <!-- 脚本 -->
- {block name="script"}
- <script>
- const moduleInit = ['tool', 'treeGrid'];
- function gouguInit() {
- var treeGrid = layui.treeGrid,table = layui.table, tool = layui.tool;
- var allcount;
- var pageTable = treeGrid.render({
- id: 'treeTable',
- elem: '#treeTable',
- idField: 'id',
- url: "/admin/pushmember/index",
- cellMinWidth: 80,
- parseData: function (res) { // 数据解析回调函数
- // 在这里可以获取数据总数
- allcount = res.data.length;
- return {
- code: res.code, // 数据状态码
- msg: res.msg, // 状态信息
- count: res.count, // 数据总数
- data: res.data // 当前页数据
- };
- },
- treeId: 'id',//树形id字段名称
- treeUpId: 'pid',//树形父id字段名称
- treeShowName: 'title',//以树形式显示的字段
- height: 'full-0',
- isOpenDefault:true,
- cols: [[
- { field: 'id', width: 100, title: '编号', align: 'center',
- templet: function (d) {
- console.log(allcount,d.LAY_NUM)
- return allcount - (d.LAY_INDEX - 1);
-
- } },
- // { field: 'pid', title: '上级部门ID',width: 120, align: 'center'},
- { field: 'title', title: '通知情况', width: 315},
- { field: 'pushmember', title: '抄送人员', width: 315},
- // { field: 'financial', title: '财政局抄送人员', width: 315},
-
- { width:180, title: '操作', align: 'center', templet: function (d) {
- if(d.pid == 0){
- return '';
- }else{
- var html =
- '<span class="layui-btn-group">' +
- '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">设置</button>' +
-
- '</span>';
- return html;
- }
-
- }
- },
- ]],
- page: false,
- });
-
- //操作按钮
- treeGrid.on('tool(treeTable)', function (obj) {
-
- if (obj.event === 'edit') {
- tool.side("/admin/pushmember/edit?id="+obj.data.id);
- return;
- }
-
- });
- }
- </script>
- {/block}
- <!-- /脚本 -->
|