_nav.php 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. use common\helpers\Html;
  3. use kartik\daterange\DateRangePicker;
  4. $addon = <<< HTML
  5. <div class="input-group-append">
  6. <span class="input-group-text">
  7. <i class="fas fa-calendar-alt"></i>
  8. </span>
  9. </div>
  10. HTML;
  11. ?>
  12. <style>
  13. .echarts-nav span {
  14. margin-right: 5px;
  15. }
  16. .pull-left {
  17. float: left !important;
  18. }
  19. </style>
  20. <div class="box-body" id="<?= $boxId; ?>">
  21. <div class="m-b-xl echarts-nav col-12">
  22. <?php $i = 0; ?>
  23. <?php foreach ($themeConfig as $key => $value) { ?>
  24. <?php if ($key == 'customData') { ?>
  25. <span class="hide" data-type="customData" data-start="" data-end="" id="freedom-<?= $boxId; ?>">自定义日期</span>
  26. <div class="input-group drp-container col-4 pull-left" style="margin-top: -5px;margin-left: 10px;width:240px">
  27. <?= DateRangePicker::widget([
  28. 'id' => 'queryDate-' . $boxId,
  29. 'name' => 'queryDate-' . $boxId,
  30. 'value' => '',
  31. 'useWithAddon' => true,
  32. 'convertFormat' => true,
  33. 'startAttribute' => 'start_time',
  34. 'endAttribute' => 'end_time',
  35. 'pluginEvents' => [
  36. "apply.daterangepicker" => "function(ev, picker) {
  37. var startDate = picker.startDate.format('YYYY-MM-DD');
  38. var endDate = picker.endDate.format('YYYY-MM-DD');
  39. var boxID = '{$boxId}';
  40. $('#freedom-' + boxID).attr('data-start', startDate);
  41. $('#freedom-' + boxID).attr('data-end', endDate);
  42. // 触发点击
  43. $('#freedom-' + boxID).trigger('click');
  44. }",
  45. ],
  46. 'options' => [
  47. 'class' => 'form-control',
  48. 'placeholder' => '开始时间 - 结束时间'
  49. ],
  50. 'pluginOptions' => [
  51. 'locale' => ['format' => 'Y-m-d'],
  52. ],
  53. ]) . $addon;?>
  54. </div>
  55. <?php } else { ?>
  56. <span class="<?= $i == 0 ? 'orange' : '' ?> pointer pull-left" data-type="<?= Html::encode($key) ?>"> <?= Html::encode($value) ?></span>
  57. <?php } ?>
  58. <?php $i++; ?>
  59. <?php } ?>
  60. <?php foreach ($columns as $column) { ?>
  61. <div class="col-<?= $column['col'] ?> pull-left" style="margin-top: -5px;margin-left: 10px;">
  62. <?php if($column['type'] == 'radioList') { ?>
  63. <?= Html::radioList($column['name'], $column['value'], $column['items'], [
  64. 'style' => 'padding-top: 5px',
  65. 'class' => 'echarts-input',
  66. 'data-type' => 'radioList'
  67. ])?>
  68. <?php } ?>
  69. <?php if($column['type'] == 'dropDownList') { ?>
  70. <?= Html::dropDownList($column['name'], $column['value'], $column['items'], [
  71. 'class' => 'form-control echarts-input',
  72. 'data-type' => 'dropDownList'
  73. ])?>
  74. <?php } ?>
  75. </div>
  76. <?php } ?>
  77. </div>
  78. <div style="height: <?= $config['height'] ?>" id="<?= $boxId; ?>-echarts"></div>
  79. <!-- /.row -->
  80. </div>
粤ICP备19079148号