| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <?php
- /* @var $this \yii\web\View */
- $this->title = '公告';
- ?>
- <?php $this->beginBlock('header_script'); ?>
- <link href="<?= STATIC_URL ?>/ui/css/plugins/dataTables/datatables.min.css" rel="stylesheet">
- <style>
- label.error {
- display: none !important;
- }
- #datatables {
- width: 100% !important;
- }
- .table-responsive tbody tr {
- cursor: pointer;
- }
- </style>
- <?php $this->endBlock(); ?>
- <div class="row">
- <div class="col-md-3">
- <?= $this->render('/common/_left_menu.php') ?>
- </div>
- <div class="col-md-9">
- <div class="ibox">
- <div class="ibox-title">
- <h2>公告</h2>
- </div>
- <div class="ibox-content">
- <div class="table-responsive">
- <table id="datatables"
- class="table table-striped table-bordered table-hover dataTables-example">
- <thead>
- <tr>
- <th>标题</th>
- <th>发布时间</th>
- <th>是否已读</th>
- </tr>
- </thead>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- <?php $this->beginBlock('footer_script'); ?>
- <script src = "<?= STATIC_URL ?>/ui/js/plugins/dataTables/datatables.min.js" ></script>
- <script>
- var table
- $(document).ready(function () {
- table = $('#datatables').DataTable({
- 'aLengthMenu': [[20, 50, 100], [20, 50, 100]],
- language: {
- 'sProcessing': '处理中...',
- 'sLengthMenu': '显示 _MENU_ 项结果',
- 'sZeroRecords': '没有匹配结果',
- 'sInfo': '显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项',
- 'sInfoEmpty': '显示第 0 至 0 项结果,共 0 项',
- 'sInfoFiltered': '(由 _MAX_ 项结果过滤)',
- 'sInfoPostFix': '',
- 'sSearch': '搜索:',
- 'sUrl': '',
- 'sEmptyTable': '表中数据为空',
- 'sLoadingRecords': '载入中...',
- 'sInfoThousands': ',',
- 'oPaginate': {
- 'sFirst': '首页',
- 'sPrevious': '上页',
- 'sNext': '下页',
- 'sLast': '末页'
- },
- 'oAria': {
- 'sSortAscending': ': 以升序排列此列',
- 'sSortDescending': ': 以降序排列此列'
- }
- },
- 'processing': true,
- 'serverSide': true,
- 'ajax': '<?= \yii\helpers\Url::to(['/ib/notice/notice-ajax']) ?>',
- 'order': [[1, 'desc']],
- 'columns': [{
- 'data': 'title',
- 'orderable': false
- },
- {
- 'data': 'in_time'
- },
- {
- 'data': 'isRead'
- }],
- columnDefs: [{
- targets: 1,
- render: function (data, type, row, meta) {
- return timeStamp2String(parseInt(data))
- },
- 'orderable': true
- }, {
- targets: 2,
- render: function (data, type, row, meta) {
- if (data) {
- return '<span class="label">已读</span>'
- } else {
- return '<span class="label label-danger">未读</span>'
- }
- },
- 'orderable': false
- }],
- 'sPaginationType': 'full_numbers',
- dom: '<"html5buttons"B>lTfgitp',
- buttons: [{
- extend: 'copy'
- },
- {
- extend: 'csv'
- },
- {
- extend: 'excel'
- },
- {
- extend: 'pdf'
- },
- {
- extend: 'print',
- customize: function (win) {
- $(win.document.body).addClass('white-bg')
- $(win.document.body).css('font-size', '10px')
- $(win.document.body).find('table').addClass('compact').css('font-size', 'inherit')
- }
- }]
- })
- $('#datatables tbody').on('click', 'tr',
- function () {
- if ($(this).hasClass('selected')) {
- $(this).removeClass('selected')
- } else {
- table.$('tr.selected').removeClass('selected')
- $(this).addClass('selected')
- }
- var data = table.row('.selected').data()
- if (data != undefined) {
- var url = '/ib/notice/nview?id=' + data.id
- window.location.href = url
- }
- })
- })
- </script>
- <?php $this->endBlock(); ?>
|