signal.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '可用',
  6. 2 => '不可用',
  7. );
  8. $type = function()
  9. {
  10. return Dever::load('device/data.type', 3);
  11. };
  12. $info = function()
  13. {
  14. return Dever::load('device/info-all');
  15. };
  16. return array
  17. (
  18. # 表名
  19. 'name' => 'signal',
  20. # 显示给用户看的名称
  21. 'lang' => '信号器管理',
  22. # 后台菜单排序
  23. 'menu' => false,
  24. 'order' => 12,
  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' => 'select',
  85. 'search' => 'select',
  86. 'list' => true,
  87. 'bind' => array('onchange', 'loading', array('element' => 'unit', 'url' => Dever::url("device/data.typeOne?json=1"))),
  88. ),
  89. 'unit' => array
  90. (
  91. 'type' => 'varchar-30',
  92. 'name' => '单位',
  93. 'default' => '',
  94. 'desc' => '单位',
  95. 'match' => 'is_string',
  96. 'update' => 'text',
  97. 'search' => 'fulltext',
  98. //'list' => true,
  99. ),
  100. 'exp' => array
  101. (
  102. 'type' => 'varchar-200',
  103. 'name' => '数值换算公式-根据该公式计算出当前回传得数据,{b}为本次回传数据,例子:{b}*5-10',
  104. 'default' => '{b}',
  105. 'desc' => '数值换算公式',
  106. 'match' => 'is_string',
  107. 'update' => 'textarea',
  108. 'search' => 'fulltext',
  109. //'list' => true,
  110. ),
  111. 'range' => array
  112. (
  113. 'type' => 'varchar-200',
  114. 'name' => '正常值范围-用逗号隔开,例子:40,100',
  115. 'default' => '',
  116. 'desc' => '正常值范围',
  117. 'match' => 'option',
  118. 'update' => 'text',
  119. 'search' => 'fulltext',
  120. //'list' => true,
  121. ),
  122. 'time' => array
  123. (
  124. 'type' => 'int-11',
  125. 'name' => '发送时间间隔-单位为秒',
  126. 'default' => '600',
  127. 'desc' => '发送时间间隔',
  128. 'match' => 'is_string',
  129. 'update' => 'text',
  130. 'search' => 'fulltext',
  131. //'list' => true,
  132. ),
  133. 'pic' => array
  134. (
  135. 'type' => 'varchar-255',
  136. 'name' => '图片-1:1的比例,如:150*150',
  137. 'default' => '',
  138. 'desc' => '请选择图片',
  139. 'match' => 'option',
  140. 'update' => 'image',
  141. 'key' => '1',
  142. ),
  143. 'info' => array
  144. (
  145. 'type' => 'varchar-255',
  146. 'name' => '说明介绍-选填',
  147. 'default' => '',
  148. 'desc' => '请输入元件说明',
  149. 'match' => 'option',
  150. 'update' => 'textarea',
  151. //'list' => true,
  152. ),
  153. 'reorder' => array
  154. (
  155. 'type' => 'int-11',
  156. 'name' => '排序-数值越大越靠前',
  157. 'default' => '1',
  158. 'desc' => '请输入排序',
  159. 'match' => 'option',
  160. 'update' => 'text',
  161. 'search' => 'order',
  162. 'list' => true,
  163. 'order' => 'desc',
  164. 'edit' => true,
  165. ),
  166. 'state' => array
  167. (
  168. 'type' => 'tinyint-1',
  169. 'name' => '状态',
  170. 'default' => '1',
  171. 'desc' => '请选择状态',
  172. 'match' => 'is_numeric',
  173. 'option' => $option,
  174. 'update' => 'radio',
  175. 'list' => true,
  176. ),
  177. 'cdate' => array
  178. (
  179. 'type' => 'int-11',
  180. 'name' => '录入时间',
  181. 'match' => array('is_numeric', time()),
  182. 'desc' => '',
  183. # 只有insert时才生效
  184. 'insert' => true,
  185. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  186. ),
  187. ),
  188. 'manage' => array
  189. (
  190. # 不允许编辑
  191. //'edit' => false,
  192. # 列表页的类型
  193. //'list_type' => 'parent',
  194. # 可以删除
  195. 'list_button' => array
  196. (
  197. //oper_save_jump=system&oper_parent=system 特殊配置 oper_save_jump保存之后跳到那个表的列表页 oper_parent下级列表页中显示返回上一页的链接
  198. //21 => array('新增命令码', '"code&option_element_id={id}&oper_parent=element"'),
  199. //11 => array('命令码列表', '"code&option_element_id={id}&oper_save_jump=element&oper_parent=element"'),
  200. //22 => array('新增设备', '"system&option_element_id={id}&oper_save_jump=system&oper_parent=system"', '{element_id}==-1'),
  201. //6 => '删除'
  202. ),
  203. //'desc' => '注意:命令码',
  204. ),
  205. # request 请求接口定义
  206. 'request' => array
  207. (
  208. # 根据id获取
  209. 'getByids' => array
  210. (
  211. 'where' => array
  212. (
  213. 'id' => array('yes', 'in'),
  214. ),
  215. 'type' => 'all',
  216. 'col' => '*',
  217. ),
  218. ),
  219. );