control.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '可用',
  6. 2 => '不可用',
  7. );
  8. $type = function()
  9. {
  10. return Dever::load('device/data.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' => 14,
  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-80',
  54. 'name' => '名称',
  55. 'default' => '',
  56. 'desc' => '名称',
  57. 'match' => 'is_string',
  58. 'update' => 'text',
  59. 'search' => 'fulltext',
  60. 'list' => true,
  61. ),
  62. /*
  63. 'info_id' => array
  64. (
  65. 'type' => 'int-11',
  66. 'name' => '所属设备',
  67. 'default' => Dever::input('option_info_id', 1),
  68. 'desc' => '请选择所属设备',
  69. 'match' => 'is_numeric',
  70. 'option' => $info,
  71. 'update' => 'select',
  72. 'search' => 'select',
  73. 'list' => true,
  74. ),
  75. */
  76. 'type_id' => array
  77. (
  78. 'type' => 'tinyint-1',
  79. 'name' => '类型',
  80. 'default' => '1',
  81. 'desc' => '请选择类型',
  82. 'match' => 'is_numeric',
  83. 'option' => $type,
  84. 'update' => 'radio',
  85. 'search' => 'select',
  86. 'list' => true,
  87. 'bind' => array('onchange', 'loading', array('element' => 'unit', 'url' => Dever::url("device/data.typeOne?json=1"))),
  88. 'show' => 'type_id',
  89. ),
  90. 'max' => array
  91. (
  92. 'type' => 'int-11',
  93. 'name' => '最大值',
  94. 'default' => '1',
  95. 'desc' => '最大值',
  96. 'match' => 'is_string',
  97. 'update' => 'text',
  98. 'search' => 'fulltext',
  99. 'list' => true,
  100. 'show' => 'type_id',
  101. ),
  102. 'min' => array
  103. (
  104. 'type' => 'int-11',
  105. 'name' => '最小值',
  106. 'default' => '0',
  107. 'desc' => '最小值',
  108. 'match' => 'is_string',
  109. 'update' => 'text',
  110. 'search' => 'fulltext',
  111. 'list' => true,
  112. ),
  113. 'reorder' => array
  114. (
  115. 'type' => 'int-11',
  116. 'name' => '排序-数值越大越靠前',
  117. 'default' => '1',
  118. 'desc' => '请输入排序',
  119. 'match' => 'option',
  120. 'update' => 'text',
  121. 'search' => 'order',
  122. 'list' => true,
  123. 'order' => 'desc',
  124. 'edit' => true,
  125. ),
  126. 'state' => array
  127. (
  128. 'type' => 'tinyint-1',
  129. 'name' => '状态',
  130. 'default' => '1',
  131. 'desc' => '请选择状态',
  132. 'match' => 'is_numeric',
  133. 'option' => $option,
  134. 'update' => 'radio',
  135. 'list' => true,
  136. ),
  137. 'cdate' => array
  138. (
  139. 'type' => 'int-11',
  140. 'name' => '录入时间',
  141. 'match' => array('is_numeric', time()),
  142. 'desc' => '',
  143. # 只有insert时才生效
  144. 'insert' => true,
  145. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  146. ),
  147. ),
  148. 'manage' => array
  149. (
  150. # 不允许编辑
  151. //'edit' => false,
  152. # 列表页的类型
  153. //'list_type' => 'parent',
  154. # 可以删除
  155. 'list_button' => array
  156. (
  157. //oper_save_jump=system&oper_parent=system 特殊配置 oper_save_jump保存之后跳到那个表的列表页 oper_parent下级列表页中显示返回上一页的链接
  158. //21 => array('新增命令码', '"code&option_element_id={id}&oper_parent=element"'),
  159. //11 => array('命令码列表', '"code&option_element_id={id}&oper_save_jump=element&oper_parent=element"'),
  160. //22 => array('新增设备', '"system&option_element_id={id}&oper_save_jump=system&oper_parent=system"', '{element_id}==-1'),
  161. //6 => '删除'
  162. ),
  163. //'desc' => '注意:命令码',
  164. ),
  165. # request 请求接口定义
  166. 'request' => array
  167. (
  168. # 根据id获取
  169. 'getByids' => array
  170. (
  171. 'where' => array
  172. (
  173. 'id' => array('yes', 'in'),
  174. ),
  175. 'type' => 'all',
  176. 'col' => '*',
  177. ),
  178. ),
  179. );