Files
shopxo/app/admin/form/Admin.php

225 lines
8.1 KiB
PHP
Raw Normal View History

2020-06-11 18:48:31 +08:00
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
2021-03-16 10:34:52 +08:00
// | Copyright (c) 2011~2099 http://shopxo.net All rights reserved.
2020-06-11 18:48:31 +08:00
// +----------------------------------------------------------------------
2021-03-16 10:34:52 +08:00
// | Licensed ( https://opensource.org/licenses/mit-license.php )
2020-06-11 18:48:31 +08:00
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace app\admin\form;
use app\service\AdminService;
/**
* 管理员动态表格
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-11
* @desc description
*/
class Admin
{
// 基础条件
public $condition_base = [];
2023-02-06 18:30:08 +08:00
// 角色列表
public $role_list;
/**
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-29
* @desc description
* @param [array] $params [输入参数]
*/
public function __construct($params = [])
{
// 角色列表
$res = AdminService::RoleList([
'where' => ['is_enable'=>1],
'field' => 'id,name',
]);
$this->role_list = empty($res['data']) ? [] : array_column($res['data'], null, 'id');
}
2020-06-11 18:48:31 +08:00
/**
* 入口
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-11
* @desc description
* @param [array] $params [输入参数]
*/
public function Run($params = [])
{
2023-02-01 22:41:26 +08:00
$lang = MyLang('admin.form_table');
2020-06-11 18:48:31 +08:00
return [
// 基础配置
'base' => [
2023-02-06 18:30:08 +08:00
'key_field' => 'id',
'is_search' => 1,
'is_delete' => 1,
'is_data_export_excel' => 1,
2020-06-11 18:48:31 +08:00
],
// 表单配置
'form' => [
[
'view_type' => 'checkbox',
'is_checked' => 0,
2023-01-29 18:11:08 +08:00
'checked_text' => MyLang('reverse_select_title'),
'not_checked_text' => MyLang('select_all_title'),
2020-06-11 18:48:31 +08:00
'align' => 'center',
'not_show_key' => 'id',
'not_show_data' => [1],
2020-06-11 18:48:31 +08:00
'width' => 80,
],
[
2023-02-01 22:41:26 +08:00
'label' => $lang['username'],
2020-06-11 18:48:31 +08:00
'view_type' => 'field',
'view_key' => 'username',
'is_sort' => 1,
2020-06-11 18:48:31 +08:00
'search_config' => [
'form_type' => 'input',
'where_type' => 'like',
],
],
[
2023-02-06 18:30:08 +08:00
'label' => $lang['status'],
2020-06-11 18:48:31 +08:00
'view_type' => 'field',
2020-07-02 22:42:01 +08:00
'view_key' => 'status',
'view_data_key' => 'name',
2023-01-19 17:44:03 +08:00
'view_data' => MyLang('common_admin_status_list'),
'is_sort' => 1,
2020-06-11 18:48:31 +08:00
'search_config' => [
'form_type' => 'select',
'where_type' => 'in',
2023-01-19 17:44:03 +08:00
'data' => MyLang('common_admin_status_list'),
2020-06-11 18:48:31 +08:00
'data_key' => 'value',
'data_name' => 'name',
'is_multiple' => 1,
],
],
[
2023-02-06 18:30:08 +08:00
'label' => $lang['gender'],
2020-06-11 18:48:31 +08:00
'view_type' => 'field',
2020-07-02 22:42:01 +08:00
'view_key' => 'gender',
'view_data_key' => 'name',
2023-01-19 17:44:03 +08:00
'view_data' => MyLang('common_gender_list'),
'is_sort' => 1,
2020-06-11 18:48:31 +08:00
'search_config' => [
'form_type' => 'select',
'where_type' => 'in',
2023-01-19 17:44:03 +08:00
'data' => MyLang('common_gender_list'),
2020-06-11 18:48:31 +08:00
'data_key' => 'id',
'data_name' => 'name',
'is_multiple' => 1,
],
],
[
2023-02-01 22:41:26 +08:00
'label' => $lang['mobile'],
2020-06-11 18:48:31 +08:00
'view_type' => 'field',
'view_key' => 'mobile',
'is_sort' => 1,
2020-06-11 18:48:31 +08:00
'search_config' => [
'form_type' => 'input',
'where_type' => 'like',
],
],
[
2023-02-01 22:41:26 +08:00
'label' => $lang['email'],
'view_type' => 'field',
'view_key' => 'email',
'is_sort' => 1,
'search_config' => [
2020-06-11 18:48:31 +08:00
'form_type' => 'input',
'where_type' => 'like',
],
],
[
2023-02-01 22:41:26 +08:00
'label' => $lang['role_name'],
2020-06-11 18:48:31 +08:00
'view_type' => 'field',
2023-02-06 18:30:08 +08:00
'view_key' => 'role_id',
'view_data_key' => 'name',
'view_data' => $this->role_list,
'is_sort' => 1,
2020-06-11 18:48:31 +08:00
'search_config' => [
'form_type' => 'select',
'where_type' => 'in',
2023-02-06 18:30:08 +08:00
'data' => $this->role_list,
2020-06-11 18:48:31 +08:00
'data_key' => 'id',
'data_name' => 'name',
'is_multiple' => 1,
],
],
[
2023-02-01 22:41:26 +08:00
'label' => $lang['login_total'],
2020-06-11 18:48:31 +08:00
'view_type' => 'field',
'view_key' => 'login_total',
'is_sort' => 1,
2020-06-11 18:48:31 +08:00
'search_config' => [
'form_type' => 'section',
],
],
[
2023-02-01 22:41:26 +08:00
'label' => $lang['login_time'],
2020-06-11 18:48:31 +08:00
'view_type' => 'field',
'view_key' => 'login_time',
'is_sort' => 1,
2020-06-11 18:48:31 +08:00
'search_config' => [
'form_type' => 'datetime',
],
],
[
2023-02-01 22:41:26 +08:00
'label' => $lang['add_time'],
2020-06-11 18:48:31 +08:00
'view_type' => 'field',
'view_key' => 'add_time',
'is_sort' => 1,
2020-06-11 18:48:31 +08:00
'search_config' => [
'form_type' => 'datetime',
],
],
[
2023-02-01 22:41:26 +08:00
'label' => $lang['upd_time'],
2020-06-11 18:48:31 +08:00
'view_type' => 'field',
'view_key' => 'upd_time',
'is_sort' => 1,
2020-06-11 18:48:31 +08:00
'search_config' => [
'form_type' => 'datetime',
],
],
[
2023-01-26 17:06:20 +08:00
'label' => MyLang('operate_title'),
2020-06-11 18:48:31 +08:00
'view_type' => 'operate',
'view_key' => 'admin/module/operate',
'align' => 'center',
'fixed' => 'right',
],
],
2022-08-02 17:23:10 +08:00
// 数据配置
'data' => [
2023-02-06 18:30:08 +08:00
'table_name' => 'Admin',
'is_page' => 1,
'is_handle_time_field' => 1,
2022-08-02 17:23:10 +08:00
],
2020-06-11 18:48:31 +08:00
];
}
/**
* 获取角色组列表
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-11
* @desc description
*/
public function GetRoleList()
{
2023-02-06 18:30:08 +08:00
2020-06-11 18:48:31 +08:00
}
}
?>