GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ //['class' => 'yii\grid\SerialColumn'], 'extract_id', [ 'attribute' => 'user_type', 'filter'=> Html::activeDropDownList ( $searchModel, 'user_type', Extract::$userTypes, [ 'class' => 'form-control','prompt' => '请选择' ] ), 'label'=>'用户类型', 'value'=>function ($model) {return Extract::$userTypes[$model->user_type];}, 'headerOptions' => ['width' => '60'], ], 'money', 'bank_code', 'bank_type', 'account_name', [ 'attribute' => 'add_time', 'label'=>'申请时间', 'value'=> function($model){ return date('Y-m-d H:i:s',$model->add_time); //主要通过此种方式实现 }, //'headerOptions' => ['width' => '160'], ], [ 'attribute' => 'check_time', 'label'=>'处理时间', 'value'=> function($model){ return date('Y-m-d H:i:s',$model->check_time); //主要通过此种方式实现 }, //'headerOptions' => ['width' => '160'], ], [ 'attribute' => 'status', 'filter'=> Html::activeDropDownList ( $searchModel, 'status', Extract::$statuses, [ 'class' => 'form-control','prompt' => '请选择' ] ), 'label'=>'用户类型', 'value'=>function ($model) {return Extract::$statuses[$model->status];}, 'headerOptions' => ['width' => '60'], ], [ 'class' => 'yii\grid\ActionColumn', 'template' => '{view} {process} {pass} {refuse}', 'buttons' => [ // 下面代码来自于 yii\grid\ActionColumn 简单修改了下 'view' => function ($url, $model, $key) { $options = [ 'title' => Yii::t('yii', 'View'), 'aria-label' => Yii::t('yii', 'View'), 'data-pjax' => '0', ]; return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, $options); }, 'process' => function($url, $model, $key){ $html = ''; if($model->status==Extract::STATUS_APPLYING){ $html = Html::a('审核', $url, [ 'title' => '审核', 'data-confirm' => '确定通过吗?', 'data-method' => 'post', 'data-pjax' => '0', ]); } return $html; }, 'pass' => function($url, $model, $key){ $html = ''; if($model->status==Extract::STATUS_APPLYING){ $html = Html::a('<span class="glyphicon glyphicon-ok"></span>', $url, [ 'title' => '通过', 'data-confirm' => '确认通过吗?', 'data-method' => 'post', 'data-pjax' => '0', ]); } return $html; }, 'refuse' => function($url, $model, $key){ $html = ''; if($model->status==Extract::STATUS_APPLYING){ $html = Html::a('<span class="glyphicon glyphicon-remove"></span>', $url, [ 'title' => '拒绝', 'data-confirm' => '确定拒绝吗?', 'data-method' => 'post', 'data-pjax' => '0', ]); } return $html; }, ] ], ], ]);
扫码二维码 获取免费视频学习资料
- 本文固定链接: http://phpxs.com/post/4049/
- 转载请注明:转载必须在正文中标注并保留原文链接
- 扫码: 扫上方二维码获取免费视频资料
查 看2022高级编程视频教程免费获取