- 源码: xhadmincn/FastMovieAI (Apache 2.0) - 二开: Docker部署, Swoole改Select, route.php修复, 补update/VERSION - vendor/示例资源已gitignore
142 lines
4.0 KiB
PHP
142 lines
4.0 KiB
PHP
<?php
|
|
|
|
namespace plugin\pluginExample\app\admin\controller;
|
|
|
|
use app\Basic;
|
|
use app\expose\build\builder\FormBuilder;
|
|
use app\expose\enum\State;
|
|
use support\Request;
|
|
|
|
class FormController extends Basic
|
|
{
|
|
public function index(Request $request)
|
|
{
|
|
$builder = new FormBuilder();
|
|
$builder->add('input', 'Input', 'input', '', [
|
|
'col' => [
|
|
'xs' => 24,
|
|
'sm' => 24,
|
|
'md' => 24,
|
|
'lg' => 24,
|
|
'xl' => 8,
|
|
],
|
|
'props' => [
|
|
'placeholder' => 'Input Placeholder',
|
|
'clearable' => true
|
|
]
|
|
]);
|
|
$builder->add('select', 'Select', 'select', '', [
|
|
'col' => [
|
|
'xs' => 24,
|
|
'sm' => 24,
|
|
'md' => 24,
|
|
'lg' => 24,
|
|
'xl' => 8,
|
|
],
|
|
'props' => [
|
|
'placeholder' => 'Select Placeholder',
|
|
'clearable' => true
|
|
],
|
|
'options' => [
|
|
[
|
|
'label' => '选项一',
|
|
'value' => '选项一'
|
|
],
|
|
[
|
|
'label' => '选项二',
|
|
'value' => '选项二',
|
|
'tips' => '选项二Tips'
|
|
]
|
|
]
|
|
]);
|
|
$builder->add('remote_select', 'Remote Select', 'select', '', [
|
|
'col' => [
|
|
'xs' => 24,
|
|
'sm' => 24,
|
|
'md' => 24,
|
|
'lg' => 24,
|
|
'xl' => 8,
|
|
],
|
|
'remote' => [
|
|
'url' => '/app/pluginExample/admin/Form/remote_select'
|
|
],
|
|
'props' => [
|
|
'placeholder' => 'Remote Select Placeholder',
|
|
'clearable' => true
|
|
],
|
|
'options' => []
|
|
]);
|
|
$builder->add('mention', 'Mention', 'mention', '', [
|
|
'col' => [
|
|
'xs' => 24,
|
|
'sm' => 24,
|
|
'md' => 24,
|
|
'lg' => 24,
|
|
'xl' => 8,
|
|
],
|
|
'remote' => [
|
|
'url' => '/app/pluginExample/admin/Form/remote_select'
|
|
],
|
|
'props' => [
|
|
'placeholder' => 'Mention Placeholder',
|
|
'clearable' => true
|
|
],
|
|
'options' => []
|
|
]);
|
|
$builder->add('autocomplete', 'Autocomplete', 'autocomplete', '', [
|
|
'col' => [
|
|
'xs' => 24,
|
|
'sm' => 24,
|
|
'md' => 24,
|
|
'lg' => 24,
|
|
'xl' => 8,
|
|
],
|
|
'remote' => [
|
|
'url' => '/app/pluginExample/admin/Form/remote_select'
|
|
],
|
|
'props' => [
|
|
'placeholder' => 'Autocomplete Placeholder',
|
|
'clearable' => true
|
|
],
|
|
'options' => []
|
|
]);
|
|
$builder->add('switch', '状态', 'switch', '', [
|
|
'col' => [
|
|
'xs' => 24,
|
|
'sm' => 24,
|
|
'md' => 24,
|
|
'lg' => 24,
|
|
'xl' => 8,
|
|
],
|
|
'props' => [
|
|
'active-value' => State::YES['value'],
|
|
'inactive-value' => State::NO['value']
|
|
]
|
|
]);
|
|
$builder->add('bundle', '附件库', 'bundle', '', [
|
|
'props' => [
|
|
// 'accept' => 'image/*',
|
|
'multiple' => 1
|
|
]
|
|
]);
|
|
return $this->resData($builder);
|
|
}
|
|
public function remote_select(Request $request)
|
|
{
|
|
$keyword = $request->post('keyword');
|
|
$form = $request->post('form');
|
|
$options = [
|
|
[
|
|
'label' => '选项一',
|
|
'value' => '选项一'
|
|
],
|
|
[
|
|
'label' => '选项二',
|
|
'value' => '选项二',
|
|
'tips' => '选项二Tips'
|
|
]
|
|
];
|
|
return $this->resData($options);
|
|
}
|
|
}
|