linyaostalker
5 years ago
8 changed files with 399 additions and 0 deletions
-
37backend/controllers/TakingSiteController.php
-
46backend/views/express-template/_form.php
-
49backend/views/express-template/_search.php
-
18backend/views/express-template/create.php
-
28backend/views/express-template/index.php
-
19backend/views/express-template/update.php
-
41backend/views/express-template/view.php
-
161common/models/searchs/ExpressTemplateSearch.php
@ -0,0 +1,46 @@ |
|||||
|
<?php |
||||
|
|
||||
|
use yii\helpers\Html; |
||||
|
use yii\bootstrap4\ActiveForm; |
||||
|
|
||||
|
/* @var $this yii\web\View */ |
||||
|
/* @var $model common\models\ars\ExpressTemplate */ |
||||
|
/* @var $form yii\widgets\ActiveForm */ |
||||
|
?>
|
||||
|
|
||||
|
<div class="express-template-form"> |
||||
|
|
||||
|
<?php $form = ActiveForm::begin(); ?>
|
||||
|
|
||||
|
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||||
|
|
||||
|
<?= $form->field($model, 'province')->textarea(['rows' => 6]) ?>
|
||||
|
|
||||
|
<?= $form->field($model, 'city')->textarea(['rows' => 6]) ?>
|
||||
|
|
||||
|
<?= $form->field($model, 'area')->textarea(['rows' => 6]) ?>
|
||||
|
|
||||
|
<?= $form->field($model, 'billing_type')->textInput() ?>
|
||||
|
|
||||
|
<?= $form->field($model, 'extra_weight_type')->textInput() ?>
|
||||
|
|
||||
|
<?= $form->field($model, 'exemption_type')->textInput() ?>
|
||||
|
|
||||
|
<?= $form->field($model, 'basic_price')->textInput() ?>
|
||||
|
|
||||
|
<?= $form->field($model, 'extra_price')->textInput() ?>
|
||||
|
|
||||
|
<?= $form->field($model, 'exemption_amount')->textInput() ?>
|
||||
|
|
||||
|
<?= $form->field($model, 'support_taking')->textInput() ?>
|
||||
|
|
||||
|
<?= $form->field($model, 'taking_site')->textarea(['rows' => 6]) ?>
|
||||
|
|
||||
|
<div class="form-group"> |
||||
|
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
|
||||
|
<?= Html::a('返回', ['index'], ['class' => 'btn btn-info']) ?>
|
||||
|
</div> |
||||
|
|
||||
|
<?php ActiveForm::end(); ?>
|
||||
|
|
||||
|
</div> |
@ -0,0 +1,49 @@ |
|||||
|
<?php |
||||
|
|
||||
|
use yii\helpers\Html; |
||||
|
use yii\widgets\ActiveForm; |
||||
|
use \blobt\widgets\DateRangePicker; |
||||
|
|
||||
|
/* @var $this yii\web\View */ |
||||
|
/* @var $model common\models\searchs\ExpressTemplateSearch */ |
||||
|
/* @var $form yii\widgets\ActiveForm */ |
||||
|
?>
|
||||
|
|
||||
|
<?php $form = ActiveForm::begin([ |
||||
|
'action' => ['index'], |
||||
|
'method' => 'get', |
||||
|
'validateOnType' => true, |
||||
|
]); |
||||
|
?>
|
||||
|
<div class="row"> |
||||
|
<div class="col"> |
||||
|
<?= $form->field($model, 'id', [ |
||||
|
"template" => "{input}{error}", |
||||
|
"inputOptions" => [ |
||||
|
"placeholder" => "检索ID", |
||||
|
"class" => "form-control", |
||||
|
], |
||||
|
"errorOptions" => [ |
||||
|
"class" => "error-tips" |
||||
|
] |
||||
|
]) |
||||
|
?>
|
||||
|
</div> |
||||
|
<div class="col"> |
||||
|
<?= $form->field($model, "created_at_range", [ |
||||
|
"template" => "{input}{error}", |
||||
|
"inputOptions" => [ |
||||
|
"placeholder" => "创建时间", |
||||
|
], |
||||
|
"errorOptions" => [ |
||||
|
"class" => "error-tips" |
||||
|
] |
||||
|
])->widget(DateRangePicker::className()); |
||||
|
?>
|
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<?= 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> |
||||
|
</div> |
||||
|
<?php ActiveForm::end(); ?>
|
@ -0,0 +1,18 @@ |
|||||
|
<?php |
||||
|
|
||||
|
use yii\helpers\Html; |
||||
|
|
||||
|
/* @var $this yii\web\View */ |
||||
|
/* @var $model common\models\ars\ExpressTemplate */ |
||||
|
|
||||
|
$this->title = '创建 Express Template'; |
||||
|
$this->params['breadcrumbs'][] = ['label' => 'Express Templates', 'url' => ['index']]; |
||||
|
$this->params['breadcrumbs'][] = $this->title; |
||||
|
?>
|
||||
|
<div class="express-template-create"> |
||||
|
|
||||
|
<?= $this->render('_form', [ |
||||
|
'model' => $model, |
||||
|
]) ?>
|
||||
|
|
||||
|
</div> |
@ -0,0 +1,28 @@ |
|||||
|
<?php |
||||
|
|
||||
|
use yii\helpers\Html; |
||||
|
use iron\grid\GridView; |
||||
|
|
||||
|
/* @var $this yii\web\View */ |
||||
|
/* @var $searchModel common\models\searchs\ExpressTemplateSearch */ |
||||
|
/* @var $dataProvider yii\data\ActiveDataProvider */ |
||||
|
|
||||
|
$this->title = '运费模板'; |
||||
|
$this->params['breadcrumbs'][] = $this->title; |
||||
|
?>
|
||||
|
<div class="row"> |
||||
|
<div class="col-12"> |
||||
|
<?= GridView::widget([ |
||||
|
'dataProvider' => $dataProvider, |
||||
|
'filter' => $this->render("_search", ['model' => $searchModel]), |
||||
|
'batch' => [ |
||||
|
[ |
||||
|
"label" => "删除", |
||||
|
"url" => "express-template/deletes" |
||||
|
], |
||||
|
], |
||||
|
'columns' => $columns |
||||
|
]); |
||||
|
?>
|
||||
|
</div> |
||||
|
</div> |
@ -0,0 +1,19 @@ |
|||||
|
<?php |
||||
|
|
||||
|
use yii\helpers\Html; |
||||
|
|
||||
|
/* @var $this yii\web\View */ |
||||
|
/* @var $model common\models\ars\ExpressTemplate */ |
||||
|
|
||||
|
$this->title = '编辑 Express Template: ' . $model->name; |
||||
|
$this->params['breadcrumbs'][] = ['label' => 'Express Templates', 'url' => ['index']]; |
||||
|
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; |
||||
|
$this->params['breadcrumbs'][] = 'Update '; |
||||
|
?>
|
||||
|
<div class="express-template-update"> |
||||
|
|
||||
|
<?= $this->render('_form', [ |
||||
|
'model' => $model, |
||||
|
]) ?>
|
||||
|
|
||||
|
</div> |
@ -0,0 +1,41 @@ |
|||||
|
<?php |
||||
|
|
||||
|
use yii\helpers\Html; |
||||
|
use yii\widgets\DetailView; |
||||
|
|
||||
|
/* @var $this yii\web\View */ |
||||
|
/* @var $model common\models\ars\ExpressTemplate */ |
||||
|
|
||||
|
$this->title = $model->name; |
||||
|
$this->params['breadcrumbs'][] = ['label' => 'Express Templates', 'url' => ['index']]; |
||||
|
$this->params['breadcrumbs'][] = $this->title; |
||||
|
\yii\web\YiiAsset::register($this); |
||||
|
?>
|
||||
|
<div class="express-template-view"> |
||||
|
|
||||
|
<p> |
||||
|
<?= Html::a('返回列表', ['index'], ['class' => 'btn btn-success']) ?>
|
||||
|
</p> |
||||
|
|
||||
|
<?= DetailView::widget([ |
||||
|
'model' => $model, |
||||
|
'attributes' => [ |
||||
|
'id', |
||||
|
'name', |
||||
|
'province:ntext', |
||||
|
'city:ntext', |
||||
|
'area:ntext', |
||||
|
'billing_type', |
||||
|
'extra_weight_type', |
||||
|
'exemption_type', |
||||
|
'basic_price', |
||||
|
'extra_price', |
||||
|
'exemption_amount', |
||||
|
'support_taking', |
||||
|
'taking_site:ntext', |
||||
|
'updated_at', |
||||
|
'created_at', |
||||
|
], |
||||
|
]) ?>
|
||||
|
|
||||
|
</div> |
@ -0,0 +1,161 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace common\models\searchs; |
||||
|
|
||||
|
use yii\base\Model; |
||||
|
use yii\data\ActiveDataProvider; |
||||
|
use yii\helpers\ArrayHelper; |
||||
|
use common\models\ars\ExpressTemplate; |
||||
|
|
||||
|
/** |
||||
|
* ExpressTemplateSearch represents the model behind the search form of `common\models\ars\ExpressTemplate`. |
||||
|
*/ |
||||
|
class ExpressTemplateSearch extends ExpressTemplate |
||||
|
{ |
||||
|
/** |
||||
|
* @return array |
||||
|
* 增加创建时间查询字段 |
||||
|
*/ |
||||
|
public function attributes() |
||||
|
{ |
||||
|
return ArrayHelper::merge(['created_at_range'], parent::attributes()); |
||||
|
} |
||||
|
/** |
||||
|
* {@inheritdoc} |
||||
|
*/ |
||||
|
public function rules() |
||||
|
{ |
||||
|
return [ |
||||
|
[['id', 'billing_type', 'extra_weight_type', 'exemption_type', 'basic_price', 'extra_price', 'exemption_amount', 'support_taking', 'updated_at', 'created_at'], 'integer'], |
||||
|
[['name', 'province', 'city', 'area', 'taking_site'], 'safe'], |
||||
|
['created_at_range','safe'], |
||||
|
]; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* {@inheritdoc} |
||||
|
*/ |
||||
|
public function scenarios() |
||||
|
{ |
||||
|
// bypass scenarios() implementation in the parent class
|
||||
|
return Model::scenarios(); |
||||
|
} |
||||
|
/** |
||||
|
* @return array |
||||
|
* 列格式 |
||||
|
*/ |
||||
|
public function columns() |
||||
|
{ |
||||
|
return [ |
||||
|
[ |
||||
|
'class' => 'blobt\grid\CheckboxColumn', |
||||
|
'width' => '2%', |
||||
|
'align' => 'center' |
||||
|
], |
||||
|
'id', |
||||
|
'name', |
||||
|
'province', |
||||
|
'city', |
||||
|
'area', |
||||
|
//'billing_type',
|
||||
|
//'extra_weight_type',
|
||||
|
//'exemption_type',
|
||||
|
//'basic_price',
|
||||
|
//'extra_price',
|
||||
|
//'exemption_amount',
|
||||
|
//'support_taking',
|
||||
|
//'taking_site',
|
||||
|
//'updated_at',
|
||||
|
//'created_at',
|
||||
|
[ |
||||
|
'class' => 'iron\grid\ActionColumn', |
||||
|
'align' => 'center', |
||||
|
], |
||||
|
]; |
||||
|
} |
||||
|
/** |
||||
|
* @param $params |
||||
|
* @return ActiveDataProvider |
||||
|
* 不分页的所有数据 |
||||
|
*/ |
||||
|
public function allData($params) |
||||
|
{ |
||||
|
$query = ExpressTemplate::find(); |
||||
|
$dataProvider = new ActiveDataProvider([ |
||||
|
'query' => $query, |
||||
|
'pagination' => false, |
||||
|
'sort' => false |
||||
|
]); |
||||
|
$this->load($params); |
||||
|
return $this->filter($query, $dataProvider); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Creates data provider instance with search query applied |
||||
|
* |
||||
|
* @param array $params |
||||
|
* |
||||
|
* @return ActiveDataProvider |
||||
|
*/ |
||||
|
public function search($params) |
||||
|
{ |
||||
|
$query = ExpressTemplate::find(); |
||||
|
|
||||
|
// add conditions that should always apply here
|
||||
|
|
||||
|
$dataProvider = new ActiveDataProvider([ |
||||
|
'query' => $query, |
||||
|
'pagination' => [ |
||||
|
'pageSizeLimit' => [1, 200] |
||||
|
], |
||||
|
'sort' => [ |
||||
|
'defaultOrder' => [ |
||||
|
'id' => SORT_DESC, |
||||
|
] |
||||
|
], |
||||
|
]); |
||||
|
|
||||
|
$this->load($params); |
||||
|
return $this->filter($query, $dataProvider); |
||||
|
} |
||||
|
/** |
||||
|
* @param $query |
||||
|
* @param $dataProvider |
||||
|
* @return ActiveDataProvider |
||||
|
* 条件筛选 |
||||
|
*/ |
||||
|
private function filter($query, $dataProvider){ |
||||
|
if (!$this->validate()) { |
||||
|
// uncomment the following line if you do not want to return any records when validation fails
|
||||
|
// $query->where('0=1');
|
||||
|
return $dataProvider; |
||||
|
} |
||||
|
|
||||
|
// grid filtering conditions
|
||||
|
$query->andFilterWhere([ |
||||
|
'id' => $this->id, |
||||
|
'billing_type' => $this->billing_type, |
||||
|
'extra_weight_type' => $this->extra_weight_type, |
||||
|
'exemption_type' => $this->exemption_type, |
||||
|
'basic_price' => $this->basic_price, |
||||
|
'extra_price' => $this->extra_price, |
||||
|
'exemption_amount' => $this->exemption_amount, |
||||
|
'support_taking' => $this->support_taking, |
||||
|
'updated_at' => $this->updated_at, |
||||
|
'created_at' => $this->created_at, |
||||
|
]); |
||||
|
|
||||
|
$query->andFilterWhere(['like', 'name', $this->name]) |
||||
|
->andFilterWhere(['like', 'province', $this->province]) |
||||
|
->andFilterWhere(['like', 'city', $this->city]) |
||||
|
->andFilterWhere(['like', 'area', $this->area]) |
||||
|
->andFilterWhere(['like', 'taking_site', $this->taking_site]); |
||||
|
if ($this->created_at_range) { |
||||
|
$arr = explode(' ~ ', $this->created_at_range); |
||||
|
$start = strtotime($arr[0]); |
||||
|
$end = strtotime($arr[1]) + 3600 * 24; |
||||
|
$query->andFilterWhere(['between', 'created_at', $start, $end]); |
||||
|
} |
||||
|
return $dataProvider; |
||||
|
} |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue