blobt
5 years ago
10 changed files with 213 additions and 71 deletions
-
8common/config/main.php
-
12common/models/Category.php
-
15common/models/CategorySearch.php
-
3composer.json
-
109composer.lock
-
3console/controllers/InitController.php
-
1kcadmin/config/main.php
-
5kcadmin/controllers/SiteController.php
-
16kcadmin/views/category/_search.php
-
112kcadmin/views/site/test.php
@ -1,68 +1,68 @@ |
|||||
<?PHP |
<?PHP |
||||
|
|
||||
use yii\widgets\ActiveForm; |
|
||||
use yii\helpers\Html; |
use yii\helpers\Html; |
||||
use blobt\web\DaterangeBootstrap; |
|
||||
|
use yii\widgets\ActiveForm; |
||||
|
use blobt\widgets\DateRangePicker; |
||||
|
|
||||
$this->title = '测试'; |
$this->title = '测试'; |
||||
$this->params['subtitle'] = '这是一个小小的测试'; |
$this->params['subtitle'] = '这是一个小小的测试'; |
||||
$this->params['breadcrumbs'][] = $this->title; |
$this->params['breadcrumbs'][] = $this->title; |
||||
|
|
||||
$js = <<<EOT |
|
||||
$('#daterange-btn').daterangepicker( |
|
||||
{ |
|
||||
locale: { |
|
||||
'cancelLabel': '清除', |
|
||||
'applyLabel': "确定", |
|
||||
"customRangeLabel": "自定义", |
|
||||
"daysOfWeek": [ |
|
||||
"日", |
|
||||
"一", |
|
||||
"二", |
|
||||
"三", |
|
||||
"四", |
|
||||
"五", |
|
||||
"六" |
|
||||
|
/* @var $this yii\web\View */ |
||||
|
/* @var $model common\models\CategorySearch */ |
||||
|
/* @var $form yii\widgets\ActiveForm */ |
||||
|
?>
|
||||
|
|
||||
|
|
||||
|
<?php |
||||
|
$form = ActiveForm::begin([ |
||||
|
'action' => ['index'], |
||||
|
'method' => 'get', |
||||
|
'validateOnType' => true, |
||||
|
]); |
||||
|
?>
|
||||
|
|
||||
|
<div class="col-sm-11"> |
||||
|
<div class="dataTables_filter"> |
||||
|
<?= |
||||
|
$form->field($model, 'id', [ |
||||
|
"template" => "{input}{error}", |
||||
|
"inputOptions" => [ |
||||
|
"placeholder" => "检索的id", |
||||
|
"class" => "form-control" |
||||
], |
], |
||||
"monthNames": [ |
|
||||
"一月", |
|
||||
"二月", |
|
||||
"三月", |
|
||||
"四月", |
|
||||
"五月", |
|
||||
"六月", |
|
||||
"七月", |
|
||||
"八月", |
|
||||
"九月", |
|
||||
"十月", |
|
||||
"十一月", |
|
||||
"十二月" |
|
||||
|
"errorOptions" => [ |
||||
|
"class" => "error-tips" |
||||
|
] |
||||
|
]) |
||||
|
?>
|
||||
|
|
||||
|
<?= |
||||
|
$form->field($model, 'cat_name', [ |
||||
|
"template" => "{input}{error}", |
||||
|
"inputOptions" => [ |
||||
|
"placeholder" => "检索类名", |
||||
|
"class" => "form-control", |
||||
], |
], |
||||
}, |
|
||||
ranges : { |
|
||||
'今天' : [moment(), moment()], |
|
||||
'昨天' : [moment().subtract(1, 'days'), moment().subtract(1, 'days')], |
|
||||
'最近7天' : [moment().subtract(6, 'days'), moment()], |
|
||||
'最近30天': [moment().subtract(29, 'days'), moment()], |
|
||||
'本月' : [moment().startOf('month'), moment().endOf('month')], |
|
||||
'上月' : [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')] |
|
||||
}, |
|
||||
startDate: moment().subtract(29, 'days'), |
|
||||
endDate : moment() |
|
||||
}, |
|
||||
function (start, end) { |
|
||||
$('#daterange-btn span').html(start.format('YYYY-M-D') + ' - ' + end.format('YYYY-M-D')) |
|
||||
} |
|
||||
) |
|
||||
EOT; |
|
||||
|
"errorOptions" => [ |
||||
|
"class" => "error-tips" |
||||
|
] |
||||
|
]) |
||||
|
?>
|
||||
|
|
||||
DaterangeBootstrap::register($this); |
|
||||
$this->registerJs($js); |
|
||||
?>
|
|
||||
|
<?= |
||||
|
$form->field($model, "created_at", [ |
||||
|
"template" => "{input}{error}", |
||||
|
"errorOptions" => [ |
||||
|
"class" => "error-tips" |
||||
|
] |
||||
|
])->widget(DateRangePicker::className()); |
||||
|
?>
|
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-sm-1" style="padding: 0;"> |
||||
|
<?= Html::submitButton('<i class="fa fa-filter"></i>', ['class' => 'btn btn-default']) ?>
|
||||
|
<?= Html::resetButton('<i class="fa fa-eraser"></i>', ['class' => 'btn btn-default']) ?>
|
||||
|
</div> |
||||
|
<?php ActiveForm::end(); ?>
|
||||
|
|
||||
<button type="button" class="btn btn-default pull-right" id="daterange-btn"> |
|
||||
<span> |
|
||||
<i class="fa fa-calendar"></i>日期范围 |
|
||||
</span> |
|
||||
<i class="fa fa-caret-down"></i> |
|
||||
</button> |
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue