$(function () {
    loadGrid();
});

function loadGrid() {
    $('#tb').datagrid({
        iconCls: 'icon-list',
        title: '',
        height: gridheight - 40,
        width: gridwidth,
        url: g.ctx+ 'pc/sys/auditLog/rest/list',
        singleSelect: true,
        pagination: true,
        idField: 'id',
        autoHeight: true,
        loadMsg: "数据加载中......",
        rownumbers: true,
        fitColumns: false,
        nowrap: true,
        remoteSort: true,
        striped: true,
        page: 1,
        pageSize: 10,
        queryParams: {
            page: 1,
            rows: 10,
            name: "",
            desc: ""
        },
        columns: [[
            {
                field: 'ck',
                checkbox: true
            },
            {
                field: 'userName',
                title: '登录账户',
                width: '7%',
                align: 'left'
            },
            {
                field: 'ip',
                title: '操作IP',
                width: '7%',
                align: 'left'
            },
            {
                field: 'operation',
                title: '操作类型',
                width: '12%',
                align: 'left'
            },
            {
                field: 'module',
                title: '操作模块',
                width: '10%',
                align: 'left'
            },
            {
                field: 'method',
                title: '请求方法',
                width: '22%',
                align: 'left'
            },
            {
                field: 'params',
                title: '请求参数',
                width: '35%',
                align: 'left'
            },
            {
                field: 'operationTime',
                title: '操作时间',
                width: '10%',
                align: 'left',
                formatter: function (value) {
                    if (!value) {
                        return '';
                    }
                    return moment(value).format('YYYY-MM-DD HH:mm:ss');
                }
            }
        ]]
    });
};

