add:增加全局loading
This commit is contained in:
@@ -215,7 +215,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 100%; height: 60px"></div>
|
||||
<div style="width: 100%; height: 100px"></div>
|
||||
<div class="button-box">
|
||||
<button class="cancel" @click="executeVisible = false">取消</button>
|
||||
<a-popconfirm
|
||||
@@ -686,47 +686,47 @@
|
||||
if (!changeList.value.length && !lockList.value.length) {
|
||||
return message.info('未产生任何修改');
|
||||
}
|
||||
state.setLoading(true);
|
||||
http
|
||||
.get(planManage.getRunningPlan, {
|
||||
deviceType: url.deviceType,
|
||||
ctrlType: url.deviceType,
|
||||
projectId: state.projectId,
|
||||
siteId: state.siteId,
|
||||
})
|
||||
.then((res) => {
|
||||
// 如果有计划正在执行
|
||||
if (res.data && res.data.length) {
|
||||
// 此处框架本身存在问题,弹出层在本地环境无法关闭,暂时使用浏览器自带的confirm方法
|
||||
// Modal.confirm({
|
||||
// title: '提示信息',
|
||||
// content: '有计划正在执行,点击"确定"将暂停当前计划',
|
||||
// onOk() {
|
||||
// return new Promise((resolve, reject) => {
|
||||
// });
|
||||
// },
|
||||
// onCancel() { },
|
||||
// });
|
||||
state.setLoading(false);
|
||||
Modal.confirm({
|
||||
title: '提示信息',
|
||||
content: '有计划正在执行,点击"确定"将暂停当前计划',
|
||||
onOk() {
|
||||
state.setLoading(false);
|
||||
// 如果点击了确定,将先终止所有进行中的计划
|
||||
http
|
||||
.post(url.getList, {
|
||||
projectId: state.projectId,
|
||||
siteId: state.siteId,
|
||||
lockList: [],
|
||||
sceneList: [],
|
||||
})
|
||||
.then((res) => {
|
||||
// 如果重置成功,则获取修改前后对比数据
|
||||
if (res.retcode == 0) {
|
||||
sendChangeList();
|
||||
// 未成功提示
|
||||
} else {
|
||||
state.setLoading(false);
|
||||
message.error('关闭进行中的任务操作失败,请重新尝试');
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
state.setLoading(false);
|
||||
});
|
||||
},
|
||||
onCancel() {},
|
||||
});
|
||||
|
||||
let flag = window.confirm('有计划正在执行,点击"确定"将暂停当前计划');
|
||||
if (flag) {
|
||||
// 如果点击了确定,将先终止所有进行中的计划
|
||||
http
|
||||
.post(url.getList, {
|
||||
projectId: state.projectId,
|
||||
siteId: state.siteId,
|
||||
lockList: [],
|
||||
sceneList: [],
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res, '成功');
|
||||
// 如果重置成功,则获取修改前后对比数据
|
||||
if (res.retcode == 0) {
|
||||
sendChangeList();
|
||||
// 未成功提示
|
||||
} else {
|
||||
message.error('关闭进行中的任务操作失败,请重新尝试');
|
||||
}
|
||||
});
|
||||
}
|
||||
// 没有计划正在执行,则直接请求
|
||||
} else {
|
||||
sendChangeList();
|
||||
@@ -743,6 +743,7 @@
|
||||
siteId: state.siteId,
|
||||
})
|
||||
.then((res) => {
|
||||
state.setLoading(false);
|
||||
if (res.retcode == 0) {
|
||||
diffList.value = res.data;
|
||||
executeVisible.value = true;
|
||||
@@ -750,7 +751,9 @@
|
||||
message.error('获取修改内容失败');
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
.catch(() => {
|
||||
state.setLoading(false);
|
||||
});
|
||||
};
|
||||
// 通用取消
|
||||
const changeCancel = () => {};
|
||||
|
@@ -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>
|
||||
@@ -109,7 +103,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>
|
||||
@@ -125,7 +119,6 @@
|
||||
import { Pagination } from 'ant-design-vue';
|
||||
import { http } from '/nerv-lib/util/http';
|
||||
import { ventilating } from '/@/api/ventilatingSystem';
|
||||
|
||||
// 全局变量
|
||||
import { items } from '/@/store/item';
|
||||
|
||||
@@ -183,6 +176,7 @@
|
||||
let trIndex = ref(-1);
|
||||
// 获得表格数据
|
||||
const getTable = (changePage = false) => {
|
||||
state.setLoading(true);
|
||||
// 如果是切换页面,则清除当前序列、关闭弹窗
|
||||
if (changePage) {
|
||||
trIndex.value = -1;
|
||||
@@ -195,16 +189,19 @@
|
||||
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);
|
||||
});
|
||||
};
|
||||
// 刷新功能(右下角)
|
||||
const reset = () => {
|
||||
trIndex.value = -1;
|
||||
logModalVisible.value = false;
|
||||
// state.setLoading(true);
|
||||
pagination.value = {
|
||||
pageSize: 10,
|
||||
pageNum: 1,
|
||||
@@ -223,16 +220,23 @@
|
||||
// 日志详情显隐
|
||||
const logModalVisible = ref(false);
|
||||
const getLogDetail = (id: any) => {
|
||||
http.get(logDetail, { 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(logDetail, { logId: id })
|
||||
.then((res) => {
|
||||
state.setLoading(false);
|
||||
const data = res.data;
|
||||
if (data && data.length) {
|
||||
// 显示模态框
|
||||
logModalVisible.value = true;
|
||||
cxList.value = res.data;
|
||||
} else {
|
||||
return message.info('返回值无效');
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
state.setLoading(false);
|
||||
});
|
||||
};
|
||||
const cxList = ref([]);
|
||||
|
||||
|
@@ -30,7 +30,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(row, index) in dataSource" :key="index">
|
||||
<tr v-for="(row, index) in dataSource" v-show="row.executeStatus.value != 0" :key="index">
|
||||
<td>{{ index + 1 }}</td>
|
||||
<td>{{ row.startTime }}</td>
|
||||
<td>{{ row.planName }}</td>
|
||||
@@ -177,7 +177,7 @@
|
||||
projectId: state.projectId,
|
||||
siteId: state.siteId,
|
||||
// 设备类型(1照明,2空调,3排风扇,4风幕机,5电动窗,6进水阀,7排水泵)
|
||||
deviceType: props.type,
|
||||
ctrlType: props.type,
|
||||
})
|
||||
.then((res) => {
|
||||
dataSource.value = res.data;
|
||||
@@ -199,12 +199,17 @@
|
||||
};
|
||||
// 将对表格的修改统一发送
|
||||
const sendTable = () => {
|
||||
if (!dataSource.value.length) {
|
||||
return message.info('没有任何数据可以提交');
|
||||
}
|
||||
state.setLoading(true);
|
||||
http
|
||||
.post(
|
||||
url + `?projectId=${state.projectId}${state.siteId ? `&siteId=${state.siteId}` : ''}`,
|
||||
dataSource.value,
|
||||
)
|
||||
.then((res) => {
|
||||
state.setLoading(false);
|
||||
if (res.retcode == 0) {
|
||||
message.success('操作成功');
|
||||
// 刷新数据
|
||||
@@ -212,6 +217,9 @@
|
||||
} else {
|
||||
message.info(res.msg);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
state.setLoading(false);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -242,7 +250,7 @@
|
||||
projectId: state.projectId,
|
||||
siteId: state.siteId,
|
||||
// 设备类型(1照明,2空调,3排风扇,4风幕机,5电动窗,6进水阀,7排水泵)
|
||||
deviceType: props.type,
|
||||
ctrlType: props.type,
|
||||
})
|
||||
.then((res) => {
|
||||
let arr: Array<Object> = [];
|
||||
|
Reference in New Issue
Block a user