SysOperLog.js 2.63 KB
let action = null;

layui.config({
    base: "/js/",
    version: 111
}).use(['system'], function () {
    var form = layui.form,
        $ = layui.jquery,
        system = layui.system,
        table = layui.table,
        u = new system.u(),
        areaName = 'Log',
        tableName = 'Logs';

    action = {
        queryOptions: function () {
            var options = {
                resetFrom: "form[lay-filter=listForm]",
                fromId: "listForm",
                urlQuery: `/${areaName}/${tableName}/LoadSysOperLog`,
                mainTable: app.data.tableIns
            }
            return options;
        },

        //所有动作成功之后
        actionSuccess: (falg) => {
            app.data.tableIns.config.where = {};
            app.data.tableIns.config.page.curr = 1;
            app.data.tableIns.reload("mainList", {});
        }
    }

    var app = {
        data: {
            cols: [[
                { field: 'id', width: 80,  hide: true, title: 'Id' },
                { field: 'url', width: 150, title: '地址' },
                { field: 'operType', width: 150, title: '类型' },
                { field: 'method', width: 150, title: '方法' },
                { field: 'request', width: 150, title: '请求' },
                { field: 'parameter', width: 150, title: '参数' },
                { field: 'response', width: 150, title: '响应' },

                { field: 'totalMilliseconds', width: 150, title: '耗时(秒)' },
                { field: 'logTime', width: 150, title: '日志时间' },
                { field: 'name', width: 150, title: '用户名' },
                { field: 'ip', width: 150, title: 'Ip' },

                { field: 'createTime', width: 150, title: '创建时间' },
                { field: 'createBy', width: 150, title: '创建用户' },
                { field: 'updateTime', width: 150, title: '更新时间' },
                { field: 'updateBy', width: 150,title: '更新用户' }
            ]],
            tableIns: null,
            tableElem: "mainList"
        },
        methods: {
            initTable: function () {
                let options = {
                    elem: "#" + app.data.tableElem,
                    url: `/${areaName}/${tableName}/LoadSysOperLog`,
                    cols: u.columnRecord(app.data.tableElem, app.data.cols),
                    toolbar: '#toolbarTable'
                }
                app.data.tableIns = u.initTable(options);
            }
        },
        registerEvent: function () {

        },
        init: function () {
            app.methods.initTable();
            app.registerEvent();
        }
    };
    app.init();
});