Эх сурвалжийг харах

修改日期选择显示错误

zq940222 4 сар өмнө
parent
commit
cc3a06d0e7

+ 13 - 10
src/views/adweb/data/trafficAnalysis.vue

@@ -10,7 +10,7 @@
       </a-col>
       <a-col :span="8">
         <span class="t1">统计时间:</span>
-        <a-range-picker @change="onChangeDatePciker" :disabledDate="disabledDate" :value="rangeDate"
+        <a-range-picker @change="onChangeDatePicker" :disabledDate="disabledDate" :value="rangeDate"
                         style="width:70%" />
       </a-col>
       <a-col :span="10">
@@ -226,11 +226,12 @@
 <script lang="ts" name="data-trafficAnalysis" setup>
 import selectSite from "@/components/Adweb/selectSite.vue";
 import areaChart from "./chart/areaChart.vue";
-import { onMounted, reactive, ref, watch } from "vue";
+import { reactive, ref } from "vue";
 import { getAction } from "@/api/manage/manage";
 import moment from "moment";
 import MapAdweb from "@/components/chart/mapAdweb.vue";
 import "flag-icon-css/css/flag-icons.css";
+import dayjs from 'dayjs';
 
 
 const queryParam = reactive<any>({});
@@ -499,12 +500,14 @@ const getMostAccessList = async () => {
 
 const rangeDate = ref([]);
 
-const onChangeDatePciker = (date, dateString) => {
+const onChangeDatePicker = (date, dateString) => {
   if (dateString.length > 0) {
+    console.log("rangeDate:", rangeDate.value);
     rangeDate.value = date;
-    queryParam.value.start = dateString[0];
-    queryParam.value.end = dateString[1];
-    queryParam.value.dateType = undefined;
+    console.log("date:", date);
+    queryParam.start = dateString[0];
+    queryParam.end = dateString[1];
+    queryParam.dateType = undefined;
     reloadData();
   }
 };
@@ -522,13 +525,13 @@ const setTime = (time) => {
   if (time == "") {
     rangeDate.value = undefined;
   } else if (time == "sevenDay") {
-    rangeDate.value = [moment().subtract(7, "days"), moment().subtract(1, "days")];
+    rangeDate.value = [dayjs().add(-7, 'd'), dayjs().add(-1, 'd')];
   } else if (time == "thirtyDay") {
-    rangeDate.value = [moment().subtract(30, "days"), moment().subtract(1, "days")];
+    rangeDate.value = [dayjs().add(-30, 'd'), dayjs().add(-1, 'd')];
   } else if (time == "yesterday") {
-    rangeDate.value = [moment().subtract(1, "days"), moment().subtract(1, "days")];
+    rangeDate.value = [dayjs().add(-1, 'd'), dayjs().add(-1, 'd')];
   } else if (time == "today") {
-    rangeDate.value = [moment(), moment()];
+    rangeDate.value = [dayjs(), dayjs()];
   }
 
   reloadData();