$id = 'medicine-grid'; ?> <div class="row"> <div class="col-md-12 portlet light"> <?php echo GridView::widget(['id' => $id, 'title' => Yii::t('app', 'Medicine'), 'moreActionsTemplate' => '{export}', 'actionsTemplate' => '{Create}{Delete}', 'actions' => ['Create' => function () { return Html::tag('a', '添加清单', ['class' => 'btn btn-primary', 'href' => Url::toRoute('create'), 'data-action' => 'get.modal']); }, 'Delete' => function () { return Html::tag('a', '删除清单', ['class' => 'btn btn-default', 'href' => Url::toRoute('multi-delete'), 'data-action' => 'confirm.multi.grid-view.modal', 'data-message' => '确认删除 <b>${num}</b> 记录? 删除后不可恢复!']); }], 'dataProvider' => $dataProvider, 'filterModel' => $filterModel, 'columns' => [['class' => SerialColumn::className()], ['class' => CheckboxColumn::className()], ['attribute' => 'id', 'label' => '编号'], ['attribute' => 'name', 'label' => '品名'], ['attribute' => 'sid', 'label' => '类名', 'content' => function ($model, $key, $index) { return $model['serviceCategory']['name']; }], ['attribute' => 'fid', 'label' => '规格', 'content' => function ($model, $key, $index) { return $model['specifications']['name']; }], ['attribute' => 'cid', 'label' => '城市', 'content' => function ($model, $key, $index) { return $model['city']['name']; }], ['attribute' => 'sexual_taste', 'label' => '性味'], ['attribute' => 'price', 'label' => '价格'], ['attribute' => 'amount', 'label' => '数量'], ['attribute' => 'create_time', 'label' => '创建时间', 'format' => 'datetime'], ['attribute' => 'status', 'label' => '状态', 'filter' => Dict::$medicineStatus, 'content' => function ($model, $key, $index, $column) { if ($model['status'] == Dict::MEDICINE_STATUS_PENDING) { return '<span class="label label-sm label-danger">' . Dict::$medicineStatus[Dict::MEDICINE_STATUS_PENDING] . '</span>'; } else { if ($model['status'] == Dict::MEDICINE_STATUS_COMPLETE) { return '<span class="label label-sm label-success">' . Dict::$medicineStatus[Dict::MEDICINE_STATUS_COMPLETE] . '</span>'; } else { return '<span class="label label-sm label-default">' . Dict::$medicineStatus[Dict::MEDICINE_STATUS_CANCEL] . '</span>'; } } }], ['class' => ActionColumn::className(), 'template' => '{view} {update}']]]); ?> </div> </div>
use yii\helpers\Html; use ext\grid\GridView; use ext\grid\ActionColumn; use ext\grid\CheckboxColumn; use ext\Helper; use yii\grid\SerialColumn; $this->title = Yii::t('app', '用户'); $this->params['breadcrumbs'][] = ['label' => $this->title, 'url' => ['index']]; $this->params['breadcrumbs'][] = Yii::t('app', '用户列表'); $id = 'user-grid'; ?> <div class="row"> <div class="col-md-12 portlet light"> <?php echo GridView::widget(['id' => $id, 'title' => Yii::t('app', 'City'), 'moreActionsTemplate' => '{export}', 'actionsTemplate' => '{Create}{Delete}', 'actions' => ['Create' => function () { return Html::tag('a', '添加用户', ['class' => 'btn btn-primary', 'href' => Url::toRoute('create'), 'data-action' => 'get.modal']); }, 'Delete' => function () { return Html::tag('a', '删除用户', ['class' => 'btn btn-default', 'href' => Url::toRoute('multi-delete'), 'data-action' => 'confirm.multi.grid-view.modal', 'data-message' => '确认删除 <b>${num}</b> 记录? 删除后不可恢复!']); }], 'dataProvider' => $dataProvider, 'filterModel' => $filterModel, 'columns' => [['class' => SerialColumn::className()], ['class' => CheckboxColumn::className()], ['attribute' => 'id', 'label' => '编号'], ['attribute' => 'username', 'label' => '用户名'], ['attribute' => 'email', 'label' => '邮箱'], ['attribute' => 'zipcode', 'label' => '邮编'], ['attribute' => 'phone', 'label' => '电话号码'], ['attribute' => 'city', 'label' => '城市'], ['attribute' => 'state', 'label' => '国家'], ['attribute' => 'street', 'label' => '街道地址'], ['attribute' => 'created_at', 'label' => '创建时间', 'format' => 'datetime'], ['attribute' => 'status', 'label' => '状态', 'filter' => Dict::$userStatus, 'content' => function ($model, $key, $index, $column) { if ($model['status'] == Dict::USER_STATUS_FREEZE) { return '<span class="label label-sm label-danger">' . Dict::$userStatus[Dict::USER_STATUS_FREEZE] . '</span>'; } else { return '<span class="label label-sm label-success">' . Dict::$userStatus[Dict::USER_STATUS_NORMAL] . '</span>'; } }], ['class' => ActionColumn::className(), 'template' => '{view} {update}']]]); ?> </div> </div>
<?php use yii\helpers\Url; use yii\helpers\Html; use ext\grid\GridView; use ext\grid\ActionColumn; use ext\grid\CheckboxColumn; use ext\Helper; use yii\grid\SerialColumn; $this->title = Yii::t('app', '城市'); $this->params['breadcrumbs'][] = ['label' => $this->title, 'url' => ['index']]; $this->params['breadcrumbs'][] = Yii::t('app', '城市列表'); $id = 'City-grid'; ?> <div class="row"> <div class="col-md-12 portlet light"> <?php echo GridView::widget(['id' => $id, 'title' => Yii::t('app', 'City'), 'moreActionsTemplate' => '{export}', 'actionsTemplate' => '{Create}{Delete}', 'actions' => ['Create' => function () { return Html::tag('a', '添加城市', ['class' => 'btn btn-primary', 'href' => Url::toRoute('create'), 'data-action' => 'get.modal']); }, 'Delete' => function () { return Html::tag('a', '删除城市', ['class' => 'btn btn-default', 'href' => Url::toRoute('multi-delete'), 'data-action' => 'confirm.multi.grid-view.modal', 'data-message' => '确认删除 <b>${num}</b> 记录? 删除后不可恢复!']); }], 'dataProvider' => $dataProvider, 'filterModel' => $filterModel, 'columns' => [['class' => SerialColumn::className()], ['class' => CheckboxColumn::className()], ['attribute' => 'id', 'label' => '编号'], ['attribute' => 'name', 'label' => '城市名称'], ['attribute' => 'create_time', 'label' => '创建时间', 'format' => 'datetime'], ['attribute' => 'update_time', 'label' => '修改时间', 'format' => 'datetime'], ['class' => ActionColumn::className(), 'template' => '{update}', 'buttons' => ['update' => function ($url, $model, $key) { $options = ['title' => Yii::t('yii', 'update'), 'href' => $url, 'data-action' => 'get.modal']; return Html::tag('a', '<i class="fa fa-pencil"></i>', $options); }]]]]); ?> </div> </div>
?> <div class="row"> <div class="col-md-12 portlet light"> <?php echo GridView::widget(['id' => $id, 'title' => Yii::t('app', 'order'), 'moreActionsTemplate' => '{export}', 'actionsTemplate' => '{Delete}', 'actions' => ['Delete' => function () { return Html::tag('a', '删除订单', ['class' => 'btn btn-default', 'href' => Url::toRoute('multi-delete'), 'data-action' => 'confirm.multi.grid-view.modal', 'data-message' => '确认删除 <b>${num}</b> 记录? 删除后不可恢复!']); }], 'dataProvider' => $dataProvider, 'filterModel' => $filterModel, 'columns' => [['class' => SerialColumn::className()], ['class' => CheckboxColumn::className()], ['attribute' => 'id', 'label' => '编号'], ['attribute' => 'name', 'label' => '订单名称'], ['attribute' => 'medicine_id', 'label' => '品名', 'content' => function ($model, $key, $index) { return $model['medicine']['name']; }], ['attribute' => 'medicine_id', 'label' => '价格', 'content' => function ($model, $key, $index) { return $model['medicine']['price']; }], ['attribute' => 'amount', 'label' => '数量'], ['attribute' => 'user_id', 'label' => '用户邮箱', 'content' => function ($model, $key, $index) { return $model['user']['email']; }], ['attribute' => 'user_id', 'label' => '用户电话', 'content' => function ($model, $key, $index) { return $model['user']['phone']; }], ['attribute' => 'create_time', 'label' => '创建时间', 'format' => 'datetime'], ['attribute' => 'status', 'label' => '状态', 'filter' => Dict::$order, 'content' => function ($model, $key, $index, $column) { if ($model['status'] == Dict::ORDER_STATUS_COMPLETE) { return '<span class="label label-sm label-danger">' . Dict::$order[Dict::ORDER_STATUS_COMPLETE] . '</span>'; } else { if ($model['status'] == Dict::ORDER_STATUS_COMPLETE) { return '<span class="label label-sm label-success">' . Dict::$order[Dict::ORDER_STATUS_COMPLETE] . '</span>'; } else { return '<span class="label label-sm label-default">' . Dict::$order[Dict::ORDER_STATUS_CANCEL] . '</span>'; } } }], ['class' => ActionColumn::className(), 'template' => '{view} {update}', 'buttons' => ['update' => function ($url, $model, $key) { $options = ['title' => Yii::t('yii', 'update'), 'href' => $url, 'data-action' => 'get.modal']; return Html::tag('a', '<i class="fa fa-pencil"></i>', $options); }]]]]); ?> </div> </div>