Sfoglia il codice sorgente

fix(question): 修复表格滚动和分页问题,优化时间显示

- 添加表格水平滚动支持
- 修复分页参数传递错误
- 优化创建时间显示格式
- 调整分页组件样式居中显示
tanshanming 7 mesi fa
parent
commit
a6c4724a1e
1 ha cambiato i file con 20 aggiunte e 8 eliminazioni
  1. 20 8
      src/views/exm/question/index.vue

+ 20 - 8
src/views/exm/question/index.vue

@@ -56,6 +56,7 @@
 			bordered
 			style="margin-top: 16px"
 			tableLayout="fixed"
+			:scroll="{ x: 'max-content' }"
 		>
 			<a-table-column title="Id" data-index="id" key="id" width="90px" />
 			<a-table-column
@@ -72,7 +73,7 @@
 				width="90px"
 				:customRender="questionTypeFormatter"
 			/>
-			<a-table-column title="题干" data-index="shortTitle" key="shortTitle" ellipsis />
+			<a-table-column title="题干" data-index="shortTitle" key="shortTitle" ellipsis width="350px" />
 			<a-table-column title="分数" data-index="score" key="score" width="90px" />
 			<a-table-column title="难度" data-index="difficult" key="difficult" width="110px">
 				<template #default="{ text }">
@@ -80,7 +81,11 @@
 					<StarOutlined v-for="n in 5 - Number(text)" :key="'empty' + n" style="color: #e8e8e8" />
 				</template>
 			</a-table-column>
-			<a-table-column title="创建时间" data-index="createTime" key="createTime" width="120px" />
+			<a-table-column title="创建时间" data-index="createTime" key="createTime" width="180px">
+				<template #default="{ text }">
+					{{ parseTime(text, '{y}-{m}-{d} {h}:{i}:{s}') }}
+				</template>
+			</a-table-column>
 			<a-table-column title="操作" key="action" width="200px">
 				<template #default="{ record }">
 					<a-button size="small" style="margin-right: 8px" @click="showQuestion(record)">预览</a-button>
@@ -94,9 +99,10 @@
 			:total="total"
 			:page-size="queryParam.pageSize"
 			:current="queryParam.pageIndex"
+			:showSizeChanger="true"
 			@change="onPageChange"
 			@showSizeChange="onPageSizeChange"
-			style="margin-top: 16px; text-align: right"
+			style="margin-top: 16px; text-align: right; display: flex; justify-content: center"
 		/>
 		<a-modal v-model:visible="questionShow.dialog" width="800px" :footer="null" :bodyStyle="{ padding: '24px' }">
 			<div v-if="questionShow.loading" style="text-align: center; padding: 40px 0">
@@ -143,6 +149,7 @@
 	import customPagination from '@/components/customPagination.vue'
 	import { StarFilled, StarOutlined } from '@ant-design/icons-vue'
 	import { Modal } from 'ant-design-vue'
+	import { parseTime } from '@/utils/exam'
 
 	const examStore = useExamStore()
 
@@ -151,8 +158,8 @@
 		questionType: null,
 		level: null,
 		subjectId: null,
-		current: 1,
-		size: 10
+		pageIndex: 1,
+		pageSize: 10
 	})
 
 	const subjectFilter = ref([])
@@ -203,10 +210,15 @@
 
 	const search = () => {
 		listLoading.value = true
+		const params = {
+			...queryParam,
+			current: queryParam.pageIndex,
+			size: queryParam.pageSize
+		}
+		delete params.pageIndex
+		delete params.pageSize
 		tQuestionApi
-			.pageList({
-				...queryParam
-			})
+			.pageList(params)
 			.then((data) => {
 				const re = data
 				tableData.value = re.records