Quellcode durchsuchen

考试培训统计增加分页

zjq vor 5 Tagen
Ursprung
Commit
052d630285

+ 15 - 1
src/views/examTrain/exam/statistics/missExamUsers.vue

@@ -15,6 +15,15 @@
 						</el-form-item>
 					</el-form>
 				</template>
+				<template #pager>
+					<pagination
+						@pagination="queryList"
+						:total="state.total"
+						v-model:current-page="state.queryParams.PageIndex"
+						v-model:page-size="state.queryParams.PageSize"
+						:disabled="state.loading"
+					/>
+				</template>
 			</vxe-grid>
 		</div>
 	</div>
@@ -29,12 +38,16 @@ import Other from '@/utils/other';
 
 // 引入组件
 const StatisticalTime = defineAsyncComponent(() => import('@/components/StatisticalTime/index.vue')); // 日期类型选择组件
+const pagination = defineAsyncComponent(() => import('@/components/ProTable/components/Pagination.vue')); // 分页
 
 // 定义变量内容
 const state = reactive<any>({
 	loading: false,
+	total: 0, // 总数
 	queryParams: {
 		// 查询参数
+		PageIndex: 1,
+		PageSize: 20,
 		crTime: defaultDate, // 时间默认今天开始到今天结束
 		startTime: null,
 		endTime: null,
@@ -108,7 +121,8 @@ const queryList = () => {
 	getMissExamUsersData(requestParams.value)
 		.then((res) => {
 			state.loading = false;
-			gridOptions.data = res.result.item ?? [];
+			gridOptions.data = res.result.items ?? [];
+			state.total = res?.result.pagination.totalCount ?? 0;
 			gridOptions.loading = false;
 		})
 		.finally(() => {

+ 15 - 1
src/views/examTrain/exam/statistics/scoresAnalysis.vue

@@ -24,6 +24,15 @@
 						</el-form-item>
 					</el-form>
 				</template>
+				<template #pager>
+					<pagination
+						@pagination="queryList"
+						:total="state.total"
+						v-model:current-page="state.queryParams.PageIndex"
+						v-model:page-size="state.queryParams.PageSize"
+						:disabled="state.loading"
+					/>
+				</template>
 			</vxe-grid>
 		</div>
 	</div>
@@ -38,12 +47,16 @@ import Other from '@/utils/other';
 
 // 引入组件
 const StatisticalTime = defineAsyncComponent(() => import('@/components/StatisticalTime/index.vue')); // 日期类型选择组件
+const pagination = defineAsyncComponent(() => import('@/components/ProTable/components/Pagination.vue')); // 分页
 
 // 定义变量内容
 const state = reactive<any>({
 	loading: false,
+	total: 0, // 总数
 	queryParams: {
 		// 查询参数
+		PageIndex: 1,
+		PageSize: 20,
 		crTime: defaultDate, // 时间默认今天开始到今天结束
         keyword: '',
         minScore: 0,
@@ -141,7 +154,8 @@ const queryList = () => {
 	getScoresAnalysisData(requestParams.value)
 		.then((res) => {
 			state.loading = false;
-			gridOptions.data = res.result.item ?? [];
+			gridOptions.data = res.result.items ?? [];
+			state.total = res?.result.pagination.totalCount ?? 0;
 			gridOptions.loading = false;
 		})
 		.finally(() => {

+ 18 - 3
src/views/examTrain/train/statistics/resultAnalysis.vue

@@ -18,7 +18,17 @@
 			<el-row :gutter="20">
                 <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
 					<div style="height: 70vh">
-						<vxe-grid v-bind="gridOptions" ref="gridRef"> </vxe-grid>
+						<vxe-grid v-bind="gridOptions" ref="gridRef">
+							<template #pager>
+								<pagination
+									@pagination="queryList"
+									:total="state.total"
+									v-model:current-page="state.queryParams.PageIndex"
+									v-model:page-size="state.queryParams.PageSize"
+									:disabled="state.loading"
+								/>
+							</template>
+						</vxe-grid>
 					</div>
 				</el-col>
 				<el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
@@ -36,12 +46,16 @@ import Other from '@/utils/other';
 import { getTrainResultAnalysisData, getTrainCalcuteAnalysisData } from '@/api/examTrain/statistics';
 
 const StatisticalTime = defineAsyncComponent(() => import('@/components/StatisticalTime/index.vue')); // 日期类型选择组件
+const pagination = defineAsyncComponent(() => import('@/components/ProTable/components/Pagination.vue')); // 分页
+
 // 定义变量内容
 const ruleFormRef = ref<RefType>(); // 表单ref
 const state = reactive<any>({
 	queryParams: {
 		// 查询条件
-		crTime: defaultDate, //
+		PageIndex: 1,
+		PageSize: 20,
+		crTime: defaultDate, 
 		startTime: null,
 		endTime: null,
         keyword: ''
@@ -100,7 +114,8 @@ const queryList = async () => {
     Reflect.deleteProperty(requestParams.value, 'crTime');
     getTrainResultAnalysisData(requestParams.value)
     .then((res) => {
-        gridOptions.data = res.result.item ?? [];
+        gridOptions.data = res.result.items ?? [];
+		state.total = res?.result.pagination.totalCount ?? 0;
     });
     getTrainCalcuteAnalysisData(requestParams.value)
     .then((res) => {