main.html
29.7 KB
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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--360浏览器优先以webkit内核解析-->
<title>概况</title>
<link rel="shortcut icon" href="favicon.ico">
<link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
<link th:href="@{/css/font-awesome.css}" rel="stylesheet"/>
<link th:href="@{/css/main/animate.min.css}" rel="stylesheet"/>
<link th:href="@{/css/main/style.min862f.css}" rel="stylesheet"/>
<style>
.tab-ul{
display: inline-block;
margin: 0 auto;
}
.tab-ul li{
text-decoration: none;
display: inline-block;
margin: 0 20px;
}
.chart-hide{
display: none;
}
</style>
</head>
<body class="gray-bg">
<div class="row" style="padding:20px 30px 10px 30px;">
<div class="col-sm-2" style="padding:5px;">
<div class="total_box ys01">
<h1 id="s1">-</h1>
<p>今日总单量</p>
</div>
</div>
<div class="col-sm-2" style="padding:5px;" onclick="createMenuItem('/twms/admin/receiptHeader?type=40','入库单')">
<div class="total_box ys02">
<h1 id="s2">-</h1>
<p>今日入库量</p>
</div>
</div>
<div class="col-sm-2" style="padding:5px;" onclick="createMenuItem('/twms/admin/shipmentHeader?type=40','出库单')">
<div class="total_box ys03">
<h1 id="s3">-</h1>
<p>今日出库量</p>
</div>
</div>
<div class="col-sm-2" style="padding:5px;" onclick="createMenuItem('/twms/admin/inventory','库存查看')">
<div class="total_box ys04">
<h1 id="s4">-</h1>
<p>库存总量</p>
</div>
</div>
<div class="col-sm-2" style="padding:5px;">
<div class="total_box ys05">
<h1 id="s5">-</h1>
<p>库内物料品数</p>
</div>
</div>
<div class="col-sm-2" style="padding:5px;" onclick="createMenuItem('/twms/admin/task?id=100','任务查看')">
<div class="total_box ys06">
<h1 id="s6">-</h1>
<p>待执行任务数</p>
</div>
</div>
</div>
<div class="row" style="padding:0 30px;">
<div class="col-sm-6" style="padding:5px 5px 10px 5px;">
<div class="float-e-margins">
<div class="ibox-title">
<h5>每日收发货量</h5>
<ul class="tab-ul tab-list1">
<li><a>时间维度</a></li>
<li><a>仓库维度</a></li>
<li><a>货主维度</a></li>
</ul>
</div>
<div class="ibox-content">
<div class="echart-1"><div id="chart1" class="flot-chart1"></div></div>
<div class="echart-1 chart-hide">
<div id="chart1-1" class="flot-chart1"></div>
</div>
<div class="echart-1 chart-hide"><div id="chart1-2" class="flot-chart1"></div></div>
</div>
</div>
</div>
<div class="col-sm-6" style="padding:5px 5px 10px 5px;">
<div class="float-e-margins">
<div class="ibox-title">
<h5>库位利用率</h5>
</div>
<div class="ibox-content">
<div class="echart-2"><div id="chart2" class="flot-chart1"></div></div>
</div>
</div>
</div>
<div class="col-sm-6" style="padding:5px 5px 10px 5px;">
<div class="float-e-margins">
<div class="ibox-title">
<h5>库龄展示</h5>
<ul class="tab-ul tab-list3">
<li><a>仓库维度</a></li>
<li><a>货主维度</a></li>
</ul>
</div>
<div class="ibox-content">
<div class="echart-3"><div id="chart3" class="flot-chart1"></div></div>
<div class="echart-3 chart-hide"><div id="chart3-1" class="flot-chart1">2</div></div>
</div>
</div>
</div>
<div class="col-sm-6" style="padding:5px 5px 10px 5px;">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>库存分布</h5>
<ul class="tab-ul tab-list4">
<li><a>仓库维度</a></li>
<li><a>货主维度</a></li>
</ul>
</div>
<div class="ibox-content">
<div class="echart-4"><div id="chart4" class="flot-chart1"></div></div>
<div class="echart-4 chart-hide"><div id="chart4-1" class="flot-chart1">2</div></div>
</div>
</div>
</div>
</div>
<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>
<script th:src="@{/js/echarts/echarts.js}"></script>
<script th:src="@{/huaheng/js/common.js}"></script>
<script>
$(function () {
refresh();
$(".tab-list1 li").click(function () {
let a=$('.tab-list1 li').index(this);
$(".echart-1").addClass('chart-hide');
$(".echart-1").eq(a).removeClass('chart-hide');
a=String(a+1);
chart(a);
});
$(".tab-list3 li").click(function () {
let a=$('.tab-list3 li').index(this);
$(".echart-3").addClass('chart-hide');
$(".echart-3").eq(a).removeClass('chart-hide');
a=String(a+1);
chart3(a);
});
$(".tab-list4 li").click(function () {
let a=$('.tab-list4 li').index(this);
$(".echart-4").addClass('chart-hide');
$(".echart-4").eq(a).removeClass('chart-hide');
a=String(a+1);
chart4(a);
});
});
function refresh() {
$.get("../admin/home/getCommonData").done(function (data) {
if(data.code==200){
$("#s1").text(data.data.bllCount)
$("#s2").text(data.data.receiptTotal)
$("#s3").text(data.data.shipmentTotal)
$("#s4").text(data.data.inventoryTotal)
$("#s5").text(data.data.materialCount)
$("#s6").text(data.data.taskUncompletedTotal)
}
});
$.ajax({
url: '../admin/home/getShipmentsLast7Days',
type:'get',
data:{
type:'1'
},
success:function (data) {
let option={
title: {
// text: '',
},
tooltip: {
trigger: 'axis'
},
legend: {
data:['今日入库量','今日出库量']
},
toolbox: {
show: true,
feature: {
dataView: {readOnly: false},
magicType: {type: ['line', 'bar']},
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: []
},
yAxis: {
type: 'value',
},
series: [
{
name:'今日入库量',
type:'line',
data:[],
},
{
name:'今日出库量',
type:'line',
data:[],
}
]
};
for(let value of data.data.receiptDetails){
option.xAxis.data.push(value.lastUpdated.substr(0,10));
option.series[0].data.push(value.qty)
}
for(let value of data.data.shipmentDetails){
option.series[1].data.push(value.qty)
}
let chart1=echarts.init(document.getElementById('chart1'));
chart1.setOption(option);
}
});
$.ajax({
url:'../admin/home/getLocationProp',
type:'get',
data:{
type:'1'
},
success:function (data) {
let option={
title: {
// text: '',
},
tooltip: {
trigger: 'axis',
// formatter: '{a0}:{c0}% <br>{a1}:{c1}%',
axisPointer : {
type : 'shadow'
},
formatter:function (params) {
let tip=params[0].name+'<br>';
for (let i = params.length-1; i >= 0; i--) {
tip=tip+params[i].marker+params[i].seriesName+':'+params[i].value+'%<br>'
}
return tip
}
},
legend: {
data:['有货','无货']
},
xAxis: {
type: 'category',
boundaryGap: true,
data: []
},
yAxis: {
type: 'value',
axisLabel: {
formatter: '{value} %'
}
},
series: [
{
name:'有货',
type:'bar',
stack: '总量',
barWidth: '30%',
data:[],
},
{
name:'无货',
type:'bar',
stack: '总量',
barWidth: '30%',
data:[],
}
]
};
for(let value of data.data){
option.xAxis.data.push(value.warehouseName);
option.series[0].data.push(value.有货*100);
option.series[1].data.push(value.无货*100);
}
let chart1=echarts.init(document.getElementById('chart2'));
chart1.setOption(option);
}
});
$.ajax({
url:'../admin/home/getInventoryStatus',
type:'get',
data:{
type:'1'
},
success:function (value) {
let option={
tooltip: {
trigger: 'axis',
axisPointer : {
type : 'shadow'
},
formatter:function (params) {
let tip=params[0].name+'<br>';
for (let i = params.length-1; i >= 0; i--) {
tip=tip+params[i].marker+params[i].seriesName+':'+params[i].value+'%<br>'
}
return tip
}
},
legend: {
data:['<3个月','3-6个月','6-9个月','9-12个月','>12个月']
},
toolbox: {
show: true,
feature: {
dataView: {readOnly: false},
magicType: {type: ['line', 'bar']},
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: true,
data: []
},
yAxis: {
type: 'value',
axisLabel: {
formatter: '{value} %'
}
},
series: []
};
let length=value.data.length;
for(let t=0;t<length;t++){
option.xAxis.data.push(value.data[t].warehouseName);
}
// for (let l = 0; l < length; l++) {
// for(let k=0;k<9;k++){
// option.series.push({name:value.data[l].list1[k].materialName,type:'bar',stack: value.data[l].warehouseName,data:[]});
// }
// }
for(let k=0;k<5;k++){
option.series.push({name:option.legend.data[k],type:'bar',stack:'总量',barWidth:'30%',data:[]});
}
// for (let i = 0; i < 10 ; i++) {
// for(let j=i;j<i+length*10;j+=10){
// option.series[i].data.push(value.data[j].days);
// }
// }
for(let i=0;i<length;i++){
for (let j = 0; j < 5; j++) {
option.series[j].data.push(value.data[i].list1[j]*100);
}
}
let chart1=echarts.init(document.getElementById('chart3'));
chart1.setOption(option);
}
});
$.ajax({
url:'../admin/home/getInventoryProp',
type:'get',
data:{
type:'1'
},
success:function (value) {
let option={
tooltip: {
trigger: 'item',
axisPointer : {
type : 'shadow'
},
formatter:function (params) {
return params.marker+params.data.name+':'+params.data.value
}
},
xAxis: {
type: 'category',
boundaryGap: true,
data: []
},
yAxis: {
type: 'value',
axisLabel: {
formatter: '{value}'
}
},
series: []
};
let length=value.data.length;
for(let t=0;t<length;t++){
option.xAxis.data.push(value.data[t].warehouseName);
}
for(let k=0;k<10;k++){
option.series.push({type:'bar',stack:'总量',data:[]});
}
for(let i=0;i<length;i++){
let showLine = 0;
if (value.data[i].list1.length < 10){
showLine = value.data[i].list1.length;
} else {
showLine = 10;
}
for (let j = 0; j < showLine; j++) {
option.series[j].data.push({value:value.data[i].list1[j].total,name:value.data[i].list1[j].name});
}
}
let chart1=echarts.init(document.getElementById('chart4'));
chart1.setOption(option);
}
})
}
let chart11=null;
let chart12=null;
let chart31=null;
let chart41=null;
function chart(index) {
$.ajax({
url: '../admin/home/getShipmentsLast7Days',
type:'get',
data:{
type:index
},
success:function (data) {
if(index==='2'){
let option={
title: {
// text: '',
},
tooltip: {
trigger: 'axis'
},
legend: {
data:['今日入库量','今日出库量']
},
toolbox: {
show: true,
feature: {
dataView: {readOnly: false},
magicType: {type: ['line', 'bar']},
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: []
},
yAxis: {
type: 'value',
},
series: [
{
name:'今日入库量',
type:'line',
data:[],
},
{
name:'今日出库量',
type:'line',
data:[],
}
]
};
for(let value of data.data.receiptDetails){
option.xAxis.data.push(value.warehouseName);
option.series[0].data.push(value.qty)
}
for(let value of data.data.shipmentDetails){
option.series[1].data.push(value.qty)
}
if(chart11 !== null){
chart11.setOption(option);
}
else {
chart11=echarts.init(document.getElementById('chart1-1'));
chart11.setOption(option);
}
}
else if(index==='3'){
let option={
title: {
// text: '',
},
tooltip: {
trigger: 'axis'
},
legend: {
data:['今日入库量','今日出库量']
},
toolbox: {
show: true,
feature: {
dataView: {readOnly: false},
magicType: {type: ['line', 'bar']},
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: []
},
yAxis: {
type: 'value',
},
series: [
{
name:'今日入库量',
type:'line',
data:[],
},
{
name:'今日出库量',
type:'line',
data:[],
}
]
};
for(let value of data.data.receiptDetails){
option.xAxis.data.push(value.companyName);
option.series[0].data.push(value.qty)
}
for(let value of data.data.shipmentDetails){
option.series[1].data.push(value.qty)
}
if(chart12 !== null){
chart12.setOption(option);
}
else {
chart12=echarts.init(document.getElementById('chart1-2'));
chart12.setOption(option);
}
}
}
});
}
function chart3(index) {
$.ajax({
url:'../admin/home/getInventoryStatus',
type:'get',
data:{
type:index
},
success:function (value) {
if(index==='2'){
let option={
tooltip: {
trigger: 'axis',
axisPointer : {
type : 'shadow'
},
formatter:function (params) {
let tip=params[0].name+'<br>';
for (let i = params.length-1; i >= 0; i--) {
tip=tip+params[i].marker+params[i].seriesName+':'+params[i].value+'%<br>'
}
return tip
}
},
legend: {
data:['<3个月','3-6个月','6-9个月','9-12个月','>12个月']
},
toolbox: {
show: true,
feature: {
dataView: {readOnly: false},
magicType: {type: ['line', 'bar']},
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: true,
data: []
},
yAxis: {
type: 'value',
axisLabel: {
formatter: '{value} %'
}
},
series: []
};
let length=value.data.length;
for(let t=0;t<length;t++){
option.xAxis.data.push(value.data[t].companyName);
}
for(let k=0;k<5;k++){
option.series.push({name:option.legend.data[k],type:'bar',stack:'总量',barWidth:'30%',data:[]});
}
for(let i=0;i<length;i++){
for (let j = 0; j < 5; j++) {
option.series[j].data.push(value.data[i].list1[j]*100);
}
}
if(chart31 !== null){
chart31.setOption(option);
}
else {
chart31=echarts.init(document.getElementById('chart3-1'));
chart31.setOption(option);
}
}
}
});
}
function chart4(index) {
$.ajax({
url:'../admin/home/getInventoryProp',
type:'get',
data:{
type:index
},
success:function (value) {
if(index==='2'){
let option={
tooltip: {
trigger: 'item',
axisPointer : {
type : 'shadow'
},
formatter:function (params) {
return params.marker+params.data.name+':'+params.data.value
}
},
xAxis: {
type: 'category',
boundaryGap: true,
data: []
},
yAxis: {
type: 'value',
axisLabel: {
formatter: '{value}'
}
},
series: []
};
let length=value.data.length;
for(let t=0;t<length;t++){
option.xAxis.data.push(value.data[t].companyName);
}
for(let k=0;k<10;k++){
option.series.push({type:'bar',stack:'总量',data:[]});
}
for(let i=0;i<length;i++){
for (let j = 0; j < 10; j++) {
option.series[j].data.push({value:value.data[i].list1[j].total,name:value.data[i].list1[j].name});
}
}
if(chart41 !== null){
chart41.setOption(option);
}
else {
chart41=echarts.init(document.getElementById('chart4-1'));
chart41.setOption(option);
}
}
}
})
}
function createMenuItem(dataUrl, menuName) {
let dataIndex = Math.floor((Math.random() * 200) + 100),
flag = true;
if (dataUrl == undefined || $.trim(dataUrl).length == 0) return false;
var topWindow = $(window.parent.document);
// 选项卡菜单已存在
$('.menuTab', topWindow).each(function() {
//todo 增加判断 如果是detail 则需去掉后面的/id 再判断
if ($(this).data('id') == dataUrl) {
if (!$(this).hasClass('active')) {
$(this).addClass('active').siblings('.menuTab').removeClass('active');
$('.page-tabs-content').animate({ marginLeft: ""}, "fast");
// 显示tab对应的内容区
$('.mainContent .huaheng_iframe', topWindow).each(function() {
if ($(this).data('id') == dataUrl) {
$(this).show().siblings('.huaheng_iframe').hide();
return false;
}
});
}
flag = false;
return false;
}
});
// 选项卡菜单不存在
if (flag) {
// if (dataUrl.indexOf("?") != -1) {
// dataUrl=dataUrl.substr(0,dataUrl.indexOf("?"));
// }
var str = '<a href="javascript:;" class="active menuTab" data-id="' + dataUrl + '">' + menuName + ' <i class="fa fa-times-circle"></i></a>';
$('.menuTab', topWindow).removeClass('active');
// 添加选项卡对应的iframe
var str1 = '<iframe class="huaheng_iframe" name="iframe' + dataIndex + '" width="100%" height="100%" src="' + dataUrl + '" frameborder="0" data-id="' + dataUrl + '" seamless></iframe>';
$('.mainContent', topWindow).find('iframe.huaheng_iframe').hide().parents('.mainContent').append(str1);
// 添加选项卡
$('.menuTabs .page-tabs-content', topWindow).append(str);
}
return false;
}
</script>
</body>
</html>