This commit is contained in:
zk
2023-12-15 18:33:04 +08:00
parent d614f10bb5
commit 2cc8886c2d
31 changed files with 820 additions and 582 deletions
@@ -38,15 +38,18 @@
total: 0,
onChange: pageChange,
});
const timer = ref(null);
const pages = ref(0); //总页数
function handlePoliceDetail(record) {
$bus.emit(earlyWarning, record);
}
onMounted(() => {
init();
init(1);
setHeight();
window.addEventListener('resize', setHeight);
interval();
});
onUnmounted(() => {
window.removeEventListener('resize', setHeight);
@@ -56,20 +59,33 @@
tableHeight.value = document.querySelector('.inner-screen').getBoundingClientRect().height - 60;
}
async function init() {
async function init(page) {
const { pageSize, current } = pagination.value;
const { code, result } = await getMonitorList({ pageSize, pageNo: current });
const { code, result } = await getMonitorList({ pageSize, pageNo: page });
if (code == 200) {
dataSource.value = [...result.records, ...result.records.map((item, i) => ({ ...item, id: item.id + i }))];
pagination.value.total = result.total * 2;
dataSource.value = result.records;
pagination.value.total = result.total;
pages.value = result.pages;
pagination.value.current = page;
}
}
function pageChange(page, pageS) {
pagination.value.current = page;
pagination.value.pageSize = pageS;
init();
init(page);
}
function interval() {
timer.value = setInterval(() => {
let page = pagination.value.current < pages.value ? pagination.value.current + 1 : 1;
init(page);
}, 10000);
}
onUnmounted(() => {
clearInterval(timer.value);
});
</script>
<style lang="less" scoped>
.inner-screen {
@@ -100,7 +116,6 @@
:deep(.ant-table) {
background-color: transparent;
//pointer-events: none;
}
:deep(.ant-table-tbody > tr > td) {