<?php
$role_id = Dever::input('set')['role_id'] ?? 0;
return array
(
    'list' => array
    (
        'where' => array('role_id' => $role_id),
        'field'      => array
        (
            'name',
            'level',
            'price',
            'status' => array
            (
                'type' => 'switch',
                'show'  => '{status}',
                'active_value' => 1,
                'inactive_value' => 2,
            ),
        ),
        'button' => array
        (
            '新增' => array('add', array('role_id' => $role_id)),
        ),
        'data_button' => array
        (
            '编辑' => array('edit', array('role_id' => $role_id)),
        ),
        'search'    => array
        (
            'name',
            'role_id' => 'hidden',
        ),
    ),
    'update' => array
    (
        'tab' => array
        (
            '基本信息' => 'name,level,price,pay,day_desc,day,icon,content',
            '权益设置' => 'place_user/role_level_profit',
        ),
        'field'    => array
        (
            'role_id',
            'name' => array
            (
                'rules' => true,
            ),
            'level' => array
            (
                'rules' => true,
                'desc' => '将按照等级数字正序排序',
            ),
            'price' => array
            (
                'rules' => true,
                'tips' => '购买当前等级所需支付的积分金额',
            ),
            'pay' => array
            (
                'type' => 'radio',
                'rules' => true,
                'tips' => '差额支付：如用户已是等级1，购买等级2时会自动减去等级1已支付的金额<br />全额支付：根据价格全额支付',
            ),
            'day_desc' => array
            (
                'rules' => true,
                'desc' => '设置时长名称，如一年',
            ),
            'day' => array
            (
                'rules' => true,
                'desc' => '设置时长天数，如365，如果填写-1就是永久有效',
            ),
            'icon' => array
            (
                'type' => 'upload',
                'upload' => '1',
                'multiple' => true,
                'style' => 'pic',
            ),
            'content' => array
            (
                'type' => 'editor',
                'editorMenu' => array
                (
                    'uploadImage' => 1,
                    'uploadVideo' => 3,
                ),
                /*
                'type' => 'textarea',
                'autosize' => array('minRows' => 4),
                */
            ),

            'place_user/role_level_profit' => array
            (
                'name' => '权益设置',
                'where'  => array('level_id' => 'id'),
            ),
        ),
    ),
);