|
@@ -0,0 +1,49 @@
|
|
|
+<?php
|
|
|
+namespace App\Distributor\Actions;
|
|
|
+
|
|
|
+use Dcat\Admin\Grid\BatchAction;
|
|
|
+use Illuminate\Http\Request;
|
|
|
+use App\Distributor\Forms\ImportProduct;
|
|
|
+use Dcat\Admin\Widgets\Modal;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+class BatchCopy extends BatchAction
|
|
|
+{
|
|
|
+ protected $title = '倒入产品';
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ * 重写弹出的表单
|
|
|
+ * @return Modal|string
|
|
|
+ */
|
|
|
+ public function render()
|
|
|
+ {
|
|
|
+
|
|
|
+ $form = ImportProduct::make();
|
|
|
+
|
|
|
+ return Modal::make()
|
|
|
+ ->lg()
|
|
|
+ ->title($this->title)
|
|
|
+ ->body($form)
|
|
|
+
|
|
|
+
|
|
|
+ ->onShow($this->getModalScript())
|
|
|
+ ->button($this->title);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 填充选择的产品ID
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ protected function getModalScript()
|
|
|
+ {
|
|
|
+
|
|
|
+ return <<<JS
|
|
|
+
|
|
|
+ var key = {$this->getSelectedKeysScript()}
|
|
|
+ $('#product_ids').val(key);
|
|
|
+ JS;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|