123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <div class="layui-layout layui-layout-admin" style="padding-left: 20px;">
- <div class="layui-row" style="margin-top: 20px;">
- <div class="layui-col-xs6">
- <div class="layui-btn-group">
- <button class="layui-btn" id="add_api">增加</button>
- </div>
- <!-- <a class="layui-btn" data-type="tabAdd" href="/api/add">新增</a> -->
- <!-- <a href="javascript:;" id="add_api" class="layui-btn"> 新增接口 </a>
- <a href="javascript:;" id="add_audit" class="layui-btn layui-btn-primary"> 提交审核 </a> -->
- </div>
- <div class="layui-col-xs6 search_text">
- <form class="layui-form" action="" onsubmit="javascript:return false;">
- <div class="demoTable">
- <div class="layui-inline" style="width: 40%">
- <input class="layui-input" name="ApiPublicName" id="ApiPublicName" autocomplete="off" placeholder="文档名称" >
- </div>
-
- <button class="layui-btn" data-type="reload" id="reload">查询</button>
- </div>
- </form>
- </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="del">删除</a>
- </script>
- </div>
- <script>
- layui.use(['table','form','element'], function(){
- var table = layui.table;
- var form = layui.form;
- var element = layui.element;
- //方法级渲染
- table.render({
- elem: '#table_list'
- ,url: '/apipublic/table'
- ,cols: [[
- // {checkbox: true, fixed: true},
- {field:'id', title: 'ID', align:'center',sort: true, width:50}
- ,{field:'api_public_name',title: '文档名称'}
- ,{field:'sort',title: '排序'}
- ,{field:'create_time', title: '创建时间'}
- ,{field:'update_time', title: '修改时间'}
- ,{fixed: 'right', width:160, align:'center', toolbar: '#bar'}
- ]]
- ,id: 'listReload'
- ,page: true
- ,height: "full-130"
- });
- var $ = layui.$, active = {
- reload: function(){
- table.reload('listReload', {
- where: {
- ApiPublicName: $('#ApiPublicName').val()
- }
- });
- }
- };
- $("#add_api").on("click",function() {
- window.location.href="/apipublic/add"
- })
- //监听工具条
- table.on('tool(table_filter)', function(obj){
- var data = obj.data;
- if(obj.event === 'edit'){
- window.location.href="/apipublic/edit?id="+data.id
- } else if(obj.event === 'del'){
- var msg = "确定要删除"+data.api_public_name+"吗?";
-
- layer.confirm(msg, function(){
- var del_data = {"id":data.id}
- $.post('{{urlfor "ApiPublicController.AjaxDel"}}', del_data, function (out) {
- if (out.status == 0) {
- layer.msg("操作成功",{icon: 1},function () {
- $("#reload").click();
- })
- } else {
- layer.msg(out.message)
- }
- }, "json");
- return false;
- });
- return false;
-
- }else{
- layer.msg('操作不存在');
- }
- });
- $('.demoTable .layui-btn').on('click', function(){
- var type = $(this).data('type');
- active[type] ? active[type].call(this) : '';
- });
- });
- </script>
|