update:大屏调整

This commit is contained in:
zk
2024-01-22 15:49:00 +08:00
parent 84dfa935ea
commit 5cf32ce40e
16 changed files with 298 additions and 138 deletions
@@ -31,11 +31,15 @@
import { earlyWarning } from '/@/utils/busConstant.ts';
import { useRefresh } from '/@/hooks/autoRefresh';
import { PAGE_SWITCH } from '/@/hooks/autoRefresh/pageRefreshTime.ts';
import { useSession, caching } from '/@/hooks/autoRefresh/caching.ts';
const props = defineProps({
orgCode: String,
type: String,
});
const { setSession, getSession } = useSession();
const { PAGE2_RIGHT3 } = caching;
const tableHeight = ref(0);
const dataSource = ref([]);
const pagination = ref({
@@ -60,7 +64,7 @@
window.addEventListener('resize', setHeight);
timer.value && clearInterval(timer.value);
},
{ immediate: true }
{ immediate: true, deep: true }
);
onUnmounted(() => {
@@ -74,16 +78,26 @@
}
async function init(page) {
const { pageSize } = pagination.value;
const { code, result } = await getMonitorList({ pageSize, pageNo: page, orgCode: props.orgCode });
if (code == 200) {
dataSource.value = result.records;
pagination.value.total = result.total;
pages.value = result.pages;
pagination.value.current = page;
try {
const { pageSize } = pagination.value;
const { code, result } = await getMonitorList({ pageSize, pageNo: page, orgCode: props.orgCode });
if (code == 200) {
setSession(PAGE2_RIGHT3, JSON.stringify({ page, result }));
setValue(result, page);
}
} catch {
const { result, page } = JSON.parse(getSession(PAGE2_RIGHT3));
setValue(result, page);
}
}
function setValue(result, page) {
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;