| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 | 
							- <?php
 
- namespace App\Admin\Extensions\Tools;
 
- use Encore\Admin\Grid\Tools\AbstractTool;
 
- use Encore\Admin\Widgets\Form;
 
- /**
 
-  * Created by PhpStorm.
 
-  * User: zhongjianquan
 
-  * Date: 2018/9/29
 
-  * Time: 上午11:45
 
-  */
 
- class DialogTool extends AbstractTool
 
- {
 
-     /**
 
-      * @var 弹窗表单数据
 
-      */
 
-     protected $config;
 
-     public function __construct($widget, $config = array(), $buttonName = '按钮')
 
-     {
 
-         if (empty($config)) {
 
-             $config = array(
 
-                 'button' => $buttonName,
 
-                 'title' => "提示",
 
-                 'dialog_cancel' => "取消",
 
-                 'dialog_ok' => "确认",
 
-                 'is_batch' => true
 
-             );
 
-         }
 
-         $this->config=$config;
 
-         $this->config['uniqid']=uniqid();
 
-         if ($widget instanceof Form) {
 
-             $widget->attribute('id', 'dialog-form-'.$this->config['uniqid']);
 
-             $widget->disableReset();
 
-             $widget->disableSubmit();
 
-             $this->config['is_form']=true;
 
-         } else {
 
-             $this->config['is_form']=false;
 
-         }
 
-         $this->config['form']=$widget->render();
 
-     }
 
-     public function render()
 
-     {
 
-         return view('admin.tools.dialog', $this->config);
 
-     }
 
- }
 
 
  |