index.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. use yii\grid\GridView;
  3. use common\helpers\Html;
  4. use common\enums\AppEnum;
  5. use common\helpers\MemberHelper;
  6. use common\helpers\DebrisHelper;
  7. $this->title = '行为日志';
  8. $this->params['breadcrumbs'][] = ['label' => $this->title, 'url' => ['index']];
  9. ?>
  10. <div class="row">
  11. <div class="col-12 col-xs-12">
  12. <div class="box">
  13. <div class="box-header">
  14. <h3 class="box-title"><?= $this->title; ?></h3>
  15. </div>
  16. <div class="box-body table-responsive">
  17. <?= GridView::widget([
  18. 'dataProvider' => $dataProvider,
  19. 'filterModel' => $searchModel,
  20. // 重新定义分页样式
  21. 'tableOptions' => ['class' => 'table table-hover'],
  22. 'columns' => [
  23. 'id',
  24. MemberHelper::gridView($searchModel),
  25. [
  26. 'attribute' => 'app_id',
  27. 'filter' => Html::activeDropDownList($searchModel, 'app_id', AppEnum::getMap(), [
  28. 'prompt' => '全部',
  29. 'class' => 'form-control'
  30. ]),
  31. 'value' => function ($model) {
  32. return AppEnum::getValue($model->app_id);
  33. },
  34. 'headerOptions' => ['class' => 'col-md-1'],
  35. ],
  36. 'url',
  37. 'behavior',
  38. 'remark',
  39. [
  40. 'label' => '位置信息',
  41. 'value' => function ($model) {
  42. $str = [];
  43. $str[] = DebrisHelper::analysisIp($model->ip);
  44. $str[] = $model->ip;
  45. return implode('</br>', $str);
  46. },
  47. 'format' => 'raw',
  48. ],
  49. [
  50. 'attribute' => 'created_at',
  51. 'filter' => false, //不显示搜索框
  52. 'format' => ['date', 'php:Y-m-d H:i:s'],
  53. ],
  54. [
  55. 'header' => "操作",
  56. 'class' => 'yii\grid\ActionColumn',
  57. 'template' => '{view}',
  58. 'buttons' => [
  59. 'view' => function ($url, $model, $key) {
  60. return Html::linkButton(['view', 'id' => $model->id], '查看详情', [
  61. 'data-toggle' => 'modal',
  62. 'data-target' => '#ajaxModalLg',
  63. ]);
  64. },
  65. ],
  66. ],
  67. ],
  68. ]); ?>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
粤ICP备19079148号