pub trait Action {
Show 38 methods
// Required methods
fn title(&self) -> &'static str;
fn index(&mut self, request: Request) -> ApiResponse;
// Provided methods
fn _name(&self) -> String { ... }
fn api(&self) -> String { ... }
fn token(&self) -> bool { ... }
fn sort(&self) -> usize { ... }
fn description(&self) -> &'static str { ... }
fn path(&self) -> &'static str { ... }
fn query(&self) -> JsonValue { ... }
fn tags(&self) -> &'static [&'static str] { ... }
fn icon(&self) -> &'static str { ... }
fn public(&self) -> bool { ... }
fn auth(&self) -> bool { ... }
fn interface_type(&self) -> InterfaceType { ... }
fn method(&mut self) -> Method { ... }
fn content_type(&mut self) -> ContentType { ... }
fn params_check(&mut self) -> bool { ... }
fn params(&mut self) -> JsonValue { ... }
fn success(&mut self) -> ApiResponse { ... }
fn error(&mut self) -> ApiResponse { ... }
fn run(&mut self, request: Request) -> Result<ApiResponse, ApiResponse> { ... }
fn check(
&mut self,
request: &mut JsonValue,
params: JsonValue,
) -> Result<(), ApiResponse> { ... }
fn params_table_select(&mut self, params: JsonValue) -> JsonValue { ... }
fn table_select(
&mut self,
request: JsonValue,
table_name: &str,
fields: Vec<&str>,
) -> JsonValue { ... }
fn params_table_menu(&mut self, params: JsonValue) -> JsonValue { ... }
fn table_menu(
&mut self,
request: JsonValue,
table_name: &str,
label_field: &str,
fields: JsonValue,
hidd_field: Vec<&str>,
show_field: Vec<&str>,
search_fields: Vec<&str>,
_filter_fields: Vec<&str>,
) -> JsonValue { ... }
fn params_table_tree(&mut self, params: JsonValue) -> JsonValue { ... }
fn table_tree(
&mut self,
request: JsonValue,
table_name: &str,
pid_field: &str,
label_field: &str,
fields: JsonValue,
hidd_field: Vec<&str>,
show_field: Vec<&str>,
search_fields: Vec<&str>,
_filter_fields: Vec<&str>,
) -> JsonValue { ... }
fn params_table_list(&mut self, params: JsonValue) -> JsonValue { ... }
fn table_list(
&mut self,
request: JsonValue,
table_name: &str,
fields: JsonValue,
hidd_field: Vec<&str>,
show_field: Vec<&str>,
search_fields: Vec<&str>,
filter_fields: Vec<&str>,
) -> JsonValue { ... }
fn table_column(&mut self, field: JsonValue) -> JsonValue { ... }
fn filter_column(&mut self, field: JsonValue) -> JsonValue { ... }
fn tools(&mut self) -> Tools { ... }
fn config(&mut self, name: &str) -> JsonValue { ... }
fn btn(&mut self) -> Btn { ... }
fn set_global_data(&mut self, key: &str, value: JsonValue) { ... }
fn get_global_data(&mut self) -> JsonValue { ... }
fn get_global_data_key(&mut self, key: &str) -> JsonValue { ... }
}Expand description
功能接口
Required Methods§
Sourcefn index(&mut self, request: Request) -> ApiResponse
fn index(&mut self, request: Request) -> ApiResponse
内部入口
Provided Methods§
fn sort(&self) -> usize
Sourcefn description(&self) -> &'static str
fn description(&self) -> &'static str
功能描述
归属标签
fn icon(&self) -> &'static str
Sourcefn interface_type(&self) -> InterfaceType
fn interface_type(&self) -> InterfaceType
接口类型 btn api menu
Sourcefn content_type(&mut self) -> ContentType
fn content_type(&mut self) -> ContentType
请求类型
Sourcefn params_check(&mut self) -> bool
fn params_check(&mut self) -> bool
是否检查参数
Sourcefn success(&mut self) -> ApiResponse
fn success(&mut self) -> ApiResponse
成功响应
Sourcefn error(&mut self) -> ApiResponse
fn error(&mut self) -> ApiResponse
失败响应
Sourcefn run(&mut self, request: Request) -> Result<ApiResponse, ApiResponse>
fn run(&mut self, request: Request) -> Result<ApiResponse, ApiResponse>
外部入口
Sourcefn check(
&mut self,
request: &mut JsonValue,
params: JsonValue,
) -> Result<(), ApiResponse>
fn check( &mut self, request: &mut JsonValue, params: JsonValue, ) -> Result<(), ApiResponse>
入参验证
fn params_table_select(&mut self, params: JsonValue) -> JsonValue
fn table_select( &mut self, request: JsonValue, table_name: &str, fields: Vec<&str>, ) -> JsonValue
菜单表格接收参数
Sourcefn params_table_tree(&mut self, params: JsonValue) -> JsonValue
fn params_table_tree(&mut self, params: JsonValue) -> JsonValue
树型表格接收参数
fn table_tree( &mut self, request: JsonValue, table_name: &str, pid_field: &str, label_field: &str, fields: JsonValue, hidd_field: Vec<&str>, show_field: Vec<&str>, search_fields: Vec<&str>, _filter_fields: Vec<&str>, ) -> JsonValue
Sourcefn params_table_list(&mut self, params: JsonValue) -> JsonValue
fn params_table_list(&mut self, params: JsonValue) -> JsonValue
表格接收参数
Sourcefn table_list(
&mut self,
request: JsonValue,
table_name: &str,
fields: JsonValue,
hidd_field: Vec<&str>,
show_field: Vec<&str>,
search_fields: Vec<&str>,
filter_fields: Vec<&str>,
) -> JsonValue
fn table_list( &mut self, request: JsonValue, table_name: &str, fields: JsonValue, hidd_field: Vec<&str>, show_field: Vec<&str>, search_fields: Vec<&str>, filter_fields: Vec<&str>, ) -> JsonValue
列表表格渲染
- table_name 表名
- fields 全部模型字段集合
- hidd_field 需要隐藏的字段集合
- show_field 需要显示的字段集合
- search_fields 搜索字段集合
- filter_fields 高级搜索字段集合
fn table_column(&mut self, field: JsonValue) -> JsonValue
fn filter_column(&mut self, field: JsonValue) -> JsonValue
Sourcefn set_global_data(&mut self, key: &str, value: JsonValue)
fn set_global_data(&mut self, key: &str, value: JsonValue)
设置全局变量
Sourcefn get_global_data(&mut self) -> JsonValue
fn get_global_data(&mut self) -> JsonValue
获取全局变量数据
Sourcefn get_global_data_key(&mut self, key: &str) -> JsonValue
fn get_global_data_key(&mut self, key: &str) -> JsonValue
获取全局变量指定字段数据