Showing
1 changed file
with
15 additions
and
11 deletions
@@ -39,11 +39,11 @@ | @@ -39,11 +39,11 @@ | ||
39 | </Select> | 39 | </Select> |
40 | </div> | 40 | </div> |
41 | <div> | 41 | <div> |
42 | - <Empty v-show="notFoundData" /> | 42 | + <Empty v-show="item.emptyFlag" /> |
43 | <div | 43 | <div |
44 | - v-show="!notFoundData" | 44 | + v-show="!item.emptyFlag" |
45 | :id="`chart-${item.device}`" | 45 | :id="`chart-${item.device}`" |
46 | - :style="{ height, width }" | 46 | + style="width: 100%; height: 400px" |
47 | ></div> | 47 | ></div> |
48 | </div> | 48 | </div> |
49 | </div> | 49 | </div> |
@@ -86,7 +86,7 @@ | @@ -86,7 +86,7 @@ | ||
86 | let currentRecord: ExecuteReportRecord = {} as unknown as ExecuteReportRecord; | 86 | let currentRecord: ExecuteReportRecord = {} as unknown as ExecuteReportRecord; |
87 | 87 | ||
88 | const chartInstance = ref< | 88 | const chartInstance = ref< |
89 | - { device: string; name: string; attributes: string[]; active?: string }[] | 89 | + { device: string; name: string; attributes: string[]; active?: string; emptyFlag?: boolean }[] |
90 | >([]); | 90 | >([]); |
91 | 91 | ||
92 | const notFoundData = ref(false); | 92 | const notFoundData = ref(false); |
@@ -257,6 +257,15 @@ | @@ -257,6 +257,15 @@ | ||
257 | try { | 257 | try { |
258 | loading.value = true; | 258 | loading.value = true; |
259 | const result = await exportViewChartApi(device, sendParams); | 259 | const result = await exportViewChartApi(device, sendParams); |
260 | + chartInstance.value.forEach((f) => { | ||
261 | + if (f.device === device) { | ||
262 | + if (Object.keys(result).length === 0) { | ||
263 | + f.emptyFlag = true; | ||
264 | + } else { | ||
265 | + f.emptyFlag = false; | ||
266 | + } | ||
267 | + } | ||
268 | + }); | ||
260 | validateHasData(result); | 269 | validateHasData(result); |
261 | const { xAxisData, series } = getChartsOption(result as unknown as ResponsData); | 270 | const { xAxisData, series } = getChartsOption(result as unknown as ResponsData); |
262 | 271 | ||
@@ -272,15 +281,10 @@ | @@ -272,15 +281,10 @@ | ||
272 | 281 | ||
273 | const validateHasData = (record: Recordable) => { | 282 | const validateHasData = (record: Recordable) => { |
274 | notFoundData.value = true; | 283 | notFoundData.value = true; |
275 | - if (Object.keys(record).length === 0) { | ||
276 | - notFoundData.value = true; | ||
277 | - } else { | 284 | + const { val = [], attr } = (record as unknown as ResponsData) || {}; |
285 | + if (!attr || !val.length) { | ||
278 | notFoundData.value = false; | 286 | notFoundData.value = false; |
279 | } | 287 | } |
280 | - // const { val = [], attr } = (record as unknown as ResponsData) || {}; | ||
281 | - // if (!attr || !val.length) { | ||
282 | - // notFoundData.value = false; | ||
283 | - // } | ||
284 | }; | 288 | }; |
285 | 289 | ||
286 | const handleChangeChars = (value: string, device: string) => { | 290 | const handleChangeChars = (value: string, device: string) => { |