🐞 fix: 实时统计页面BUG修复

This commit is contained in:
LokerL 2024-12-05 16:22:00 +08:00
parent 0953591ae8
commit 4d1f2e6fec
3 changed files with 19 additions and 12 deletions

View File

@ -49,20 +49,17 @@ export default {
watch: {
queryParam: {
handler: function (newVal, oldVal) {
this.refreshDebounce();
this.refresh();
},
deep: true,
},
selectedDept: {
handler: function (newVal, oldVal) {
this.refreshDebounce();
this.refresh();
},
deep: true,
},
},
mounted() {
this.refreshDebounce = debounce(this.refresh, 100);
},
methods: {
refresh() {
if (this.selectedDept && this.selectedDept.sn && this.queryParam) {
@ -81,12 +78,17 @@ export default {
this.chartData.Xdata = axisData;
this.chartData.Ydata = seriesData;
} else {
this.chartData.Xdata = [];
this.chartData.Ydata = [];
this.resetChart();
}
});
} else {
this.resetChart();
}
},
resetChart() {
this.chartData.Xdata = [];
this.chartData.Ydata = [];
},
},
};
</script>

View File

@ -32,8 +32,8 @@ export default {
computed: {
position() {
return {
lng: parseFloat(this.selectedDept.longitude),
lat: parseFloat(this.selectedDept.latitude),
lng: parseFloat(this.selectedDept?.longitude),
lat: parseFloat(this.selectedDept?.latitude),
};
},
},

View File

@ -87,7 +87,12 @@ export default {
refresh() {
if (this.queryParam.deptId) {
getDeviceList(this.queryParam.deptId, this.pager).then((res) => {
if (res.code === 200 && res.rows.length > 0) {
if (res.code === 200) {
if (res.rows.length === 0) {
this.tableData = [];
this.deptSelect(null);
return;
}
this.tableData = res.rows;
this.radio = res.rows[0].id;
this.pager.total = res.total;