add apimanager module
This commit is contained in:
61
catch/apimanager/tables/ApiCategory.php
Normal file
61
catch/apimanager/tables/ApiCategory.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | UCToo [ Universal Convergence Technology ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2014-2021 https://www.uctoo.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: UCToo <contact@uctoo.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace catchAdmin\apimanager\tables;
|
||||
|
||||
use catchAdmin\apimanager\tables\forms\Factory;
|
||||
use catcher\CatchTable;
|
||||
use catcher\library\table\Actions;
|
||||
use catcher\library\table\HeaderItem;
|
||||
use catcher\library\table\Search;
|
||||
use catcher\library\table\Table;
|
||||
|
||||
class ApiCategory extends CatchTable
|
||||
{
|
||||
/**
|
||||
* table
|
||||
*
|
||||
* @time 2021年03月29日
|
||||
* @return array
|
||||
*/
|
||||
protected function table(): array
|
||||
{
|
||||
// TODO: Implement table() method.
|
||||
return $this->getTable('api_category')->header([
|
||||
HeaderItem::label('分类标题')->prop('category_title'),
|
||||
HeaderItem::label('分类唯一标识')->prop('category_name'),
|
||||
HeaderItem::label('排序')->prop('sort')->withEditNumberComponent(),
|
||||
HeaderItem::label('状态')->prop('status')->withSwitchComponent(),
|
||||
HeaderItem::label('创建时间')->prop('created_at'),
|
||||
HeaderItem::label('操作')->width(260)->actions([
|
||||
Actions::update(),
|
||||
Actions::delete(),
|
||||
])
|
||||
])->withApiRoute('apicategory')->withActions([
|
||||
Actions::create()
|
||||
])->withSearch([
|
||||
Search::label('分类标题')->text('category_title', '请输入分类标题'),
|
||||
Search::label('状态')->status()
|
||||
])->withDialogWidth('35%')
|
||||
->toTreeTable()->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* form 方式
|
||||
*
|
||||
* @time 2021年03月29日
|
||||
* @return array
|
||||
*/
|
||||
protected function form(): array
|
||||
{
|
||||
return Factory::create('ApiCategory');
|
||||
}
|
||||
}
|
40
catch/apimanager/tables/forms/ApiCategory.php
Normal file
40
catch/apimanager/tables/forms/ApiCategory.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | UCToo [ Universal Convergence Technology ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2014-2021 https://www.uctoo.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: UCToo <contact@uctoo.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace catchAdmin\apimanager\tables\forms;
|
||||
|
||||
use catchAdmin\apimanager\model\ApiCategory as ApiCategoryModel;
|
||||
use catcher\library\form\Form;
|
||||
|
||||
class ApiCategory extends Form
|
||||
{
|
||||
public function fields(): array
|
||||
{
|
||||
return [
|
||||
// TODO: Implement fields() method
|
||||
Form::cascader('parent_id', '上级分类', [0])->options(
|
||||
ApiCategoryModel::field(['id', 'parent_id', 'category_title'])->select()->toTree()
|
||||
)->clearable(true)->filterable(true)->props([
|
||||
'props' => [
|
||||
'value' => 'id',
|
||||
'label' => 'category_title',
|
||||
'checkStrictly' => true
|
||||
],
|
||||
])->style(['width' => '100%']),
|
||||
Form::input('category_title', '分类标题')->required()->placeholder('分类标题'),
|
||||
Form::input('category_name', '分类唯一标识'),
|
||||
Form::radio('status', '状态')->value(1)->options(
|
||||
Form::options()->add('启用', 1)->add('禁用', 2)->render()
|
||||
),
|
||||
Form::number('sort', '排序')->value(1)->min(1)->max(10000),
|
||||
];
|
||||
}
|
||||
}
|
22
catch/apimanager/tables/forms/Factory.php
Normal file
22
catch/apimanager/tables/forms/Factory.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | UCToo [ Universal Convergence Technology ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2014-2021 https://www.uctoo.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: UCToo <contact@uctoo.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace catchAdmin\apimanager\tables\forms;
|
||||
|
||||
use catcher\library\form\FormFactory;
|
||||
|
||||
class Factory extends FormFactory
|
||||
{
|
||||
public static function from(): string
|
||||
{
|
||||
return __NAMESPACE__;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user