- //下拉列表
- <?php echo $form->field($searchModel, 'status', [
- 'options'=> ['class' => 'form-group col-md-2'],
- ])->dropDownList(Util::fp($statusList), [
- 'prompt' => Util::f('请选择'),
- ])->label(Util::f('状态'));
- } ?>
-
- //输入框
- <?php echo $form->field($searchModel, 'name', [
- 'options'=> ['class' => 'form-group col-md-2 valid_js'],
- ])->textInput([
- 'placeholder' => Util::f('提示').': 中文 or 英文',
- ])->label(Util::f('姓名'));
- ?>
-
- //检索下拉框
- <?php
- echo $form->field($searchModel, 'product_id', [
- 'options'=> ['class' => 'form-group col-md-2'],
- ])->widget(\kartik\select2\Select2::class, [
- 'data' => $product_list,
- 'class'=>'form-control',
- 'options' => [
- 'placeholder' => Util::f('请选择'),
- ],
- 'pluginOptions' => [
- 'allowClear' => true //删除按钮
- ],
- ])->label(Util::f('产品'));
- ?>
-
- //日期 时间
- <?php echo $form->field($searchModel, 'c_time', [
- 'options'=> ['class' => 'form-group col-md-3'],
- ])->widget(DateTimePicker::class, [
- //'value' =>'',
- 'class'=>'form-control',
- 'id'=> 'last_collection_time',
- 'options' => ['placeholder' => Util::f('请选择')],
- 'pluginOptions' => [
- 'autoclose' => true,//当选择一个日期后自动关闭日期选择器
- 'format' => 'yyyy-mm-dd',//输入框显示的格式 [yyyy-mm-dd | yyyy-mm-dd hh:ii:ss]
- 'todayHighlight' => true,//高亮今日
- 'minView' => 'month',//日期选择器的最小视图为月视图 [month | day | ]
- 'todayBtn' => true,//显示today按钮
- 'endDate' => '2016-09-15',//设置可选择的最大日期
- ]
- ])->label(Util::f('时间'));
- ?>
-
- //双日历 无日历图标
- <?= $form->field($model,'c_time')->widget(DateRangePicker::className(),[
- 'readonly' => 'readonly',
- 'name' => 'c_time',
- 'autoUpdateOnInit'=>false,
- 'convertFormat' => true,
- 'language' => 'zh-CN',
- //'startAttribute' => 'stime',
- //'endAttribute' => 'etime',
- //'presetDropdown' => true,
- 'pluginOptions' => [
- //'stime'=>$stime,
- //'etime'=>$etime,
- //'timePickerIncrement' => 30,
- //'maxDate' => date('Y-m-d', time()),
- 'locale' => [
- //'applyLabel' => '确认',
- //'cancelLabel' => '取消',
- 'format' => 'Y-m-d',
- 'separator'=>' to '
- ]
- ],
- 'options' => [
- //'value'=>$ctime,
- //'style'=>'width:250px',
- ],
- ]);?>
- //双日历 带图标
- <?php
- $addon = <<< HTML
- <span class="input-group-addon">
- <i class="glyphicon glyphicon-calendar"></i>
- </span>
- HTML;
- echo '<div class="input-group drp-container">';
- echo \kartik\daterange\DateRangePicker::widget([
- 'name' => 'c_time',
- 'value' => '',
- 'readonly' => 'readonly',
- 'useWithAddon' => true,
- 'convertFormat' => true,
- //'startAttribute' => 'from_date',
- //'endAttribute' => 'to_date',
- //'startInputOptions' => ['value' => date('Y-m-d')],
- //'endInputOptions' => ['value' => date('Y-m-d')],
- 'pluginOptions' => [
- 'locale' => ['format' => 'Y-m-d', 'separator'=>' to '],
- ]
- ]) . $addon;
- echo '</div>';
- ?>