You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<?php
namespace App\Admin\Actions\Tools;
use Dcat\Admin\Admin;use Dcat\Admin\Grid\Tools\AbstractTool;
class DataReportOrder extends AbstractTool{ protected $url; protected $option; protected $route; protected $dateTime; protected $marketId; public function __construct($route,$marketId,$dateTime) { $this->route = $route; $this->dateTime = $dateTime; $this->marketId = $marketId; parent::__construct(); }
protected function script() { return <<<JS$("#{$this->option}").change(function () { var url = "{$this->url}" Dcat.reload(url)});JS; }
public function render() { $options = [ 'amount' => '金额', 'num' => '单数',
];
$data = [ 'amount' => '1', 'num' => '2',
]; $option = request()->get('option'); $this->dateTime['start'] = date('Y-m-d',$this->dateTime['start']); $this->dateTime['end'] = date('Y-m-d',$this->dateTime['end']); foreach ($data as $key=>$value){ $this->url = "{$this->route}?order_type={$key}&option={$option}&name={$options[$key]}&market_id={$this->marketId}&created_at[start]={$this->dateTime['start']}&created_at[end]={$this->dateTime['end']}"; $this->option = $key; Admin::script($this->script()); } return view('admin.tools.data_report_order', compact('options')); }}
|