Manager.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <?php
  2. /**
  3. * FecShop file.
  4. *
  5. * @link http://www.fecshop.com/
  6. * @copyright Copyright (c) 2016 FecShop Software LLC
  7. * @license http://www.fecshop.com/license/
  8. */
  9. namespace fecadmin\block\config;
  10. use fecadmin\FecadminbaseBlock;
  11. use fecadmin\models\AdminConfig;
  12. use fec\helpers\CUrl;
  13. /**
  14. * @author Terry Zhao <2358269014@qq.com>
  15. * @since 1.0
  16. */
  17. class Manager extends FecadminbaseBlock{
  18. public $_obj ;
  19. public $_paramKey = 'id';
  20. public $_defaultDirection = 'asc';
  21. # 初始化参数
  22. public function initParam(){
  23. # 定义编辑和删除的URL
  24. $this->_editUrl = CUrl::getUrl("fecadmin/config/manageredit");
  25. $this->_deleteUrl = CUrl::getUrl("fecadmin/config/managerdelete");
  26. $this->_obj = new AdminConfig;
  27. $this->_paramKey = 'id';
  28. /*
  29. # 自定义参数如下:
  30. #排序默认为主键倒序
  31. $this->_orderField = 'created_at';
  32. $this->_sortDirection = 'asc';
  33. # 主键默认为id
  34. $this->_paramKey = 'id';
  35. #第一次打开默认为第一页,一页显示50个
  36. $this->_pageNum = 1;
  37. $this->_numPerPage;
  38. */
  39. parent::initParam();
  40. }
  41. public function getLastData(){
  42. # 返回数据的函数
  43. # 隐藏部分
  44. $pagerForm = $this->getPagerForm();
  45. # 搜索部分
  46. $searchBar = $this->getSearchBar();
  47. # 编辑 删除 按钮部分
  48. $editBar = $this->getEditBar();
  49. # 表头部分
  50. $thead = $this->getTableThead();
  51. # 表内容部分
  52. $tbody = $this->getTableTbody();
  53. # 分页部分
  54. $toolBar = $this->getToolBar($this->_param['numCount'],$this->_param['pageNum'],$this->_param['numPerPage']);
  55. return [
  56. 'pagerForm' => $pagerForm,
  57. 'searchBar' => $searchBar,
  58. 'editBar' => $editBar,
  59. 'thead' => $thead,
  60. 'tbody' => $tbody,
  61. 'toolBar' => $toolBar,
  62. ];
  63. }
  64. # 定义搜索部分字段格式
  65. public function getSearchArr(){
  66. $data = [
  67. [ # 字符串类型
  68. 'type'=>'inputtext',
  69. 'title'=>'配置LABEL',
  70. 'name'=>'label' ,
  71. 'columns_type' =>'string'
  72. ],
  73. [ # 字符串类型
  74. 'type'=>'inputtext',
  75. 'title'=>'配置KEY',
  76. 'name'=>'key' ,
  77. 'columns_type' =>'string'
  78. ],
  79. ];
  80. return $data;
  81. }
  82. # 定义表格显示部分的配置
  83. public function getTableFieldArr(){
  84. $table_th_bar = [
  85. [
  86. 'orderField' => 'id',
  87. 'label' => 'ID',
  88. 'width' => '40',
  89. 'align' => 'left',
  90. ],
  91. [
  92. 'orderField' => 'label',
  93. 'label' => '配置LABEL',
  94. 'width' => '150',
  95. 'align' => 'left',
  96. ],
  97. [
  98. 'orderField' => 'key',
  99. 'label' => '配置key',
  100. 'width' => '110',
  101. 'align' => 'left',
  102. ],
  103. [
  104. 'orderField' => 'value',
  105. 'label' => '配置值',
  106. 'width' => '150',
  107. 'align' => 'left',
  108. ],
  109. [
  110. 'orderField' => 'created_at',
  111. 'label' => '创建时间',
  112. 'width' => '70',
  113. 'align' => 'center',
  114. ],
  115. [
  116. 'orderField' => 'updated_at',
  117. 'label' => '更新时间',
  118. 'width' => '70',
  119. 'align' => 'center',
  120. ],
  121. [
  122. 'orderField' => 'created_person',
  123. 'label' => '创建人',
  124. 'width' => '50',
  125. 'align' => 'left',
  126. ],
  127. ];
  128. return $table_th_bar ;
  129. }
  130. }