add:增加全局loading

This commit is contained in:
chenpingsen
2024-08-22 16:00:04 +08:00
parent ca74de5b37
commit 7b4f22222d
18 changed files with 401 additions and 251 deletions

View File

@@ -55,16 +55,10 @@
<div class="btn-item">
<div class="left">控制模式</div>
<div class="right">
<span>{{
item.autoStatusBefore.label.indexOf('模式') != -1
? item.autoStatusBefore.label.replace('模式', '')
: item.autoStatusBefore.label
}}</span>
<span>{{ item.autoStatusBefore.label ? item.autoStatusBefore.label : '--' }}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>{{
item.autoStatusAfter.label.indexOf('模式') != -1
? item.autoStatusAfter.label.replace('模式', '')
: item.autoStatusAfter.label
item.autoStatusAfter.label ? item.autoStatusAfter.label : '--'
}}</span></div
>
</div>
@@ -110,7 +104,7 @@
</div>
</div>
</div>
<div style="width: 100%; height: 80px"></div>
<div style="width: 100%; height: 160px"></div>
<div class="button-box">
<button class="cancel" @click="logModalVisible = false">关闭</button>
</div>
@@ -126,7 +120,8 @@
import { Pagination } from 'ant-design-vue';
import { http } from '/nerv-lib/util/http';
import { airConditionControl } from '/@/api/airConditionControlSystem';
// 全局变量
import { items } from '/@/store/item';
// 初始化 =======================================================
// 组件
@@ -140,6 +135,9 @@
getTable();
});
// 全局变量
const state = items();
// 日志业务 ======================================================
// 分页设置
@@ -154,6 +152,7 @@
let trIndex = ref(-1);
// 获得表格数据
const getTable = (changePage = false) => {
state.setLoading(true);
// 如果是切换页面,则清除当前序列、关闭弹窗
if (changePage) {
trIndex.value = -1;
@@ -166,9 +165,13 @@
pageNum: pagination.value.pageNum,
})
.then((res) => {
state.setLoading(false);
let data = res.data;
dataSource.value = data.records;
pagination.value.total = data.total;
})
.catch(() => {
state.setLoading(false);
});
};
// 刷新功能(右下角)
@@ -193,16 +196,23 @@
// 日志详情显隐
const logModalVisible = ref(false);
const getLogDetail = (id: any) => {
http.get(airConditionControl.getLogDetail, { logId: id }).then((res) => {
const data = res.data;
if (data && data.length) {
// 显示模态框
logModalVisible.value = true;
cxList.value = res.data;
} else {
return message.info('返回值无效');
}
});
state.setLoading(true);
http
.get(airConditionControl.getLogDetail, { logId: id })
.then((res) => {
const data = res.data;
state.setLoading(false);
if (data && data.length) {
// 显示模态框
logModalVisible.value = true;
cxList.value = res.data;
} else {
return message.info('返回值无效');
}
})
.catch(() => {
state.setLoading(false);
});
};
// 日志详情
const cxList = ref([]);