title = '全部消息'; } else { $this->title = NotifyTypeEnum::getValue($type) . '列表'; } $this->params['breadcrumbs'][] = $this->title; ?>

消息提醒

render('_nav') ?>

title; ?>

$type], [ 'onclick' => "rfTwiceAffirm(this, '确认全部设为已读么?', '可能会漏看一些关键信息,请谨慎操作');return false;" ]) ?>
'btn btn-white btn-sm m-l-n-md read']); ?> 'btn btn-white btn-sm delete hide']); ?>
$dataProvider, 'filterModel' => $searchModel, //重新定义分页样式 'tableOptions' => ['class' => 'table table-hover'], 'options' => [ 'id' => 'grid' ], 'columns' => [ [ 'class' => 'yii\grid\CheckboxColumn', 'checkboxOptions' => function ($model, $key, $index, $column) { return [ 'value' => $model->id, ]; } ], [ 'class' => 'yii\grid\SerialColumn', 'visible' => true, // 不显示# ], 'notify.title', [ 'label' => '消息内容', 'attribute' => 'notify.content', 'format' => 'raw', 'filter' => false, //不显示搜索框 'value' => function ($model) { if ($model->type == NotifyTypeEnum::ANNOUNCE) { return '内容过多,请查看详情'; } $str = $model->notify->content ?? ''; $model->notify->target_id> 0 && $str .= ' #' . $model->notify->target_id . ''; return $str; }, ], [ 'label' => '创建时间', 'attribute' => 'created_at', 'headerOptions' => ['class' => 'col-md-2'], 'filter' => false, //不显示搜索框 'format' => ['date', 'php:Y-m-d H:i:s'], ], [ 'label' => '查看时间', 'attribute' => 'updated_at', 'headerOptions' => ['class' => 'col-md-1'], 'filter' => false, //不显示搜索框 'value' => function ($model) { if (empty($model['is_read'])) { return '未读'; } return Yii::$app->formatter->asRelativeTime($model['updated_at']); }, ], [ 'label' => '操作', 'format' => 'raw', 'headerOptions' => ['class' => 'col-md-1'], 'value' => function ($model) { switch ($model->type) { case NotifyTypeEnum::ANNOUNCE : return Html::a('查看详情', ['announce-view', 'id' => $model->id], [ 'class' => 'blue', ]); default : if (!empty($model->notify->link)) { return Html::a('查看详情', [$model->notify->link], [ 'class' => 'blue openIframeView', ]); } break; } return ''; } ] ], ]); ?>