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() ?>