category.php 7.2 KB

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