1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <div class="layui-layout layui-layout-admin" style="padding-left: 20px;">
- <div class="layui-row" style="margin-top: 20px;">
- <div class="layui-col-xs6">
- <a class="layui-btn" data-type="tabAdd" href="/propertynotice/add">新增</a>
- </div>
- </div>
- <table class="layui-hide" id="table_list" lay-filter="table_filter">
- </table>
- <script type="text/html" id="bar">
- <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
- <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete">删除</a>
- </script>
- </div>
- <script type="text/javascript">
- layui.use(['table','form','element'], function(){
- var table = layui.table;
- var form = layui.form;
- var element = layui.element;
- //方法级渲染
- table.render({
- elem: '#table_list'
- ,url: '/propertynotice/index'
- ,cols: [[
- {field:'id', title: 'ID', align:'center',sort: true, width:150}
- ,{field:'title',title: '标题'}
- ,{field:'create_time', title: '创建时间'}
- ,{fixed: 'right', width:160, align:'center', toolbar: '#bar'}
- ]]
- ,id: 'listReload'
- ,page: true
- ,height: "full-130"
- });
- var $ = layui.$;
- //监听工具条
- table.on('tool(table_filter)', function(obj){
- var data = obj.data;
- if(obj.event === 'edit'){
- window.location.href="/propertynotice/edit?id="+data.id
- } else if(obj.event === 'delete'){
- layer.confirm('确定删除【'+data.title+'】', function(index){
- var jsData = {'id':data.id}
- $.post('/propertynotice/del', jsData, function (out) {
- if (out.status == 0) {
- layer.alert(out.message, {icon: 1},function(index){
- layer.close(index);
- window.location.reload();
- });
- } else {
- layer.msg(out.message)
- }
- }, "json");
- layer.close(index);
- })
- }else{
- layer.msg('操作不存在');
- }
- });
- });
- </script>
|