<?php
$admin = function()
{
	$array = array();
	$data = Dever::load('work/lib/appoint.people');
	if($data)
    {
        $array += $data;
    }
    return $array;
};
$email = array
(
    1 => '不发送',
    2 => '发送',
);
return array
(
    # 表名
    'name' => 'appoint',
    # 显示给用户看的名称
    'lang' => '指派工单',
    # 后台菜单排序
    'order' => 2,
    'menu' => false,
    'start' => array
    (
        'insert' => 'work/lib/appoint.insertAppoint',
        'update' => 'work/lib/appoint.insertAppoint',
    ),
    'end' => array
    (
    	'insert' => 'work/lib/appoint.updateAppoint',
    	'update' => 'work/lib/appoint.updateAppoint',
    ),
    // 'auto' => 100000,
    # 数据结构
    'struct' => array
    (
        'id'        => array
        (
            'type'      => 'int-11',
            'name'      => 'ID',
            'default'   => '',
            'desc'      => '',
            'match'     => 'is_numeric',
            'search'    => 'order',
            'list'      => true,
            'order'     => 'desc',
        ),

        'info_id'      => array
        (
            'type'      => 'int-11',
            'name'      => '工单来源',
            'default'   => '-1',
            'desc'      => '工单来源',
            'match'     => 'option',
            // 'option'    => $info_id,
            'update'    => 'hidden',
            'value'     => Dever::input('search_option_info_id'),
            'list'      => true,
        ),

        'admin_id'       => array
        (
            'type'      => 'varchar-500',
            'name'      => '指派人',
            'default'   => '',
            'desc'      => '指派人',
            'match'     => 'option',
            'search'    => 'linkage',
            'update'    => 'linkage',
            'option'    => Dever::url('lib/appoint.get?level_total=2', 'work'),
        ),

        'email'       => array
        (
            'type'      => 'int-11',
            'name'      => '是否发送邮件',
            'default'   => '1',
            'desc'      => '是否发送邮件',
            'match'     => 'option',
            'option'    => $email,
            // 'search'    => 'linkage',
            'update'    => 'radio',
            // 'option'    => Dever::url('lib/appoint.get?level_total=2', 'work'),
        ),

        'group'       => array
        (
            'type'      => 'int-11',
            'name'      => '部门',
            'default'   => '',
            'desc'      => '部门',
            'match'     => 'option',
            // 'search'    => 'linkage',
            'update'    => 'hidden',
            // 'option'    => Dever::url('lib/appoint.get?level_total=2', 'work'),
        ),

        'admin'       => array
        (
            'type'      => 'int-11',
            'name'      => '指派的人',
            'default'   => '',
            'desc'      => '指派的人',
            'match'     => 'option',
            // 'search'    => 'linkage',
            'update'    => 'hidden',
            // 'option'    => Dever::url('lib/appoint.get?level_total=2', 'work'),
        ),

        'desc'       => array
        (
            'type'      => 'text-255',
            'name'      => '描述详情',
            'default'   => '',
            'desc'      => '描述详情',
            'match'     => 'is_string',
            'update'    => 'textarea',
            'list'      => true,
        ),
        'pic'        => array
        (
            'type'      => 'varchar-500',
            'name'      => '相关截图',
            'default'   => '',
            'desc'      => '请选择相关截图',
            'match'     => 'option',
            'update'    => 'images',
            'key'       => '1',
            //'place'       => '150',
        ),

        'video'        => array
        (
            'type'      => 'varchar-500',
            'name'      => '相关视频',
            'default'   => '',
            'desc'      => '请选择相关视频',
            'match'     => 'option',
            'update'    => 'video',
            'key'       => '3',
            'place'     => '150',
            'upload'    => 'yun',
            'large'     => 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,
            'list'      => 'date("Y-m-d H:i:s", {cdate})',
        ),
    ),

    'manage' => array
    (
    	//'insert' => false,
        'delete' => false,
        // 'edit' => false,
        
    ),

    'request' => array
    (
        'getData' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                //'id' => array('yes', '!='),
                'state' => 1,
            ),
            'type' => 'all',
            'order' => array('id' => 'desc'),
            'col' => '*|id',
        ),
        'getAll' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'info_id' => 'yes',
                'state' => 1,
            ),
            'type' => 'all',
            'order' => array('id' => 'asc'),
            'col' => '*',
        ),
        'getEmail' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'group' => array('yes','in'),
                'start' => array('yes-cdate','>='),
                'end' =>array('yes-cdate','<='),
                'state' => 1,
            ),
            'type' => 'count',
            // 'order' => array('id' => 'desc'),
            'col' => '*',
        ),
        'getYAll' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'group' => array('yes','in'),
                'start' => array('yes-cdate','>='),
                'end' =>array('yes-cdate','<='),
                'state' => 1,
            ),
            'type' => 'all',
            // 'order' => array('id' => 'desc'),
            'col' => '*|info_id',
        ),

        'getAdmin' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'info_id' => 'yes',
                'admin' => array('yes','!='),
                // 'end' =>array('yes-cdate','<='),
                'state' => 1,
            ),
            'type' => 'one',
            'order' => array('id' => 'desc'),
            'col' => '*',
        ),
        'getmyAll' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                // 'info_id' => 'yes',
                'admin' => 'yes',
                // 'end' =>array('yes-cdate','<='),
                'state' => 1,
            ),
            'type' => 'all',
            'order' => array('id' => 'desc'),
            'col' => '*|info_id',
        ),
    ),
);
