<?php
$company = function()
{
    $array = array();
    $data = Dever::db('manage/company')->state();
    if($data)
    {
        $array += $data;
    }
    return $array;
};
# 常用的col
$col = '*';
return array
(
    # 表名
    'name' => 'company',
    # 显示给用户看的名称
    'lang' => '期权公司配置',
    'order' => -100,
    'check' => 'company_id',

    # 数据结构
    'struct' => array
    (
        'id'        => array
        (
            'type'      => 'int-11',
            'name'      => 'ID',
            'default'   => '',
            'desc'      => '',
            'match'     => 'is_numeric',
            'list'      => true,
        ),
        
        'company_id'      => array
        (
            'type'      => 'int-11',
            'name'      => '选择公司',
            'default'   => '',
            'desc'      => '公司名称',
            'match'     => 'is_numeric',
            'update'    => 'radio',
            'list_name' => '公司名称',
            'option'    => $company,
            'list'      => true,
            'search'    => 'select',
        ),

        'agreement_name'      => array
        (
            'type'      => 'varchar-500',
            'name'      => '合同名称-变量说明：{name}是姓名，{date}签署时间',
            'default'   => '',
            'desc'      => '合同名称',
            'match'     => 'is_string',
            'update'    => 'text',
            'search'    => 'fulltext',
            'list'      => true,
        ),

        'option-company_qiquan'=> array
		(
			'name' 		=> '期权类型设置',
			'default' 	=> '',
			'desc' 		=> '期权类型设置',
			'match' 	=> 'option',
			# 同步更新另外一个表的内容，两个表相关联的id，更新另一个表的字段
			'sync'		=> array('id', 'company_id'),
			# 根据category字段的值，获取product/attr.search接口的内容
			'update'	=> array(1),
		),

		/*
        'qiquan'       => array
        (
            'type'      => 'text-1000',
            'name'      => '期权类型设置',
            'default'   => '',
            'desc'      => '期权类型设置',
            'match'     => 'is_string',
            'update'    => array
            (
                array
                (
                    'col'       => 'name',
                    'name'      => '类型名称',
                    'default'   => '',
                    'desc'      => '类型名称',
                    'match'     => 'is_string',
                    'update'    => 'textarea',
                ),
            ),
        ),
        */
        
        '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", {cdate})',
        ),
    ),

	'default' => array
    (
        'col' => 'id,company_id,agreement_name, state,cdate',
        'value' => array
        (
            '1, 1, "{name}期权交付合同.{date}.pdf", 1,' . DEVER_TIME,
        ),
    ),
    
    # 管理功能
    'manage' => array
    (
       'delete' => false,
    ),

    'request' => array
    (
        'getIds' => array
        (
            'type' => 'all',
            'option' => array
            (
                'ids' => array('yes-id', 'in'),
                'state' => 1,
            ),
            'order' => array('id' => 'desc'),
            'col' => '*|id',
        ),
    ),
);
