123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- <template>
- <div class="score-archive">
- <div class="part-box part-box-filter part-box-flex">
- <el-form ref="FilterForm" label-position="left" inline>
- <template v-if="checkPrivilege('condition', 'condition')">
- <el-form-item label="考试时间:">
- <semester-select
- v-model="filter.semesterId"
- placeholder="考试时间"
- ></semester-select>
- </el-form-item>
- <el-form-item label="学院:">
- <college-select
- v-model="filter.orgId"
- :semester-id="filter.semesterId"
- cascader
- placeholder="学院"
- ></college-select>
- </el-form-item>
- <el-form-item label="专业:">
- <major-select
- v-model="filter.majorId"
- :college-id="filter.orgId"
- cascader
- placeholder="专业"
- ></major-select>
- </el-form-item>
- <el-form-item label="班级:">
- <class-select
- v-model="filter.clazzId"
- :major-id="filter.majorId"
- cascader
- placeholder="班级"
- ></class-select>
- </el-form-item>
- <el-form-item label="课程:">
- <course-select
- v-model="filter.courseCode"
- placeholder="课程"
- filterable
- clearable
- ></course-select>
- </el-form-item>
- </template>
- <el-form-item label-width="0px">
- <el-button
- v-if="checkPrivilege('button', 'select')"
- type="primary"
- :disabled="!filter.semesterId || !filter.orgId"
- @click="toPage(1)"
- >查询</el-button
- >
- </el-form-item>
- </el-form>
- <div class="part-box-action">
- <el-button
- type="success"
- icon="el-icon-refresh"
- :loading="loading"
- @click="toSync"
- >同步</el-button
- >
- <el-button
- v-if="checkPrivilege('button', 'BatchDownload')"
- type="primary"
- icon="el-icon-download"
- :loading="loading"
- @click="toDownloadAll"
- >一键下载</el-button
- >
- <el-button
- v-if="checkPrivilege('button', 'export')"
- type="primary"
- icon="el-icon-download"
- :loading="loading"
- @click="toExport"
- >成绩导出</el-button
- >
- </div>
- </div>
- <div class="part-box part-box-pad">
- <el-table ref="TableList" :data="dataList">
- <el-table-column
- type="index"
- label="序号"
- width="70"
- :index="indexMethod"
- ></el-table-column>
- <el-table-column prop="semesterName" label="考试时间"></el-table-column>
- <el-table-column prop="name" label="姓名" width="120"></el-table-column>
- <el-table-column prop="studentCode" label="学号"></el-table-column>
- <el-table-column prop="orgName" label="院系"></el-table-column>
- <el-table-column prop="majorName" label="专业"></el-table-column>
- <el-table-column prop="clazzName" label="班级"></el-table-column>
- <el-table-column prop="courseName" label="课程名"></el-table-column>
- <el-table-column
- prop="totalScore"
- label="成绩"
- width="80"
- ></el-table-column>
- <el-table-column class-name="action-column" label="操作" width="160px">
- <template slot-scope="scope">
- <el-button
- v-if="checkPrivilege('link', 'Preview')"
- class="btn-primary"
- type="text"
- @click="toViewPaper(scope.row)"
- >查看原卷</el-button
- >
- <el-button
- v-if="checkPrivilege('link', 'download')"
- class="btn-primary"
- type="text"
- :loading="downloading"
- @click="toDownload(scope.row)"
- >下载</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- <div class="part-page">
- <el-pagination
- background
- layout="total,prev, pager, next"
- :current-page="current"
- :total="total"
- :page-size="size"
- @current-change="toPage"
- >
- </el-pagination>
- </div>
- </div>
- <!-- image-preview -->
- <simple-image-preview
- :cur-image="curImage"
- simple
- ref="SimpleImagePreview"
- ></simple-image-preview>
- </div>
- </template>
- <script>
- import {
- scoreListPage,
- scoreExport,
- scoreBatchDownload,
- scoreDownload,
- scoreSync
- } from "../api";
- // import { downloadPaper } from "../components/downloadPaper";
- import { downloadByApi } from "@/plugins/download";
- import SimpleImagePreview from "@/components/SimpleImagePreview";
- export default {
- name: "score-archive",
- components: { SimpleImagePreview },
- data() {
- return {
- filter: {
- semesterId: "",
- orgId: "",
- majorId: "",
- clazzId: "",
- courseCode: ""
- },
- current: 1,
- size: this.GLOBAL.pageSize,
- total: 0,
- dataList: [],
- curImage: {},
- curRow: {},
- curPapers: [],
- downloading: false,
- loading: false
- };
- },
- mounted() {
- // this.getList();
- },
- methods: {
- async getList() {
- if (!this.checkPrivilege("list", "list")) return;
- const datas = {
- ...this.filter,
- pageNumber: this.current,
- pageSize: this.size
- };
- const data = await scoreListPage(datas);
- this.dataList = data.records;
- this.total = data.total;
- },
- toPage(page) {
- this.current = page;
- this.getList();
- },
- async toSync() {
- if (this.loading) return;
- this.loading = true;
- const res = await scoreSync({ examId: "" }).catch(() => {});
- this.loading = false;
- if (!res) return;
- this.$message.success("同步任务已经提交");
- },
- async toDownloadAll() {
- if (this.loading) return;
- this.loading = true;
- const res = await scoreBatchDownload(this.filter).catch(() => {});
- this.loading = false;
- if (!res) return;
- this.$message.success("下载任务已经提交");
- },
- async toExport() {
- if (this.loading) return;
- this.loading = true;
- const res = await scoreExport(this.filter).catch(() => {});
- this.loading = false;
- if (!res) return;
- this.$message.success("导出任务已经提交");
- },
- toViewPaper(row) {
- if (!row.sheetUrls) {
- this.$message.error("原卷缺失!");
- return;
- }
- this.curImage = { url: row.sheetUrls };
- this.$refs.SimpleImagePreview.open();
- },
- async toDownload(row) {
- if (this.downloading) return;
- this.downloading = true;
- const res = await downloadByApi(() => {
- return scoreDownload(row.studentCode);
- }, `${row.name}-原卷.jpg`).catch(e => {
- console.log(e);
- });
- this.downloading = false;
- if (!res) {
- this.$message.error("下载失败,请重新尝试!");
- return;
- }
- this.$message.success("下载成功!");
- }
- }
- };
- </script>
|