| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- use yii\grid\GridView;
- use common\helpers\Html;
- $this->title = '商品参数';
- $this->params['breadcrumbs'][] = $this->title;
- ?>
- <div class="row">
- <div class="col-12 col-xs-12">
- <div class="box">
- <div class="box-header">
- <h3 class="box-title"><?= $this->title; ?></h3>
- <div class="box-tools">
- <?= Html::create(['edit']); ?>
- </div>
- </div>
- <!-- /.box-header -->
- <div class="box-body table-responsive">
- <?= GridView::widget([
- 'dataProvider' => $dataProvider,
- 'filterModel' => $searchModel,
- //重新定义分页样式
- 'tableOptions' => ['class' => 'table table-hover'],
- 'columns' => [
- [
- 'class' => 'yii\grid\SerialColumn',
- ],
- 'title',
- [
- 'label' => '参数标签',
- 'filter' => false, //不显示搜索框
- 'value' => function ($model) {
- $data = [];
- foreach ($model->value as $item) {
- $data[] = $item['title'];
- }
- return implode(',', $data);
- },
- ],
- [
- 'attribute' => 'sort',
- 'filter' => false, //不显示搜索框
- 'value' => function ($model) {
- return Html::sort($model->sort);
- },
- 'format' => 'raw',
- 'headerOptions' => ['class' => 'col-md-1'],
- ],
- [
- 'header' => "操作",
- 'class' => 'yii\grid\ActionColumn',
- 'template' => '{edit} {status} {delete}',
- 'buttons' => [
- 'edit' => function ($url, $model, $key) {
- return Html::edit(['edit', 'id' => $model->id]);
- },
- 'status' => function ($url, $model, $key) {
- return Html::status($model->status);
- },
- 'delete' => function ($url, $model, $key) {
- return Html::delete(['destroy', 'id' => $model->id]);
- },
- ],
- ],
- ],
- ]); ?>
- <!-- /.box-body -->
- </div>
- <!-- /.box -->
- </div>
- </div>
- </div>
|