| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296 | 
							- <?php
 
- $project = function()
 
- {
 
- 	$array = array();
 
- 	$info = Dever::load('category/project-state');
 
- 	if($info)
 
- 	{
 
- 		$array += $info;
 
- 	}
 
- 	return $array;
 
- };
 
- $status = array
 
- (
 
- 	1 => '启用',
 
- 	2 => '不启用',
 
- );
 
- return array
 
- (
 
- 	# 表名
 
- 	'name' => 'info',
 
- 	# 显示给用户看的名称
 
- 	'lang' => '分类列表',
 
- 	# 是否显示在后台菜单
 
- 	'order' => 10,
 
- 	//'check' => 'key',
 
- 	'end' => array
 
- 	(
 
- 		'insert' => 'category/lib/manage.update',
 
- 		'update' => 'category/lib/manage.update',
 
- 	),
 
- 	# 数据结构
 
- 	'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,
 
- 		),
 
- 		'key'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-150',
 
- 			'name' 		=> '分类标识-请输入英文,分类标识为唯一项,用来区分前端展示,选填项',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '分类标识',
 
- 			'match' 	=> 'option',
 
- 			//'update'	=> 'text',
 
- 			//'search'	=> 'fulltext',
 
- 			//'list'		=> true,
 
- 			//'edit'		=> true,
 
- 		),
 
- 		'info'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-800',
 
- 			'name' 		=> '上级分类',
 
- 			'default' 	=> Dever::input('option_info', -1),
 
- 			'desc' 		=> '请选择上级分类',
 
- 			'match' 	=> 'is_string',
 
- 			'update'	=> 'linkage',
 
- 			'linkage' 	=> 'id=' . Dever::input('where_id'),
 
- 			'option'	=> Dever::url('api.get', 'category'),
 
- 			//'list'		=> 'Dever::load("category/api.string", "{info}")',
 
- 		),
 
- 		'project_id'		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> '所属项目',
 
- 			'default' 	=> Dever::input('option_project_id', 1),
 
- 			'desc' 		=> '所属项目',
 
- 			'match' 	=> 'is_numeric',
 
- 			'update'	=> 'select',
 
- 			'option'	=> $project,
 
- 			'list'		=> '{project_id} > 0 ? Dever::load("category/project-one#name", {project_id}) : "未选择"',
 
- 			'edit'		=> true,
 
- 		),
 
- 		'icon'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-150',
 
- 			'name' 		=> '图标',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '图标',
 
- 			'match' 	=> 'option',
 
- 			'update'	=> 'image',
 
- 			'key'		=> 1,
 
- 		),
 
- 		'color'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-10',
 
- 			'name' 		=> '字体颜色-请填写颜色代码',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '字体颜色',
 
- 			'match' 	=> 'option',
 
- 			'update'	=> 'color',
 
- 		),
 
- 		'bgcolor'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-10',
 
- 			'name' 		=> '背景颜色-请填写颜色代码',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '背景颜色',
 
- 			'match' 	=> 'option',
 
- 			'update'	=> 'color',
 
- 		),
 
- 		'info_id'		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> '上级分类',
 
- 			'default' 	=> -1,
 
- 			'desc' 		=> '请选择上级分类',
 
- 			'match' 	=> 'is_numeric',
 
- 			'value'		=> Dever::input('option_info_id', -1),
 
- 			'list'		=> '{info_id} > 0 ? Dever::load("category/info-one#name", {info_id}) : "父级分类"',
 
- 		),
 
- 		'top_id'		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> '顶级分类',
 
- 			'default' 	=> -1,
 
- 			'desc' 		=> '请选择顶级分类',
 
- 			'match' 	=> 'is_numeric',
 
- 		),
 
- 		'level'		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> '分类级别-1为顶级分类、2为2级分类,-1为最后一级分类',
 
- 			'default' 	=> 1,
 
- 			'desc' 		=> '分类级别',
 
- 			'match' 	=> 'is_numeric',
 
- 		),
 
- 		'status'		=> array
 
- 		(
 
- 			'type' 		=> 'tinyint-1',
 
- 			'name' 		=> '是否启用',
 
- 			'default' 	=> '1',
 
- 			'desc' 		=> '是否启用',
 
- 			'match' 	=> 'is_numeric',
 
- 			//'update'	=> 'select',
 
- 			'option'	=> $status,
 
- 			'list'		=> true,
 
- 			'edit'		=> 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
 
- 	(
 
- 		'button' => array
 
-         (
 
-         	'项目管理' => array('list', 'project&oper_parent=info&oper_project=category'),
 
-         ),
 
- 		# 列表页的类型
 
- 		'list_type' => 'tree',
 
- 		'list_button' => array
 
- 		(
 
- 			'add' => array('新增子分类', '"{info}" == -1 ? "info&option_info={id}&option_project_id={project_id}" : "info&option_info={info},{id}&option_project_id={project_id}"'),
 
- 		),
 
- 	),
 
- 	'request' => array
 
- 	(
 
- 		# 获取顶级分类
 
- 		'getTop' => array
 
- 		(
 
- 			# 匹配的正则或函数 选填项
 
- 			'option' => array
 
- 			(
 
- 				'project_id' => 'yes',
 
- 				'info_id' => -1,
 
- 				'state' => 1,
 
- 			),
 
- 			'type' => 'all',
 
- 			'order' => array('reorder' => 'desc', 'id' => 'asc'),
 
- 			'col' => '*|id',
 
- 		),
 
- 		'getChild' => array
 
- 		(
 
- 			# 匹配的正则或函数 选填项
 
- 			'option' => array
 
- 			(
 
- 				'project_id' => 'yes',
 
- 				'info_id' => 'yes',
 
- 				'top_id' => 'yes',
 
- 				'level' => 'yes',
 
- 				'info_id_in' => array('yes-info_id', 'in'),
 
- 				'id' => array('yes', '!='),
 
- 				'info' => array('yes', 'like'),
 
- 				'state' => 1,
 
- 			),
 
- 			'type' => 'all',
 
- 			'order' => array('reorder' => 'desc', 'id' => 'asc'),
 
- 			'col' => '*|info_id|',
 
- 		),
 
- 		'getList' => array
 
- 		(
 
- 			# 匹配的正则或函数 选填项
 
- 			'option' => array
 
- 			(
 
- 				'project_id' => 'yes',
 
- 				'info_id' => 'yes',
 
- 				'top_id' => 'yes',
 
- 				'level' => 'yes',
 
- 				'info_id_in' => array('yes-info_id', 'in'),
 
- 				'id' => array('yes', '!='),
 
- 				'info' => array('yes', 'like'),
 
- 				'state' => 1,
 
- 			),
 
- 			'type' => 'all',
 
- 			'order' => array('reorder' => 'desc', 'id' => 'asc'),
 
- 			'col' => '*',
 
- 		),
 
- 		'getAll' => array
 
- 		(
 
- 			# 匹配的正则或函数 选填项
 
- 			'option' => array
 
- 			(
 
- 				'project_id' => 'yes',
 
- 				'info_id' => 'yes',
 
- 				'id' => array('yes', '!='),
 
- 				'state' => 1,
 
- 			),
 
- 			'type' => 'all',
 
- 			'order' => array('reorder' => 'desc', 'id' => 'asc'),
 
- 			'col' => 'id as value, name',
 
- 		),
 
- 	)
 
- );
 
 
  |