|
|
@@ -5,6 +5,12 @@ namespace App;
|
|
|
|
|
|
require '../vendor/autoload.php';
|
|
|
|
|
|
+use FormBuilder\Annotation\Col;
|
|
|
+use FormBuilder\Annotation\Emit;
|
|
|
+use FormBuilder\Annotation\Group;
|
|
|
+use FormBuilder\Annotation\Validate\Required;
|
|
|
+use FormBuilder\Annotation\Validate\Min;
|
|
|
+use FormBuilder\Annotation\Validate\Range;
|
|
|
use FormBuilder\Factory\Elm;
|
|
|
use FormBuilder\Handle\ElmFormHandle;
|
|
|
use FormBuilder\UI\Elm\Components\Rate;
|
|
|
@@ -24,57 +30,93 @@ class GoodsForm extends ElmFormHandle
|
|
|
|
|
|
protected function getScene()
|
|
|
{
|
|
|
- $this->except = ['goods_name'];
|
|
|
+// $this->except = ['goods_name'];
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @Col(6)
|
|
|
+ * @return \FormBuilder\UI\Elm\Components\Input
|
|
|
+ */
|
|
|
public function goods_name_field()
|
|
|
{
|
|
|
return Elm::input('goods_name', '商品名称')->required();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @Required()
|
|
|
+ * @Group()
|
|
|
+ * @Col(8)
|
|
|
+ * @Range({10,1000},message = "最少输入10个字")
|
|
|
+ * @return \FormBuilder\UI\Elm\Components\Input
|
|
|
+ */
|
|
|
public function goods_info_field()
|
|
|
{
|
|
|
return Elm::textarea('goods_info', '商品简介');
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @Group()
|
|
|
+ * @Col(8)
|
|
|
+ * @Emit({"change","click"})
|
|
|
+ * @return \FormBuilder\UI\Elm\Components\Switches
|
|
|
+ */
|
|
|
public function is_open_field()
|
|
|
{
|
|
|
return Elm::switches('is_open', '是否开启');
|
|
|
}
|
|
|
|
|
|
- public function id_field()
|
|
|
- {
|
|
|
- return Elm::hidden('1', '1');
|
|
|
- }
|
|
|
-
|
|
|
+ /**
|
|
|
+ * @Group(2)
|
|
|
+ * @Col(12)
|
|
|
+ * @return \FormBuilder\UI\Elm\Components\Frame
|
|
|
+ */
|
|
|
public function frame_field()
|
|
|
{
|
|
|
return Elm::frameFile('as', 'asd', 'afsdfasdf');
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @Group(2)
|
|
|
+ * @Col(12)
|
|
|
+ * @return \FormBuilder\UI\Elm\Components\Upload
|
|
|
+ */
|
|
|
public function test_field()
|
|
|
{
|
|
|
return Elm::uploadFiles('aaa', 'aaa', 'bbb', [1])->required();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @return \FormBuilder\UI\Elm\Components\Hidden
|
|
|
+ */
|
|
|
+ public function id_field()
|
|
|
+ {
|
|
|
+ return Elm::hidden('1', '1');
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Required("请输入 testRow")
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
public function row_field()
|
|
|
{
|
|
|
+// return [
|
|
|
+// 'type' => 'row',
|
|
|
+// 'children' =>
|
|
|
+// [
|
|
|
return [
|
|
|
- 'type' => 'row',
|
|
|
- 'children' => [
|
|
|
- [
|
|
|
- 'type' => 'input',
|
|
|
- 'field' => 'row',
|
|
|
- 'title' => 'test Row',
|
|
|
- 'value' => '123',
|
|
|
- 'col' => [
|
|
|
- 'span' => 12
|
|
|
- ]
|
|
|
- ],
|
|
|
- Elm::input('row2', 'row2', 'asdf')->col(12)
|
|
|
- ],
|
|
|
- 'native' => true
|
|
|
+ 'type' => 'input',
|
|
|
+ 'field' => 'row',
|
|
|
+ 'title' => 'test Row',
|
|
|
+ 'value' => '123',
|
|
|
+ 'col' => [
|
|
|
+ 'span' => 12
|
|
|
+ ]
|
|
|
];
|
|
|
+// ,
|
|
|
+// Elm::input('row2', 'row2', 'asdf')->col(12)
|
|
|
+// ],
|
|
|
+// 'native' => true
|
|
|
+// ];
|
|
|
}
|
|
|
|
|
|
/**
|