index.php 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. use common\models\Space;
  3. use yii\helpers\Html;
  4. use yii\grid\GridView;
  5. use yii\helpers\Url;
  6. /* @var $this yii\web\View */
  7. /* @var $searchModel backend\models\search\SpaceSearch */
  8. /* @var $dataProvider yii\data\ActiveDataProvider */
  9. $this->title = Yii::t('common', 'Spaces');
  10. $this->params['breadcrumbs'][] = $this->title;
  11. ?>
  12. <?php $this->beginBlock('content-header') ?>
  13. <?= $this->title . ' ' . Html::a(Yii::t('common', 'Create Space'), ['create'], ['class' => 'btn btn-success']) ?>
  14. <?php $this->endBlock() ?>
  15. <?php echo $this->render('_search', ['model' => $searchModel]); ?>
  16. <div class="box box-success">
  17. <div class="box-body">
  18. <?= GridView::widget([
  19. 'dataProvider' => $dataProvider,
  20. //'filterModel' => $searchModel,
  21. 'columns' => [
  22. 'id',
  23. 'name',
  24. 'desc',
  25. [
  26. 'attribute' => 'province',
  27. 'format' => 'raw',
  28. 'value' => function ($model) {
  29. return \common\models\Region::getNameById($model->province);
  30. },
  31. ],
  32. [
  33. 'attribute' => 'city',
  34. 'format' => 'raw',
  35. 'value' => function ($model) {
  36. return \common\models\Region::getNameById($model->city);
  37. },
  38. ],
  39. [
  40. 'attribute' => 'area',
  41. 'format' => 'raw',
  42. 'value' => function ($model) {
  43. return \common\models\Region::getNameById($model->area);
  44. },
  45. ],
  46. // 'address',
  47. 'contacts',
  48. 'tel',
  49. 'created_at:datetime',
  50. 'updated_at:datetime',
  51. [
  52. 'attribute' => 'status',
  53. 'value' => function ($model) {
  54. return Space::getStatusList($model->status);
  55. },
  56. ],
  57. ['class' => 'common\helpers\DiyActionColumn',
  58. 'template' => '{goods} {view} {update} {delete}',
  59. 'buttons' => [
  60. 'goods' => function ($url, $model, $key) {
  61. return Html::a('商品设置', Url::to(['/goods-index/create', 'entity' => Space::className(),'entity_id'=>$model->id,'origin'=>Yii::$app->request->url]), [
  62. 'class' => 'btn btn-success btn-xs',
  63. 'title'=>Yii::t('common', 'Create Goods Index'),
  64. 'target'=>'_blank'
  65. ]);
  66. },
  67. 'view' => function ($url, $model, $key) {
  68. return Html::a('查看', Url::to(['/space/view', 'id' => $model->id]), [
  69. 'class' => 'btn btn-success btn-xs',
  70. 'title'=>$model->name.'空间详情',
  71. 'target'=>'_blank'
  72. ]);
  73. },
  74. ]
  75. ],
  76. ],
  77. ]); ?>
  78. </div>
  79. </div>