Browse Source

监控中心添加loading

temp
fks-yangshouda 3 months ago
parent
commit
190ec589ce
  1. 8
      hx-ai-intelligent/src/view/monitor/deviceMonitor/tree/index.vue
  2. 42
      hx-ai-intelligent/src/view/monitor/environmentMonitor/aggregateData/index.vue

8
hx-ai-intelligent/src/view/monitor/deviceMonitor/tree/index.vue

@ -93,6 +93,8 @@
import { deviceMonitor } from '/@/api/monitor'; import { deviceMonitor } from '/@/api/monitor';
import { Item } from 'ant-design-vue/lib/menu'; import { Item } from 'ant-design-vue/lib/menu';
import { dict, getEnum } from '/@/api'; import { dict, getEnum } from '/@/api';
//
import { items } from '/@/store/item';
export default defineComponent({ export default defineComponent({
// eslint-disable-next-line vue/multi-word-component-names // eslint-disable-next-line vue/multi-word-component-names
@ -101,6 +103,8 @@
const select = ref<HTMLElement | null>(null); const select = ref<HTMLElement | null>(null);
const divWidth = ref(0); // div const divWidth = ref(0); // div
//
const state = items();
// div // div
// const getDivWidth = () => { // const getDivWidth = () => {
// if (select.value) { // if (select.value) {
@ -282,6 +286,7 @@
// pageData // pageData
const getSelect = () => { const getSelect = () => {
state.setLoading(true);
pageData.tableList = []; pageData.tableList = [];
pageData.tableColumns = []; pageData.tableColumns = [];
@ -324,6 +329,9 @@
pageData.graphList = res.data.graphData; pageData.graphList = res.data.graphData;
pageData.XData = res.data.XData; pageData.XData = res.data.XData;
})
.finally(() => {
state.setLoading(false);
}); });
}; };

42
hx-ai-intelligent/src/view/monitor/environmentMonitor/aggregateData/index.vue

