| @@ -652,6 +652,12 @@ export default { | |||||
| //切换时间 | //切换时间 | ||||
| tabtimetap(index) { | tabtimetap(index) { | ||||
| this.TimetoAhoose = index; | this.TimetoAhoose = index; | ||||
| if (index == 0) { | |||||
| this.customtime = [] | |||||
| } | |||||
| if (index == 4) { | if (index == 4) { | ||||
| let starTime = new Date().getTime() - 24 * 60 * 60 * 1000 * 7; | let starTime = new Date().getTime() - 24 * 60 * 60 * 1000 * 7; | ||||
| let startDate = `${new Date(starTime).getFullYear()}-${ | let startDate = `${new Date(starTime).getFullYear()}-${ | ||||
| @@ -1081,6 +1081,35 @@ export default { | |||||
| }, | }, | ||||
| //切换时间 | //切换时间 | ||||
| tabtimetap(index) { | tabtimetap(index) { | ||||
| if (index == 0) { | |||||
| this.customtime = [] | |||||
| } | |||||
| if (index == 4) { | |||||
| let starTime = new Date().getTime() - 24 * 60 * 60 * 1000 * 7; | |||||
| let startDate = `${new Date(starTime).getFullYear()}-${ | |||||
| new Date(starTime).getMonth() + 1 | |||||
| }-${new Date(starTime).getDate()}`; | |||||
| let endTime = new Date().getTime() - 24 * 60 * 60 * 1000; | |||||
| let endDate = `${new Date(endTime).getFullYear()}-${ | |||||
| new Date(endTime).getMonth() + 1 | |||||
| }-${new Date(endTime).getDate()}`; | |||||
| this.customtime = [startDate, endDate]; | |||||
| } | |||||
| if (index == 6) { | |||||
| let starTime = new Date().getTime() - 24 * 60 * 60 * 1000 * 30; | |||||
| let startDate = `${new Date(starTime).getFullYear()}-${ | |||||
| new Date(starTime).getMonth() + 1 | |||||
| }-${new Date(starTime).getDate()}`; | |||||
| let endTime = new Date().getTime() - 24 * 60 * 60 * 1000; | |||||
| let endDate = `${new Date(endTime).getFullYear()}-${ | |||||
| new Date(endTime).getMonth() + 1 | |||||
| }-${new Date(endTime).getDate()}`; | |||||
| this.customtime = [startDate, endDate]; | |||||
| } | |||||
| this.statDateStart = ""; | this.statDateStart = ""; | ||||
| this.statDateEnd = ""; | this.statDateEnd = ""; | ||||
| this.dateType = index; | this.dateType = index; | ||||
| @@ -1292,6 +1292,10 @@ export default { | |||||
| //切换时间 | //切换时间 | ||||
| tabtimetap(index) { | tabtimetap(index) { | ||||
| this.TimetoAhoose = index; | this.TimetoAhoose = index; | ||||
| if (index == 0) { | |||||
| this.customtime = [] | |||||
| } | |||||
| if (index == 4) { | if (index == 4) { | ||||
| let starTime = new Date().getTime() - 24 * 60 * 60 * 1000 * 7; | let starTime = new Date().getTime() - 24 * 60 * 60 * 1000 * 7; | ||||
| let startDate = `${new Date(starTime).getFullYear()}-${ | let startDate = `${new Date(starTime).getFullYear()}-${ | ||||
| @@ -1671,6 +1671,9 @@ export default { | |||||
| tabtimetap(index) { | tabtimetap(index) { | ||||
| this.TimetoAhoose = index; | this.TimetoAhoose = index; | ||||
| if (index == 0) { | |||||
| this.customtime = [] | |||||
| } | |||||
| if (index == 4) { | if (index == 4) { | ||||
| let starTime = new Date().getTime() - 24 * 60 * 60 * 1000 * 7; | let starTime = new Date().getTime() - 24 * 60 * 60 * 1000 * 7; | ||||
| @@ -40,6 +40,7 @@ | |||||
| type="daterange" | type="daterange" | ||||
| range-separator="-" | range-separator="-" | ||||
| :default-time="['00:00:00', '23:59:59']" | :default-time="['00:00:00', '23:59:59']" | ||||
| :clearable="false" | |||||
| value-format="yyyy-MM-dd" | value-format="yyyy-MM-dd" | ||||
| start-placeholder="开始日期" | start-placeholder="开始日期" | ||||
| end-placeholder="结束日期" | end-placeholder="结束日期" | ||||
| @@ -593,6 +594,24 @@ export default { | |||||
| this.statDateEnd = ""; | this.statDateEnd = ""; | ||||
| this.dateType = index; | this.dateType = index; | ||||
| this.customtime = []; | this.customtime = []; | ||||
| //给时间选择器赋值 | |||||
| let num = 24 * 3600 * 1000; | |||||
| // 获取当前时间戳转换为日期格式 | |||||
| if (index == 4) { | |||||
| num = 24 * 3600 * 1000 * 7; | |||||
| } | |||||
| if (index == 5) { | |||||
| num = 24 * 3600 * 1000 * 15; | |||||
| } | |||||
| if (index == 6) { | |||||
| num = 24 * 3600 * 1000 * 30; | |||||
| } | |||||
| this.customtime = [ | |||||
| this.timestampToTime(new Date().getTime() - num), | |||||
| this.timestampToTime(new Date().getTime() - 24 * 3600 * 1000), | |||||
| ]; | |||||
| this.init(); | this.init(); | ||||
| }, | }, | ||||
| dealData(arr) { | dealData(arr) { | ||||
| @@ -607,6 +626,18 @@ export default { | |||||
| }); | }); | ||||
| return arr; | return arr; | ||||
| }, | }, | ||||
| timestampToTime(timestamp) { | |||||
| var date = new Date(timestamp); //时间戳为10位需*1000,时间戳为13位的话不需乘1000 | |||||
| var yyyy = date.getFullYear() + "-"; | |||||
| var MM = | |||||
| (date.getMonth() + 1 < 10 | |||||
| ? "0" + (date.getMonth() + 1) | |||||
| : date.getMonth() + 1) + "-"; | |||||
| var dd = date.getDate() < 10 ? "0" + date.getDate() : date.getDate(); | |||||
| return yyyy + MM + dd; | |||||
| }, | |||||
| }, | }, | ||||
| }; | }; | ||||
| </script> | </script> | ||||
| @@ -1174,7 +1174,11 @@ export default { | |||||
| //切换时间 | //切换时间 | ||||
| tabtimetap(index) { | tabtimetap(index) { | ||||
| this.TimetoAhoose = index; | this.TimetoAhoose = index; | ||||
| if (index == 0) { | |||||
| this.customtime = [] | |||||
| } | |||||
| if (index == 4) { | if (index == 4) { | ||||
| let starTime = new Date().getTime() - 24 * 60 * 60 * 1000 * 7; | let starTime = new Date().getTime() - 24 * 60 * 60 * 1000 * 7; | ||||
| let startDate = `${new Date(starTime).getFullYear()}-${ | let startDate = `${new Date(starTime).getFullYear()}-${ | ||||
| @@ -385,6 +385,10 @@ export default { | |||||
| tabtimetap(index) { | tabtimetap(index) { | ||||
| this.TimetoAhoose = index; | this.TimetoAhoose = index; | ||||
| if (index == 0) { | |||||
| this.customtime = [] | |||||
| } | |||||
| if (index == 4) { | if (index == 4) { | ||||
| let starTime = new Date().getTime() - 24 * 60 * 60 * 1000 * 7; | let starTime = new Date().getTime() - 24 * 60 * 60 * 1000 * 7; | ||||
| let startDate = `${new Date(starTime).getFullYear()}-${ | let startDate = `${new Date(starTime).getFullYear()}-${ | ||||