var StoreChartManager = {
Server: function (URL, data, callback) {
$.gitAjax({
url: URL,
data: data,
type: "post",
dataType: "json",
success: function (result) {
callback(result);
}
});
},
ToolBar: function () {
StoreChartManager.Chart1();
StoreChartManager.Chart2();
var searchBar = $("div[data-condition='search']");
searchBar.find("a[data-command='search']").click(function () {
StoreChartManager.Chart1();
StoreChartManager.Chart2();
});
},
AutoOrders: function () {
var searchBar = $("div[data-condition='search']");
var LRow = searchBar.find("select[name='Pai']").val();
if (Number(LRow) + 1 > 2) {
$("#Pai").find("option[value='1']").attr("selected", true);
} else {
$("#Pai").find("option[value='" + (Number(LRow) + 1).toString() + "']").attr("selected", true);
}
StoreChartManager.Chart1();
StoreChartManager.Chart2();
},
Chart1: function () {
var myChart = echarts.init(document.getElementById('main'));
var searchBar = $("div[data-condition='search']");
var LRow = searchBar.find("select[name='Pai']").val();
var lie = ['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'];
if (LRow == "2") {
lie = ['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'];
} else
{
lie = ['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'];
}
var ceng = ['1', '2', '3'];
var searchBar = $("div[data-condition='search']");
var Pai = searchBar.find("select[name='Pai']").val();
StoreChartManager.Server('/Data/SChartAjax/GetList', { aaa: Pai }, function (result) {
if (result != null) {
if (result.Code == 1) {
var str = result.Result;
var newdata = eval(str);
//var newdata = [[0,0,1]];
option = {
title: {
show: true,
text: "\n"+Pai + "排库位图表",
left: 'center'
},
//grid: {
// show: true,
// backgroundColor:'red'
// //left: '5%',
// //top: '10%'
//},
xAxis: {
type: 'category',
data: lie,
name: "列",
boundaryGap: true,
splitArea: {
show: true,
lineStyle: {
color: '#999'
}
},
splitLine: {
show: true,
//interval: '0',
lineStyle: {
width: 0,
color: ['black'],
type: 'dashed',
opacity:1
}
},
minorTick: {
show: true
}
},
yAxis: {
type: 'category',
data: ceng,
name: '层',
boundaryGap: true,
splitArea: {
show: true
},
splitLine: {
show: true,
//interval: '0', // 显示所有线条
lineStyle: {
width: 0, // 线条宽度
color: ['black'], // 线条颜色
type: 'dashed', // 虚线
opacity: 1
}
}
},
visualMap: {
type: 'piecewise',
splitNumber: 4,
right: 10,
bottom: 100,
align: 'left',
pieces: [
{ value: 1, label: '空库位', color:'rgb(84, 112, 198)' },/*, color: 'grey' */
{ value: 2, label: '合格', color:'rgb(145, 204, 117)'},
{ value: 3, label: '待入库', color:'rgb(255, 220, 96)' },
{ value: 4, label: '待出库', color: 'rgb(238, 102, 102)' },
{ value: 5, label: '空托盘', color: 'rgb(202, 231, 240)' }
]
},
series: {
type: 'heatmap',
left: 0,
data: newdata
}
};
myChart.setOption(option);
} else {
$.jBox.tip(result.Message, "warn");
}
}
});
},
Chart2: function () {
var myCharts = echarts.init(document.getElementById('mains'));
StoreChartManager.Server('/Data/SChartAjax/GetCharts', { aaa: "aa" }, function (result) {
if (result != null) {
obj = eval(result.Result);
if (result.Code == 1) {
options = {
title: {
text: '\n立体库使用图表',
left: 'center'
},
tooltip: {
trigger: 'item',
//formatter: '{a}
{b} : {c} ({d}%)'
formatter: '{a}
{b} ({d}%)'
},
series: [
{
name: '立体仓库:',
type: 'pie',
radius: '60%',
center: ['50%', '60%'],
bottom: 100,
data: obj,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
myCharts.setOption(options)
} else {
$.jBox.tip(result.Message, "warn");
}
}
});
}
}