提交已修改的代码
This commit is contained in:
1 parent
65d2d71469
commit
60cb1b09f8
32 files changed
+10359
-4786
No files matched your search
@@ -42,7 +42,6 @@
|
||||
|
||||
<div class="table-container">
|
||||
<el-table
|
||||
:height="tableHeight"
|
||||
v-loading="loading"
|
||||
border
|
||||
:data="satSurveyList"
|
||||
@@ -1832,161 +1831,30 @@ const cancelQuestionSelector = () => {
|
||||
selectedQuestionIds.value = [];
|
||||
};
|
||||
|
||||
const toolbarRef = ref<any>();
|
||||
const searchRef = ref<HTMLElement>();
|
||||
const actualToolbarHeight = ref(70); // 默认工具栏高度
|
||||
const actualSearchHeight = ref(160); // 默认搜索栏高度
|
||||
const windowHeight = ref(window.innerHeight);
|
||||
|
||||
/** 计算搜索栏实际高度 */
|
||||
const calculateSearchHeight = () => {
|
||||
nextTick(() => {
|
||||
if (searchRef.value && showSearch.value) {
|
||||
// 获取搜索栏元素的完整高度,包括边距和内边距
|
||||
const rect = searchRef.value.getBoundingClientRect();
|
||||
const computedStyle = window.getComputedStyle(searchRef.value);
|
||||
const marginTop = parseFloat(computedStyle.marginTop);
|
||||
const marginBottom = parseFloat(computedStyle.marginBottom);
|
||||
actualSearchHeight.value = rect.height + marginTop + marginBottom;
|
||||
} else {
|
||||
// 如果搜索栏隐藏,高度为0
|
||||
actualSearchHeight.value = 0;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 计算工具栏实际高度 */
|
||||
const calculateToolbarHeight = () => {
|
||||
nextTick(() => {
|
||||
if (toolbarRef.value) {
|
||||
// 获取工具栏DOM元素,toolbarRef.value是组件实例,需要通过$el获取DOM元素
|
||||
const toolbarDom = toolbarRef.value.$el || toolbarRef.value;
|
||||
|
||||
// 检查是否是有效的DOM元素
|
||||
if (toolbarDom && typeof toolbarDom.closest === 'function') {
|
||||
// 获取工具栏元素的完整高度,包括边距和内边距
|
||||
const toolbarElement = toolbarDom.closest('.el-card__header');
|
||||
if (toolbarElement) {
|
||||
const rect = toolbarElement.getBoundingClientRect();
|
||||
const computedStyle = window.getComputedStyle(toolbarElement);
|
||||
const marginTop = parseFloat(computedStyle.marginTop);
|
||||
const marginBottom = parseFloat(computedStyle.marginBottom);
|
||||
actualToolbarHeight.value = rect.height + marginTop + marginBottom;
|
||||
} else {
|
||||
// 如果找不到父元素,直接使用工具栏元素高度
|
||||
const rect = toolbarDom.getBoundingClientRect();
|
||||
actualToolbarHeight.value = rect.height + 20; // 添加一些边距
|
||||
}
|
||||
} else {
|
||||
// 如果无法获取DOM元素,使用默认高度
|
||||
actualToolbarHeight.value = 70;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 窗口大小变化监听 */
|
||||
const handleResize = () => {
|
||||
windowHeight.value = window.innerHeight;
|
||||
// 窗口大小变化时重新计算搜索栏和工具栏高度
|
||||
calculateSearchHeight();
|
||||
calculateToolbarHeight();
|
||||
};
|
||||
|
||||
/** 计算表格高度 */
|
||||
const tableHeight = computed(() => {
|
||||
// 精确计算:窗口高度 - 搜索栏高度 - 工具栏高度 - 分页栏高度 - 页面边距 - 分页栏底部边距
|
||||
const searchHeight = actualSearchHeight.value; // 实际搜索栏高度
|
||||
const toolbarHeight = actualToolbarHeight.value; // 实际工具栏高度
|
||||
const pageTopPadding = 8; // 页面顶部边距
|
||||
const pageBottomMargin = 10; // 分页栏距离底部的边距
|
||||
const paginationOwnHeight = 32; // 分页组件自身高度
|
||||
const paginationPadding = 20; // 分页栏上下内边距
|
||||
const cardPadding = 40; // 卡片内边距(上下各20px)
|
||||
|
||||
// 总的固定高度 = 搜索栏 + 工具栏 + 分页栏自身高度 + 分页栏内边距 + 页面边距 + 底部边距 + 卡片边距
|
||||
const fixedHeight = searchHeight + toolbarHeight + paginationOwnHeight + paginationPadding + pageTopPadding + pageBottomMargin + cardPadding;
|
||||
|
||||
const calculatedHeight = windowHeight.value - fixedHeight - 45;
|
||||
|
||||
// 确保至少有300px的表格高度,避免过小
|
||||
return Math.max(calculatedHeight, 300);
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
// 初始计算搜索栏和工具栏高度
|
||||
calculateSearchHeight();
|
||||
calculateToolbarHeight();
|
||||
// 监听窗口大小变化
|
||||
window.addEventListener('resize', handleResize);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
// 移除监听器
|
||||
window.removeEventListener('resize', handleResize);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 页面容器样式 */
|
||||
.page-container {
|
||||
height: calc(100vh - 85px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
padding: 8px 8px 0 8px !important; /* 顶部和左右边距,底部无边距 */
|
||||
}
|
||||
|
||||
/* 自定义页面滚动条样式 */
|
||||
.page-container::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
.page-container::-webkit-scrollbar-track {
|
||||
background: #f1f1f1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.page-container::-webkit-scrollbar-thumb {
|
||||
background: #c1c1c1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.page-container::-webkit-scrollbar-thumb:hover {
|
||||
background: #a8a8a8;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
/* 表格卡片布局 */
|
||||
.table-card {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.table-card :deep(.el-card__body) {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
padding: 0px 20px 0 20px !important;
|
||||
min-height: 0;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
/* 表格主体 */
|
||||
.table-main {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
padding: 0px 20px 20px 20px !important;
|
||||
}
|
||||
|
||||
/* 表格容器 - 支持横向滚动 */
|
||||
.table-container {
|
||||
width: 100%;
|
||||
/* overflow: hidden; */
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* 横向滚动表格样式 */
|
||||
@@ -2062,14 +1930,13 @@ onUnmounted(() => {
|
||||
background-color: #f5f7fa !important;
|
||||
}
|
||||
|
||||
/* 分页容器固定在底部 */
|
||||
/* 分页容器样式 */
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
padding-top: 10px 0 0 0 !important;
|
||||
margin: 0 !important;
|
||||
/* padding-bottom: 10px !important; 距离底部10px */
|
||||
/* margin: 0 !important; */
|
||||
/* margin-bottom: 10px !important; 确保距离视窗底部10px */
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 16px 20px 0 0 !important;
|
||||
background-color: #fff;
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
/* 移除按钮栏底部边框 */
|
||||
|
||||
@@ -53,14 +53,7 @@
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
border
|
||||
:data="hallReservationList"
|
||||
@selection-change="handleSelectionChange"
|
||||
:height="tableHeight"
|
||||
style="margin-bottom: 0"
|
||||
>
|
||||
<el-table v-loading="loading" border :data="hallReservationList" @selection-change="handleSelectionChange" style="margin-bottom: 0">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="报告厅ID" align="center" prop="hallId" />
|
||||
<el-table-column label="报告厅名称" align="center" prop="hallName" />
|
||||
@@ -172,14 +165,9 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
class="pagination-container"
|
||||
/>
|
||||
<div class="pagination-container">
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- 查看报告厅预约详情对话框 -->
|
||||
@@ -397,11 +385,6 @@ const auditForm = ref({
|
||||
const selectedRecords = ref<HallReservationVO[]>([]);
|
||||
const auditLoading = ref(false);
|
||||
|
||||
const toolbarRef = ref<HTMLElement>();
|
||||
const searchRef = ref<HTMLElement>();
|
||||
const actualToolbarHeight = ref(70); // 默认工具栏高度
|
||||
const actualSearchHeight = ref(160); // 默认搜索栏高度
|
||||
|
||||
const queryParams = ref<HallReservationQuery>({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
@@ -418,64 +401,6 @@ const queryParams = ref<HallReservationQuery>({
|
||||
}
|
||||
});
|
||||
|
||||
/** 计算搜索栏实际高度 */
|
||||
const calculateSearchHeight = () => {
|
||||
nextTick(() => {
|
||||
if (searchRef.value && showSearch.value) {
|
||||
// 获取搜索栏元素的完整高度,包括边距和内边距
|
||||
const rect = searchRef.value.getBoundingClientRect();
|
||||
const computedStyle = window.getComputedStyle(searchRef.value);
|
||||
const marginTop = parseFloat(computedStyle.marginTop);
|
||||
const marginBottom = parseFloat(computedStyle.marginBottom);
|
||||
actualSearchHeight.value = rect.height + marginTop + marginBottom;
|
||||
} else {
|
||||
// 如果搜索栏隐藏,高度为0
|
||||
actualSearchHeight.value = 0;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 计算工具栏实际高度 */
|
||||
const calculateToolbarHeight = () => {
|
||||
nextTick(() => {
|
||||
if (toolbarRef.value) {
|
||||
// 获取工具栏元素的完整高度,包括边距和内边距
|
||||
const toolbarElement = toolbarRef.value.closest('.el-card__header');
|
||||
if (toolbarElement) {
|
||||
const rect = toolbarElement.getBoundingClientRect();
|
||||
const computedStyle = window.getComputedStyle(toolbarElement);
|
||||
const marginTop = parseFloat(computedStyle.marginTop);
|
||||
const marginBottom = parseFloat(computedStyle.marginBottom);
|
||||
actualToolbarHeight.value = rect.height + marginTop + marginBottom;
|
||||
} else {
|
||||
// 如果找不到父元素,直接使用工具栏元素高度
|
||||
const rect = toolbarRef.value.getBoundingClientRect();
|
||||
actualToolbarHeight.value = rect.height + 20; // 添加一些边距
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 计算表格高度 */
|
||||
const tableHeight = computed(() => {
|
||||
// 精确计算:窗口高度 - 搜索栏高度 - 工具栏高度 - 分页栏高度 - 页面边距 - 分页栏底部边距
|
||||
const searchHeight = actualSearchHeight.value; // 实际搜索栏高度
|
||||
const toolbarHeight = actualToolbarHeight.value; // 实际工具栏高度
|
||||
const pageTopPadding = 8; // 页面顶部边距
|
||||
const pageBottomMargin = 10; // 分页栏距离底部的边距
|
||||
const paginationOwnHeight = 32; // 分页组件自身高度
|
||||
const paginationPadding = 20; // 分页栏上下内边距
|
||||
const cardPadding = 40; // 卡片内边距(上下各20px)
|
||||
|
||||
// 总的固定高度 = 搜索栏 + 工具栏 + 分页栏自身高度 + 分页栏内边距 + 页面边距 + 底部边距 + 卡片边距
|
||||
const fixedHeight = searchHeight + toolbarHeight + paginationOwnHeight + paginationPadding + pageTopPadding + pageBottomMargin + cardPadding;
|
||||
|
||||
const calculatedHeight = windowHeight.value - fixedHeight - 30;
|
||||
|
||||
// 确保至少有300px的表格高度,避免过小
|
||||
return Math.max(calculatedHeight, 300);
|
||||
});
|
||||
|
||||
/** 获取报告厅列表 */
|
||||
const getHallList = async () => {
|
||||
try {
|
||||
@@ -650,12 +575,6 @@ const handleQuery = () => {
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 监听搜索栏显示状态变化 */
|
||||
watch(showSearch, () => {
|
||||
// 搜索栏显示状态变化时重新计算高度
|
||||
calculateSearchHeight();
|
||||
});
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
@@ -834,86 +753,25 @@ const handleExport = () => {
|
||||
);
|
||||
};
|
||||
|
||||
/** 窗口大小变化监听 */
|
||||
const handleResize = () => {
|
||||
windowHeight.value = window.innerHeight;
|
||||
// 窗口大小变化时重新计算搜索栏和工具栏高度
|
||||
calculateSearchHeight();
|
||||
calculateToolbarHeight();
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
// 审核界面不需要限制用户信息
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
getHallList(); // 获取报告厅列表
|
||||
// 初始计算搜索栏和工具栏高度
|
||||
calculateSearchHeight();
|
||||
calculateToolbarHeight();
|
||||
// 监听窗口大小变化
|
||||
window.addEventListener('resize', handleResize);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
// 移除监听器
|
||||
window.removeEventListener('resize', handleResize);
|
||||
getHallList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 页面容器样式 */
|
||||
.page-container {
|
||||
height: calc(100vh - 85px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
padding: 8px 8px 0 8px !important; /* 顶部和左右边距,底部无边距 */
|
||||
}
|
||||
|
||||
/* 隐藏滚动条但保持滚动功能 */
|
||||
.page-container::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.page-container {
|
||||
-ms-overflow-style: none; /* IE and Edge */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
/* 表格卡片布局 */
|
||||
.table-card {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.table-card :deep(.el-card__body) {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
padding: 0px 20px 0 20px !important;
|
||||
min-height: 0;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
/* 表格主体 */
|
||||
.table-main {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* 分页容器固定在底部 */
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
padding-top: 10px 0 0 0 !important;
|
||||
margin: 0 !important;
|
||||
/* padding-bottom: 10px !important; 距离底部10px */
|
||||
/* margin: 0 !important; */
|
||||
/* margin-bottom: 10px !important; 确保距离视窗底部10px */
|
||||
padding: 0px 20px 20px 20px !important;
|
||||
}
|
||||
|
||||
/* 移除按钮栏底部边框 */
|
||||
@@ -921,6 +779,15 @@ onUnmounted(() => {
|
||||
border-bottom: none !important;
|
||||
}
|
||||
|
||||
/* 分页容器样式 */
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 16px 20px 0 0 !important;
|
||||
background-color: #fff;
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
.hall-option {
|
||||
padding: 8px 0;
|
||||
line-height: 1.4;
|
||||
|
||||
@@ -42,14 +42,7 @@
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
border
|
||||
:data="hallInfoList"
|
||||
@selection-change="handleSelectionChange"
|
||||
:height="tableHeight"
|
||||
style="margin-bottom: 20px"
|
||||
>
|
||||
<el-table v-loading="loading" border :data="hallInfoList" @selection-change="handleSelectionChange" style="margin-bottom: 20px">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column label="主键ID" align="center" prop="id" v-if="true" /> -->
|
||||
<el-table-column label="报告厅名称" align="center" prop="hallName" />
|
||||
@@ -108,7 +101,9 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
<div class="pagination-container">
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</div>
|
||||
</el-card>
|
||||
<!-- 添加或修改报告厅信息对话框 -->
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="1000px" append-to-body>
|
||||
@@ -193,7 +188,6 @@ const ids = ref<Array<string | number>>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const windowHeight = ref(window.innerHeight);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const hallInfoFormRef = ref<ElFormInstance>();
|
||||
@@ -243,17 +237,6 @@ const data = reactive<PageData<HallInfoForm, HallInfoQuery>>({
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 计算表格高度 */
|
||||
const tableHeight = computed(() => {
|
||||
// 窗口高度 - 页面边距 - 搜索栏高度 - 工具栏高度 - 分页栏高度 - 其他边距
|
||||
const searchHeight = showSearch.value ? 120 : 0; // 搜索栏高度
|
||||
const toolbarHeight = 50; // 工具栏高度
|
||||
const paginationHeight = 60; // 分页栏高度
|
||||
const otherHeight = 90; // 其他边距和间距
|
||||
|
||||
return windowHeight.value - searchHeight - toolbarHeight - paginationHeight - otherHeight - 10;
|
||||
});
|
||||
|
||||
/** 查询报告厅信息列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
@@ -366,11 +349,6 @@ const handleExport = () => {
|
||||
);
|
||||
};
|
||||
|
||||
/** 窗口大小变化监听 */
|
||||
const handleResize = () => {
|
||||
windowHeight.value = window.innerHeight;
|
||||
};
|
||||
|
||||
/** 查看按钮操作 */
|
||||
const handleView = async (row: HallInfoVO) => {
|
||||
Object.assign(viewForm, row);
|
||||
@@ -391,24 +369,27 @@ const cancelView = () => {
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
// 监听窗口大小变化
|
||||
window.addEventListener('resize', handleResize);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
// 移除监听器
|
||||
window.removeEventListener('resize', handleResize);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 页面容器样式 */
|
||||
.page-container {
|
||||
height: calc(100vh - 85px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
padding: 8px 8px 0 8px !important; /* 顶部和左右边距,底部无边距 */
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
/* 表格卡片布局 */
|
||||
.table-card {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.table-card :deep(.el-card__body) {
|
||||
padding: 0px 20px 20px 20px !important;
|
||||
}
|
||||
|
||||
/* 移除按钮栏底部边框 */
|
||||
.button-card :deep(.el-card__header) {
|
||||
border-bottom: none !important;
|
||||
}
|
||||
|
||||
.image-gallery {
|
||||
@@ -489,41 +470,13 @@ onUnmounted(() => {
|
||||
word-break: break-word;
|
||||
overflow-y: auto;
|
||||
}
|
||||
/* 表格卡片布局 */
|
||||
.table-card {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.table-card :deep(.el-card__body) {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
padding: 0px 20px 0 20px !important;
|
||||
}
|
||||
|
||||
/* 表格主体 */
|
||||
.table-main {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* 分页容器固定在底部 */
|
||||
/* 分页容器样式 */
|
||||
.pagination-container {
|
||||
/* margin-top: auto; */
|
||||
/* padding: 8px 0 4px 0; */
|
||||
/* background-color: #fff; */
|
||||
/* border-top: 1px solid #f0f0f0; */
|
||||
flex-shrink: 0;
|
||||
padding-top: 10px 0 0 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
/* 移除按钮栏底部边框 */
|
||||
.button-card :deep(.el-card__header) {
|
||||
border-bottom: none !important;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 16px 20px 0 0 !important;
|
||||
background-color: #fff;
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
</style>
|
||||
@@ -53,14 +53,7 @@
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
border
|
||||
:data="hallReservationList"
|
||||
@selection-change="handleSelectionChange"
|
||||
:height="tableHeight"
|
||||
style="margin-bottom: 0"
|
||||
>
|
||||
<el-table v-loading="loading" border :data="hallReservationList" @selection-change="handleSelectionChange" style="margin-bottom: 0">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="报告厅ID" align="center" prop="hallId" />
|
||||
<el-table-column label="报告厅名称" align="center" prop="hallName" />
|
||||
@@ -170,14 +163,9 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
class="pagination-container"
|
||||
/>
|
||||
<div class="pagination-container">
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</div>
|
||||
</el-card>
|
||||
<!-- 添加或修改报告厅预约对话框 -->
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="600px" append-to-body>
|
||||
@@ -357,7 +345,6 @@ const ids = ref<Array<string | number>>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const windowHeight = ref(window.innerHeight);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const hallReservationFormRef = ref<ElFormInstance>();
|
||||
@@ -388,11 +375,6 @@ const viewForm = ref<HallReservationForm>({
|
||||
auditRemark: undefined
|
||||
});
|
||||
|
||||
const toolbarRef = ref<HTMLElement>();
|
||||
const searchRef = ref<HTMLElement>();
|
||||
const actualToolbarHeight = ref(70); // 默认工具栏高度
|
||||
const actualSearchHeight = ref(160); // 默认搜索栏高度
|
||||
|
||||
const initFormData: HallReservationForm = {
|
||||
id: undefined,
|
||||
hallId: undefined,
|
||||
@@ -434,64 +416,6 @@ const data = reactive<PageData<HallReservationForm, HallReservationQuery>>({
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 计算搜索栏实际高度 */
|
||||
const calculateSearchHeight = () => {
|
||||
nextTick(() => {
|
||||
if (searchRef.value && showSearch.value) {
|
||||
// 获取搜索栏元素的完整高度,包括边距和内边距
|
||||
const rect = searchRef.value.getBoundingClientRect();
|
||||
const computedStyle = window.getComputedStyle(searchRef.value);
|
||||
const marginTop = parseFloat(computedStyle.marginTop);
|
||||
const marginBottom = parseFloat(computedStyle.marginBottom);
|
||||
actualSearchHeight.value = rect.height + marginTop + marginBottom;
|
||||
} else {
|
||||
// 如果搜索栏隐藏,高度为0
|
||||
actualSearchHeight.value = 0;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 计算工具栏实际高度 */
|
||||
const calculateToolbarHeight = () => {
|
||||
nextTick(() => {
|
||||
if (toolbarRef.value) {
|
||||
// 获取工具栏元素的完整高度,包括边距和内边距
|
||||
const toolbarElement = toolbarRef.value.closest('.el-card__header');
|
||||
if (toolbarElement) {
|
||||
const rect = toolbarElement.getBoundingClientRect();
|
||||
const computedStyle = window.getComputedStyle(toolbarElement);
|
||||
const marginTop = parseFloat(computedStyle.marginTop);
|
||||
const marginBottom = parseFloat(computedStyle.marginBottom);
|
||||
actualToolbarHeight.value = rect.height + marginTop + marginBottom;
|
||||
} else {
|
||||
// 如果找不到父元素,直接使用工具栏元素高度
|
||||
const rect = toolbarRef.value.getBoundingClientRect();
|
||||
actualToolbarHeight.value = rect.height + 20; // 添加一些边距
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 计算表格高度 */
|
||||
const tableHeight = computed(() => {
|
||||
// 精确计算:窗口高度 - 搜索栏高度 - 工具栏高度 - 分页栏高度 - 页面边距 - 分页栏底部边距
|
||||
const searchHeight = actualSearchHeight.value; // 实际搜索栏高度
|
||||
const toolbarHeight = actualToolbarHeight.value; // 实际工具栏高度
|
||||
const pageTopPadding = 8; // 页面顶部边距
|
||||
const pageBottomMargin = 10; // 分页栏距离底部的边距
|
||||
const paginationOwnHeight = 32; // 分页组件自身高度
|
||||
const paginationPadding = 20; // 分页栏上下内边距
|
||||
const cardPadding = 40; // 卡片内边距(上下各20px)
|
||||
|
||||
// 总的固定高度 = 搜索栏 + 工具栏 + 分页栏自身高度 + 分页栏内边距 + 页面边距 + 底部边距 + 卡片边距
|
||||
const fixedHeight = searchHeight + toolbarHeight + paginationOwnHeight + paginationPadding + pageTopPadding + pageBottomMargin + cardPadding;
|
||||
|
||||
const calculatedHeight = windowHeight.value - fixedHeight - 30;
|
||||
|
||||
// 确保至少有300px的表格高度,避免过小
|
||||
return Math.max(calculatedHeight, 300);
|
||||
});
|
||||
|
||||
/** 获取报告厅列表 */
|
||||
const getHallList = async () => {
|
||||
try {
|
||||
@@ -679,12 +603,6 @@ const handleQuery = () => {
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 监听搜索栏显示状态变化 */
|
||||
watch(showSearch, () => {
|
||||
// 搜索栏显示状态变化时重新计算高度
|
||||
calculateSearchHeight();
|
||||
});
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
@@ -829,94 +747,25 @@ const handleExport = () => {
|
||||
);
|
||||
};
|
||||
|
||||
/** 窗口大小变化监听 */
|
||||
const handleResize = () => {
|
||||
windowHeight.value = window.innerHeight;
|
||||
// 窗口大小变化时重新计算搜索栏和工具栏高度
|
||||
calculateSearchHeight();
|
||||
calculateToolbarHeight();
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
// 确保用户信息已加载
|
||||
if (!userStore.userId) {
|
||||
console.warn('用户信息尚未加载完成,等待加载...');
|
||||
// 如果用户信息尚未加载,可以等待一下再查询
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
}
|
||||
|
||||
// 再次确保queryParams中的applicantId是最新的
|
||||
queryParams.value.applicantId = userStore.userId;
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
getHallList(); // 获取报告厅列表
|
||||
// 初始计算搜索栏和工具栏高度
|
||||
calculateSearchHeight();
|
||||
calculateToolbarHeight();
|
||||
// 监听窗口大小变化
|
||||
window.addEventListener('resize', handleResize);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
// 移除监听器
|
||||
window.removeEventListener('resize', handleResize);
|
||||
getHallList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 页面容器样式 */
|
||||
.page-container {
|
||||
height: calc(100vh - 85px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
padding: 8px 8px 0 8px !important; /* 顶部和左右边距,底部无边距 */
|
||||
}
|
||||
|
||||
/* 隐藏滚动条但保持滚动功能 */
|
||||
.page-container::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.page-container {
|
||||
-ms-overflow-style: none; /* IE and Edge */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
/* 表格卡片布局 */
|
||||
.table-card {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.table-card :deep(.el-card__body) {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
padding: 0px 20px 0 20px !important;
|
||||
min-height: 0;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
/* 表格主体 */
|
||||
.table-main {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* 分页容器固定在底部 */
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
padding-top: 10px 0 0 0 !important;
|
||||
margin: 0 !important;
|
||||
/* padding-bottom: 10px !important; 距离底部10px */
|
||||
/* margin: 0 !important; */
|
||||
/* margin-bottom: 10px !important; 确保距离视窗底部10px */
|
||||
padding: 0px 20px 20px 20px !important;
|
||||
}
|
||||
|
||||
/* 移除按钮栏底部边框 */
|
||||
@@ -924,6 +773,15 @@ onUnmounted(() => {
|
||||
border-bottom: none !important;
|
||||
}
|
||||
|
||||
/* 分页容器样式 */
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 16px 20px 0 0 !important;
|
||||
background-color: #fff;
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
.hall-option {
|
||||
padding: 8px 0;
|
||||
line-height: 1.4;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="p-2 page-container">
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div ref="searchRef" v-show="showSearch" class="mb-[10px]">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<!-- <el-form-item label="删除标志" prop="deleted">
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
<el-card shadow="never" class="button-card table-card">
|
||||
<template #header>
|
||||
<el-row ref="toolbarRef" :gutter="10" class="mb8">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['hq:satCategory:add']">新增</el-button>
|
||||
</el-col>
|
||||
@@ -59,7 +59,7 @@
|
||||
</template>
|
||||
|
||||
<div class="table-container">
|
||||
<el-table v-loading="loading" border :data="satCategoryList" :height="tableHeight" @selection-change="handleSelectionChange">
|
||||
<el-table v-loading="loading" border :data="satCategoryList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column label="主键ID" align="center" prop="id" v-if="true" /> -->
|
||||
<!-- <el-table-column label="删除标志" align="center" prop="deleted">
|
||||
@@ -299,151 +299,42 @@ const handleExport = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const toolbarRef = ref<HTMLElement>();
|
||||
const searchRef = ref<HTMLElement>();
|
||||
const actualToolbarHeight = ref(70); // 默认工具栏高度
|
||||
const actualSearchHeight = ref(160); // 默认搜索栏高度
|
||||
const windowHeight = ref(window.innerHeight);
|
||||
|
||||
/** 计算搜索栏实际高度 */
|
||||
const calculateSearchHeight = () => {
|
||||
nextTick(() => {
|
||||
if (searchRef.value && showSearch.value) {
|
||||
// 获取搜索栏元素的完整高度,包括边距和内边距
|
||||
const rect = searchRef.value.getBoundingClientRect();
|
||||
const computedStyle = window.getComputedStyle(searchRef.value);
|
||||
const marginTop = parseFloat(computedStyle.marginTop);
|
||||
const marginBottom = parseFloat(computedStyle.marginBottom);
|
||||
actualSearchHeight.value = rect.height + marginTop + marginBottom;
|
||||
} else {
|
||||
// 如果搜索栏隐藏,高度为0
|
||||
actualSearchHeight.value = 0;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 计算工具栏实际高度 */
|
||||
const calculateToolbarHeight = () => {
|
||||
nextTick(() => {
|
||||
if (toolbarRef.value) {
|
||||
// 获取工具栏元素的完整高度,包括边距和内边距
|
||||
const toolbarElement = toolbarRef.value.closest('.el-card__header');
|
||||
if (toolbarElement) {
|
||||
const rect = toolbarElement.getBoundingClientRect();
|
||||
const computedStyle = window.getComputedStyle(toolbarElement);
|
||||
const marginTop = parseFloat(computedStyle.marginTop);
|
||||
const marginBottom = parseFloat(computedStyle.marginBottom);
|
||||
actualToolbarHeight.value = rect.height + marginTop + marginBottom;
|
||||
} else {
|
||||
// 如果找不到父元素,直接使用工具栏元素高度
|
||||
const rect = toolbarRef.value.getBoundingClientRect();
|
||||
actualToolbarHeight.value = rect.height + 20; // 添加一些边距
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 窗口大小变化监听 */
|
||||
const handleResize = () => {
|
||||
windowHeight.value = window.innerHeight;
|
||||
// 窗口大小变化时重新计算搜索栏和工具栏高度
|
||||
calculateSearchHeight();
|
||||
calculateToolbarHeight();
|
||||
};
|
||||
|
||||
/** 计算表格高度 */
|
||||
const tableHeight = computed(() => {
|
||||
// 精确计算:窗口高度 - 搜索栏高度 - 工具栏高度 - 分页栏高度 - 页面边距 - 分页栏底部边距
|
||||
const searchHeight = actualSearchHeight.value; // 实际搜索栏高度
|
||||
const toolbarHeight = actualToolbarHeight.value; // 实际工具栏高度
|
||||
const pageTopPadding = 8; // 页面顶部边距
|
||||
const pageBottomMargin = 10; // 分页栏距离底部的边距
|
||||
const paginationOwnHeight = 32; // 分页组件自身高度
|
||||
const paginationPadding = 20; // 分页栏上下内边距
|
||||
const cardPadding = 40; // 卡片内边距(上下各20px)
|
||||
|
||||
// 总的固定高度 = 搜索栏 + 工具栏 + 分页栏自身高度 + 分页栏内边距 + 页面边距 + 底部边距 + 卡片边距
|
||||
const fixedHeight = searchHeight + toolbarHeight + paginationOwnHeight + paginationPadding + pageTopPadding + pageBottomMargin + cardPadding;
|
||||
|
||||
const calculatedHeight = windowHeight.value - fixedHeight - 35;
|
||||
|
||||
// 确保至少有300px的表格高度,避免过小
|
||||
return Math.max(calculatedHeight, 300);
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
// 初始计算搜索栏和工具栏高度
|
||||
calculateSearchHeight();
|
||||
calculateToolbarHeight();
|
||||
// 监听窗口大小变化
|
||||
window.addEventListener('resize', handleResize);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
// 移除监听器
|
||||
window.removeEventListener('resize', handleResize);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 页面容器样式 */
|
||||
.page-container {
|
||||
height: calc(100vh - 85px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
padding: 8px 8px 0 8px !important; /* 顶部和左右边距,底部无边距 */
|
||||
}
|
||||
|
||||
/* 隐藏滚动条但保持滚动功能 */
|
||||
.page-container::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.page-container {
|
||||
-ms-overflow-style: none; /* IE and Edge */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
/* 表格卡片布局 */
|
||||
.table-card {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.table-card :deep(.el-card__body) {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
padding: 0px 20px 0 20px !important;
|
||||
min-height: 0;
|
||||
margin-bottom: 0 !important;
|
||||
padding: 0px 20px 20px 20px !important;
|
||||
}
|
||||
|
||||
/* 表格主体 */
|
||||
.table-main {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* 分页容器固定在底部 */
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
padding-top: 10px 0 0 0 !important;
|
||||
margin: 0 !important;
|
||||
/* padding-bottom: 10px !important; 距离底部10px */
|
||||
/* margin: 0 !important; */
|
||||
/* margin-bottom: 10px !important; 确保距离视窗底部10px */
|
||||
.table-container {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* 移除按钮栏底部边框 */
|
||||
.button-card :deep(.el-card__header) {
|
||||
border-bottom: none !important;
|
||||
}
|
||||
|
||||
/* 分页容器样式 */
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 16px 20px 0 0 !important;
|
||||
background-color: #fff;
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
</style>
|
||||
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<div class="p-2">
|
||||
<div class="p-2 page-container">
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<el-form-item label="删除标志" prop="deleted">
|
||||
<el-select v-model="queryParams.deleted" placeholder="请选择删除标志" clearable >
|
||||
<el-option v-for="dict in sys_item_delete" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
<el-select v-model="queryParams.deleted" placeholder="请选择删除标志" clearable>
|
||||
<el-option v-for="dict in sys_item_delete" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="答题记录ID" prop="recordId">
|
||||
@@ -27,7 +27,7 @@
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card shadow="never">
|
||||
<el-card shadow="never" class="button-card table-card">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
@@ -37,7 +37,9 @@
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['hq:satDetail:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['hq:satDetail:remove']">删除</el-button>
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['hq:satDetail:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['hq:satDetail:export']">导出</el-button>
|
||||
@@ -46,43 +48,42 @@
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" border :data="satDetailList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键ID" align="center" prop="id" v-if="true" />
|
||||
<el-table-column label="删除标志" align="center" prop="deleted">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sys_item_delete" :value="scope.row.deleted"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="答题记录ID" align="center" prop="recordId" />
|
||||
<el-table-column label="题目ID" align="center" prop="questionId" />
|
||||
<el-table-column label="答案分数" align="center" prop="answerScore" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['hq:satDetail:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['hq:satDetail:remove']"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="table-container">
|
||||
<el-table v-loading="loading" border :data="satDetailList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键ID" align="center" prop="id" v-if="true" />
|
||||
<el-table-column label="删除标志" align="center" prop="deleted">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sys_item_delete" :value="scope.row.deleted" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="答题记录ID" align="center" prop="recordId" />
|
||||
<el-table-column label="题目ID" align="center" prop="questionId" />
|
||||
<el-table-column label="答案分数" align="center" prop="answerScore" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['hq:satDetail:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['hq:satDetail:remove']"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
<div class="pagination-container">
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</div>
|
||||
</el-card>
|
||||
<!-- 添加或修改答题详情对话框 -->
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||
<el-form ref="satDetailFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="删除标志" prop="deleted">
|
||||
<el-select v-model="form.deleted" placeholder="请选择删除标志">
|
||||
<el-option
|
||||
v-for="dict in sys_item_delete"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="parseInt(dict.value)"
|
||||
></el-option>
|
||||
<el-option v-for="dict in sys_item_delete" :key="dict.value" :label="dict.label" :value="parseInt(dict.value)"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="答题记录ID" prop="recordId">
|
||||
@@ -95,7 +96,7 @@
|
||||
<el-input v-model="form.answerScore" placeholder="请输入答案分数" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@@ -139,9 +140,9 @@ const initFormData: SatDetailForm = {
|
||||
questionId: undefined,
|
||||
answerScore: undefined,
|
||||
remark: undefined
|
||||
}
|
||||
};
|
||||
const data = reactive<PageData<SatDetailForm, SatDetailQuery>>({
|
||||
form: {...initFormData},
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
@@ -149,19 +150,12 @@ const data = reactive<PageData<SatDetailForm, SatDetailQuery>>({
|
||||
recordId: undefined,
|
||||
questionId: undefined,
|
||||
answerScore: undefined,
|
||||
params: {
|
||||
}
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [
|
||||
{ required: true, message: "主键ID不能为空", trigger: "blur" }
|
||||
],
|
||||
recordId: [
|
||||
{ required: true, message: "答题记录ID不能为空", trigger: "blur" }
|
||||
],
|
||||
questionId: [
|
||||
{ required: true, message: "题目ID不能为空", trigger: "blur" }
|
||||
],
|
||||
id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }],
|
||||
recordId: [{ required: true, message: '答题记录ID不能为空', trigger: 'blur' }],
|
||||
questionId: [{ required: true, message: '题目ID不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
@@ -174,55 +168,55 @@ const getList = async () => {
|
||||
satDetailList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = {...initFormData};
|
||||
form.value = { ...initFormData };
|
||||
satDetailFormRef.value?.resetFields();
|
||||
}
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
}
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: SatDetailVO[]) => {
|
||||
ids.value = selection.map(item => item.id);
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
reset();
|
||||
dialog.visible = true;
|
||||
dialog.title = "添加答题详情";
|
||||
}
|
||||
dialog.title = '添加答题详情';
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: SatDetailVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0]
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getSatDetail(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = "修改答题详情";
|
||||
}
|
||||
dialog.title = '修改答题详情';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
@@ -230,34 +224,73 @@ const submitForm = () => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateSatDetail(form.value).finally(() => buttonLoading.value = false);
|
||||
await updateSatDetail(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addSatDetail(form.value).finally(() => buttonLoading.value = false);
|
||||
await addSatDetail(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess("操作成功");
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: SatDetailVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除答题详情编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
||||
await proxy?.$modal.confirm('是否确认删除答题详情编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delSatDetail(_ids);
|
||||
proxy?.$modal.msgSuccess("删除成功");
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
}
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download('hq/satDetail/export', {
|
||||
...queryParams.value
|
||||
}, `satDetail_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
proxy?.download(
|
||||
'hq/satDetail/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`satDetail_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 页面容器样式 */
|
||||
.page-container {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
/* 表格卡片布局 */
|
||||
.table-card {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.table-card :deep(.el-card__body) {
|
||||
padding: 0px 20px 20px 20px !important;
|
||||
}
|
||||
|
||||
/* 表格容器 */
|
||||
.table-container {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* 分页容器样式 */
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 16px 20px 0 0 !important;
|
||||
background-color: #fff;
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
/* 移除按钮栏底部边框 */
|
||||
.button-card :deep(.el-card__header) {
|
||||
border-bottom: none !important;
|
||||
}
|
||||
</style>
|
||||
@@ -53,7 +53,7 @@
|
||||
</el-row>
|
||||
</template>
|
||||
<div class="table-container">
|
||||
<el-table :height="tableHeight" v-loading="loading" border :data="satOptionList" @selection-change="handleSelectionChange">
|
||||
<el-table v-loading="loading" border :data="satOptionList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column label="主键ID" align="center" prop="id" v-if="true" />
|
||||
<el-table-column label="删除标志" align="center" prop="deleted">
|
||||
@@ -291,144 +291,38 @@ const handleExport = () => {
|
||||
|
||||
const toolbarRef = ref<HTMLElement>();
|
||||
const searchRef = ref<HTMLElement>();
|
||||
const actualToolbarHeight = ref(70); // 默认工具栏高度
|
||||
const actualSearchHeight = ref(160); // 默认搜索栏高度
|
||||
const windowHeight = ref(window.innerHeight);
|
||||
|
||||
/** 计算搜索栏实际高度 */
|
||||
const calculateSearchHeight = () => {
|
||||
nextTick(() => {
|
||||
if (searchRef.value && showSearch.value) {
|
||||
// 获取搜索栏元素的完整高度,包括边距和内边距
|
||||
const rect = searchRef.value.getBoundingClientRect();
|
||||
const computedStyle = window.getComputedStyle(searchRef.value);
|
||||
const marginTop = parseFloat(computedStyle.marginTop);
|
||||
const marginBottom = parseFloat(computedStyle.marginBottom);
|
||||
actualSearchHeight.value = rect.height + marginTop + marginBottom;
|
||||
} else {
|
||||
// 如果搜索栏隐藏,高度为0
|
||||
actualSearchHeight.value = 0;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 计算工具栏实际高度 */
|
||||
const calculateToolbarHeight = () => {
|
||||
nextTick(() => {
|
||||
if (toolbarRef.value) {
|
||||
// 获取工具栏元素的完整高度,包括边距和内边距
|
||||
const toolbarElement = toolbarRef.value.closest('.el-card__header');
|
||||
if (toolbarElement) {
|
||||
const rect = toolbarElement.getBoundingClientRect();
|
||||
const computedStyle = window.getComputedStyle(toolbarElement);
|
||||
const marginTop = parseFloat(computedStyle.marginTop);
|
||||
const marginBottom = parseFloat(computedStyle.marginBottom);
|
||||
actualToolbarHeight.value = rect.height + marginTop + marginBottom;
|
||||
} else {
|
||||
// 如果找不到父元素,直接使用工具栏元素高度
|
||||
const rect = toolbarRef.value.getBoundingClientRect();
|
||||
actualToolbarHeight.value = rect.height + 20; // 添加一些边距
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 窗口大小变化监听 */
|
||||
const handleResize = () => {
|
||||
windowHeight.value = window.innerHeight;
|
||||
// 窗口大小变化时重新计算搜索栏和工具栏高度
|
||||
calculateSearchHeight();
|
||||
calculateToolbarHeight();
|
||||
};
|
||||
|
||||
/** 计算表格高度 */
|
||||
const tableHeight = computed(() => {
|
||||
// 精确计算:窗口高度 - 搜索栏高度 - 工具栏高度 - 分页栏高度 - 页面边距 - 分页栏底部边距
|
||||
const searchHeight = actualSearchHeight.value; // 实际搜索栏高度
|
||||
const toolbarHeight = actualToolbarHeight.value; // 实际工具栏高度
|
||||
const pageTopPadding = 8; // 页面顶部边距
|
||||
const pageBottomMargin = 10; // 分页栏距离底部的边距
|
||||
const paginationOwnHeight = 32; // 分页组件自身高度
|
||||
const paginationPadding = 20; // 分页栏上下内边距
|
||||
const cardPadding = 40; // 卡片内边距(上下各20px)
|
||||
|
||||
// 总的固定高度 = 搜索栏 + 工具栏 + 分页栏自身高度 + 分页栏内边距 + 页面边距 + 底部边距 + 卡片边距
|
||||
const fixedHeight = searchHeight + toolbarHeight + paginationOwnHeight + paginationPadding + pageTopPadding + pageBottomMargin + cardPadding;
|
||||
|
||||
const calculatedHeight = windowHeight.value - fixedHeight - 35;
|
||||
|
||||
// 确保至少有300px的表格高度,避免过小
|
||||
return Math.max(calculatedHeight, 300);
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
// 初始计算搜索栏和工具栏高度
|
||||
calculateSearchHeight();
|
||||
calculateToolbarHeight();
|
||||
// 监听窗口大小变化
|
||||
window.addEventListener('resize', handleResize);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
// 移除监听器
|
||||
window.removeEventListener('resize', handleResize);
|
||||
});
|
||||
</script>
|
||||
<style scoped>
|
||||
/* 页面容器样式 */
|
||||
.page-container {
|
||||
height: calc(100vh - 85px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
padding: 8px 8px 0 8px !important; /* 顶部和左右边距,底部无边距 */
|
||||
}
|
||||
|
||||
/* 隐藏滚动条但保持滚动功能 */
|
||||
.page-container::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.page-container {
|
||||
-ms-overflow-style: none; /* IE and Edge */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
/* 表格卡片布局 */
|
||||
.table-card {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.table-card :deep(.el-card__body) {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
padding: 0px 20px 0 20px !important;
|
||||
min-height: 0;
|
||||
margin-bottom: 0 !important;
|
||||
padding: 0px 20px 20px 20px !important;
|
||||
}
|
||||
|
||||
/* 表格主体 */
|
||||
.table-main {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
/* 表格容器 */
|
||||
.table-container {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* 分页容器固定在底部 */
|
||||
/* 分页容器样式 */
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
padding-top: 10px 0 0 0 !important;
|
||||
margin: 0 !important;
|
||||
/* padding-bottom: 10px !important; 距离底部10px */
|
||||
/* margin: 0 !important; */
|
||||
/* margin-bottom: 10px !important; 确保距离视窗底部10px */
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 16px 20px 0 0 !important;
|
||||
background-color: #fff;
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
/* 移除按钮栏底部边框 */
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
</el-row>
|
||||
</template>
|
||||
<div class="table-container">
|
||||
<el-table v-loading="loading" border :data="satQuestionList" @selection-change="handleSelectionChange" :height="tableHeight">
|
||||
<el-table v-loading="loading" border :data="satQuestionList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column label="主键ID" align="center" prop="id" v-if="true" /> -->
|
||||
<!-- <el-table-column label="删除标志" align="center" prop="deleted">
|
||||
@@ -378,145 +378,39 @@ const handleExport = () => {
|
||||
|
||||
const toolbarRef = ref<HTMLElement>();
|
||||
const searchRef = ref<HTMLElement>();
|
||||
const actualToolbarHeight = ref(70); // 默认工具栏高度
|
||||
const actualSearchHeight = ref(160); // 默认搜索栏高度
|
||||
const windowHeight = ref(window.innerHeight);
|
||||
|
||||
/** 计算搜索栏实际高度 */
|
||||
const calculateSearchHeight = () => {
|
||||
nextTick(() => {
|
||||
if (searchRef.value && showSearch.value) {
|
||||
// 获取搜索栏元素的完整高度,包括边距和内边距
|
||||
const rect = searchRef.value.getBoundingClientRect();
|
||||
const computedStyle = window.getComputedStyle(searchRef.value);
|
||||
const marginTop = parseFloat(computedStyle.marginTop);
|
||||
const marginBottom = parseFloat(computedStyle.marginBottom);
|
||||
actualSearchHeight.value = rect.height + marginTop + marginBottom;
|
||||
} else {
|
||||
// 如果搜索栏隐藏,高度为0
|
||||
actualSearchHeight.value = 0;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 计算工具栏实际高度 */
|
||||
const calculateToolbarHeight = () => {
|
||||
nextTick(() => {
|
||||
if (toolbarRef.value) {
|
||||
// 获取工具栏元素的完整高度,包括边距和内边距
|
||||
const toolbarElement = toolbarRef.value.closest('.el-card__header');
|
||||
if (toolbarElement) {
|
||||
const rect = toolbarElement.getBoundingClientRect();
|
||||
const computedStyle = window.getComputedStyle(toolbarElement);
|
||||
const marginTop = parseFloat(computedStyle.marginTop);
|
||||
const marginBottom = parseFloat(computedStyle.marginBottom);
|
||||
actualToolbarHeight.value = rect.height + marginTop + marginBottom;
|
||||
} else {
|
||||
// 如果找不到父元素,直接使用工具栏元素高度
|
||||
const rect = toolbarRef.value.getBoundingClientRect();
|
||||
actualToolbarHeight.value = rect.height + 20; // 添加一些边距
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 窗口大小变化监听 */
|
||||
const handleResize = () => {
|
||||
windowHeight.value = window.innerHeight;
|
||||
// 窗口大小变化时重新计算搜索栏和工具栏高度
|
||||
calculateSearchHeight();
|
||||
calculateToolbarHeight();
|
||||
};
|
||||
|
||||
/** 计算表格高度 */
|
||||
const tableHeight = computed(() => {
|
||||
// 精确计算:窗口高度 - 搜索栏高度 - 工具栏高度 - 分页栏高度 - 页面边距 - 分页栏底部边距
|
||||
const searchHeight = actualSearchHeight.value; // 实际搜索栏高度
|
||||
const toolbarHeight = actualToolbarHeight.value; // 实际工具栏高度
|
||||
const pageTopPadding = 8; // 页面顶部边距
|
||||
const pageBottomMargin = 10; // 分页栏距离底部的边距
|
||||
const paginationOwnHeight = 32; // 分页组件自身高度
|
||||
const paginationPadding = 20; // 分页栏上下内边距
|
||||
const cardPadding = 40; // 卡片内边距(上下各20px)
|
||||
|
||||
// 总的固定高度 = 搜索栏 + 工具栏 + 分页栏自身高度 + 分页栏内边距 + 页面边距 + 底部边距 + 卡片边距
|
||||
const fixedHeight = searchHeight + toolbarHeight + paginationOwnHeight + paginationPadding + pageTopPadding + pageBottomMargin + cardPadding;
|
||||
|
||||
const calculatedHeight = windowHeight.value - fixedHeight - 35;
|
||||
|
||||
// 确保至少有300px的表格高度,避免过小
|
||||
return Math.max(calculatedHeight, 300);
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
getCategoryList();
|
||||
// 初始计算搜索栏和工具栏高度
|
||||
calculateSearchHeight();
|
||||
calculateToolbarHeight();
|
||||
// 监听窗口大小变化
|
||||
window.addEventListener('resize', handleResize);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
// 移除监听器
|
||||
window.removeEventListener('resize', handleResize);
|
||||
});
|
||||
</script>
|
||||
<style scoped>
|
||||
/* 页面容器样式 */
|
||||
.page-container {
|
||||
height: calc(100vh - 85px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
padding: 8px 8px 0 8px !important; /* 顶部和左右边距,底部无边距 */
|
||||
}
|
||||
|
||||
/* 隐藏滚动条但保持滚动功能 */
|
||||
.page-container::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.page-container {
|
||||
-ms-overflow-style: none; /* IE and Edge */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
/* 表格卡片布局 */
|
||||
.table-card {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.table-card :deep(.el-card__body) {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
padding: 0px 20px 0 20px !important;
|
||||
min-height: 0;
|
||||
margin-bottom: 0 !important;
|
||||
padding: 0px 20px 20px 20px !important;
|
||||
}
|
||||
|
||||
/* 表格主体 */
|
||||
.table-main {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
/* 表格容器 */
|
||||
.table-container {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* 分页容器固定在底部 */
|
||||
/* 分页容器样式 */
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
padding-top: 10px 0 0 0 !important;
|
||||
margin: 0 !important;
|
||||
/* padding-bottom: 10px !important; 距离底部10px */
|
||||
/* margin: 0 !important; */
|
||||
/* margin-bottom: 10px !important; 确保距离视窗底部10px */
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 16px 20px 0 0 !important;
|
||||
background-color: #fff;
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
/* 移除按钮栏底部边框 */
|
||||
@@ -524,12 +418,12 @@ onUnmounted(() => {
|
||||
border-bottom: none !important;
|
||||
}
|
||||
|
||||
/* 文本省略号样式 */
|
||||
/* 文字省略样式 */
|
||||
.text-ellipsis {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
/* cursor: help; */
|
||||
max-width: 200px;
|
||||
display: inline-block;
|
||||
}
|
||||
</style>
|
||||
@@ -82,7 +82,6 @@
|
||||
|
||||
<div class="table-container">
|
||||
<el-table
|
||||
:height="tableHeight"
|
||||
v-loading="loading"
|
||||
border
|
||||
:data="satSurveyList"
|
||||
@@ -2054,161 +2053,30 @@ const exportRawData = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const toolbarRef = ref<any>();
|
||||
const searchRef = ref<HTMLElement>();
|
||||
const actualToolbarHeight = ref(70); // 默认工具栏高度
|
||||
const actualSearchHeight = ref(160); // 默认搜索栏高度
|
||||
const windowHeight = ref(window.innerHeight);
|
||||
|
||||
/** 计算搜索栏实际高度 */
|
||||
const calculateSearchHeight = () => {
|
||||
nextTick(() => {
|
||||
if (searchRef.value && showSearch.value) {
|
||||
// 获取搜索栏元素的完整高度,包括边距和内边距
|
||||
const rect = searchRef.value.getBoundingClientRect();
|
||||
const computedStyle = window.getComputedStyle(searchRef.value);
|
||||
const marginTop = parseFloat(computedStyle.marginTop);
|
||||
const marginBottom = parseFloat(computedStyle.marginBottom);
|
||||
actualSearchHeight.value = rect.height + marginTop + marginBottom;
|
||||
} else {
|
||||
// 如果搜索栏隐藏,高度为0
|
||||
actualSearchHeight.value = 0;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 计算工具栏实际高度 */
|
||||
const calculateToolbarHeight = () => {
|
||||
nextTick(() => {
|
||||
if (toolbarRef.value) {
|
||||
// 获取工具栏DOM元素,toolbarRef.value是组件实例,需要通过$el获取DOM元素
|
||||
const toolbarDom = toolbarRef.value.$el || toolbarRef.value;
|
||||
|
||||
// 检查是否是有效的DOM元素
|
||||
if (toolbarDom && typeof toolbarDom.closest === 'function') {
|
||||
// 获取工具栏元素的完整高度,包括边距和内边距
|
||||
const toolbarElement = toolbarDom.closest('.el-card__header');
|
||||
if (toolbarElement) {
|
||||
const rect = toolbarElement.getBoundingClientRect();
|
||||
const computedStyle = window.getComputedStyle(toolbarElement);
|
||||
const marginTop = parseFloat(computedStyle.marginTop);
|
||||
const marginBottom = parseFloat(computedStyle.marginBottom);
|
||||
actualToolbarHeight.value = rect.height + marginTop + marginBottom;
|
||||
} else {
|
||||
// 如果找不到父元素,直接使用工具栏元素高度
|
||||
const rect = toolbarDom.getBoundingClientRect();
|
||||
actualToolbarHeight.value = rect.height + 20; // 添加一些边距
|
||||
}
|
||||
} else {
|
||||
// 如果无法获取DOM元素,使用默认高度
|
||||
actualToolbarHeight.value = 70;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 窗口大小变化监听 */
|
||||
const handleResize = () => {
|
||||
windowHeight.value = window.innerHeight;
|
||||
// 窗口大小变化时重新计算搜索栏和工具栏高度
|
||||
calculateSearchHeight();
|
||||
calculateToolbarHeight();
|
||||
};
|
||||
|
||||
/** 计算表格高度 */
|
||||
const tableHeight = computed(() => {
|
||||
// 精确计算:窗口高度 - 搜索栏高度 - 工具栏高度 - 分页栏高度 - 页面边距 - 分页栏底部边距
|
||||
const searchHeight = actualSearchHeight.value; // 实际搜索栏高度
|
||||
const toolbarHeight = actualToolbarHeight.value; // 实际工具栏高度
|
||||
const pageTopPadding = 8; // 页面顶部边距
|
||||
const pageBottomMargin = 10; // 分页栏距离底部的边距
|
||||
const paginationOwnHeight = 32; // 分页组件自身高度
|
||||
const paginationPadding = 20; // 分页栏上下内边距
|
||||
const cardPadding = 40; // 卡片内边距(上下各20px)
|
||||
|
||||
// 总的固定高度 = 搜索栏 + 工具栏 + 分页栏自身高度 + 分页栏内边距 + 页面边距 + 底部边距 + 卡片边距
|
||||
const fixedHeight = searchHeight + toolbarHeight + paginationOwnHeight + paginationPadding + pageTopPadding + pageBottomMargin + cardPadding;
|
||||
|
||||
const calculatedHeight = windowHeight.value - fixedHeight - 45;
|
||||
|
||||
// 确保至少有300px的表格高度,避免过小
|
||||
return Math.max(calculatedHeight, 300);
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
// 初始计算搜索栏和工具栏高度
|
||||
calculateSearchHeight();
|
||||
calculateToolbarHeight();
|
||||
// 监听窗口大小变化
|
||||
window.addEventListener('resize', handleResize);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
// 移除监听器
|
||||
window.removeEventListener('resize', handleResize);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 页面容器样式 */
|
||||
.page-container {
|
||||
height: calc(100vh - 85px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
padding: 8px 8px 0 8px !important; /* 顶部和左右边距,底部无边距 */
|
||||
}
|
||||
|
||||
/* 自定义页面滚动条样式 */
|
||||
.page-container::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
.page-container::-webkit-scrollbar-track {
|
||||
background: #f1f1f1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.page-container::-webkit-scrollbar-thumb {
|
||||
background: #c1c1c1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.page-container::-webkit-scrollbar-thumb:hover {
|
||||
background: #a8a8a8;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
/* 表格卡片布局 */
|
||||
.table-card {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.table-card :deep(.el-card__body) {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
padding: 0px 20px 0 20px !important;
|
||||
min-height: 0;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
/* 表格主体 */
|
||||
.table-main {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
padding: 0px 20px 20px 20px !important;
|
||||
}
|
||||
|
||||
/* 表格容器 - 支持横向滚动 */
|
||||
.table-container {
|
||||
width: 100%;
|
||||
/* overflow: hidden; */
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* 横向滚动表格样式 */
|
||||
@@ -2284,14 +2152,13 @@ onUnmounted(() => {
|
||||
background-color: #f5f7fa !important;
|
||||
}
|
||||
|
||||
/* 分页容器固定在底部 */
|
||||
/* 分页容器样式 */
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
padding-top: 10px 0 0 0 !important;
|
||||
margin: 0 !important;
|
||||
/* padding-bottom: 10px !important; 距离底部10px */
|
||||
/* margin: 0 !important; */
|
||||
/* margin-bottom: 10px !important; 确保距离视窗底部10px */
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 16px 20px 0 0 !important;
|
||||
background-color: #fff;
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
/* 移除按钮栏底部边框 */
|
||||
|
||||
Reference in new issue
Block a user