|
|
<?php
use yii\bootstrap4\Html; use yii\bootstrap4\ActiveForm; use blobt\widgets\Icheck; use kartik\depdrop\DepDrop; use backend\models\ars\Province; use yii\helpers\ArrayHelper; use yii\helpers\Url;
/* @var $this yii\web\View */ /* @var $model backend\models\ars\TakingSite */ /* @var $form yii\widgets\ActiveForm */ $provinces = Province::find()->select('province_id as id,name')->asArray()->all(); $data = ArrayHelper::map($provinces, 'id', 'name'); Yii::$app->params['bsVersion'] = '4.x'; ?>
<div class="taking-site-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<div class="row"> <div class="col-lg-4"> <?= $form->field($model, 'province')->dropDownList($data, ['id' => 'province-id', 'prompt' => '请选择']); ?>
</div> <div class="col-lg-4"> <?= $form->field($model, 'city')->widget(DepDrop::classname(), [ 'options' => ['id' => 'city-id', 'prompt' => $model->city], 'data' => $cityList, 'pluginOptions' => [ 'depends' => ['province-id'], 'placeholder' => '请选择成市', 'url' => Url::to(['/taking-site/city']) ], 'pluginEvents' => [ "depdrop:change" => "function(event, id, value, count) { log(id); log(value); log(count); }", ]
]) ?>
</div> <div class="col-lg-4"> <?= $form->field($model, 'area')->widget(DepDrop::classname(), [ 'options' => ['prompt' => $model->area], 'data' => $areaList, 'pluginOptions' => [ 'depends' => ['city-id'], 'placeholder' => '请选择县区', 'url' => Url::to(['/taking-site/area'])
] ]) ?>
</div> </div>
<?= $form->field($model, 'address')->textarea(['rows' => 2]) ?>
<div class="form-group"> <?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
<?= Html::a('返回', ['index'], ['class' => 'btn btn-info']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
|