123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- <?php
- # 定义几个常用的选项
- $option = array
- (
- 1 => '可用',
- 2 => '不可用',
- );
- $type = array
- (
- 1 => '土壤墒情',
- 2 => '温室',
- 3 => '气象站',
- 4 => '灌溉',
- );
- $sensor = function()
- {
- return Dever::load('device/sensor-all');
- };
- $control = function()
- {
- return Dever::load('device/control-all');
- };
- return array
- (
- # 表名
- 'name' => 'info',
- # 显示给用户看的名称
- 'lang' => '设备管理',
- # 后台菜单排序
- 'order' => 20,
- # 同步更新另外一个或多个表的数据
- 'sync' => array
- (
- 'device/device_sensor' => array
- (
- # 更新另外一个表的字段 => 本表的字段
- 'where' => array('device_id', 'id'),
- # 要更新的数据
- 'update' => array('sensor_id' => 'sensor'),
- # 同步更新的类型,delete为先删再插入,update为直接更新
- 'type' => 'delete',
- ),
- 'device/device_control' => array
- (
- # 更新另外一个表的字段 => 本表的字段
- 'where' => array('device_id', 'id'),
- # 要更新的数据
- 'update' => array('control_id' => 'control'),
- # 同步更新的类型,delete为先删再插入,update为直接更新
- 'type' => 'delete',
- )
- ),
- # 数据结构
- 'struct' => array
- (
- 'id' => array
- (
- 'type' => 'int-11',
- 'name' => '标识ID',
- 'default' => '',
- 'desc' => '',
- 'match' => 'is_numeric',
- 'search' => 'order',
- 'order' => 'desc',
- 'list' => true,
- ),
-
- 'name' => array
- (
- 'type' => 'varchar-40',
- 'name' => '设备名称',
- 'default' => '',
- 'desc' => '设备名称',
- 'match' => 'is_string',
- 'update' => 'text',
- 'search' => 'fulltext',
- 'list' => true,
- ),
- 'num' => array
- (
- 'type' => 'int-11',
- 'name' => '成品数量',
- 'default' => '',
- 'desc' => '成品数量',
- 'match' => 'is_string',
- //'update' => 'text',
- //'search' => 'fulltext',
- 'list' => true,
- ),
- 'type' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '设备类型',
- 'default' => '1',
- 'desc' => '请选择设备类型',
- 'match' => 'is_numeric',
- 'option' => $type,
- 'update' => 'select',
- 'search' => 'select',
- 'list' => true,
- # 开启显示控制,可以控制下边的表单
- 'show' => 'type',
- ),
- 'sensor' => array
- (
- 'type' => 'varchar-500',
- 'name' => '传感器',
- 'default' => '',
- 'desc' => '请选择传感器',
- 'match' => 'is_string',
- 'option' => $sensor,
- 'update' => 'checkbox',
- //'list' => true,
- ),
- 'control' => array
- (
- 'type' => 'varchar-500',
- 'name' => '控制器',
- 'default' => '',
- 'desc' => '请选择控制器',
- 'match' => 'is_string',
- 'option' => $control,
- 'update' => 'checkbox',
- //'list' => true,
- ),
-
- 'info' => array
- (
- 'type' => 'varchar-255',
- 'name' => '说明介绍-选填',
- 'default' => '',
- 'desc' => '请输入系统说明',
- 'match' => 'option',
- 'update' => 'editor',
- //'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下级列表页中显示返回上一页的链接
- 10 => array('<br />'),
- 21 => array('新增传感器', '"sensor&option_info_id={id}&oper_parent=info"'),
- 11 => array('传感器列表', '"sensor&search_option_info_id={id}&option_info_id={id}&oper_save_jump=info&oper_parent=info"'),
- 12 => array('<br />'),
- 23 => array('新增控制器', '"control&option_info_id={id}&oper_parent=info"'),
- 13 => array('控制器列表', '"control&search_option_info_id={id}&option_info_id={id}&oper_save_jump=info&oper_parent=info"'),
- 16 => array('<br />'),
- 24 => array('新增信号器', '"signal&option_info_id={id}&oper_parent=info"'),
- 17 => array('信号器列表', '"signal&search_option_info_id={id}&option_info_id={id}&oper_save_jump=info&oper_parent=info"'),
- */
- 14 => array('<br />'),
- 25 => array('包装成品', 'modal|showMsg(\'包装成品\',$(this),\''.Dever::url('data.product', 'device').'\',function(){updateMsg(\'sendmsg\')})|"info_id={id}"'),
- 15 => array('成品列表', '"product&search_option_info_id={id}&option_info_id={id}&oper_save_jump=info&oper_parent=info"'),
- //6 => '删除'
- ),
-
- //'desc' => '注意:命令码',
- ),
-
- # request 请求接口定义
- 'request' => array
- (
- ),
- );
|