123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 |
- <?php
- $cate = function()
- {
- $array = array();
- $info = Dever::load('attr/cate-state');
- if($info)
- {
- $array += $info;
- }
- return $array;
- };
- $type = array
- (
- 1 => '单行输入框',
- 2 => '多行输入框',
- 3 => '图文编辑器',
- 4 => '单图片上传',
- 5 => '多图片上传',
- 6 => '地区选择器',
- //7 => '多级分类',
- 10 => '单选框',
- 11 => '多选框',
- 12 => '单项选择框',
- );
- $option = array
- (
- 1 => '必填项',
- 2 => '选填项',
- );
- $data_type = array
- (
- 1 => '数字',
- 2 => '字符',
- 3 => '正则匹配',
- );
- $search = array
- (
- 1 => '可以作为搜索条件',
- 2 => '不作为搜索条件',
- );
- /*
- 使用该组件,这么用
- $attr = function()
- {
- $auth = Dever::load('attr/api.get', false);
- return $auth;
- };
- 'attr' => array
- (
- 'type' => 'varchar-800',
- 'name' => '属性设置',
- 'default' => '',
- 'desc' => '属性设置',
- 'match' => 'option',
- 'update' => 'checkbox',
- 'option' => $attr,
- 'update_input' => '',
- 'update_input_default' => '',
- 'update_parent' => 'checkbox',
- ),
- 'attr_input' => array
- (
- 'type' => 'text-255',
- 'name' => '属性值设置',
- 'default' => '',
- 'desc' => '属性值设置',
- 'match' => 'option',
- ),
- */
- return array
- (
- # 表名
- 'name' => 'info',
- # 显示给用户看的名称
- 'lang' => '属性设置',
- # 是否显示在后台菜单
- 'order' => 10,
- # 数据结构
- 'struct' => array
- (
- 'id' => array
- (
- 'type' => 'int-11',
- 'name' => 'ID',
- 'default' => '',
- 'desc' => '',
- 'match' => 'is_numeric',
- 'order' => 'asc',
- 'list' => true,
- ),
- 'name' => array
- (
- 'type' => 'varchar-150',
- 'name' => '中文名称',
- 'default' => '',
- 'desc' => '中文名称',
- 'match' => 'is_string',
- 'update' => 'text',
- 'search' => 'fulltext',
- 'list' => true,
- 'edit' => true,
- ),
- 'ename' => array
- (
- 'type' => 'varchar-150',
- 'name' => '英文名称',
- 'default' => '',
- 'desc' => '英文名称',
- 'match' => 'is_string',
- //'update' => 'text',
- //'search' => 'fulltext',
- //'list' => true,
- //'edit' => true,
- ),
- 'cate_id' => array
- (
- 'type' => 'int-11',
- 'name' => '属性类别',
- 'default' => '1',
- 'desc' => '属性类别',
- 'match' => 'is_numeric',
- 'update' => 'select',
- 'option' => $cate,
- 'list' => '{cate_id} > 0 ? Dever::load("attr/cate-one#name", {cate_id}) : "未选择"',
- ),
- 'type' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '属性类型',
- 'default' => '1',
- 'desc' => '属性类型',
- 'match' => 'is_numeric',
- 'update' => 'radio',
- 'option' => $type,
- 'search' => 'select',
- 'list' => true,
- 'control' => 'type',
- ),
- 'type_option' => array
- (
- 'type' => 'varchar-800',
- 'name' => '属性可选项-多个值用换行隔开',
- 'default' => '',
- 'desc' => '属性可选项',
- 'match' => 'is_string',
- 'update' => 'textarea',
- //'list' => true,
- 'show' => 'type=10,11,12',
- ),
- 'option_type' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '是否必填',
- 'default' => '1',
- 'desc' => '是否必填',
- 'match' => 'is_numeric',
- 'update' => 'radio',
- 'option' => $option,
- 'search' => 'select',
- 'list' => true,
- ),
- 'data_type' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '数据类型-选择类型之后会自动验证数据有效性',
- 'default' => '1',
- 'desc' => '数据类型',
- 'match' => 'is_numeric',
- 'update' => 'radio',
- 'option' => $data_type,
- 'search' => 'select',
- //'list' => true,
- 'control' => 'data_type',
- 'show' => 'type=1',
- ),
- 'match' => array
- (
- 'type' => 'varchar-600',
- 'name' => '正则匹配规则-直接输入正则表达式即可',
- 'default' => '',
- 'desc' => '正则匹配规则',
- 'match' => 'option',
- 'update' => 'textarea',
- //'search' => 'fulltext',
- //'list' => true,
- //'edit' => true,
- 'show' => array('data_type' => 3),
- ),
- 'search' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '是否作为搜索条件-如果选择作为搜索条件,将把该属性放入搜索引擎中,这里不宜选择过多,否则影响搜索速度。',
- 'default' => '2',
- 'desc' => '是否作为搜索条件',
- 'match' => 'is_numeric',
- 'update' => 'radio',
- 'option' => $search,
- 'search' => 'select',
- 'show' => 'type=1,6,10,11,12',
- //'list' => true,
- ),
- 'reorder' => array
- (
- 'type' => 'int-11',
- 'name' => '排序(数值越大越靠前)',
- 'default' => '1',
- 'desc' => '请输入排序',
- 'match' => 'option',
- 'update' => 'text',
- 'search' => 'order',
- 'list_name' => '排序',
- 'list' => true,
- 'order' => 'desc',
- 'edit' => true,
- ),
-
- 'state' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '状态',
- 'default' => '1',
- 'desc' => '请选择状态',
- 'match' => 'is_numeric',
- ),
-
- 'cdate' => array
- (
- 'type' => 'int-11',
- 'name' => '录入时间',
- 'match' => array('is_numeric', time()),
- 'desc' => '',
- # 只有insert时才生效
- 'insert' => true,
- 'search' => 'date',
- 'list' => 'date("Y-m-d H:i:s", {cdate})',
- ),
- ),
- 'manage' => array
- (
- # 列表页的类型
-
- ),
- 'request' => array
- (
- 'getAllByIds' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'ids' => array('yes-id', 'in'),
- 'state' => 1,
- ),
- 'type' => 'all',
- 'order' => array('reorder' => 'desc', 'id' => 'desc'),
- 'col' => '*|id',
- ),
- )
- );
|