|
@@ -219,20 +219,36 @@ export default {
|
|
// 调用函数
|
|
// 调用函数
|
|
callFn(fn1, fn2) {
|
|
callFn(fn1, fn2) {
|
|
const tabActive = this.tabActive;
|
|
const tabActive = this.tabActive;
|
|
- const day =
|
|
|
|
- this.radioValue === "1" ? 7 : this.radioValue === "2" ? 30 : 360;
|
|
|
|
-
|
|
|
|
let pxChartDom = document.getElementById(`${tabActive}PxChartDom`);
|
|
let pxChartDom = document.getElementById(`${tabActive}PxChartDom`);
|
|
let ksChartDom = document.getElementById(`${tabActive}KsChartDom`);
|
|
let ksChartDom = document.getElementById(`${tabActive}KsChartDom`);
|
|
|
|
|
|
pxChartDom && pxChartDom.removeAttribute("_echarts_instance_");
|
|
pxChartDom && pxChartDom.removeAttribute("_echarts_instance_");
|
|
ksChartDom && ksChartDom.removeAttribute("_echarts_instance_");
|
|
ksChartDom && ksChartDom.removeAttribute("_echarts_instance_");
|
|
-
|
|
|
|
|
|
+ const nowDate = new Date()
|
|
|
|
+ let startDate = null
|
|
|
|
+ let endDate = null
|
|
|
|
+ let monthDays = null // 当前月共多少天
|
|
|
|
+ const weekDay = nowDate.getDay() // 获取当前为周几
|
|
|
|
+ const month = nowDate.getMonth() + 1 // 获取当前为几月
|
|
|
|
+ if (this.radioValue === '1') {
|
|
|
|
+ nowDate.setDate(nowDate.getDate() - weekDay)
|
|
|
|
+ startDate = nowDate.formatDate("yyyy-MM-dd 00:00:00")
|
|
|
|
+ nowDate.setDate(nowDate.getDate() + 6)
|
|
|
|
+ endDate = nowDate.formatDate("yyyy-MM-dd 23:59:59")
|
|
|
|
+ } else if (this.radioValue === '2') {
|
|
|
|
+ nowDate.setMonth(month)
|
|
|
|
+ nowDate.setDate(0)
|
|
|
|
+ monthDays = nowDate.getDate()
|
|
|
|
+ nowDate.setMonth(month - 1)
|
|
|
|
+ startDate = nowDate.formatDate("yyyy-MM-01 00:00:00")
|
|
|
|
+ endDate = nowDate.formatDate(`yyyy-MM-${monthDays} 23:59:59`)
|
|
|
|
+ } else {
|
|
|
|
+ startDate = nowDate.formatDate("yyyy-01-01 00:00:00")
|
|
|
|
+ endDate = nowDate.formatDate('yyyy-12-31 23:59:59')
|
|
|
|
+ }
|
|
this[fn1]({
|
|
this[fn1]({
|
|
- statDateL: new Date(new Date() - 3600 * 1000 * 24 * day).formatDate(
|
|
|
|
- "yyyy-MM-dd hh:mm:ss"
|
|
|
|
- ),
|
|
|
|
- statDateR: new Date().formatDate("yyyy-MM-dd hh:mm:ss"),
|
|
|
|
|
|
+ statDateL: startDate,
|
|
|
|
+ statDateR: endDate
|
|
}).then((res) => {
|
|
}).then((res) => {
|
|
let myChart = echarts.init(pxChartDom);
|
|
let myChart = echarts.init(pxChartDom);
|
|
|
|
|
|
@@ -304,10 +320,8 @@ export default {
|
|
});
|
|
});
|
|
|
|
|
|
this[fn2]({
|
|
this[fn2]({
|
|
- statDateL: new Date(new Date() - 3600 * 1000 * 24 * day).formatDate(
|
|
|
|
- "yyyy-MM-dd hh:mm:ss"
|
|
|
|
- ),
|
|
|
|
- statDateR: new Date().formatDate("yyyy-MM-dd hh:mm:ss"),
|
|
|
|
|
|
+ statDateL: startDate,
|
|
|
|
+ statDateR: endDate,
|
|
}).then((res) => {
|
|
}).then((res) => {
|
|
let myChart = echarts.init(ksChartDom);
|
|
let myChart = echarts.init(ksChartDom);
|
|
|
|
|