diff --git a/vendor/antgoods/goods/src/models/ars/Brand.php b/vendor/antgoods/goods/src/models/ars/Brand.php index bf681bd..f3e49b5 100644 --- a/vendor/antgoods/goods/src/models/ars/Brand.php +++ b/vendor/antgoods/goods/src/models/ars/Brand.php @@ -74,4 +74,9 @@ class Brand extends \yii\db\ActiveRecord ], ]; } + + public static function modelColumn() + { + return $column = Brand::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column(); + } } diff --git a/vendor/antgoods/goods/src/models/ars/Category.php b/vendor/antgoods/goods/src/models/ars/Category.php index 212def5..7d4fa46 100644 --- a/vendor/antgoods/goods/src/models/ars/Category.php +++ b/vendor/antgoods/goods/src/models/ars/Category.php @@ -96,4 +96,9 @@ class Category extends \yii\db\ActiveRecord ], ]; } + + public static function modelColumn() + { + return $column = Category::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column(); + } } diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php index 5956348..a944d3e 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -2,6 +2,8 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; +use antgoods\goods\models\ars\Category; +use antgoods\goods\models\ars\Brand; /* @var $this yii\web\View */ /* @var $model antgoods\goods\models\ars\Goods */ @@ -12,11 +14,9 @@ use yii\widgets\ActiveForm; - = $form->field($model, 'pid')->textInput() ?> + = $form->field($model, 'cat_id')->dropDownList(Category::modelColumn(), ['prompt' => '请选择']) ?> - = $form->field($model, 'cat_id')->textInput() ?> - - = $form->field($model, 'brand_id')->textInput() ?> + = $form->field($model, 'brand_id')->dropDownList(Brand::modelColumn(), ['prompt' => '请选择']) ?> = $form->field($model, 'shop_cat_id')->textInput() ?> @@ -68,8 +68,6 @@ use yii\widgets\ActiveForm; = $form->field($model, 'experience_points')->textInput() ?> - = $form->field($model, 'is_delete')->textInput() ?> - = $form->field($model, 'express_template')->textInput() ?>