链街Dcat后台
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.

47 lines
1007 B

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Admin\Actions\Tools;
  3. use Dcat\Admin\Admin;
  4. use Dcat\Admin\Grid\Tools\AbstractTool;
  5. class SalesmanOption extends AbstractTool
  6. {
  7. protected $url;
  8. protected $option;
  9. protected function script()
  10. {
  11. return <<<JS
  12. $("#{$this->option}").change(function () {
  13. var url = "{$this->url}"
  14. Dcat.reload(url)
  15. });
  16. JS;
  17. }
  18. public function render()
  19. {
  20. $options = [
  21. 'today' => '今日',
  22. 'yesterday' => '昨日',
  23. 'week' => '本周',
  24. 'month' => '本月',
  25. ];
  26. $data = [
  27. 'today' => '1',
  28. 'yesterday' => '-1',
  29. 'week' => 'w',
  30. 'month' => '30',
  31. ];
  32. foreach ($data as $key=>$value){
  33. $this->url = "salesman?type={$key}&option={$value}";
  34. $this->option = $key;
  35. Admin::script($this->script());
  36. }
  37. return view('admin.tools.salesman', compact('options'));
  38. }
  39. }