Sfoglia il codice sorgente

修复日期选择后返回天数据问题;设置本地化时间格式

guojing_wu 1 anno fa
parent
commit
c4eaba619b
2 ha cambiato i file con 17 aggiunte e 17 eliminazioni
  1. 2 0
      src/main.ts
  2. 15 17
      src/views/adManage/sp/chartComponents/dataTendency.vue

+ 2 - 0
src/main.ts

@@ -37,10 +37,12 @@ import dayjs from 'dayjs'
 import UTC from 'dayjs/plugin/utc'
 import Timezon from 'dayjs/plugin/timezone'
 import IsSameOrBefore from 'dayjs/plugin/isSameOrBefore'
+import 'dayjs/locale/zh-cn'
 
 dayjs.extend(UTC)
 dayjs.extend(Timezon)
 dayjs.extend(IsSameOrBefore)
+dayjs.locale('zh-cn')
 
 let forIconfont = analyzingIconForIconfont(iconfont); //解析class
 iconList.addIcon(forIconfont.list); // 添加iconfont dvadmin3的icon

+ 15 - 17
src/views/adManage/sp/chartComponents/dataTendency.vue

@@ -245,8 +245,20 @@ const initLine = async () => {
   loading.value = false
 }
 const getDataset = async () => {
-	const resp = await props.fetchLine(queryParams.value)
-	return resp.data
+	if (statDim.value === 'week') {
+    if (props.fetchLineWeek) {
+      const resp = await props.fetchLineWeek(queryParams.value)
+      return resp.data
+    }
+  } else if (statDim.value === 'month') {
+    if (props.fetchLineMonth) {
+      const resp = await props.fetchLineMonth(queryParams.value)
+      return resp.data
+    }
+  } else {
+    const resp = await props.fetchLine(queryParams.value)
+    return resp.data
+  }
 }
 const getMetricsItems = async () => {
 	const resp = await props.fetchCard(queryParams.value)
@@ -271,21 +283,7 @@ const changeMetric = () => {
 
 const changeStatDim = async () => {
   loading.value = true
-  let source = []
-  if (statDim.value === 'week') {
-    if (props.fetchLineWeek) {
-      const resp = await props.fetchLineWeek(queryParams.value)
-      source = resp.data
-    }
-  } else if (statDim.value === 'month') {
-    if (props.fetchLineMonth) {
-      const resp = await props.fetchLineMonth(queryParams.value)
-      source = resp.data
-    }
-  } else {
-    const resp = await props.fetchLine(queryParams.value)
-    source = resp.data
-  }
+  let source = await getDataset()
   if (source.length > 0) {
     chartObj.setOption({dataset: {source: source}})
   }