SysInterfaceLog.js 3.69 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}/LoadSysInterLog`,
                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: 'type', width: 130, title: '类型:接收/发送' },
                    { field: 'system', width: 120, hide: true, title: '系统' },
                    { field: 'path', width: 200, title: '路径' },
                    { field: 'method', width: 100, title: '方法' },
                    { field: 'request', width: 500,   title: '请求',   },
                    { field: 'response', width: 400, title: '响应' },
                    { field: 'totalMilliseconds', width: 100, title: '耗时(毫秒)' },
                    { field: 'logTime', width: 150, title: '日志时间' },
                    { field: 'actionName', width: 400, title: '调用方法' },
                    { field: 'server', width: 150, title: '服务器' },
                    { field: 'queryString', width: 150, title: '查询字符串' },
                    { field: 'apiGroup', width: 150, title: 'Api控制器' },
                    { field: 'name', width: 150, title: '用户名' },
                    { field: 'ip', width: 150, title: 'Ip地址' },
                    { field: 'browser', width: 150, title: '浏览器' },
                    { field: 'result', width: 150, title: '结果' },
                    { field: 'flag', width: 150, title: '重发标识' },
                    { field: 'createTime', width: 150, title: '创建时间' },
                    { field: 'createBy', width: 150, title: '创建用户' }
                ]
            ],
            tableIns: null,
            tableElem: "mainList",

            selectOption: {
                type: {
                    SelType: "key",
                    SelValue: "key",
                    SelFrom: "dataSource",
                    Dom: [$("select[name='type']")],
                    dataSource: window.top.EnumLog,
                },
                //返回的数据 用于后续操作
                selectData: {
                }
            }
        },
        methods: {
            initTable: function () {
                let options = {
                    elem: "#" + app.data.tableElem,
                    url: `/${areaName}/${tableName}/LoadSysInterLog`,
                    cols: u.columnRecord(app.data.tableElem, app.data.cols),
                    toolbar: '#toolbarTable'
                }
                app.data.tableIns = u.initTable(options);
            },
            initFrom: function () {
                debugger
                u.initSelecteByEnum(app.data.selectOption);
            }
        },
        registerEvent: function () {

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