|
@@ -259,16 +259,18 @@ export default {
|
|
|
this.defaultYear = [e.indexs[0]];
|
|
|
this.currentYear = e.value[0].value;
|
|
|
this.yearObj = e.value[0];
|
|
|
- this.params.queryDate = `${this.currentYear}-${this.currentMonth}-${this.currentDay}`;
|
|
|
+ this.params.queryDate = `${this.currentYear || 1}-${this.currentMonth || 1}-${this.currentDay || 1}`;
|
|
|
this.yearPicker = false;
|
|
|
+ this.formatDateStr(this.params.queryDate);
|
|
|
this.getData();
|
|
|
},
|
|
|
monthConfirm(e) {
|
|
|
this.defaultMonth = [e.indexs[0]];
|
|
|
this.currentMonth = e.value[0].value;
|
|
|
this.monthObj = e.value[0];
|
|
|
- this.params.queryDate = `${this.currentYear}-${this.currentMonth}-${this.currentDay}`;
|
|
|
+ this.params.queryDate = `${this.currentYear}-${this.currentMonth || '01'}-${this.currentDay || '01'}`;
|
|
|
this.monthPicker = false;
|
|
|
+ this.formatDateStr(this.params.queryDate);
|
|
|
this.dayList = this.getDayList();
|
|
|
this.getData();
|
|
|
},
|
|
@@ -276,7 +278,8 @@ export default {
|
|
|
this.defaultDay = [e.indexs[0]];
|
|
|
this.currentDay = e.value[0].value;
|
|
|
this.dayObj = e.value[0];
|
|
|
- this.params.queryDate = `${this.currentYear}-${this.currentMonth}-${this.currentDay}`;
|
|
|
+ this.params.queryDate = `${this.currentYear}-${this.currentMonth || '01'}-${this.currentDay || '01'}`;
|
|
|
+ this.formatDateStr(this.params.queryDate);
|
|
|
this.dayPicker = false;
|
|
|
this.getData();
|
|
|
},
|
|
@@ -298,7 +301,25 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 初始化时间格式
|
|
|
+ * @param {Object} val
|
|
|
+ */
|
|
|
+ formatDateStr(val) {
|
|
|
+ let timestamp = new Date(val).valueOf();
|
|
|
+ switch (this.params.reportType) {
|
|
|
+ case 0:
|
|
|
+ this.currentDate = uni.$u.timeFormat(timestamp, 'yyyy年mm月dd日');
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ this.currentDate = uni.$u.timeFormat(timestamp, 'yyyy年mm月');
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ this.currentDate = uni.$u.timeFormat(timestamp, 'yyyy年');
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|