info.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <?php
  2. $project = function()
  3. {
  4. $array = array();
  5. $info = Dever::load('category/project-state');
  6. if($info)
  7. {
  8. $array += $info;
  9. }
  10. return $array;
  11. };
  12. $status = array
  13. (
  14. 1 => '启用',
  15. 2 => '不启用',
  16. );
  17. return array
  18. (
  19. # 表名
  20. 'name' => 'info',
  21. # 显示给用户看的名称
  22. 'lang' => '分类列表',
  23. # 是否显示在后台菜单
  24. 'order' => 10,
  25. //'check' => 'key',
  26. 'end' => array
  27. (
  28. 'insert' => 'category/lib/manage.update',
  29. 'update' => 'category/lib/manage.update',
  30. ),
  31. # 数据结构
  32. 'struct' => array
  33. (
  34. 'id' => array
  35. (
  36. 'type' => 'int-11',
  37. 'name' => 'ID',
  38. 'default' => '',
  39. 'desc' => '',
  40. 'match' => 'is_numeric',
  41. 'order' => 'asc',
  42. 'list' => true,
  43. ),
  44. 'name' => array
  45. (
  46. 'type' => 'varchar-150',
  47. 'name' => '分类名称',
  48. 'default' => '',
  49. 'desc' => '分类名称',
  50. 'match' => 'is_string',
  51. 'update' => 'text',
  52. 'search' => 'fulltext',
  53. 'list' => true,
  54. 'edit' => true,
  55. ),
  56. 'key' => array
  57. (
  58. 'type' => 'varchar-150',
  59. 'name' => '分类标识-请输入英文,分类标识为唯一项,用来区分前端展示,选填项',
  60. 'default' => '',
  61. 'desc' => '分类标识',
  62. 'match' => 'option',
  63. //'update' => 'text',
  64. //'search' => 'fulltext',
  65. //'list' => true,
  66. //'edit' => true,
  67. ),
  68. 'info' => array
  69. (
  70. 'type' => 'varchar-800',
  71. 'name' => '上级分类',
  72. 'default' => Dever::input('option_info', -1),
  73. 'desc' => '请选择上级分类',
  74. 'match' => 'option',
  75. 'update' => 'linkage',
  76. 'linkage' => 'id=' . Dever::input('where_id'),
  77. 'option' => Dever::url('api.get', 'category'),
  78. //'list' => 'Dever::load("category/api.string", "{info}")',
  79. ),
  80. 'project_id' => array
  81. (
  82. 'type' => 'int-11',
  83. 'name' => '所属项目',
  84. 'default' => Dever::input('option_project_id', 1),
  85. 'desc' => '所属项目',
  86. 'match' => 'is_numeric',
  87. 'update' => 'select',
  88. 'option' => $project,
  89. 'list' => '{project_id} > 0 ? Dever::load("category/project-one#name", {project_id}) : "未选择"',
  90. 'edit' => true,
  91. ),
  92. 'icon' => array
  93. (
  94. 'type' => 'varchar-150',
  95. 'name' => '图标',
  96. 'default' => '',
  97. 'desc' => '图标',
  98. 'match' => 'option',
  99. 'update' => 'image',
  100. 'key' => 1,
  101. ),
  102. 'color' => array
  103. (
  104. 'type' => 'varchar-10',
  105. 'name' => '字体颜色-请填写颜色代码',
  106. 'default' => '',
  107. 'desc' => '字体颜色',
  108. 'match' => 'option',
  109. 'update' => 'color',
  110. ),
  111. 'bgcolor' => array
  112. (
  113. 'type' => 'varchar-10',
  114. 'name' => '背景颜色-请填写颜色代码',
  115. 'default' => '',
  116. 'desc' => '背景颜色',
  117. 'match' => 'option',
  118. 'update' => 'color',
  119. ),
  120. 'info_id' => array
  121. (
  122. 'type' => 'int-11',
  123. 'name' => '上级分类',
  124. 'default' => -1,
  125. 'desc' => '请选择上级分类',
  126. 'match' => 'is_numeric',
  127. 'value' => Dever::input('option_info_id', -1),
  128. 'list' => '{info_id} > 0 ? Dever::load("category/info-one#name", {info_id}) : "父级分类"',
  129. ),
  130. 'top_id' => array
  131. (
  132. 'type' => 'int-11',
  133. 'name' => '顶级分类',
  134. 'default' => -1,
  135. 'desc' => '请选择顶级分类',
  136. 'match' => 'is_numeric',
  137. ),
  138. 'level' => array
  139. (
  140. 'type' => 'int-11',
  141. 'name' => '分类级别-1为顶级分类、2为2级分类,-1为最后一级分类',
  142. 'default' => 1,
  143. 'desc' => '分类级别',
  144. 'match' => 'is_numeric',
  145. ),
  146. 'status' => array
  147. (
  148. 'type' => 'tinyint-1',
  149. 'name' => '是否启用',
  150. 'default' => '1',
  151. 'desc' => '是否启用',
  152. 'match' => 'is_numeric',
  153. //'update' => 'select',
  154. 'option' => $status,
  155. 'list' => true,
  156. 'edit' => true,
  157. ),
  158. 'reorder' => array
  159. (
  160. 'type' => 'int-11',
  161. 'name' => '排序(数值越大越靠前)',
  162. 'default' => '1',
  163. 'desc' => '请输入排序',
  164. 'match' => 'option',
  165. //'update' => 'text',
  166. 'search' => 'order',
  167. 'list_name' => '排序',
  168. 'list' => true,
  169. 'order' => 'desc',
  170. 'edit' => true,
  171. ),
  172. 'state' => array
  173. (
  174. 'type' => 'tinyint-1',
  175. 'name' => '状态',
  176. 'default' => '1',
  177. 'desc' => '请选择状态',
  178. 'match' => 'is_numeric',
  179. ),
  180. 'cdate' => array
  181. (
  182. 'type' => 'int-11',
  183. 'name' => '录入时间',
  184. 'match' => array('is_numeric', time()),
  185. 'desc' => '',
  186. # 只有insert时才生效
  187. 'insert' => true,
  188. //'search' => 'date',
  189. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  190. ),
  191. ),
  192. 'manage' => array
  193. (
  194. 'button' => array
  195. (
  196. '项目管理' => array('list', 'project&oper_parent=info&oper_project=category'),
  197. ),
  198. # 列表页的类型
  199. 'list_type' => 'tree',
  200. 'list_button' => array
  201. (
  202. 'add' => array('新增子分类', '"{info}" == -1 ? "info&option_info={id}&option_project_id={project_id}" : "info&option_info={info},{id}&option_project_id={project_id}"'),
  203. ),
  204. ),
  205. 'request' => array
  206. (
  207. # 获取顶级分类
  208. 'getTop' => array
  209. (
  210. # 匹配的正则或函数 选填项
  211. 'option' => array
  212. (
  213. 'ids' => array('yes-id', 'in'),
  214. 'project_id' => 'yes',
  215. 'info_id' => -1,
  216. 'state' => 1,
  217. ),
  218. 'type' => 'all',
  219. 'order' => array('reorder' => 'desc', 'id' => 'asc'),
  220. 'col' => '*|id',
  221. ),
  222. 'getChild' => array
  223. (
  224. # 匹配的正则或函数 选填项
  225. 'option' => array
  226. (
  227. 'project_id' => 'yes',
  228. 'info_id' => 'yes',
  229. 'top_id' => 'yes',
  230. 'level' => 'yes',
  231. 'info_id_in' => array('yes-info_id', 'in'),
  232. 'id' => array('yes', '!='),
  233. 'info' => array('yes', 'like'),
  234. 'state' => 1,
  235. ),
  236. 'type' => 'all',
  237. 'order' => array('reorder' => 'desc', 'id' => 'asc'),
  238. 'col' => '*|info_id|',
  239. ),
  240. 'getList' => array
  241. (
  242. # 匹配的正则或函数 选填项
  243. 'option' => array
  244. (
  245. 'project_id' => 'yes',
  246. 'info_id' => 'yes',
  247. 'top_id' => 'yes',
  248. 'level' => 'yes',
  249. 'info_id_in' => array('yes-info_id', 'in'),
  250. 'id' => array('yes', '!='),
  251. 'info' => array('yes', 'like'),
  252. 'state' => 1,
  253. ),
  254. 'type' => 'all',
  255. 'order' => array('reorder' => 'desc', 'id' => 'asc'),
  256. 'col' => '*',
  257. ),
  258. 'getAll' => array
  259. (
  260. # 匹配的正则或函数 选填项
  261. 'option' => array
  262. (
  263. 'project_id' => 'yes',
  264. 'info_id' => 'yes',
  265. 'id' => array('yes', '!='),
  266. 'state' => 1,
  267. ),
  268. 'type' => 'all',
  269. 'order' => array('reorder' => 'desc', 'id' => 'asc'),
  270. 'col' => 'id as value, name',
  271. ),
  272. )
  273. );