代码调整

This commit is contained in:
dong 2023-10-27 17:54:24 +08:00
parent d3b3d50150
commit 7bfea1a651

View File

@ -105,11 +105,12 @@ import {
getSimulationList, getSimulationList,
destroySimulation, destroySimulation,
} from 'src/api/Simulation'; } from 'src/api/Simulation';
import { useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { PublishItem, getPublishList } from 'src/api/PublishApi'; import { PublishItem, getPublishList } from 'src/api/PublishApi';
import { getRunconfigList } from 'src/api/RunconfigApi'; import { getRunconfigList } from 'src/api/RunconfigApi';
const router = useRouter(); const router = useRouter();
const route = useRoute();
const $q = useQuasar(); const $q = useQuasar();
const props = withDefaults( const props = withDefaults(
@ -180,7 +181,7 @@ const pagination = ref({
rowsNumber: 10, rowsNumber: 10,
}); });
let time: NodeJS.Timeout; let time: NodeJS.Timeout | null;
function intervalRequest() { function intervalRequest() {
getSimulationList() getSimulationList()
.then((res) => { .then((res) => {
@ -188,20 +189,22 @@ function intervalRequest() {
rows.splice(0, rows.length, ...(data as [])); rows.splice(0, rows.length, ...(data as []));
pagination.value.rowsNumber = rows.length; pagination.value.rowsNumber = rows.length;
pagination.value.rowsPerPage = rows.length; pagination.value.rowsPerPage = rows.length;
})
.finally(() => {
if (route.path != '/testManage/test') {
return;
}
time = setTimeout(() => { time = setTimeout(() => {
intervalRequest(); intervalRequest();
}, 3000); }, 3000);
})
.catch((err) => {
console.log(err);
time = setTimeout(() => {
intervalRequest();
}, 5000);
}); });
} }
onUnmounted(() => { onUnmounted(() => {
clearInterval(time); if (time) {
clearTimeout(time);
time = null;
}
}); });
const createFormShow = ref(false); const createFormShow = ref(false);