<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
    <tr>
        <td class="td_bg">
            <input type="button" class="act_btn" value="添加" onclick="location.href='/fix-car-group/info'">
        </td>
    </tr>
</table>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
    <tr>
        <td width="50" align="center" align="center" class="bg_tr" nowrap>排序</td>
        <td align="center" align="center" class="bg_tr">分组名</td>
        <td width="30" align="center" class="bg_tr">操作</td>
    </tr>
    <?php if (isset($lists) > 0): ?>
        <?php foreach ($lists as $index => $list): ?>
            <tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
                <td align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                <td align="left" class="td_bg" nowrap><?= $list->name ?></td>
                <td align="center" class="td_bg" nowrap>
                    [<a href="javascript:void(0);" onclick="edit('<?= $list->id ?>')">详情</a>]
                </td>
            </tr>
        <?php endforeach; ?>
    <?php endif; ?>
    <tr>
        <td height="25" colspan="12" align="center" class="td_bg"><?= isset($page_info) ? $page_info : '' ?></td>
    </tr>
</table>
<script type="text/javascript" language="javascript">
    //编辑
    function edit(id) {
        window.location.href = '/fix-car-group/info?id=' + id;
    }

    //顶级分类 change 事件
    function getSons(val) {
        if (!val) return false;
        $.post('/fix-car-category/get-machine', {pid: val}, function (data) {
            if (data.success) {
                var _option = '';
                for (var i = 0; i < data.content.length; i++) {
                    _option += '<option value="' + data.content[i].id + '">' + data.content[i].name + '</option>';
                }
                $('#id').html(_option);
            }

        }, 'json');
    }
</script>
