1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
| /**
|
| @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} <br/>{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}<br>新增用户:{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: '<div><a href="https://www.baidu.com/s?wd={{ d.keywords }}" target="_blank" class="layui-table-link">{{ d.keywords }}</div>'}
| ,{field: 'frequency', title: '搜索次数', minWidth: 120, sort: true}
| ,{field: 'userNums', title: '用户数', sort: true}
| ]]
| ,skin: 'line'
| });
|
| //今日热贴
| table.render({
| elem: '#LAY-index-topCard'
| ,url: layui.setter.base + 'json/console/top-card.js' //模拟接口
| ,page: true
| ,cellMinWidth: 120
| ,cols: [[
| {type: 'numbers', fixed: 'left'}
| ,{field: 'title', title: '标题', minWidth: 300, templet: '<div><a href="{{ d.href }}" target="_blank" class="layui-table-link">{{ d.title }}</div>'}
| ,{field: 'username', title: '发帖者'}
| ,{field: 'channel', title: '类别'}
| ,{field: 'crt', title: '点击率', sort: true}
| ]]
| ,skin: 'line'
| });
| });
|
| exports('console', {})
| });
|
|