优化首页

This commit is contained in:
季圣华
2020-07-08 00:22:39 +08:00
parent 2f67fc8e4a
commit fda716cd03

View File

@@ -123,26 +123,35 @@
}).find('.box-header, .nav-tabs').css('cursor', 'move'); }).find('.box-header, .nav-tabs').css('cursor', 'move');
$(function () { $(function () {
var loginName = sessionStorage.getItem("loginName");
if(loginName!="admin") {
$.ajax({ $.ajax({
type: "get", type: "get",
url: "/depotHead/getBuyAndSaleStatistics", url: "/depotHead/getBuyAndSaleStatistics",
dataType: "json", dataType: "json",
success: function (res) { success: function (res) {
if(res && res.code === 200) { if (res && res.code === 200) {
if(res.data) { if (res.data) {
$("#todaySale").text((res.data.todaySale).toFixed(2)); $("#todaySale").text((res.data.todaySale).toFixed(2));
$("#thisMonthSale").text((res.data.thisMonthSale).toFixed(2)); $("#thisMonthSale").text((res.data.thisMonthSale).toFixed(2));
$("#thisMonthBuy").text((res.data.thisMonthBuy).toFixed(2)); $("#thisMonthBuy").text((res.data.thisMonthBuy).toFixed(2));
} }
} }
}, },
error:function(res){ error: function (res) {
} }
}); });
} else {
$("#todaySale").text("--");
$("#thisMonthSale").text("--");
$("#thisMonthBuy").text("--");
}
}); });
$(function () { $(function () {
var loginName = sessionStorage.getItem("loginName");
if(loginName!="admin") {
$.ajax({ $.ajax({
type: "get", type: "get",
url: "/account/getStatistics", url: "/account/getStatistics",
@@ -158,6 +167,9 @@
} }
}); });
} else {
$("#thisMonthAmount").text("--");
}
}); });
function getChartObj(titleName, categories, seriesData) { function getChartObj(titleName, categories, seriesData) {
@@ -184,21 +196,27 @@
return chartObj; return chartObj;
} }
$(function () { $(function () {
var loginName = sessionStorage.getItem("loginName");
if(loginName!="admin") {
$.ajax({ $.ajax({
type: "get", type: "get",
url: "/depotItem/buyOrSalePrice", url: "/depotItem/buyOrSalePrice",
dataType: "json", dataType: "json",
success: function (res) { success: function (res) {
if(res && res.code === 200) { if (res && res.code === 200) {
var data = res.data; var data = res.data;
Highcharts.chart('buyIn', getChartObj("最近6个月采购数据", res.data.monthList, res.data.buyPriceList)); Highcharts.chart('buyIn', getChartObj("最近6个月采购数据", res.data.monthList, res.data.buyPriceList));
Highcharts.chart('saleOut', getChartObj("最近6个月销售数据", res.data.monthList, res.data.salePriceList)); Highcharts.chart('saleOut', getChartObj("最近6个月销售数据", res.data.monthList, res.data.salePriceList));
} }
}, },
error:function(res){ error: function (res) {
} }
}); });
} else {
Highcharts.chart('buyIn', getChartObj("最近6个月采购数据", [], []));
Highcharts.chart('saleOut', getChartObj("最近6个月销售数据", [], []));
}
}); });
</script> </script>