This commit is contained in:
duanxiaohai 2024-11-11 13:02:03 +08:00
parent 65f2b7cb49
commit 1b62334ad4
1 changed files with 45 additions and 6 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="module"> <div class="module" v-loading="isLoading">
<div class="displayFlex left_bg"> <div class="displayFlex left_bg">
<div class="bt_title"> <div class="bt_title">
<div class="yd_title"> <div class="yd_title">
@ -297,6 +297,7 @@ const lampImages = {
const router = useRouter(); const router = useRouter();
const routers = useRoute(); const routers = useRoute();
const data = reactive({ const data = reactive({
name: "", name: "",
identNo: "", //ID identNo: "", //ID
@ -449,7 +450,7 @@ const lampScreen = (val) => {
if (selectedLamp.value === val) { if (selectedLamp.value === val) {
return; // return; //
} }
console.log(val);
if (val == 1 || val == 2) { if (val == 1 || val == 2) {
data.column_2 = [ data.column_2 = [
{ {
@ -519,7 +520,6 @@ const lampScreen = (val) => {
property: "operatesDeng", property: "operatesDeng",
type: "slot", type: "slot",
}, },
]; ];
} }
selectedLamp.value = val; selectedLamp.value = val;
@ -528,9 +528,10 @@ const lampScreen = (val) => {
}; };
//---------------- //----------------
/** /**
* 表格弹框 * 控制表格弹框和算法弹框的显示状态
* @param {*} dialogShow -弹框状态false表示关闭true表示开启 *
* @param {*} dialogShowSf -算法弹框状态false表示关闭true表示开启 * @param {boolean} dialogShow - 表格弹框的状态`false` 表示关闭`true` 表示打开
* @param {boolean} dialogShowSf - 算法弹框的状态`false` 表示关闭`true` 表示打开
*/ */
const dialogShow = ref(false); const dialogShow = ref(false);
const dialogShowSf = ref(false); const dialogShowSf = ref(false);
@ -748,7 +749,23 @@ const openSf = () => {
} }
}); });
}; };
const isLoading = ref(true);
let loadingCount = 0; //
//
function startLoading() {
loadingCount++;
isLoading.value = true; // true
}
//
function stopLoading() {
loadingCount--;
if (loadingCount === 0) {
isLoading.value = false; // false
}
}
const getTable = (pagination) => { const getTable = (pagination) => {
startLoading(); //
http http
.get( .get(
`${pagination.url}?page=${pagination.currentPage}&size=${pagination.pageSize}&xh=${routers.query.xh}&deng=${selectedLamp.value}` `${pagination.url}?page=${pagination.currentPage}&size=${pagination.pageSize}&xh=${routers.query.xh}&deng=${selectedLamp.value}`
@ -780,10 +797,19 @@ const getTable = (pagination) => {
// }; // };
// }); // });
// pagination2.total = res.count - 6; // pagination2.total = res.count - 6;
} else {
ElMessage.warning({ message: res.message });
} }
})
.catch((error) => {
console.error("请求失败", error);
})
.finally(() => {
stopLoading(); // stopLoading
}); });
}; };
const getTable1 = (pagination) => { const getTable1 = (pagination) => {
startLoading(); //
http http
.get(`${pagination.url}?sfzhm=${data.identNo}&xh=${routers.query.xh}`) .get(`${pagination.url}?sfzhm=${data.identNo}&xh=${routers.query.xh}`)
.then((res) => { .then((res) => {
@ -797,9 +823,16 @@ const getTable1 = (pagination) => {
message: res.message, message: res.message,
}); });
} }
})
.catch((error) => {
console.error("请求失败", error);
})
.finally(() => {
stopLoading(); // stopLoading
}); });
}; };
const getTable2 = (pagination) => { const getTable2 = (pagination) => {
startLoading(); //
http http
.get(`${pagination.url1}?dxbm=${data.dxbm}&xh=${routers.query.xh}`) .get(`${pagination.url1}?dxbm=${data.dxbm}&xh=${routers.query.xh}`)
.then((res) => { .then((res) => {
@ -813,6 +846,12 @@ const getTable2 = (pagination) => {
message: res.message, message: res.message,
}); });
} }
})
.catch((error) => {
console.error("请求失败", error);
})
.finally(() => {
stopLoading(); // stopLoading
}); });
}; };