链街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.

55 lines
1.2 KiB

5 years ago
5 years ago
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. 'all'=>'全部',
  22. 'today' => '今日',
  23. 'yesterday' => '昨日',
  24. 'week' => '本周',
  25. 'last_week' => '上周',
  26. 'month' => '本月',
  27. 'last_month' => '上月',
  28. ];
  29. $data = [
  30. 'all'=>'0',
  31. 'today' => '1',
  32. 'yesterday' => '-1',
  33. 'week' => 'w',
  34. 'last_week' => 'lw',
  35. 'month' => '30',
  36. 'last_month' => '-30',
  37. ];
  38. foreach ($data as $key=>$value){
  39. $this->url = "salesman?type={$key}&option={$value}&&name={$options[$key]}";
  40. $this->option = $key;
  41. Admin::script($this->script());
  42. }
  43. return view('admin.tools.salesman', compact('options'));
  44. }
  45. }