info.php 9.6 KB

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