*/ namespace app\admin\page\system; use app\common\BasePage; use sdModule\layui\Layui; use sdModule\layui\TablePage; use sdModule\layui\tablePage\TableAux; use sdModule\layuiSearch\Form; use sdModule\layui\defaultForm\FormData; use sdModule\layuiSearch\SearchForm; use sdModule\layuiSearch\generate\TimeRange; /** * Class ApiModule * @package app\admin\page */ class ApiModule extends BasePage { /** * 获取创建列表table的数据 * @return TablePage * @throws \app\common\SdException */ public function getTablePageData(): TablePage { $table = TablePage::create([ TableAux::column(['type' => 'checkbox']), // TableAux::column('id', ''), TableAux::column('item_name', '模块名'), TableAux::column('url_prefix', '路径前缀'), TableAux::column('update_time', '修改时间'), ]); $table->setHandleWidth(250); $table->addEvent('api'); $table->setEventHtml('api', Layui::button('接口', 'release')->setEvent('api')->normal('xs')); $table->setEventJs('api', TableAux::openTabs([url('system.Api/index'), 'url_prefix'], '接口维护')); return $table; } /** * 生成表单的数据 * @return array */ public function formData(): array { return [ FormData::hidden('id'), FormData::text('item_name', '模块名'), FormData::tag('url_prefix', '路径前缀'), FormData::text('token', 'Token参数', 'key=value&key1=value1'), FormData::text('describe', '描述'), ]; } /** * 列表页面的名字 * @return string */ public function listPageName(): string { return "接口模块"; } /** * 创建搜索表单的数据 * @return string */ public function searchFormData():string { $form_data = [ // SearchForm::Text('i.id', "")->label(true)->html(), SearchForm::Text('i.item_name%%', "模块名")->label(true)->html(), SearchForm::TimeRange("i.update_time_~", "修改时间")->label(true)->html(TimeRange::TYPE_DATETIME), ]; return Form::CreateHTML($form_data); } /** * @return array 设置快捷搜索 */ public function setQuickSearchField():array { return [ ]; } }