info.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '可用',
  6. 2 => '不可用',
  7. );
  8. $type = array
  9. (
  10. 1 => '土壤墒情',
  11. 2 => '温室',
  12. 3 => '气象站',
  13. 4 => '灌溉',
  14. );
  15. $sensor = function()
  16. {
  17. return Dever::load('device/sensor-all');
  18. };
  19. $control = function()
  20. {
  21. return Dever::load('device/control-all');
  22. };
  23. return array
  24. (
  25. # 表名
  26. 'name' => 'info',
  27. # 显示给用户看的名称
  28. 'lang' => '设备管理',
  29. # 后台菜单排序
  30. 'order' => 20,
  31. # 同步更新另外一个或多个表的数据
  32. 'sync' => array
  33. (
  34. 'device/device_sensor' => array
  35. (
  36. # 更新另外一个表的字段 => 本表的字段
  37. 'where' => array('device_id', 'id'),
  38. # 要更新的数据
  39. 'update' => array('sensor_id' => 'sensor'),
  40. # 同步更新的类型,delete为先删再插入,update为直接更新
  41. 'type' => 'delete',
  42. ),
  43. 'device/device_control' => array
  44. (
  45. # 更新另外一个表的字段 => 本表的字段
  46. 'where' => array('device_id', 'id'),
  47. # 要更新的数据
  48. 'update' => array('control_id' => 'control'),
  49. # 同步更新的类型,delete为先删再插入,update为直接更新
  50. 'type' => 'delete',
  51. )
  52. ),
  53. # 数据结构
  54. 'struct' => array
  55. (
  56. 'id' => array
  57. (
  58. 'type' => 'int-11',
  59. 'name' => '标识ID',
  60. 'default' => '',
  61. 'desc' => '',
  62. 'match' => 'is_numeric',
  63. 'search' => 'order',
  64. 'order' => 'desc',
  65. 'list' => true,
  66. ),
  67. 'name' => array
  68. (
  69. 'type' => 'varchar-40',
  70. 'name' => '设备名称',
  71. 'default' => '',
  72. 'desc' => '设备名称',
  73. 'match' => 'is_string',
  74. 'update' => 'text',
  75. 'search' => 'fulltext',
  76. 'list' => true,
  77. ),
  78. 'num' => array
  79. (
  80. 'type' => 'int-11',
  81. 'name' => '成品数量',
  82. 'default' => '',
  83. 'desc' => '成品数量',
  84. 'match' => 'is_string',
  85. //'update' => 'text',
  86. //'search' => 'fulltext',
  87. 'list' => true,
  88. ),
  89. 'type' => array
  90. (
  91. 'type' => 'tinyint-1',
  92. 'name' => '设备类型',
  93. 'default' => '1',
  94. 'desc' => '请选择设备类型',
  95. 'match' => 'is_numeric',
  96. 'option' => $type,
  97. 'update' => 'select',
  98. 'search' => 'select',
  99. 'list' => true,
  100. # 开启显示控制,可以控制下边的表单
  101. 'show' => 'type',
  102. ),
  103. 'sensor' => array
  104. (
  105. 'type' => 'varchar-500',
  106. 'name' => '传感器',
  107. 'default' => '',
  108. 'desc' => '请选择传感器',
  109. 'match' => 'is_string',
  110. 'option' => $sensor,
  111. 'update' => 'checkbox',
  112. //'list' => true,
  113. ),
  114. 'control' => array
  115. (
  116. 'type' => 'varchar-500',
  117. 'name' => '控制器',
  118. 'default' => '',
  119. 'desc' => '请选择控制器',
  120. 'match' => 'is_string',
  121. 'option' => $control,
  122. 'update' => 'checkbox',
  123. //'list' => true,
  124. ),
  125. 'info' => array
  126. (
  127. 'type' => 'varchar-255',
  128. 'name' => '说明介绍-选填',
  129. 'default' => '',
  130. 'desc' => '请输入系统说明',
  131. 'match' => 'option',
  132. 'update' => 'editor',
  133. //'list' => true,
  134. ),
  135. 'reorder' => array
  136. (
  137. 'type' => 'int-11',
  138. 'name' => '排序-数值越大越靠前',
  139. 'default' => '1',
  140. 'desc' => '请输入排序',
  141. 'match' => 'option',
  142. 'update' => 'text',
  143. 'search' => 'order',
  144. 'list' => true,
  145. 'order' => 'desc',
  146. 'edit' => true,
  147. ),
  148. 'state' => array
  149. (
  150. 'type' => 'tinyint-1',
  151. 'name' => '状态',
  152. 'default' => '1',
  153. 'desc' => '请选择状态',
  154. 'match' => 'is_numeric',
  155. 'option' => $option,
  156. 'update' => 'radio',
  157. 'list' => true,
  158. ),
  159. 'cdate' => array
  160. (
  161. 'type' => 'int-11',
  162. 'name' => '录入时间',
  163. 'match' => array('is_numeric', time()),
  164. 'desc' => '',
  165. # 只有insert时才生效
  166. 'insert' => true,
  167. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  168. ),
  169. ),
  170. 'manage' => array
  171. (
  172. # 不允许编辑
  173. //'edit' => false,
  174. # 列表页的类型
  175. //'list_type' => 'parent',
  176. # 可以删除
  177. 'list_button' => array
  178. (
  179. /*
  180. //oper_save_jump=system&oper_parent=system 特殊配置 oper_save_jump保存之后跳到那个表的列表页 oper_parent下级列表页中显示返回上一页的链接
  181. 10 => array('<br />'),
  182. 21 => array('新增传感器', '"sensor&option_info_id={id}&oper_parent=info"'),
  183. 11 => array('传感器列表', '"sensor&search_option_info_id={id}&option_info_id={id}&oper_save_jump=info&oper_parent=info"'),
  184. 12 => array('<br />'),
  185. 23 => array('新增控制器', '"control&option_info_id={id}&oper_parent=info"'),
  186. 13 => array('控制器列表', '"control&search_option_info_id={id}&option_info_id={id}&oper_save_jump=info&oper_parent=info"'),
  187. 16 => array('<br />'),
  188. 24 => array('新增信号器', '"signal&option_info_id={id}&oper_parent=info"'),
  189. 17 => array('信号器列表', '"signal&search_option_info_id={id}&option_info_id={id}&oper_save_jump=info&oper_parent=info"'),
  190. */
  191. 14 => array('<br />'),
  192. 25 => array('包装成品', 'modal|showMsg(\'包装成品\',$(this),\''.Dever::url('data.product', 'device').'\',function(){updateMsg(\'sendmsg\')})|"info_id={id}"'),
  193. 15 => array('成品列表', '"product&search_option_info_id={id}&option_info_id={id}&oper_save_jump=info&oper_parent=info"'),
  194. //6 => '删除'
  195. ),
  196. //'desc' => '注意:命令码',
  197. ),
  198. # request 请求接口定义
  199. 'request' => array
  200. (
  201. ),
  202. );