@ -205,10 +205,21 @@
import { dict, getEnum } from '/@/api'; import { dict, getEnum } from '/@/api';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
//
import { items } from '/@/store/item';
defineOptions({ defineOptions({
name: 'AggregateData', // name name: 'AggregateData', // name
}); });
const loading = ref(false); let statusLoading = ref(false);
let averageLoading = ref(false);
let hotLoading = ref(false);
//
const state = items();
// //
const frequencyValue = ref<string>(); const frequencyValue = ref<string>();
@ -241,7 +252,10 @@
// //
const getDeviceStatus = () => { const getDeviceStatus = () => {
http.post(environmentMonitor.getDeviceStatus, { orgId: orgId.value }).then((res) => { statusLoading.value = true;
http
.post(environmentMonitor.getDeviceStatus, { orgId: orgId.value })
.then((res) => {
ringData.value = [ ringData.value = [
{ {
name: '在线', name: '在线',
@ -256,10 +270,17 @@
]; ];
sum.value = res.data.在线 + res.data.离线; sum.value = res.data.在线 + res.data.离线;
// drawRing(ringData.value); // drawRing(ringData.value);
})
.finally(() => {
statusLoading.value = false;
if (!statusLoading.value && !averageLoading.value && !hotLoading.value) {
state.setLoading(false);
}
}); });
}; };
// //
const getAverageData = () => { const getAverageData = () => {
averageLoading.value = true;
const now = new Date(); const now = new Date();
const year = now.getFullYear(); const year = now.getFullYear();
// getMonth() 01 // getMonth() 01
@ -319,6 +340,12 @@
'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0Ny45OTYiIGhlaWdodD0iNDguMDAxIiB2aWV3Qm94PSIwIDAgNDcuOTk2IDQ4LjAwMSI+DQogIDxwYXRoIGlkPSLlh4/ljrtfMTA3OCIgZGF0YS1uYW1lPSLlh4/ljrsgMTA3OCIgZD0iTS0xNjU5Ni05YTIzLjg0LDIzLjg0LDAsMCwxLTE2Ljk2Ny03LjAyOUEyMy44MzEsMjMuODMxLDAsMCwxLTE2NjIwLTMzYTIzLjg0NSwyMy44NDUsMCwwLDEsNy4wMjUtMTYuOTczQTIzLjg0MSwyMy44NDEsMCwwLDEtMTY1OTYtNTdoLjAwOGEyMy44MzIsMjMuODMyLDAsMCwxLDE2Ljk2NSw3LjAyOUEyMy44NDUsMjMuODQ1LDAsMCwxLTE2NTcyLTMzYTIzLjg0MywyMy44NDMsMCwwLDEtNy4wMjksMTYuOTcxQTIzLjg0NSwyMy44NDUsMCwwLDEtMTY1OTYtOVptLTIuODQ0LTM0LjIyNGgtLjAxYTEuMjA2LDEuMjA2LDAsMCwwLS45My4zOTJjLS4xMDcuMT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yNVptMTAuMDc4LS43NzZoLS4wMDZhLjUzLjUzLDAsMCwwLS40LjE1OGMtLjAwNiwwLS4yNjIuMjc2LS41MTguNTcybC0uMDI1LjAyOWMtLjc2Ni44ODktMi41NDksMy4wOTEtMi41NDksNC4zNDZhMy4yNzEsMy4yNzEsMCwwLDAsMS4xNiwyLjU2NSwzLjY3NywzLjY3NywwLDAsMCwyLjMzMi44NTloLjAyMWEzLjc0NiwzLjc0NiwwLDAsMCwyLjI4OS0uODQzLDMuMzc4LDMuMzc4LDAsMCwwLDEuMTc2LTIuNTY1YzAtMS41MDYtMi40ODItNC4yOTMtMi41MDYtNC4zMjEsMCwwLS40MzItLjUxLS42LS42NTlBLjU5LjU5LDAsMCwwLTE2NTg4Ljc2OC00NFptLTguNTYxLDE4LjIyNWEuNjM3LjYzNywwLDAsMS0uNjMxLS4zMWMtLjItLjQ0NS4zLTEuMjExLDEuMTI3LTEuNzA2YTIuNTM5LDIuNTM5LDAsMCwxLDEuMjMtLjQuNjQzLjY0MywwLDAsMSwuNjM1LjMxM2MuMi40NDUtLjMsMS4yMDktMS4xMjcsMS43QTIuNTYsMi41NiwwLDAsMS0xNjU5Ny4zMjgtMjUuNzc2WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTY2MTkuOTk4IDU3LjAwMikiIGZpbGw9IiMyNzc4ZmYiLz4NCjwvc3ZnPg0K',
}, },
]; ];
})
.finally(() => {
averageLoading.value = false;
if (!statusLoading.value && !averageLoading.value && !hotLoading.value) {
state.setLoading(false);
}
}); });
}; };
// //
@ -336,6 +363,7 @@
// //
const getDeviceHotMap = () => { const getDeviceHotMap = () => {
hotLoading.value = true;
let environmentType = ''; let environmentType = '';
for (let i = 0; i < typeList.value.length; i++) { for (let i = 0; i < typeList.value.length; i++) {
if (typeList.value[i].value == typeValue.value) { if (typeList.value[i].value == typeValue.value) {
@ -356,10 +384,18 @@
.then((res) => { .then((res) => {
let hotData = res.data; let hotData = res.data;
drawHot(hotData); drawHot(hotData);
})
.finally(() => {
hotLoading.value = false;
if (!statusLoading.value && !averageLoading.value && !hotLoading.value) {
state.setLoading(false);
}
}); });
}; };
const initOptions = () => {}; const initOptions = () => {
state.setLoading(true);
};
onMounted(async () => { onMounted(async () => {
initOptions(); initOptions();
// //

Loading…
Cancel
Save