index.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. use yii\grid\GridView;
  3. use yii\helpers\Html;
  4. /* @var $searchModel backend\models\search\PolicySearch */
  5. /* @var $this yii\web\View */
  6. /* @var $dataProvider yii\data\ActiveDataProvider */
  7. /* @var $cengciList [] */
  8. $this->title = '政策列表';
  9. $this->params['breadcrumbs'][] = $this->title;
  10. ?>
  11. <?php $this->beginBlock('content-header'); ?>
  12. <?= $this->title . ' ' . Html::a(Yii::t('common', '新增政策'), ['create'], ['class' => 'btn btn-success']) ?>
  13. <?php $this->endBlock(); ?>
  14. <?php echo $this->render('_search', ['model' => $searchModel, 'cengciList' => $cengciList]); ?>
  15. <div class="box box-success">
  16. <div class="box-body">
  17. <?= GridView::widget([
  18. 'dataProvider' => $dataProvider,
  19. 'columns' => [
  20. 'id',
  21. 'title',
  22. [
  23. 'attribute' => 'type',
  24. 'value' => function ($model) {
  25. /* @var $model \common\models\Policy */
  26. return $model->getTypeText();
  27. },
  28. ],
  29. [
  30. 'attribute' => 'estate',
  31. 'value' => function ($model) {
  32. /* @var $model \common\models\Policy */
  33. if ($model->estate) {
  34. return \common\enums\PolicyEnum::$list[$model->estate];
  35. } else {
  36. return '';
  37. }
  38. },
  39. ],
  40. 'cengci',
  41. 'author',
  42. [
  43. 'class' => 'backend\widgets\grid\PositionColumn',
  44. 'attribute' => 'sort'
  45. ],
  46. 'created_at:datetime',
  47. ['class' => 'common\helpers\DiyActionColumn'],
  48. ],
  49. ]); ?>
  50. </div>
  51. </div>