|
@@ -1,123 +1,162 @@
|
|
|
<template>
|
|
|
+ <div class="part-box is-filter">
|
|
|
+ <a-space class="filter-line" :size="12" wrap>
|
|
|
+ <SelectSemester
|
|
|
+ v-model="searchModel.semesterId"
|
|
|
+ :clearable="false"
|
|
|
+ select-default
|
|
|
+ placeholder="请选择"
|
|
|
+ />
|
|
|
+ <SelectExam
|
|
|
+ v-model="searchModel.examId"
|
|
|
+ :semester-id="searchModel.semesterId"
|
|
|
+ :clearable="false"
|
|
|
+ select-default
|
|
|
+ placeholder="请选择"
|
|
|
+ @default-selected="toPage(1)"
|
|
|
+ />
|
|
|
+ <SelectCourse
|
|
|
+ v-model="searchModel.courseId"
|
|
|
+ :semester-id="searchModel.semesterId"
|
|
|
+ :exam-id="searchModel.examId"
|
|
|
+ placeholder="请选择"
|
|
|
+ />
|
|
|
+ <SelectPaperNumber
|
|
|
+ v-model="searchModel.paperNumber"
|
|
|
+ :semester-id="searchModel.semesterId"
|
|
|
+ :exam-id="searchModel.examId"
|
|
|
+ :course-id="searchModel.courseId"
|
|
|
+ placeholder="请选择"
|
|
|
+ />
|
|
|
+ <a-button type="primary" @click="toPage(1)">查询</a-button>
|
|
|
+ </a-space>
|
|
|
+ </div>
|
|
|
<div class="part-box">
|
|
|
- <a-form ref="formRef" :model="formData" :rules="rules" auto-label-width>
|
|
|
- <a-form-item field="semesterId" label="学期">
|
|
|
- <!-- <SelectSemester v-model="formData.semesterId" placeholder="请选择" /> -->
|
|
|
- </a-form-item>
|
|
|
- <a-form-item field="examId" label="考试">
|
|
|
- <!-- <SelectExam v-model="formData.examId" placeholder="请选择" /> -->
|
|
|
- </a-form-item>
|
|
|
- <a-form-item field="extType" label="文件类型">
|
|
|
- <a-radio-group v-model="formData.extType">
|
|
|
- <a-radio
|
|
|
- v-for="(option, index) in extOptions"
|
|
|
- :key="index"
|
|
|
- :value="option.value"
|
|
|
- >{{ option.label }}</a-radio
|
|
|
- >
|
|
|
- </a-radio-group>
|
|
|
- </a-form-item>
|
|
|
- <a-form-item field="pictureType" label="图片类型">
|
|
|
- <a-checkbox-group v-model="formData.pictureType">
|
|
|
- <a-checkbox
|
|
|
- v-for="(option, index) in pictureOptions"
|
|
|
- :key="index"
|
|
|
- :value="option.value"
|
|
|
- >{{ option.label }}</a-checkbox
|
|
|
- >
|
|
|
- </a-checkbox-group>
|
|
|
- </a-form-item>
|
|
|
- <a-form-item field="outputDir" label="保存目录">
|
|
|
- <a-input-search
|
|
|
- v-model.trim="formData.outputDir"
|
|
|
- :style="{ width: '400px' }"
|
|
|
- readonly
|
|
|
- search-button
|
|
|
- button-text="选择"
|
|
|
- @search="toSelectDir"
|
|
|
+ <a-space class="part-action" :size="6">
|
|
|
+ <a-button type="text" @click="toBatchDownload">
|
|
|
+ <template #icon>
|
|
|
+ <svg-icon name="icon-import" />
|
|
|
+ </template>
|
|
|
+ 批量下载
|
|
|
+ </a-button>
|
|
|
+ <a-button type="text" @click="toSet">
|
|
|
+ <template #icon>
|
|
|
+ <svg-icon name="icon-add" />
|
|
|
+ </template>
|
|
|
+ 下载设置
|
|
|
+ </a-button>
|
|
|
+ </a-space>
|
|
|
+ <a-table
|
|
|
+ class="page-table"
|
|
|
+ :columns="columns"
|
|
|
+ :data="dataList"
|
|
|
+ :pagination="pagination"
|
|
|
+ :scroll="{ x: 1200 }"
|
|
|
+ :bordered="false"
|
|
|
+ >
|
|
|
+ <template #courseCode="{ record }">
|
|
|
+ {{ courseNameCodeFilter(record) }}
|
|
|
+ </template>
|
|
|
+ <template #action="{ record }">
|
|
|
+ <a-button
|
|
|
+ type="text"
|
|
|
+ class="btn-primary"
|
|
|
+ disabled
|
|
|
+ @click="toDownload(record)"
|
|
|
+ >下载</a-button
|
|
|
>
|
|
|
- </a-input-search>
|
|
|
- </a-form-item>
|
|
|
- <a-form-item>
|
|
|
- <a-button type="primary">开始</a-button>
|
|
|
- </a-form-item>
|
|
|
- </a-form>
|
|
|
+ </template>
|
|
|
+ </a-table>
|
|
|
</div>
|
|
|
+
|
|
|
+ <!-- ModifySet -->
|
|
|
+ <ModifySet ref="modifySetRef" />
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import { ref, reactive } from 'vue';
|
|
|
- import type { FormInstance } from '@arco-design/web-vue/es/form';
|
|
|
- import { FormRules } from '@/types/global';
|
|
|
- import useDictOption from '@/hooks/dict-option';
|
|
|
- import { ExtTypeEnum, PictureTypeEnum } from '@/constants/enumerate';
|
|
|
+ import { Message, TableColumnData } from '@arco-design/web-vue';
|
|
|
+
|
|
|
+ import useTable from '@/hooks/table';
|
|
|
+ import { courseNameCodeFilter } from '@/utils/filter';
|
|
|
+ import { TrackExportItem } from '@/api/types/task';
|
|
|
+ import { trackExportListPage } from '@/api/task';
|
|
|
+ import { TrackConfigType } from '@/store/modules/app/types';
|
|
|
+ import { useAppStore } from '@/store';
|
|
|
+
|
|
|
+ import ModifySet from './modifySet.vue';
|
|
|
|
|
|
defineOptions({
|
|
|
name: 'TrackExport',
|
|
|
});
|
|
|
|
|
|
- const { optionList: extOptions } = useDictOption('EXT_TYPE');
|
|
|
- const { optionList: pictureOptions } = useDictOption('PICTURE_TYPE');
|
|
|
+ const appStore = useAppStore();
|
|
|
|
|
|
- const defaultFormData = {
|
|
|
+ const searchModel = reactive({
|
|
|
semesterId: '',
|
|
|
examId: '',
|
|
|
- extType: 'img' as ExtTypeEnum,
|
|
|
- pictureType: ['track'] as PictureTypeEnum[],
|
|
|
- outputDir: '',
|
|
|
- };
|
|
|
-
|
|
|
- interface FormDataType {
|
|
|
- semesterId: string;
|
|
|
- examId: string;
|
|
|
- extType: ExtTypeEnum;
|
|
|
- pictureType: PictureTypeEnum[];
|
|
|
- outputDir: string;
|
|
|
- }
|
|
|
-
|
|
|
- const formRef = ref<FormInstance>();
|
|
|
- const formData = reactive<FormDataType>({ ...defaultFormData });
|
|
|
- const rules: FormRules<keyof FormDataType> = {
|
|
|
- semesterId: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请选择学期',
|
|
|
- },
|
|
|
- ],
|
|
|
- examId: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请选择考试',
|
|
|
- },
|
|
|
- ],
|
|
|
- extType: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请选择文件类型',
|
|
|
- },
|
|
|
- ],
|
|
|
- pictureType: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请选择图片类型',
|
|
|
- },
|
|
|
- ],
|
|
|
- outputDir: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请选择保存目录',
|
|
|
- },
|
|
|
- ],
|
|
|
- };
|
|
|
+ courseId: '',
|
|
|
+ paperNumber: '',
|
|
|
+ });
|
|
|
|
|
|
- async function toSelectDir() {
|
|
|
- const result = await window.electron.dialogSelectFile({
|
|
|
- title: '选择保存目录',
|
|
|
- properties: ['openDirectory'],
|
|
|
- });
|
|
|
+ const columns: TableColumnData[] = [
|
|
|
+ {
|
|
|
+ title: '课程(代码)',
|
|
|
+ slotName: 'courseCode',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '试卷编号',
|
|
|
+ slotName: 'paperNumber',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '参考人数',
|
|
|
+ slotName: 'studentCount',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ slotName: 'action',
|
|
|
+ width: 220,
|
|
|
+ fixed: 'right',
|
|
|
+ cellClass: 'action-column',
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ const { dataList, pagination, toPage } = useTable<TrackExportItem>(
|
|
|
+ trackExportListPage,
|
|
|
+ searchModel,
|
|
|
+ false
|
|
|
+ );
|
|
|
|
|
|
- if (result.canceled) return;
|
|
|
+ // table action
|
|
|
+ const modifySetRef = ref();
|
|
|
+ function toSet() {
|
|
|
+ modifySetRef.value?.open();
|
|
|
+ }
|
|
|
+ function checkTrackConfigExist() {
|
|
|
+ return Boolean(
|
|
|
+ appStore.trackConfig.outputDir && appStore.trackConfig.pictureType.length
|
|
|
+ );
|
|
|
+ }
|
|
|
+ function toBatchDownload() {
|
|
|
+ if (!checkTrackConfigExist()) {
|
|
|
+ Message.error('请先编辑下载设置');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ console.log('batch');
|
|
|
+ }
|
|
|
+ function toDownload(row: TrackExportItem) {
|
|
|
+ if (!checkTrackConfigExist()) {
|
|
|
+ Message.error('请先编辑下载设置');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ console.log('download', row);
|
|
|
+ }
|
|
|
|
|
|
- formData.outputDir = result.filePaths[0];
|
|
|
+ async function initData() {
|
|
|
+ const res = await window.db.getDict('trackConfig');
|
|
|
+ if (res) {
|
|
|
+ const trackConfig = JSON.parse(res) as TrackConfigType;
|
|
|
+ appStore.setInfo({ trackConfig });
|
|
|
+ }
|
|
|
}
|
|
|
+ initData();
|
|
|
</script>
|