info.php 9.6 KB

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