|
@@ -27,7 +27,7 @@
|
|
|
>
|
|
|
</a-form-item>
|
|
|
</a-form>
|
|
|
- <a-button
|
|
|
+ <!-- <a-button
|
|
|
type="primary"
|
|
|
class="tw-flex tw-items-center operation-button"
|
|
|
@click="syncExamData"
|
|
@@ -36,7 +36,7 @@
|
|
|
<CloudSyncOutlined />
|
|
|
</template>
|
|
|
同步
|
|
|
- </a-button>
|
|
|
+ </a-button> -->
|
|
|
<a-button
|
|
|
type="primary"
|
|
|
class="tw-flex tw-items-center operation-button"
|
|
@@ -53,6 +53,12 @@
|
|
|
:columns="columns"
|
|
|
:data-source="examTableData.result"
|
|
|
emptyText="暂无考试信息"
|
|
|
+ :loading="tableLoading"
|
|
|
+ :pagination="{
|
|
|
+ total: examTableData.totalCount,
|
|
|
+ pageSize: query.pageSize,
|
|
|
+ }"
|
|
|
+ @change="currentPageChange"
|
|
|
:row-class-name="
|
|
|
(_:any, index:number) => (index % 2 === 1 ? 'table-striped' : null)
|
|
|
"
|
|
@@ -62,13 +68,7 @@
|
|
|
{{ index + 1 }}
|
|
|
</template>
|
|
|
<template v-else-if="column.dataIndex === 'examStatus'">
|
|
|
- {{
|
|
|
- record.examStatus === "EDIT"
|
|
|
- ? "开放上报"
|
|
|
- : record.examStatus === "FINISH"
|
|
|
- ? "停止上报"
|
|
|
- : "关闭卡松是"
|
|
|
- }}
|
|
|
+ {{ EXAM_STATUS[record.examStatus as keyof typeof EXAM_STATUS] }}
|
|
|
</template>
|
|
|
<template v-else-if="column.dataIndex === 'operation'">
|
|
|
<div class="tw-flex tw-items-center">
|
|
@@ -84,18 +84,19 @@
|
|
|
</Block>
|
|
|
<a-modal
|
|
|
v-model:visible="showModal"
|
|
|
- title="新增考试"
|
|
|
+ :title="`${examInfo.id ? '编辑' :'新增'}考试`"
|
|
|
okText="确定"
|
|
|
cancelText="取消"
|
|
|
:maskClosable="false"
|
|
|
@ok="onAddNewExam"
|
|
|
- :afterClose="resetExamInfo"
|
|
|
+ :afterClose="resetFields"
|
|
|
>
|
|
|
<a-form :labelCol="{ span: 6 }">
|
|
|
<a-form-item label="学校名称" v-bind="validateInfos.schoolId">
|
|
|
<a-select
|
|
|
v-model:value="examInfo.schoolId"
|
|
|
show-search
|
|
|
+ :disabled="!!examInfo.id"
|
|
|
@search="querySchoolList"
|
|
|
:filterOption="false"
|
|
|
placeholder="学校名称"
|
|
@@ -113,9 +114,15 @@
|
|
|
</a-form-item>
|
|
|
<a-form-item label="状态" v-bind="validateInfos.examStatus">
|
|
|
<a-select v-model:value="examInfo.examStatus">
|
|
|
- <a-select-option value="EDIT">开放上报</a-select-option>
|
|
|
- <a-select-option value="FINISH">停止上报</a-select-option>
|
|
|
- <a-select-option value="CLOSE">关闭考试</a-select-option>
|
|
|
+ <a-select-option value="EDIT">{{
|
|
|
+ EXAM_STATUS.EDIT
|
|
|
+ }}</a-select-option>
|
|
|
+ <a-select-option value="FINISH">{{
|
|
|
+ EXAM_STATUS.FINISH
|
|
|
+ }}</a-select-option>
|
|
|
+ <a-select-option value="CLOSE">{{
|
|
|
+ EXAM_STATUS.CLOSE
|
|
|
+ }}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
|
</a-form>
|
|
@@ -125,7 +132,7 @@
|
|
|
|
|
|
<script setup lang="ts" name="PageExam">
|
|
|
import { reactive, ref, watch } from "vue";
|
|
|
-import { PlusCircleOutlined, CloudSyncOutlined } from "@ant-design/icons-vue";
|
|
|
+import { PlusCircleOutlined } from "@ant-design/icons-vue";
|
|
|
import { getSchoolListHttp } from "@/apis/school";
|
|
|
import {
|
|
|
getExamListHttp,
|
|
@@ -135,10 +142,14 @@ import {
|
|
|
import Block from "@/components/block/index.vue";
|
|
|
import { message, TableColumnType } from "ant-design-vue";
|
|
|
import { Form } from "ant-design-vue";
|
|
|
-
|
|
|
import { throttle } from "lodash-es";
|
|
|
+import { EXAM_STATUS } from "@/constants/dicts";
|
|
|
+import { useMainStore } from "@/store/main";
|
|
|
+
|
|
|
+const userInfo = useMainStore();
|
|
|
|
|
|
const showModal = ref(false);
|
|
|
+const tableLoading = ref(false);
|
|
|
|
|
|
const examInfo = ref<BaseExamInfo>({
|
|
|
examStatus: "",
|
|
@@ -153,14 +164,17 @@ const examRules = {
|
|
|
schoolId: [{ required: true, message: "请选择学校" }],
|
|
|
};
|
|
|
|
|
|
-const { validate, validateInfos } = Form.useForm(examInfo.value, examRules);
|
|
|
+const { validate, validateInfos, resetFields } = Form.useForm(
|
|
|
+ examInfo.value,
|
|
|
+ examRules
|
|
|
+);
|
|
|
|
|
|
/** 请求参数 */
|
|
|
const query = reactive<FetchExamListQuery>({
|
|
|
name: "",
|
|
|
- schoolId: "",
|
|
|
+ schoolId: userInfo.systemUserInfo?.schoolId || "",
|
|
|
pageNumber: 1,
|
|
|
- pageSize: 10,
|
|
|
+ pageSize: 8,
|
|
|
});
|
|
|
|
|
|
/** table配置 */
|
|
@@ -188,11 +202,13 @@ const examTableData = reactive<MultiplePageData<ExamListInfo>>({
|
|
|
/** 查询学校列表 */
|
|
|
const querySchoolList = throttle(async (name: string = "") => {
|
|
|
try {
|
|
|
+ tableLoading.value = true;
|
|
|
const { result = [], totalCount } = await getSchoolListHttp({
|
|
|
pageNumber: 1,
|
|
|
pageSize: 10,
|
|
|
name,
|
|
|
});
|
|
|
+ tableLoading.value = false;
|
|
|
Object.assign(schoolTableData, { result, totalCount });
|
|
|
} catch (error) {
|
|
|
console.error(error);
|
|
@@ -217,10 +233,9 @@ const queryExamList = async () => {
|
|
|
watch(() => query.pageNumber, queryExamList);
|
|
|
|
|
|
/** 编辑考试 */
|
|
|
-
|
|
|
const onEdit = (record: ExamListInfo) => {
|
|
|
- examInfo.value = Object.assign(examInfo.value, { ...record });
|
|
|
- toggleAddExamModal(true);
|
|
|
+ Object.assign(examInfo.value, { ...record });
|
|
|
+ toggleAddExamModal(true);
|
|
|
};
|
|
|
|
|
|
/** 新增考试 */
|
|
@@ -236,14 +251,8 @@ const onAddNewExam = () => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
-/** 初始化examInfo */
|
|
|
-const resetExamInfo = () => {
|
|
|
- examInfo.value = Object.assign(examInfo.value, {
|
|
|
- examStatus: "",
|
|
|
- name: "",
|
|
|
- schoolId: "",
|
|
|
- id: void 0,
|
|
|
- });
|
|
|
+const currentPageChange = ({ current }: { current: number }) => {
|
|
|
+ query.pageNumber = current;
|
|
|
};
|
|
|
|
|
|
/** 同步考试数据 */
|