/**
@Name:layuiAdmin 主页控制台
@Author:贤心
@Site:http://www.layui.com/admin/
@License:GPL-2
*/
layui.define(function (exports) {
/*
下面通过 layui.use 分段加载不同的模块,实现不同区域的同时渲染,从而保证视图的快速呈现
*/
//区块轮播切换
layui.use(['admin', 'carousel'], function(){
var $ = layui.$
,admin = layui.admin
,carousel = layui.carousel
,element = layui.element
,device = layui.device();
//轮播切换
$('.layadmin-carousel').each(function(){
var othis = $(this);
carousel.render({
elem: this
,width: '100%'
,arrow: 'none'
,interval: othis.data('interval')
,autoplay: othis.data('autoplay') === true
,trigger: (device.ios || device.android) ? 'click' : 'hover'
,anim: othis.data('anim')
});
});
element.render('progress');
});
//数据概览
layui.use(['admin', 'carousel', 'echarts'], function(){
var $ = layui.$
,admin = layui.admin
,carousel = layui.carousel
,echarts = layui.echarts;
//汇报单数量
var quantity = [];
//汇报时间辖区
var time = [];
get_Display();
var echartsApp = [], options = [
//今日产量趋势
{
title: {
text: '今日产量趋势',
x: 'center',
textStyle: {
fontSize: 14
}
},
tooltip : {
trigger: 'axis'
},
legend: {
data:['','']
},
xAxis : [{
type : 'category',
boundaryGap : false,
data: time
}],
yAxis : [{
type : 'value'
}],
series : [{
name:'PV',
type:'line',
smooth:true,
itemStyle: { normal: { areaStyle: { type: 'default' } } },
data: quantity
},{
name:'UV',
type:'line',
smooth:true,
itemStyle: { normal: { areaStyle: { type: 'default' } } },
data: quantity
}]
},
//访客浏览器分布
{
title : {
text: '访客浏览器分布',
x: 'center',
textStyle: {
fontSize: 14
}
},
tooltip : {
trigger: 'item',
formatter: "{a}
{b} : {c} ({d}%)"
},
legend: {
orient : 'vertical',
x : 'left',
data:['Chrome','Firefox','IE 8.0','Safari','其它浏览器']
},
series : [{
name:'访问来源',
type:'pie',
radius : '55%',
center: ['50%', '50%'],
data:[
{value:9052, name:'Chrome'},
{value:1610, name:'Firefox'},
{value:3200, name:'IE 8.0'},
{value:535, name:'Safari'},
{value:1700, name:'其它浏览器'}
]
}]
},
//新增的用户量
{
title: {
text: '最近一周新增的用户量',
x: 'center',
textStyle: {
fontSize: 14
}
},
tooltip : { //提示框
trigger: 'axis',
formatter: "{b}
新增用户:{c}"
},
xAxis : [{ //X轴
type : 'category',
data : ['11-07', '11-08', '11-09', '11-10', '11-11', '11-12', '11-13']
}],
yAxis : [{ //Y轴
type : 'value'
}],
series : [{ //内容
type: 'line',
data:[200, 300, 400, 610, 150, 270, 380],
}]
}
]
,elemDataView = $('#LAY-index-dataview').children('div')
,renderDataView = function(index){
echartsApp[index] = echarts.init(elemDataView[index], layui.echartsTheme);
echartsApp[index].setOption(options[index]);
//window.onresize = echartsApp[index].resize;
admin.resize(function(){
echartsApp[index].resize();
});
};
//没找到DOM,终止执行
if(!elemDataView[0]) return;
renderDataView(0);
//监听数据概览轮播
var carouselIndex = 0;
carousel.on('change(LAY-index-dataview)', function(obj){
renderDataView(carouselIndex = obj.index);
});
//监听侧边伸缩
layui.admin.on('side', function(){
setTimeout(function(){
renderDataView(carouselIndex);
}, 300);
});
//监听路由
layui.admin.on('hash(tab)', function(){
layui.router().path.join('') || renderDataView(carouselIndex);
});
//查询
function get_Display() {
var index = layer.load(0, { shade: false });
var ajaxLoad = layer.load();
//进入页面显示的缓存列表
$.ajax({
url: GetWEBURL() + '/Web/GetICMOBillWorkQtyStatus_Tmp',
type: "GET",
async: false,
data: {},
success: function (data1) {
if (data1.count == 1) {
quantity = [];
time = [];
for (var i = 0; i < data1.data.length; i++) {
time.push(data1.data[i].date);
quantity.push(data1.data[i].quantity);
}
layer.close(ajaxLoad);
} else {
layer.close(ajaxLoad);
layer.alert(data1.code + data1.Message, { icon: 5 });
}
}, error: function () {
layer.close(ajaxLoad);
layer.alert("接口请求失败!", { icon: 5 });
}
});
layer.close(index);
}
});
//最新订单
layui.use('table', function(){
var $ = layui.$
,table = layui.table;
//今日热搜
table.render({
elem: '#LAY-index-topSearch'
,url: layui.setter.base + 'json/console/top-search.js' //模拟接口
,page: true
,cols: [[
{type: 'numbers', fixed: 'left'}
,{field: 'keywords', title: '关键词', minWidth: 300, templet: '