You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
114 lines
2.1 KiB
114 lines
2.1 KiB
<?php |
|
/** |
|
* Date: 2020/11/25 12:36 |
|
* User: chenlong <vip_chenlong@163.com> |
|
*/ |
|
|
|
namespace app\common; |
|
|
|
use app\common\traits\Lang; |
|
use sdModule\layui\TablePage; |
|
use sdModule\layuiSearch\Form; |
|
|
|
/** |
|
* Class BasePage |
|
* @package app\common |
|
*/ |
|
abstract class BasePage |
|
{ |
|
use Lang; |
|
|
|
/** |
|
* @var int 表单占用页面比例,默认为自适应,取值 1 - 12, 设置后提交按钮会取消定位 |
|
*/ |
|
public int $md = 0; |
|
|
|
/** |
|
* @var string 列表数据页面模板 |
|
*/ |
|
public string $list_template = 'common/list_page'; |
|
|
|
/** |
|
* @var string 表单页面模板 |
|
*/ |
|
public string $form_template = 'common/save_page'; |
|
|
|
/** |
|
* @var array 表单默认值赋值字段 |
|
* @example ['scene' => ['id', 'name', ...]] |
|
*/ |
|
protected array $default_filter = []; |
|
|
|
/** |
|
* 获取创建列表table的数据 |
|
* @return TablePage |
|
*/ |
|
abstract public function getTablePageData():TablePage; |
|
|
|
/** |
|
* 生成表单的数据 |
|
* @return array |
|
*/ |
|
abstract public function formData():array; |
|
|
|
/** |
|
* 列表页面的名字 |
|
* @return string |
|
*/ |
|
abstract public function listPageName():string; |
|
|
|
/** |
|
* 设置js |
|
* @return string |
|
*/ |
|
public function formJs() |
|
{ |
|
return ''; |
|
} |
|
|
|
/** |
|
* 表单是否为方框风格 |
|
* @return bool |
|
*/ |
|
public function setFormSkin():bool |
|
{ |
|
return false; |
|
} |
|
|
|
/** |
|
* 创建搜索表单的数据 |
|
* @return string |
|
*/ |
|
public function searchFormData():string |
|
{ |
|
return Form::CreateHTML([]); |
|
} |
|
|
|
/** |
|
* @return array 设置快捷搜索 |
|
*/ |
|
public function setQuickSearchField():array |
|
{ |
|
return []; |
|
} |
|
|
|
/** |
|
* 获取场景赋值时的字段过滤 |
|
* @param string $scene |
|
* @return array|mixed |
|
*/ |
|
public function getOnlyFieldVal(string $scene):array |
|
{ |
|
return $this->default_filter[$scene] ?? []; |
|
} |
|
|
|
/** |
|
* @return array 设置短表单 |
|
*/ |
|
public function shortInput():array |
|
{ |
|
return [ |
|
// 'id' => 'this short' |
|
]; |
|
} |
|
}
|
|
|