category_attr.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. <?php
  2. $col = 'id,name,is_must,`type`,data_type,`match`,`unit`,ename,icon,color,bgcolor,list_reorder,search_reorder,view_reorder,cate_id,state';
  3. $type = array
  4. (
  5. 1 => '数字输入框',
  6. 2 => '单行输入框',
  7. 3 => '多行输入框',
  8. //4 => '图文编辑器',
  9. 5 => '单图片上传',
  10. 6 => '多图片上传',
  11. 7 => '地区选择器',
  12. //8 => '多级分类',
  13. 9 => '区间输入框',
  14. 10 => '单选框',
  15. 11 => '多选框',
  16. 12 => '单项选择框',
  17. );
  18. $is_must = array
  19. (
  20. 1 => '必填项',
  21. 2 => '选填项',
  22. );
  23. $data_type = array
  24. (
  25. 1 => '数字',
  26. 2 => '字符',
  27. 3 => '正则匹配',
  28. );
  29. /*
  30. 使用该组件,这么用
  31. $attr = function()
  32. {
  33. $auth = Dever::load('attr/api.get', false);
  34. return $auth;
  35. };
  36. 'attr' => array
  37. (
  38. 'type' => 'varchar-800',
  39. 'name' => '属性设置',
  40. 'default' => '',
  41. 'desc' => '属性设置',
  42. 'match' => 'option',
  43. 'update' => 'checkbox',
  44. 'option' => $attr,
  45. 'update_input' => '',
  46. 'update_input_default' => '',
  47. 'update_parent' => 'checkbox',
  48. ),
  49. 'attr_input' => array
  50. (
  51. 'type' => 'text-255',
  52. 'name' => '属性值设置',
  53. 'default' => '',
  54. 'desc' => '属性值设置',
  55. 'match' => 'option',
  56. ),
  57. */
  58. return array
  59. (
  60. # 表名
  61. 'name' => 'category_attr',
  62. # 显示给用户看的名称
  63. 'lang' => '属性设置',
  64. # 是否显示在后台菜单
  65. 'order' => 10,
  66. 'menu' => false,
  67. 'end' => array
  68. (
  69. 'insert' => 'product/lib/manage.updateAttr',
  70. 'update' => 'product/lib/manage.updateAttr',
  71. ),
  72. # 数据结构
  73. 'struct' => array
  74. (
  75. 'id' => array
  76. (
  77. 'type' => 'int-11',
  78. 'name' => 'ID',
  79. 'default' => '',
  80. 'desc' => '',
  81. 'match' => 'is_numeric',
  82. 'order' => 'asc',
  83. 'list' => true,
  84. ),
  85. 'name' => array
  86. (
  87. 'type' => 'varchar-150',
  88. 'name' => '名称',
  89. 'default' => '',
  90. 'desc' => '名称',
  91. 'match' => 'is_string',
  92. 'update' => 'text',
  93. 'search' => 'fulltext',
  94. 'list' => true,
  95. 'edit' => true,
  96. 'tab' => 0,
  97. ),
  98. 'category_id' => array
  99. (
  100. 'type' => 'int-11',
  101. 'name' => '分类',
  102. 'default' => '-1',
  103. 'desc' => '分类',
  104. 'match' => 'is_numeric',
  105. 'update' => 'hidden',
  106. 'value' => Dever::input('search_option_category_id'),
  107. //'list' => '{category_id} > 0 ? Dever::load("product/category-one#name", {category_id}) : "未选择"',
  108. 'tab' => 0,
  109. ),
  110. 'is_must' => array
  111. (
  112. 'type' => 'tinyint-1',
  113. 'name' => '是否必填',
  114. 'default' => '1',
  115. 'desc' => '是否必填',
  116. 'match' => 'is_numeric',
  117. 'update' => 'radio',
  118. 'option' => $is_must,
  119. 'search' => 'select',
  120. 'list' => true,
  121. 'tab' => 0,
  122. ),
  123. 'type' => array
  124. (
  125. 'type' => 'tinyint-11',
  126. 'name' => '录入类型-配置录入类型后可以在商品录入时进行属性设置',
  127. 'default' => '1',
  128. 'desc' => '录入类型',
  129. 'match' => 'is_numeric',
  130. 'update' => 'radio',
  131. 'option' => $type,
  132. //'search' => 'select',
  133. //'list' => true,
  134. 'control' => 'type',
  135. 'tab' => 0,
  136. ),
  137. 'data_type' => array
  138. (
  139. 'type' => 'tinyint-1',
  140. 'name' => '数据验证类型-选择类型之后会自动验证数据有效性',
  141. 'default' => '1',
  142. 'desc' => '数据验证类型',
  143. 'match' => 'is_numeric',
  144. 'update' => 'radio',
  145. 'option' => $data_type,
  146. 'search' => 'select',
  147. //'list' => true,
  148. 'control' => 'data_type',
  149. 'show' => 'type=2',
  150. 'tab' => 0,
  151. ),
  152. 'match' => array
  153. (
  154. 'type' => 'varchar-600',
  155. 'name' => '正则匹配规则-直接输入正则表达式即可',
  156. 'default' => '',
  157. 'desc' => '正则匹配规则',
  158. 'match' => 'option',
  159. 'update' => 'textarea',
  160. //'search' => 'fulltext',
  161. //'list' => true,
  162. //'edit' => true,
  163. 'show' => array('data_type' => 3),
  164. 'tab' => 0,
  165. ),
  166. 'list_reorder' => array
  167. (
  168. 'type' => 'int-11',
  169. 'name' => '列表页排序-设置该属性在列表页中的排序,数字越大越靠前,如果为负数或者0,则不加入到列表页中。',
  170. 'default' => '1',
  171. 'desc' => '是否作为搜索条件',
  172. 'match' => 'is_numeric',
  173. 'update' => 'text',
  174. 'show' => 'type=1,2,7,9,10,11,12',
  175. //'search' => 'order',
  176. //'order' => 'desc',
  177. 'edit' => true,
  178. //'list' => true,
  179. 'tab' => 2,
  180. ),
  181. 'search_reorder' => array
  182. (
  183. 'type' => 'int-11',
  184. 'name' => '搜索条件排序-设置搜索条件中的排序,数字越大越靠前,如果为负数或者0,则不加入到搜索条件中。',
  185. 'default' => '1',
  186. 'desc' => '是否作为搜索条件',
  187. 'match' => 'is_numeric',
  188. 'update' => 'text',
  189. 'show' => 'type=1,2,7,9,10,11,12',
  190. //'search' => 'order',
  191. //'order' => 'desc',
  192. 'edit' => true,
  193. //'list' => true,
  194. 'tab' => 2,
  195. ),
  196. 'view_reorder' => array
  197. (
  198. 'type' => 'int-11',
  199. 'name' => '详情页排序-设置该属性在详情页中的排序,数字越大越靠前,如果为负数或者0,则不加入到详情页中。',
  200. 'default' => '1',
  201. 'desc' => '详情页排序',
  202. 'match' => 'is_numeric',
  203. 'update' => 'text',
  204. //'show' => 'type=1,2,7,9,10,11,12',
  205. //'search' => 'order',
  206. //'order' => 'desc',
  207. 'edit' => true,
  208. //'list' => true,
  209. 'tab' => 2,
  210. ),
  211. 'key' => array
  212. (
  213. 'type' => 'varchar-150',
  214. 'name' => '标识-该标识一般为前台样式名称,选填项',
  215. 'default' => '',
  216. 'desc' => '标识',
  217. 'match' => 'option',
  218. 'update' => 'text',
  219. //'search' => 'fulltext',
  220. //'list' => true,
  221. //'edit' => true,
  222. 'tab' => 1,
  223. ),
  224. 'unit' => array
  225. (
  226. 'type' => 'varchar-150',
  227. 'name' => '单位-填写属性单位,选填项',
  228. 'default' => '',
  229. 'desc' => '单位',
  230. 'match' => 'option',
  231. 'update' => 'text',
  232. 'tab' => 1,
  233. ),
  234. 'icon' => array
  235. (
  236. 'type' => 'varchar-150',
  237. 'name' => '图标-属性图标,选填项',
  238. 'default' => '',
  239. 'desc' => '图标',
  240. 'match' => 'option',
  241. 'update' => 'image',
  242. 'key' => 1,
  243. 'tab' => 1,
  244. ),
  245. 'color' => array
  246. (
  247. 'type' => 'varchar-10',
  248. 'name' => '字体颜色-请填写颜色代码,选填项',
  249. 'default' => '',
  250. 'desc' => '字体颜色',
  251. 'match' => 'option',
  252. 'update' => 'color',
  253. 'tab' => 1,
  254. ),
  255. 'bgcolor' => array
  256. (
  257. 'type' => 'varchar-10',
  258. 'name' => '背景颜色-请填写颜色代码,选填项',
  259. 'default' => '',
  260. 'desc' => '背景颜色',
  261. 'match' => 'option',
  262. 'update' => 'color',
  263. 'tab' => 1,
  264. ),
  265. 'state' => array
  266. (
  267. 'type' => 'tinyint-1',
  268. 'name' => '状态',
  269. 'default' => '1',
  270. 'desc' => '请选择状态',
  271. 'match' => 'is_numeric',
  272. ),
  273. 'cdate' => array
  274. (
  275. 'type' => 'int-11',
  276. 'name' => '录入时间',
  277. 'match' => array('is_numeric', time()),
  278. 'desc' => '',
  279. # 只有insert时才生效
  280. 'insert' => true,
  281. //'search' => 'date',
  282. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  283. ),
  284. ),
  285. 'manage' => array
  286. (
  287. 'lang' => 'name,unit',
  288. 'tab' => array('基本配置', '扩展设置', '排序规则'),
  289. 'insert' => false,
  290. 'edit' => false,
  291. 'button' => array
  292. (
  293. '新增' => array('fast'),
  294. ),
  295. # 列表
  296. 'list_button' => array
  297. (
  298. 'fast' => array('编辑'),
  299. 'list1' => array('属性值设置', '"category_attr_value&search_type=4&search_option_category_id={category_id}&search_option_attr_id={id}&oper_table=category_attr&top_table=category"' , '{type} > 9'),
  300. 'list2' => array('搜索值设置', '"category_attr_search&search_type=4&search_option_attr_id={id}&search_option_category_id={category_id}&oper_table=category_attr&top_table=category"' , '{type} == 1 || {type} == 9'),
  301. ),
  302. ),
  303. 'request' => array
  304. (
  305. 'getOne' => array
  306. (
  307. # 匹配的正则或函数 选填项
  308. 'option' => array
  309. (
  310. 'id' => 'yes',
  311. 'state' => 1,
  312. ),
  313. 'type' => 'one',
  314. 'col' => 'id,type,unit,name,icon as front_icon,color as front_color,bgcolor as front_bgcolor',
  315. ),
  316. 'getAll' => array
  317. (
  318. # 匹配的正则或函数 选填项
  319. 'option' => array
  320. (
  321. 'ids' => array('yes-id', 'in'),
  322. //'state' => 1,
  323. ),
  324. 'type' => 'all',
  325. 'order' => array('list_reorder`+`search_reorder`+`view_reorder' => 'desc', 'id' => 'desc'),
  326. 'col' => $col. '|id',
  327. ),
  328. 'getAllByIds' => array
  329. (
  330. # 匹配的正则或函数 选填项
  331. 'option' => array
  332. (
  333. 'ids' => array('yes-id', 'in'),
  334. //'state' => 1,
  335. ),
  336. 'type' => 'all',
  337. 'order' => array('list_reorder`+`search_reorder`+`view_reorder' => 'desc', 'id' => 'desc'),
  338. 'col' => $col. '|id',
  339. ),
  340. 'getListByIds' => array
  341. (
  342. # 匹配的正则或函数 选填项
  343. 'option' => array
  344. (
  345. 'ids' => array('yes-id', 'in'),
  346. 'list_reorder' => array('yes', '>='),
  347. 'state' => 1,
  348. ),
  349. 'type' => 'all',
  350. 'order' => array('list_reorder' => 'desc', 'id' => 'desc'),
  351. 'col' => $col. '|id',
  352. ),
  353. 'getSearchByIds' => array
  354. (
  355. # 匹配的正则或函数 选填项
  356. 'option' => array
  357. (
  358. 'ids' => array('yes-id', 'in'),
  359. 'search_reorder' => array('yes', '>='),
  360. 'state' => 1,
  361. ),
  362. 'type' => 'all',
  363. 'order' => array('search_reorder' => 'desc', 'id' => 'desc'),
  364. 'col' => $col. '|id',
  365. ),
  366. 'getViewByIds' => array
  367. (
  368. # 匹配的正则或函数 选填项
  369. 'option' => array
  370. (
  371. 'ids' => array('yes-id', 'in'),
  372. 'view_reorder' => array('yes', '>='),
  373. 'state' => 1,
  374. ),
  375. 'type' => 'all',
  376. 'order' => array('view_reorder' => 'desc', 'id' => 'desc'),
  377. 'col' => $col. '|id',
  378. ),
  379. 'getCateAll' => array
  380. (
  381. # 匹配的正则或函数 选填项
  382. 'option' => array
  383. (
  384. 'category_id' => array('yes', 'in'),
  385. 'state' => 1,
  386. ),
  387. 'type' => 'all',
  388. 'order' => array('list_reorder`+`search_reorder`+`view_reorder' => 'desc', 'id' => 'desc'),
  389. 'col' => '*',
  390. ),
  391. /*
  392. 'getSearch' => array
  393. (
  394. # 匹配的正则或函数 选填项
  395. 'option' => array
  396. (
  397. 'ids' => array('yes-id', 'in'),
  398. 'search_reorder' => array('yes', '>='),
  399. 'state' => 1,
  400. ),
  401. 'type' => 'all',
  402. 'order' => array('search_reorder' => 'desc', 'id' => 'desc'),
  403. 'col' => '*',
  404. ),
  405. */
  406. )
  407. );