|
@@ -1,103 +1,181 @@
|
|
|
<template>
|
|
|
<div class="scan-check-miss h-full">
|
|
|
- <qm-low-form
|
|
|
- :params="searchParams"
|
|
|
- :fields="searchFields"
|
|
|
- :label-width="80"
|
|
|
- ></qm-low-form>
|
|
|
- <a-table :data-source="tableData" :columns="columns" size="middle" bordered>
|
|
|
+ <qm-low-form :params="params" :fields="fields" :label-width="80">
|
|
|
+ <template #subjectCode>
|
|
|
+ <SelectSubject
|
|
|
+ v-model="params.subjectCode"
|
|
|
+ :exam-id="userStore.curExam?.id as number"
|
|
|
+ ></SelectSubject>
|
|
|
+ </template>
|
|
|
+ </qm-low-form>
|
|
|
+ <a-table
|
|
|
+ :data-source="dataList"
|
|
|
+ :columns="columns"
|
|
|
+ size="middle"
|
|
|
+ bordered
|
|
|
+ :loading="loading"
|
|
|
+ :pagination="pagination"
|
|
|
+ >
|
|
|
+ <template #bodyCell="{ column, record }">
|
|
|
+ <template v-if="column.dataIndex === 'scanned'">
|
|
|
+ {{ record[column.dataIndex] }}
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
</a-table>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script name="ScanCheckMiss" lang="ts" setup>
|
|
|
-import { ref, computed } from "vue";
|
|
|
+import { ref, reactive, computed } from "vue";
|
|
|
+import SelectSubject from "@/components/SelectSubject/index.vue";
|
|
|
+import { useUserStore } from "@/store";
|
|
|
+import { useRequest } from "vue-request";
|
|
|
+import useTable from "@/hooks/useTable";
|
|
|
+import { downloadByApi } from "@/utils/download";
|
|
|
+
|
|
|
+import {
|
|
|
+ getSiteList,
|
|
|
+ getCampusList,
|
|
|
+ getScannedList,
|
|
|
+ exportScanned,
|
|
|
+} from "@/ap/baseDataConfig";
|
|
|
import type { TableColumnsType } from "@qmth/ui";
|
|
|
-//todo 入参名
|
|
|
-const searchParams = ref({
|
|
|
- a: "",
|
|
|
- b: "",
|
|
|
- c: "",
|
|
|
- d: "",
|
|
|
- e: "",
|
|
|
- f: "",
|
|
|
+const userStore = useUserStore();
|
|
|
+
|
|
|
+//考点下拉
|
|
|
+const { data: examSiteOptions, run: runSite } = useRequest(getSiteList);
|
|
|
+const { data: examCampusOptions, run: runCampus } = useRequest(getCampusList);
|
|
|
+runSite({ examId: userStore.curExam?.id });
|
|
|
+runCampus({ examId: userStore.curExam?.id });
|
|
|
+
|
|
|
+const params = reactive({
|
|
|
+ subjectCode: "",
|
|
|
+ province: "",
|
|
|
+ examSite: "",
|
|
|
+ campusCode: "",
|
|
|
+ examRoom: "",
|
|
|
+ scanned: null,
|
|
|
});
|
|
|
-const searchFields = ref([
|
|
|
- {
|
|
|
- prop: "a",
|
|
|
- type: "select",
|
|
|
- colSpan: 3,
|
|
|
- label: "科目",
|
|
|
- },
|
|
|
- {
|
|
|
- prop: "b",
|
|
|
- type: "select",
|
|
|
- colSpan: 3,
|
|
|
- label: "省份",
|
|
|
- },
|
|
|
- {
|
|
|
- prop: "c",
|
|
|
- type: "select",
|
|
|
- colSpan: 3,
|
|
|
- label: "考点",
|
|
|
- },
|
|
|
- {
|
|
|
- prop: "d",
|
|
|
- type: "select",
|
|
|
- colSpan: 3,
|
|
|
- label: "校区",
|
|
|
- },
|
|
|
- {
|
|
|
- prop: "e",
|
|
|
- type: "select",
|
|
|
- colSpan: 3,
|
|
|
- label: "考场号",
|
|
|
- },
|
|
|
- {
|
|
|
- prop: "f",
|
|
|
- type: "select",
|
|
|
- colSpan: 3,
|
|
|
- label: "扫描状态",
|
|
|
- },
|
|
|
- {
|
|
|
- type: "buttons",
|
|
|
- colSpan: 5,
|
|
|
- children: [
|
|
|
- {
|
|
|
- text: "查询",
|
|
|
+const transParams = computed(() => {
|
|
|
+ return { ...params, examId: userStore.curExam?.id };
|
|
|
+});
|
|
|
+const { dataList, pagination, loading, getList, toPage } = useTable(
|
|
|
+ getScannedList,
|
|
|
+ transParams,
|
|
|
+ true
|
|
|
+);
|
|
|
+const fields = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ cell: "subjectCode",
|
|
|
+ type: "select",
|
|
|
+ colSpan: 3,
|
|
|
+ label: "科目",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: "province",
|
|
|
+ type: "select",
|
|
|
+ colSpan: 3,
|
|
|
+ label: "省份",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: "examSite",
|
|
|
+ type: "select",
|
|
|
+ colSpan: 3,
|
|
|
+ label: "考点",
|
|
|
+ attrs: {
|
|
|
+ options: examSiteOptions.value || [],
|
|
|
+ fieldNames: { label: "name", value: "code" },
|
|
|
},
|
|
|
- {
|
|
|
- text: "导出",
|
|
|
- attrs: {
|
|
|
- type: "default",
|
|
|
- },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: "campusCode",
|
|
|
+ type: "select",
|
|
|
+ colSpan: 3,
|
|
|
+ label: "校区",
|
|
|
+ attrs: {
|
|
|
+ options: examCampusOptions.value || [],
|
|
|
+ fieldNames: { label: "name", value: "code" },
|
|
|
},
|
|
|
- ],
|
|
|
- },
|
|
|
-]);
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: "examRoom",
|
|
|
+ type: "select",
|
|
|
+ colSpan: 3,
|
|
|
+ label: "考场号",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: "scanned",
|
|
|
+ type: "select",
|
|
|
+ colSpan: 3,
|
|
|
+ label: "扫描状态",
|
|
|
+ attrs: {
|
|
|
+ options: [
|
|
|
+ { value: true, label: "已扫描" },
|
|
|
+ { value: false, label: "未扫描" },
|
|
|
+ ],
|
|
|
+ allowClear: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "buttons",
|
|
|
+ colSpan: 5,
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ text: "查询",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ text: "导出",
|
|
|
+ attrs: {
|
|
|
+ type: "default",
|
|
|
+ loading: exportLoading.value,
|
|
|
+ },
|
|
|
+ onClick: () => {
|
|
|
+ exportFile();
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
|
|
|
-const tableData = ref([{ a: 1, b: 2, c: 3 }]);
|
|
|
const columns: TableColumnsType = [
|
|
|
{
|
|
|
title: "科目",
|
|
|
- dataIndex: "a",
|
|
|
+ dataIndex: "subjectName",
|
|
|
},
|
|
|
{
|
|
|
title: "考点",
|
|
|
- dataIndex: "b",
|
|
|
+ dataIndex: "examSite",
|
|
|
},
|
|
|
{
|
|
|
title: "校区",
|
|
|
- dataIndex: "c",
|
|
|
+ dataIndex: "campusCode",
|
|
|
},
|
|
|
{
|
|
|
title: "考场号",
|
|
|
- dataIndex: "d",
|
|
|
+ dataIndex: "examRoom",
|
|
|
},
|
|
|
{
|
|
|
title: "扫描状态",
|
|
|
- dataIndex: "e",
|
|
|
+ dataIndex: "scanned",
|
|
|
},
|
|
|
];
|
|
|
+const exportLoading = ref(false);
|
|
|
+const exportFile = async () => {
|
|
|
+ if (exportLoading.value) return;
|
|
|
+ exportLoading.value = true;
|
|
|
+
|
|
|
+ downloadByApi(() => exportScanned(transParams.value))
|
|
|
+ .then(() => {
|
|
|
+ window.$message.success("导出成功!");
|
|
|
+ })
|
|
|
+ .catch((e: Error) => {
|
|
|
+ window.$message.error(e.message || "下载失败,请重新尝试!");
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ exportLoading.value = false;
|
|
|
+ });
|
|
|
+};
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
|
.scan-check-miss {
|