@extends('layout') @section('content') <body class="gray-bg"> <div class="wrapper wrapper-content animated fadeInRight"> <div class="row"> <div class="col-sm-12"> <div class="ibox float-e-margins"> <div class="ibox-title"></div> <div class="ibox-content"> <form class="row" id="searchForm"> <div class="col-md-4"> <div class="input-group"> <span class="input-group-btn"> <button type="button" class="btn btn-md btn-info" id="on"><span class="glyphicon glyphicon-hand-up"></span> 启用</button> <button type="button" class="btn btn-md btn-warning" id="off" style="margin-left: 10px"><span class="glyphicon glyphicon-hand-down"></span> 禁用</button> <button type="button" class="btn btn-md btn-primary" id="add" style="margin-left: 10px"> <span class="glyphicon glyphicon-plus"></span> 添加</button> <button type="button" class="btn btn-md btn-danger" id="batchDelete" style="margin-left: 10px"><span class="glyphicon glyphicon-remove"></span> 删除</button> </span> </div> </div> <div class="col-md-6 pull-right"> <div class="input-group"> <input type="text" placeholder="请输入关键词" class="input-md form-control" name="keyWord" id="keyWord"> <span class="input-group-btn"> <button type="button" class="btn btn-md btn-primary" onclick="refresh()"> 搜索</button> <button type="reset" class="btn btn-md btn-primary" style="margin-left: 10px" name="resetBtn"> 重置</button> </span> </div> </div> {{--<div class="col-sm-2 pull-right" style="text-align: right">--}} {{--<button type="button" class="btn btn-md btn-primary" id="addBtn"> 添加</button>--}} {{--</div>--}} </form> <hr> <div class="table-responsive"> <table id="table" class="table table-condensed" data-mobile-responsive="true"></table> </div> </div> </div> </div> </div> </div> </body> @endsection @section('footer') <script> var units = { getIdsBySelections: function () { var selections = $("#table").bootstrapTable('getSelections'); var ids = []; $.each(selections, function (inx, val) { ids.push(val.id); }); return ids; }, edit: function (id) { layer.open({ type: 2, content: ['/project/show/' + id], area: ['60%', '70%'], title: '修改' }); }, detail: function (id) { layer.open({ type: 2, content: ['/system/user/' + id], area: ['50%', '60%'], title: '详情' }); } }; var config = {}; config.url = '/projects'; config.columns = [ //字段 {checkbox: true}, { title: '序号', align: 'center', formatter: function (value, item, index) { return index + 1; } }, {title: '项目名称', field: 'title', align: 'center'}, {title: '域名', field: 'domain', align: 'center'}, {title: 'ae人员', field: 'ae_name', align: 'center'}, {title: '状态', field: 'status_title', align: 'center'}, {title: '创建时间', field: 'created_at', align: 'center'}, { title: '操作', field: 'id', align: 'center', formatter: function (value) { return ( '<button onclick="units.edit(' + value + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>编辑</button> ' + '<button onclick="units.detail(' + value + ')" class="btn btn-xs"><span class="glyphicon glyphicon-menu-hamburger"></span>详情</button>' ); } } ]; tips.bootstrapTable(config); $(document).on('click', '#on', function () { var ids = units.getIdsBySelections(); if (ids.length === 0) { layer.alert('请先选择您所要操作的对象'); return; } tips.ajax({url: '/system/users/on', type: 'put', data: {ids: ids}}); tips.tableRefresh('#table'); }); $(document).on('click', '#off', function () { var ids = units.getIdsBySelections(); if (ids.length === 0) { layer.alert('请先选择您所要操作的对象'); return; } tips.ajax({url: '/system/users/off', type: 'put', data: {ids: ids}}); tips.tableRefresh('#table'); }); $(document).on('click', '#batchDelete', function () { var ids = units.getIdsBySelections(); if (ids.length === 0) { layer.alert('请先选择您所要操作的对象'); return; } layer.confirm('您确定要删除吗?', {icon: 3, title: '删除信息'}, function () { tips.ajax({url: '/system/users', type: 'delete', data: {ids: ids}}); tips.tableRefresh('#table'); }); }); $(document).on('click', '#add', function () { layer.open({ type: 2, content: ['/project/show/0'], area: ['60%', '70%'], title: '添加' }); }); </script> @endsection