From b504393c42043eedf14dea8026096151dcec5ab6 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Sat, 30 Nov 2019 09:53:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=9E=E6=80=A7=E8=A1=A8=E5=8D=95=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=90=8E=E5=8F=B0=E5=95=86=E5=93=81=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../antgoods/goods/src/controllers/AttributeController.php | 1 + vendor/antgoods/goods/src/models/ars/Attribute.php | 4 ++-- vendor/antgoods/goods/src/models/searchs/AttributeSearch.php | 5 +++++ vendor/antgoods/goods/src/views/attribute/_form.php | 4 ++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/vendor/antgoods/goods/src/controllers/AttributeController.php b/vendor/antgoods/goods/src/controllers/AttributeController.php index 9b7f455..27216a7 100644 --- a/vendor/antgoods/goods/src/controllers/AttributeController.php +++ b/vendor/antgoods/goods/src/controllers/AttributeController.php @@ -67,6 +67,7 @@ class AttributeController extends Controller { $model = new Attribute(); $model->sort_order = 0; + $model->cat_id = 0; if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect('index'); diff --git a/vendor/antgoods/goods/src/models/ars/Attribute.php b/vendor/antgoods/goods/src/models/ars/Attribute.php index 711b266..4b62982 100644 --- a/vendor/antgoods/goods/src/models/ars/Attribute.php +++ b/vendor/antgoods/goods/src/models/ars/Attribute.php @@ -54,8 +54,8 @@ class Attribute extends \yii\db\ActiveRecord { return [ 'id' => 'id', - 'name' => '规格名称', - 'value' => '规格内容(每项以逗号隔开)', + 'name' => '属性名', + 'value' => '属性值', 'type' => '类型', 'sort_order' => '排序', 'is_delete' => '是否删除,1为已删除', diff --git a/vendor/antgoods/goods/src/models/searchs/AttributeSearch.php b/vendor/antgoods/goods/src/models/searchs/AttributeSearch.php index 24605ce..567f008 100644 --- a/vendor/antgoods/goods/src/models/searchs/AttributeSearch.php +++ b/vendor/antgoods/goods/src/models/searchs/AttributeSearch.php @@ -56,6 +56,11 @@ class AttributeSearch extends Attribute 'name', 'value', 'sort_order', + ['attribute' => 'cat_id', + 'value' => function ($model){ + return $model->cat_id ? $model->category->name : '无限制'; + }, + ], [ 'class' => 'iron\grid\ActionColumn', 'align' => 'center', diff --git a/vendor/antgoods/goods/src/views/attribute/_form.php b/vendor/antgoods/goods/src/views/attribute/_form.php index b0e98f7..6a5ba60 100644 --- a/vendor/antgoods/goods/src/views/attribute/_form.php +++ b/vendor/antgoods/goods/src/views/attribute/_form.php @@ -2,6 +2,8 @@ use yii\helpers\Html; use yii\bootstrap4\ActiveForm; +use linyao\widgets\Select2; +use antgoods\goods\models\ars\Category; /* @var $this yii\web\View */ /* @var $model antgoods\goods\models\ars\Attribute */ @@ -18,6 +20,8 @@ use yii\bootstrap4\ActiveForm; field($model, 'sort_order')->textInput() ?> + field($model, 'cat_id')->widget(Select2::className(), ["items" => array_merge([0 => '请选择'], Category::modelColumn()), "promptText" => false]) ?> +
'btn btn-success']) ?> 'btn btn-info']) ?>