diff --git a/app/Forms/ProductForm.php b/app/Forms/ProductForm.php index 800de86..cd7482d 100755 --- a/app/Forms/ProductForm.php +++ b/app/Forms/ProductForm.php @@ -52,7 +52,7 @@ class ProductForm extends Form 'label' => false ] ]); - + $this->add("factor_item_ids", Field::SELECT, ["label" => "统计价格因素", "rules" => "required", "attr" => ["multiple" => true, "data-plugin" => "select2"]]); $this->add('buttons', 'buttongroup', ["splitted" => true, "buttons" => [ ["label" => "保存", "attr" => ["class" => "btn btn-primary mr-1", "type" => "submit"]], ["label" => "返回", "attr" => ["class" => "btn btn-light btn-back", "type" => "button"]] diff --git a/app/Http/Controllers/Admin/ProductController.php b/app/Http/Controllers/Admin/ProductController.php index 151d642..a0d2c74 100755 --- a/app/Http/Controllers/Admin/ProductController.php +++ b/app/Http/Controllers/Admin/ProductController.php @@ -91,7 +91,7 @@ class ProductController extends CommonController "model" => $vo ]); $form->add("_previous", "hidden", ["value" => (url()->previous())]); - $form->add("factor_item_ids", 'select', ["label" => "统计价格因素", "attr" => ["multiple" => true, "data-plugin" => "select2"], + $form->modify("factor_item_ids", 'select', ["label" => "统计价格因素", "attr" => ["multiple" => true, "data-plugin" => "select2"], "choices" => (new Factor())->where('product_id', $request->id)->get()->pluck("name", "id")->toArray() ]); return view($this->bladePath . ".create", compact("form", "project", "vo"));