var bootstrap = function ($, learun) { "use strict"; var date = ""; var page = { init: function () { page.bind(); page.initGrid(); page.initChart(); }, bind: function () { //当前年 var now = learun.formatDate(new Date(), 'yyyy-MM-dd'); $('#date').val(now); date = now; // 刷新 $('#lr-replace').on('click', function () { location.reload(); }); //查询 $('#btn_Search').on('click', function () { date = $('#date').val(); page.search(); }); }, initGrid: function () { $(".lr-layout-grid").height($(window).height() - 110); $('#gridtable').jfGrid({ url: top.$.rootUrl + '/LR_SystemModule/Log/GetUseList?CategoryId=1', headData: [ { name: "category", label: "分类", width: 50, align: "center", formatter: function (cellvalue) { return "登录"; } }, { name: "department", label: "部门", width: 150, align: "center" }, { name: "source", label: "来源", width: 80, align: "center" }, { name: "total", label: "人数", width: 80, align: "center" } ] }); $('#gridtable2').jfGrid({ url: top.$.rootUrl + '/LR_SystemModule/Log/GetUseList?CategoryId=2', headData: [ { name: "category", label: "分类", width: 50, align: "center", formatter: function (cellvalue) { return "操作"; } }, { name: "department", label: "部门", width: 150, align: "center" }, { name: "source", label: "来源", width: 80, align: "center" }, { name: "total", label: "人数", width: 80, align: "center" } ] }); page.search(); }, initChart: function () { var myChart1 = echarts.init(document.getElementById('main')); var myChart2 = echarts.init(document.getElementById('main1')); var myChart3 = echarts.init(document.getElementById('main2')); var queryJson = { date: date }; learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/Log/GetUseChartList", { queryJson: JSON.stringify(queryJson) }, function (res) { if (res.code == 200) { var option1 = { title: { text: date + ' 登录记录', x: 'center' }, tooltip: { trigger: 'item', formatter: "{a}
{b} : {c}人 ({d}%)" }, legend: { orient: 'vertical', left: 'left', data: res.data.legendData }, series: [ { name: '登录记录', type: 'pie', radius: '55%', center: ['50%', '60%'], data: res.data.seriesData, itemStyle: { emphasis: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)' } } } ] }; myChart1.setOption(option1); var option2 = { title: { text: date + ' 操作记录', x: 'center' }, tooltip: { trigger: 'item', formatter: "{a}
{b} : {c}人 ({d}%)" }, legend: { orient: 'vertical', left: 'left', data: res.data.legendData }, series: [ { name: '操作记录', type: 'pie', radius: '55%', center: ['50%', '60%'], data: res.data.seriesData2, itemStyle: { emphasis: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)' } } } ] }; myChart2.setOption(option2); var option3 = { title: { text: date.slice(0, 4) + '年系统使用趋势图', x: 'center' }, legend: { orient: 'vertical', left: 'left', data: res.data.legendDataOfLine }, tooltip: { trigger: 'axis' }, grid: { left: '15%', right: '3%', bottom: '3%', containLabel: true }, xAxis: { type: 'category', boundaryGap: false, data: res.data.xAxis }, yAxis: { type: 'value', name: '人数' }, series: res.data.seriesLineData }; myChart3.setOption(option3); } }); }, search: function (param) { param = param || {}; param.date = date; $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); $('#gridtable2').jfGridSet('reload', { queryJson: JSON.stringify(param) }); page.initChart(); } }; page.init(); }