Browse Source

处理商品表单供应商字段选择功能

wechat_public_accounts
linyaostalker 5 years ago
parent
commit
79327ab225
  1. 9
      vendor/antgoods/goods/src/models/ars/Supplier.php
  2. 3
      vendor/antgoods/goods/src/views/goods/_form.php

9
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();
}
}

3
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;
<?= $form->field($model, 'code')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'supplier_id')->textInput() ?>
<?= $form->field($model, 'supplier_id')->dropDownList(Supplier::modelColumn(), ['prompt' => '请选择']) ?>
<?= $form->field($model, 'weight')->textInput() ?>

Loading…
Cancel
Save