From 79327ab225691c36b0c988e2e9512541f732462d Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Wed, 20 Nov 2019 14:24:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=95=86=E5=93=81=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E4=BE=9B=E5=BA=94=E5=95=86=E5=AD=97=E6=AE=B5=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/antgoods/goods/src/models/ars/Supplier.php | 9 +++++++++ vendor/antgoods/goods/src/views/goods/_form.php | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/vendor/antgoods/goods/src/models/ars/Supplier.php b/vendor/antgoods/goods/src/models/ars/Supplier.php index 899b173..e30b599 100644 --- a/vendor/antgoods/goods/src/models/ars/Supplier.php +++ b/vendor/antgoods/goods/src/models/ars/Supplier.php @@ -81,4 +81,13 @@ class Supplier extends \yii\db\ActiveRecord ], ]; } + + /** + * @return array + * 数据键值对 + */ + public static function modelColumn() + { + return $column = self::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 4dba452..6efd34f 100644 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -5,6 +5,7 @@ use yii\widgets\ActiveForm; use antgoods\goods\models\ars\Category; use antgoods\goods\models\ars\Brand; use antgoods\goods\models\ars\ShopCategory; +use antgoods\goods\models\ars\Supplier; /* @var $this yii\web\View */ /* @var $model antgoods\goods\models\ars\Goods */ @@ -27,7 +28,7 @@ use antgoods\goods\models\ars\ShopCategory; field($model, 'code')->textInput(['maxlength' => true]) ?> - field($model, 'supplier_id')->textInput() ?> + field($model, 'supplier_id')->dropDownList(Supplier::modelColumn(), ['prompt' => '请选择']) ?> field($model, 'weight')->textInput() ?>