diff --git a/src/utils/index.ts b/src/utils/index.ts index 65ab7ebc..7f97d4e4 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -135,32 +135,46 @@ export function getTreeData( return arr } -// 获取近一周的时间 +// 获取近7的时间 export function getWeek() { - const date = new Date() - const year = date.getFullYear() - const month = date.getMonth() - const day = date.getDate() - const week = date.getDay() - //开始时间 - let WeekStartDate = dayjs(new Date(year, month, day - week + 1)).format('YYYY-MM-DD') - // 结束时间 - let WeekEndDate = dayjs(new Date()).format('YYYY-MM-DD') + let toData = new Date(new Date().toLocaleDateString()).getTime() + //今天 + let todayStart = toData + //昨天 + let yesterdayStart = toData - 3600 * 24 * 1000 + let yesterdayEnd = yesterdayStart + 24 * 60 * 60 * 1000 - 1 + //最近7天 + let past7daysStart = todayStart - 7 * 3600 * 24 * 1000 + // const date = new Date() + // const year = date.getFullYear() + // const month = date.getMonth() + // const day = date.getDate() + // const week = date.getDay() + // //开始时间 + // let WeekStartDate = dayjs(new Date(year, month, day - week + 1)).format('YYYY-MM-DD') + // // 结束时间 + // let WeekEndDate = dayjs(new Date()).format('YYYY-MM-DD') return { - WeekStartDate, - WeekEndDate, + WeekStartDate: dayjs(past7daysStart).format('YYYY-MM-DD'), + WeekEndDate: dayjs(yesterdayEnd).format('YYYY-MM-DD'), } } // 获取近一月的数据 export function getMonth() { - const date = new Date() - const year = date.getFullYear() - const month = date.getMonth() - let MonthStartDate = dayjs(new Date(year, month, 1)).format('YYYY-MM-DD') - let MonthEndDate = dayjs(new Date()).format('YYYY-MM-DD') + let toData = new Date(new Date().toLocaleDateString()).getTime() + //昨天 + let yesterdayStart = toData - 3600 * 24 * 1000 + let yesterdayEnd = yesterdayStart + 24 * 60 * 60 * 1000 - 1 + //最近30天 + let past30daysStart = toData - 30 * 3600 * 24 * 1000 + // const date = new Date() + // const year = date.getFullYear() + // const month = date.getMonth() + // let MonthStartDate = dayjs(new Date(year, month, 1)).format('YYYY-MM-DD') + // let MonthEndDate = dayjs(new Date()).format('YYYY-MM-DD') return { - MonthStartDate, - MonthEndDate, + MonthStartDate: dayjs(past30daysStart).format('YYYY-MM-DD'), + MonthEndDate: dayjs(yesterdayEnd).format('YYYY-MM-DD'), } } diff --git a/src/views/main/meteorological/components/AirHumidity.vue b/src/views/main/meteorological/components/AirHumidity.vue index 3311ade5..a8d594dc 100644 --- a/src/views/main/meteorological/components/AirHumidity.vue +++ b/src/views/main/meteorological/components/AirHumidity.vue @@ -11,7 +11,7 @@ diff --git a/src/views/main/water-quality/components/FormDrawer.vue b/src/views/main/water-quality/components/FormDrawer.vue index e6796215..f8358128 100644 --- a/src/views/main/water-quality/components/FormDrawer.vue +++ b/src/views/main/water-quality/components/FormDrawer.vue @@ -3,59 +3,101 @@ v-bind="$attrs" @register="registerDrawer" showFooter - :title="getTitle" + title="设置" width="500px" @ok="handleSubmit" > - -
温度
-
-
Ⅰ级预警:
+
+
{{ enumName[item] }}
+
+
{{ enumName1[item1] }}:
-
- - - -
-
- - - +
+ +
-
+
- +
- diff --git a/src/views/main/water-quality/components/LineCharts.vue b/src/views/main/water-quality/components/LineCharts.vue index 1a392f76..92e593b3 100644 --- a/src/views/main/water-quality/components/LineCharts.vue +++ b/src/views/main/water-quality/components/LineCharts.vue @@ -3,16 +3,17 @@ - +
diff --git a/src/views/main/water-quality/index.vue b/src/views/main/water-quality/index.vue index eaa8e738..ca942910 100644 --- a/src/views/main/water-quality/index.vue +++ b/src/views/main/water-quality/index.vue @@ -1,261 +1,348 @@ -