control.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '可用',
  6. 2 => '不可用',
  7. );
  8. $type = function()
  9. {
  10. return Dever::load('device/type-all?option_type=2');
  11. };
  12. $info = function()
  13. {
  14. return Dever::load('device/info-all');
  15. };
  16. return array
  17. (
  18. # 表名
  19. 'name' => 'control',
  20. # 显示给用户看的名称
  21. 'lang' => '控制器元件管理',
  22. # 后台菜单排序
  23. 'menu' => false,
  24. 'order' => 10,
  25. 'check' => 'key',
  26. # 数据结构
  27. 'struct' => array
  28. (
  29. 'id' => array
  30. (
  31. 'type' => 'int-11',
  32. 'name' => 'ID',
  33. 'default' => '',
  34. 'desc' => '',
  35. 'match' => 'is_numeric',
  36. 'search' => 'order',
  37. 'order' => 'desc',
  38. //'list' => true,
  39. ),
  40. 'key' => array
  41. (
  42. 'type' => 'varchar-52',
  43. 'name' => '标识',
  44. 'default' => '',
  45. 'desc' => '请输入标识',
  46. 'match' => 'is_string',
  47. 'update' => 'text',
  48. 'search' => 'fulltext',
  49. 'list' => true,
  50. ),
  51. 'name' => array
  52. (
  53. 'type' => 'varchar-32',
  54. 'name' => '名称',
  55. 'default' => '',
  56. 'desc' => '名称',
  57. 'match' => 'is_string',
  58. 'update' => 'text',
  59. 'search' => 'fulltext',
  60. 'list' => true,
  61. ),
  62. 'info_id' => array
  63. (
  64. 'type' => 'int-11',
  65. 'name' => '所属设备',
  66. 'default' => Dever::input('option_info_id', 1),
  67. 'desc' => '请选择所属设备',
  68. 'match' => 'is_numeric',
  69. 'option' => $info,
  70. 'update' => 'select',
  71. 'search' => 'select',
  72. 'list' => true,
  73. ),
  74. 'type' => array
  75. (
  76. 'type' => 'tinyint-1',
  77. 'name' => '类型',
  78. 'default' => '1',
  79. 'desc' => '请选择类型',
  80. 'match' => 'is_numeric',
  81. 'option' => $type,
  82. 'update' => 'radio',
  83. 'search' => 'select',
  84. 'list' => true,
  85. 'bind' => array('onchange', 'loading', array('element' => 'unit')),
  86. ),
  87. 'max' => array
  88. (
  89. 'type' => 'int-11',
  90. 'name' => '最大值',
  91. 'default' => '',
  92. 'desc' => '最大值',
  93. 'match' => 'is_string',
  94. 'update' => 'text',
  95. 'search' => 'fulltext',
  96. 'list' => true,
  97. ),
  98. 'min' => array
  99. (
  100. 'type' => 'int-11',
  101. 'name' => '最小值',
  102. 'default' => '',
  103. 'desc' => '最小值',
  104. 'match' => 'is_string',
  105. 'update' => 'text',
  106. 'search' => 'fulltext',
  107. 'list' => true,
  108. ),
  109. 'reorder' => array
  110. (
  111. 'type' => 'int-11',
  112. 'name' => '排序-数值越大越靠前',
  113. 'default' => '1',
  114. 'desc' => '请输入排序',
  115. 'match' => 'option',
  116. 'update' => 'text',
  117. 'search' => 'order',
  118. 'list' => true,
  119. 'order' => 'desc',
  120. 'edit' => true,
  121. ),
  122. 'state' => array
  123. (
  124. 'type' => 'tinyint-1',
  125. 'name' => '状态',
  126. 'default' => '1',
  127. 'desc' => '请选择状态',
  128. 'match' => 'is_numeric',
  129. 'option' => $option,
  130. 'update' => 'radio',
  131. 'list' => true,
  132. ),
  133. 'cdate' => array
  134. (
  135. 'type' => 'int-11',
  136. 'name' => '录入时间',
  137. 'match' => array('is_numeric', time()),
  138. 'desc' => '',
  139. # 只有insert时才生效
  140. 'insert' => true,
  141. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  142. ),
  143. ),
  144. 'manage' => array
  145. (
  146. # 不允许编辑
  147. //'edit' => false,
  148. # 列表页的类型
  149. //'list_type' => 'parent',
  150. # 可以删除
  151. 'list_button' => array
  152. (
  153. //oper_save_jump=system&oper_parent=system 特殊配置 oper_save_jump保存之后跳到那个表的列表页 oper_parent下级列表页中显示返回上一页的链接
  154. //21 => array('新增命令码', '"code&option_element_id={id}&oper_parent=element"'),
  155. //11 => array('命令码列表', '"code&option_element_id={id}&oper_save_jump=element&oper_parent=element"'),
  156. //22 => array('新增设备', '"system&option_element_id={id}&oper_save_jump=system&oper_parent=system"', '{element_id}==-1'),
  157. //6 => '删除'
  158. ),
  159. //'desc' => '注意:命令码',
  160. ),
  161. # request 请求接口定义
  162. 'request' => array
  163. (
  164. # main 取所有主系统
  165. 'info' => array
  166. (
  167. 'where' => array
  168. (
  169. 'state' => 1,
  170. 'id' => 'yes',
  171. ),
  172. 'type' => 'one',
  173. ),
  174. # 取所有菜单
  175. 'all' => array
  176. (
  177. 'where' => array
  178. (
  179. 'state' => 1,
  180. ),
  181. 'type' => 'all',
  182. 'order' => array('reorder` desc,`id', 'desc'),
  183. 'col' => 'id,concat(key,"-",name) as name|id',
  184. ),
  185. # 根据id获取
  186. 'getByids' => array
  187. (
  188. 'where' => array
  189. (
  190. 'id' => array('yes', 'in'),
  191. ),
  192. 'type' => 'all',
  193. 'col' => '*',
  194. ),
  195. ),
  196. );