public function actionIndex() { $params = Yii::$app->request->get(); $searchModel = new ErrorLogSearch(); $dataProvider = $searchModel->search($params); $query = $dataProvider->query; $sort = new Sort(['attributes' => ['AddDate'], 'defaultOrder' => ['AddDate' => SORT_DESC]]); $locals = ToolService::getPagedRows($query, $tablename = 'ErrorLog', $params, ['orderBy' => $sort->orders, 'pageSize' => 10]); $locals['searchModel'] = $searchModel; $application_item = ErrorLogService::getApplicationNameItem(0); $locals['application_item'] = $application_item; return $this->render('index', $locals); }
<i class="fa fa-chevron-up"></i> </a> <a class="expand-link"> <i class="fa fa-expand"></i> </a> <a class="close-link"> <i class="fa fa-times"></i> </a> </div> <div class="no-move"></div> </div> <div class="box-content"> <?php Pjax::begin(['id' => 'countries']); if (isset($p_get['type']) && $p_get['type'] != 1) { $searchModel = new ErrorLogSearch(); $dataProvider = $searchModel->search($params); ?> <script type="text/javascript"> $(document).ready(function() { <?php if (isset($params['ErrorLogSearch']['start_date']) && !empty($params['ErrorLogSearch']['start_date'])) { ?> $("#ErrorLogSearch-start_date").val("<?php echo $params['ErrorLogSearch']['start_date']; ?> "); <?php } if (isset($params['ErrorLogSearch']['end_date']) && !empty($params['ErrorLogSearch']['end_date'])) { ?>
<?php echo Breadcrumbs::widget(['tag' => 'ol', 'itemTemplate' => "<li>{link}</li>\n", 'links' => [['label' => '错误信息', 'url' => ['/ajax/error/index']], ['label' => $typename->newname]]]); ?> </section> <!-- Main content --> <section class="content"> <div class="row"> <div class="col-xs-12"> <div class="box"> <div class="box-header"> <h3 class="box-title">数据列表</h3> </div><!-- /.box-header --> <div class="box-body"> <?php Pjax::begin(['id' => 'countries']); $searchModel = new ErrorLogSearch(); $dataProvider = $searchModel->search($params); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'ApplicationName', 'label' => '类型', 'value' => function ($model) { return Html::encode($model->ApplicationId); }], ['label' => '函数', 'filter' => Html::activeTextInput($searchModel, 'Method', ['class' => 'form-control']), 'format' => 'raw', 'value' => function ($model) { return Html::encode($model->Method); }], ['label' => '参数', 'filter' => Html::activeTextInput($searchModel, 'Parameter', ['class' => 'form-control']), 'format' => 'raw', 'value' => function ($model) { return Html::encode($model->Parameter); }], ['attribute' => 'start_date', 'label' => '开始时间', 'value' => 'AddDate', 'filter' => \yii\jui\DatePicker::widget(['model' => $searchModel, 'attribute' => 'start_date', 'language' => 'zh-CN', 'dateFormat' => 'yyyy-MM-dd']), 'format' => 'html'], ['attribute' => 'end_date', 'label' => '结束时间', 'value' => 'AddDate', 'filter' => \yii\jui\DatePicker::widget(['model' => $searchModel, 'attribute' => 'end_date', 'language' => 'zh-CN', 'dateFormat' => 'yyyy-MM-dd', 'value' => date('Y-m-d')]), 'format' => 'html'], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}', 'buttons' => ['view' => function ($url, $model, $key) { $options = ['title' => Yii::t('yii', 'View'), 'aria-label' => Yii::t('yii', 'View'), 'class' => 'show_model']; $url = 'javascript:showDetaildiv("text' . $model->Id . '");'; return Html::textarea('text' . $model->Id, Html::encode($model->Content), ['style' => 'display:none;', 'id' => 'text' . $model->Id]) . Html::a('<button type="button" class="btn btn-sm btn-info">查看详情</button>', $url, $options); }]]]]); Pjax::end();