|
@ -25,7 +25,7 @@ new Vue({
|
|
|
lastDayYear: "", //本年最后一天
|
|
|
halfYearStartDate: "", //近半年开始时间
|
|
|
halfYearEndDate: "", //近半年结束时间
|
|
|
yesterdayDate:""
|
|
|
yesterdayDate:""//昨天
|
|
|
},
|
|
|
mounted: function() {
|
|
|
this.initData();
|
|
@ -33,9 +33,8 @@ new Vue({
|
|
|
methods: {
|
|
|
initData: function() {
|
|
|
$(".div-mask-layer").show();
|
|
|
var vm = this,
|
|
|
data1, data2, data3, data4, data5, data6, data7, data8;
|
|
|
this.formatDate(); //格式化时间
|
|
|
var vm = this,data1, data2, data3, data4, data5, data6, data7, data8;
|
|
|
this.formatDate2017(); //格式化时间
|
|
|
this.town.map(function(v, i) {
|
|
|
if(v.name == vm.city) {
|
|
|
vm.cityVal = v.id;
|
|
@ -75,7 +74,7 @@ new Vue({
|
|
|
"id": "0"
|
|
|
}].concat(datas[0]);
|
|
|
vm.leftData1 = datas[1];
|
|
|
vm.leftData2 = data2 = datas[2];
|
|
|
vm.leftData2 = datas[2];
|
|
|
data3 = datas[3];
|
|
|
data4 = datas[4];
|
|
|
data5 = datas[5];
|
|
@ -184,7 +183,7 @@ new Vue({
|
|
|
setTable1: function(data4) {
|
|
|
var resData = [];
|
|
|
_.map(data4.obj.VIEW_14_0013, function(item, index) {
|
|
|
if(item.firstColumn != "合计") {
|
|
|
if(item.firstColumn != "合计" && item.month) {
|
|
|
item.month = parseInt(item.month.substring(5, 7))+"月";
|
|
|
resData.push(item)
|
|
|
}
|
|
@ -194,7 +193,7 @@ new Vue({
|
|
|
setTable2: function(data5) {
|
|
|
var resData = [];
|
|
|
_.map(data5.obj.VIEW_14_0014, function(item, index) {
|
|
|
if(item.firstColumn != "合计") {
|
|
|
if(item.firstColumn != "合计" && item.month) {
|
|
|
item.month = parseInt(item.month.substring(5, 7))+"月";
|
|
|
resData.push(item)
|
|
|
}
|
|
@ -217,6 +216,53 @@ new Vue({
|
|
|
}
|
|
|
},
|
|
|
formatDate: function() {
|
|
|
//获取上个月第一天
|
|
|
var firstdate = new Date(new Date().getFullYear(), new Date().getMonth() - 1, 1);
|
|
|
//获取上个月最后一天
|
|
|
var date = new Date();
|
|
|
var day = new Date(date.getFullYear(), date.getMonth(), 0).getDate();
|
|
|
var enddate = new Date(new Date().getFullYear(), new Date().getMonth() - 1, day);
|
|
|
//获取本年第一天和最后一天
|
|
|
var firstYearDate = new Date();
|
|
|
firstYearDate.setDate(1);
|
|
|
firstYearMonty = firstYearDate.setMonth(0);
|
|
|
//近半年开始时间
|
|
|
var date1 = new Date();
|
|
|
date1.setMonth(date1.getMonth() - 6);
|
|
|
var year1 = date1.getFullYear();
|
|
|
var month1 = date1.getMonth() + 1;
|
|
|
month1 = (month1 < 10 ? "0" + month1 : month1);
|
|
|
//格式化结果
|
|
|
this.firstDay = firstdate.format("yyyy-MM-dd");
|
|
|
this.lastDay = enddate.format("yyyy-MM-dd");
|
|
|
this.firstDayYear = firstYearDate.format("yyyy-MM-dd");
|
|
|
this.lastDayYear = (new Date().getFullYear()) + "-12-31";
|
|
|
this.halfYearStartDate = year1.toString() + '-' + month1.toString() + "-01";
|
|
|
this.halfYearEndDate = this.getCurrentMonthLast();
|
|
|
this.yesterdayDate = this.getYesterday(-1, '-');
|
|
|
},
|
|
|
getCurrentMonthLast: function() {
|
|
|
var date = new Date();
|
|
|
var currentMonth = date.getMonth();
|
|
|
var nextMonth = ++currentMonth;
|
|
|
var nextMonthFirstDay = new Date(date.getFullYear(), nextMonth-1, 1);
|
|
|
var oneDay = 1000 * 60 * 60 * 24;
|
|
|
return(new Date(nextMonthFirstDay - oneDay)).format("yyyy-MM-dd");
|
|
|
},
|
|
|
getYesterday:function(num, str){
|
|
|
var today = new Date();
|
|
|
var nowTime = today.getTime();
|
|
|
var ms = 24*3600*1000*num;
|
|
|
today.setTime(parseInt(nowTime + ms));
|
|
|
var oYear = today.getFullYear();
|
|
|
var oMoth = (today.getMonth() + 1).toString();
|
|
|
if (oMoth.length <= 1) oMoth = '0' + oMoth;
|
|
|
var oDay = today.getDate().toString();
|
|
|
if (oDay.length <= 1) oDay = '0' + oDay;
|
|
|
return oYear + str + oMoth + str + oDay;
|
|
|
},
|
|
|
formatDate2017: function() {
|
|
|
debugger
|
|
|
//获取上个月第一天
|
|
|
var firstdate = new Date(new Date().getFullYear()-1, new Date().getMonth() - 1, 1);
|
|
|
//获取上个月最后一天
|
|
@ -225,6 +271,7 @@ new Vue({
|
|
|
var enddate = new Date(new Date().getFullYear()-1, new Date().getMonth() - 1, day);
|
|
|
//获取本年第一天和最后一天
|
|
|
var firstYearDate = new Date();
|
|
|
firstYearDate.setFullYear(new Date().getFullYear()-1)
|
|
|
firstYearDate.setDate(1);
|
|
|
firstYearMonty = firstYearDate.setMonth(0);
|
|
|
//近半年开始时间
|
|
@ -239,10 +286,10 @@ new Vue({
|
|
|
this.firstDayYear = firstYearDate.format("yyyy-MM-dd");
|
|
|
this.lastDayYear = (new Date().getFullYear()-1) + "-12-31";
|
|
|
this.halfYearStartDate = year1.toString() + '-' + month1.toString() + "-01";
|
|
|
this.halfYearEndDate = this.getCurrentMonthLast();
|
|
|
this.yesterdayDate = this.getYesterday(-1, '-');
|
|
|
this.halfYearEndDate = this.getCurrentMonthLast2017();
|
|
|
this.yesterdayDate = this.getYesterday2017(-1, '-');
|
|
|
},
|
|
|
getYesterday:function(num, str){
|
|
|
getYesterday2017:function(num, str){
|
|
|
var today = new Date();
|
|
|
var nowTime = today.getTime();
|
|
|
var ms = 24*3600*1000*num;
|
|
@ -254,7 +301,7 @@ new Vue({
|
|
|
if (oDay.length <= 1) oDay = '0' + oDay;
|
|
|
return oYear + str + oMoth + str + oDay;
|
|
|
},
|
|
|
getCurrentMonthLast: function() {
|
|
|
getCurrentMonthLast2017: function() {
|
|
|
var date = new Date();
|
|
|
var currentMonth = date.getMonth();
|
|
|
var nextMonth = ++currentMonth;
|