|
@@ -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}})
|
|
|
}
|