123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- <?php
- # 定义几个常用的选项
- $option = array
- (
- 1 => '可用',
- 2 => '不可用',
- );
- $type = function()
- {
- return Dever::load('device/type-all?option_type=2');
- };
- $info = function()
- {
- return Dever::load('device/info-all');
- };
- return array
- (
- # 表名
- 'name' => 'sensor',
- # 显示给用户看的名称
- 'lang' => '传感器元件管理',
- # 后台菜单排序
- 'menu' => false,
- 'order' => 10,
- 'check' => 'key',
- # 数据结构
- 'struct' => array
- (
- 'id' => array
- (
- 'type' => 'int-11',
- 'name' => 'ID',
- 'default' => '',
- 'desc' => '',
- 'match' => 'is_numeric',
- 'search' => 'order',
- 'order' => 'desc',
- //'list' => true,
- ),
- 'key' => array
- (
- 'type' => 'varchar-52',
- 'name' => '标识',
- 'default' => '',
- 'desc' => '请输入标识',
- 'match' => 'is_string',
- 'update' => 'text',
- 'search' => 'fulltext',
- 'list' => true,
- ),
- 'name' => array
- (
- 'type' => 'varchar-32',
- 'name' => '名称',
- 'default' => '',
- 'desc' => '名称',
- 'match' => 'is_string',
- 'update' => 'text',
- 'search' => 'fulltext',
- 'list' => true,
- ),
- 'info_id' => array
- (
- 'type' => 'int-11',
- 'name' => '所属设备',
- 'default' => Dever::input('option_info_id', 1),
- 'desc' => '请选择所属设备',
- 'match' => 'is_numeric',
- 'option' => $info,
- 'update' => 'select',
- 'search' => 'select',
- 'list' => true,
- ),
-
- 'type' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '类型',
- 'default' => '1',
- 'desc' => '请选择类型',
- 'match' => 'is_numeric',
- 'option' => $type,
- 'update' => 'radio',
- 'search' => 'select',
- 'list' => true,
- 'bind' => array('onchange', 'loading', array('element' => 'unit')),
- ),
- 'unit' => array
- (
- 'type' => 'varchar-30',
- 'name' => '单位',
- 'default' => '',
- 'desc' => '单位',
- 'match' => 'is_string',
- 'update' => 'text',
- 'search' => 'fulltext',
- //'list' => true,
- ),
- 'exp' => array
- (
- 'type' => 'varchar-200',
- 'name' => '数值换算公式-根据该公式计算出当前回传得数据,{b}为本次回传数据,例子:{b}*5-10',
- 'default' => '',
- 'desc' => '数值换算公式',
- 'match' => 'is_string',
- 'update' => 'textarea',
- 'search' => 'fulltext',
- //'list' => true,
- ),
- 'range' => array
- (
- 'type' => 'varchar-200',
- 'name' => '正常值范围-用逗号隔开,例子:-40,100',
- 'default' => '',
- 'desc' => '正常值范围',
- 'match' => 'is_string',
- 'update' => 'text',
- 'search' => 'fulltext',
- //'list' => true,
- ),
- 'time' => array
- (
- 'type' => 'int-11',
- 'name' => '发送时间间隔-单位为秒',
- 'default' => '',
- 'desc' => '发送时间间隔',
- 'match' => 'is_string',
- 'update' => 'text',
- 'search' => 'fulltext',
- //'list' => true,
- ),
- 'pic' => array
- (
- 'type' => 'varchar-255',
- 'name' => '图片-1:1的比例,如:150*150',
- 'default' => '',
- 'desc' => '请选择图片',
- 'match' => 'is_string',
- 'update' => 'image',
- 'key' => '1',
- ),
-
- 'info' => array
- (
- 'type' => 'varchar-255',
- 'name' => '说明介绍-选填',
- 'default' => '',
- 'desc' => '请输入元件说明',
- 'match' => 'option',
- 'update' => 'textarea',
- //'list' => true,
- ),
-
- 'reorder' => array
- (
- 'type' => 'int-11',
- 'name' => '排序-数值越大越靠前',
- 'default' => '1',
- 'desc' => '请输入排序',
- 'match' => 'option',
- 'update' => 'text',
- 'search' => 'order',
- 'list' => true,
- 'order' => 'desc',
- 'edit' => true,
- ),
- 'state' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '状态',
- 'default' => '1',
- 'desc' => '请选择状态',
- 'match' => 'is_numeric',
- 'option' => $option,
- 'update' => 'radio',
- 'list' => true,
- ),
-
- 'cdate' => array
- (
- 'type' => 'int-11',
- 'name' => '录入时间',
- 'match' => array('is_numeric', time()),
- 'desc' => '',
- # 只有insert时才生效
- 'insert' => true,
- 'list' => 'date("Y-m-d H:i:s", {cdate})',
- ),
- ),
-
- 'manage' => array
- (
- # 不允许编辑
- //'edit' => false,
-
- # 列表页的类型
- //'list_type' => 'parent',
-
- # 可以删除
- 'list_button' => array
- (
- //oper_save_jump=system&oper_parent=system 特殊配置 oper_save_jump保存之后跳到那个表的列表页 oper_parent下级列表页中显示返回上一页的链接
- //21 => array('新增命令码', '"code&option_element_id={id}&oper_parent=element"'),
- //11 => array('命令码列表', '"code&option_element_id={id}&oper_save_jump=element&oper_parent=element"'),
- //22 => array('新增设备', '"system&option_element_id={id}&oper_save_jump=system&oper_parent=system"', '{element_id}==-1'),
- //6 => '删除'
- ),
-
- //'desc' => '注意:命令码',
- ),
-
- # request 请求接口定义
- 'request' => array
- (
- # main 取所有主系统
- 'info' => array
- (
- 'where' => array
- (
- 'state' => 1,
- 'id' => 'yes',
- ),
- 'type' => 'one',
- ),
-
- # 取所有菜单
- 'all' => array
- (
- 'where' => array
- (
- 'state' => 1,
- ),
- 'type' => 'all',
- 'order' => array('reorder` desc,`id', 'desc'),
- 'col' => 'id,concat(key,"-",name) as name|id',
- ),
- # 根据id获取
- 'getByids' => array
- (
- 'where' => array
- (
- 'id' => array('yes', 'in'),
- ),
- 'type' => 'all',
- 'col' => '*',
- ),
- ),
- );
|