From: fomichev Date: Tue, 18 Feb 2025 06:54:08 +0000 (+0300) Subject: Выгрузка в учсуд X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=dc55c931b9ef1f2736b6c53b65196b38a82334db;p=erp24_rep%2Fyii-erp24%2F.git Выгрузка в учсуд --- diff --git a/erp24/composer.json b/erp24/composer.json index ec2445cc..02825c64 100644 --- a/erp24/composer.json +++ b/erp24/composer.json @@ -38,7 +38,8 @@ "enqueue/amqp-lib": "^0.10.19", "vlucas/phpdotenv": "^5.6", "softark/yii2-dual-listbox": "^1.0", - "kartik-v/yii2-widget-depdrop": "dev-master" + "kartik-v/yii2-widget-depdrop": "dev-master", + "kartik-v/yii2-export": "@dev" }, "require-dev": { "yiisoft/yii2-debug": "~2.1.0", diff --git a/erp24/config/web.php b/erp24/config/web.php index 5046e664..874a787c 100644 --- a/erp24/config/web.php +++ b/erp24/config/web.php @@ -18,7 +18,8 @@ $config = [ ], 'modules' => [ 'gridview' => [ - 'class' => '\kartik\grid\Module' + 'class' => '\kartik\grid\Module', + 'downloadAction' => 'gridview/export/download', ], 'crud' => [ 'class' => \yii\base\Module::class, diff --git a/erp24/views/products1c-nomenclature/index.php b/erp24/views/products1c-nomenclature/index.php index 815e5d1c..b68c2ae1 100644 --- a/erp24/views/products1c-nomenclature/index.php +++ b/erp24/views/products1c-nomenclature/index.php @@ -1,5 +1,6 @@ params['breadcrumbs'][] = $this->title;

title) ?>

+ SerialColumn::class], + 'id', + 'location', + 'name', + 'type_num', + 'category', + 'subcategory', + 'species', + 'sort', + 'type', + 'size', + 'measure', + 'color', + [ + 'class' => ActionColumn::class, + 'header' => 'Действия', + 'template' => '{view}', + 'urlCreator' => function ($action, Products1cNomenclature $model, $key, $index, $column) { + return Url::toRoute([$action, 'id' => $model->id]); + } + ], + ]; + $exportMenu = ExportMenu::widget([ + 'dataProvider' => $dataProvider, + 'columns' => $gridColumns, + 'exportConfig' => [ + ExportMenu::FORMAT_EXCEL => [ + 'label' => 'Excel', + 'filename' => 'export_' . date('Y-m-d'), + ], + ], + 'dropdownOptions' => [ + 'label' => 'Экспорт данных', + 'class' => 'btn btn-secondary', + ], + ]); ?> + $dataProvider, 'filterModel' => $searchModel, - 'columns' => [ - ['class' => SerialColumn::class], - 'id', - 'location', - 'name', - 'type_num', - 'category', - 'subcategory', - 'species', - 'sort', - 'type', - 'size', - 'measure', - 'color', - [ - 'class' => ActionColumn::class, - - 'template' => '{view}', - 'urlCreator' => function ($action, Products1cNomenclature $model, $key, $index, $column) { - return Url::toRoute([$action, 'id' => $model->id]); - } + 'columns' => $gridColumns, + 'export' => [ + 'label' => 'Экспорт', + 'header' => '', + 'fontAwesome' => false, + 'showConfirmAlert' => false, + 'target' => GridView::TARGET_BLANK, + ], + 'exportConfig' => [ + GridView::EXCEL => [ + 'label' => 'Excel', + 'icon' => 'file-excel', + 'filename' => 'export_' . date('Y-m-d'), + 'options' => ['title' => 'Сохранить в Excel'], ], ], + 'toolbar' => [ + '{export}', + ], + 'panel' => [ + 'type' => GridView::TYPE_SECONDARY, + 'heading' => '

Список товаров

', + ], ]); ?>