123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302 |
- <template>
- <div class="business-data-export">
- <div class="part-box part-box-filter part-box-flex">
- <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
- <template v-if="checkPrivilege('condition', 'condition')">
- <el-form-item label="印刷计划:">
- <print-plan-select
- v-model.trim="filter.printPlanId"
- placeholder="请选择"
- clearable
- @change="printPlanChange"
- ></print-plan-select>
- </el-form-item>
- <el-form-item label="课程(代码):" label-width="110px">
- <course-select
- v-model.trim="filter.courseCode"
- :print-plan-id="filter.printPlanId"
- placeholder="请选择"
- clearable
- ></course-select>
- </el-form-item>
- <el-form-item label="试卷编号:">
- <paper-number-select
- ref="PaperNumberSelect"
- v-model="filter.paperNumber"
- :print-plan-id="filter.printPlanId"
- placeholder="请选择"
- clearable
- ></paper-number-select>
- </el-form-item>
- <el-form-item label="考点:" label-width="55px">
- <place-select
- v-model.trim="filter.examPlace"
- :print-plan-id="filter.printPlanId"
- placeholder="请选择"
- clearable
- ></place-select>
- </el-form-item>
- <el-form-item label="考场:" label-width="55px">
- <room-select
- v-model.trim="filter.examRoom"
- :print-plan-id="filter.printPlanId"
- placeholder="请选择"
- clearable
- ></room-select>
- </el-form-item>
- <el-form-item label="卷袋号:" label-width="70px">
- <el-input
- v-model="filter.packageCode"
- placeholder="请输入"
- clearable
- ></el-input>
- </el-form-item>
- </template>
- <el-form-item label-width="0px">
- <el-button
- v-if="checkPrivilege('button', 'select')"
- type="primary"
- icon="el-icon-search"
- @click="search"
- >查询</el-button
- >
- </el-form-item>
- </el-form>
- <div class="part-box-action">
- <el-button
- v-if="checkPrivilege('button', 'TempleteDownload')"
- icon="el-icon-download"
- :loading="loading"
- @click="toDownloadTemplate"
- >
- 考务数据模板下载
- </el-button>
- <el-button
- v-if="checkPrivilege('button', 'export')"
- icon="el-icon-download"
- type="primary"
- :loading="loading"
- @click="toExport"
- >
- 导出查询结果
- </el-button>
- <el-button
- v-if="checkPrivilege('button', 'import')"
- icon="el-icon-upload2"
- type="warning"
- @click="toUpload"
- >
- 导入
- </el-button>
- </div>
- </div>
- <div class="part-box">
- <el-table ref="TableList" :data="dataList" border stripe>
- <el-table-column
- type="index"
- label="序号"
- width="70"
- align="center"
- :index="indexMethod"
- ></el-table-column>
- <el-table-column
- prop="printPlanName"
- label="印刷计划"
- ></el-table-column>
- <el-table-column prop="examDate" label="考试日期"> </el-table-column>
- <el-table-column prop="examTime" label="考试时间"> </el-table-column>
- <el-table-column prop="examPlace" label="考点"> </el-table-column>
- <el-table-column prop="examRoom" label="考场"> </el-table-column>
- <el-table-column prop="packageCode" label="卷袋号"> </el-table-column>
- <el-table-column prop="courseNameCode" label="课程(代码)">
- </el-table-column>
- <el-table-column prop="paperNumber" label="试卷编码"></el-table-column>
- <el-table-column prop="totalSubjects" label="科次" width="80">
- </el-table-column>
- <el-table-column
- class-name="action-column"
- label="操作"
- align="center"
- width="70"
- >
- <template slot-scope="scope">
- <el-button
- v-if="checkPrivilege('link', 'preview')"
- class="btn-table-icon"
- type="text"
- icon="icon icon-circle-right"
- @click="toPreview(scope.row)"
- title="查看详情"
- ></el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="part-box-flex">
- <div>
- <span class="mr-2"
- >科次总计:<i class="color-primary">{{ totalData.totalSubjects }}</i>
- 科次</span
- >
- <span
- >卷袋数量总计:<i class="color-primary">{{
- totalData.packageCount
- }}</i>
- 个</span
- >
- </div>
- <el-pagination
- background
- layout="total,prev, pager, next"
- :current-page="current"
- :total="total"
- :page-size="size"
- @current-change="toPage"
- >
- </el-pagination>
- </div>
- <!-- PreviewBusinessDetail -->
- <preview-business-detail
- ref="PreviewBusinessDetail"
- :instance="curRow"
- ></preview-business-detail>
- <!-- UploadBusinessDataDialog -->
- <upload-business-data-dialog
- ref="UploadBusinessDataDialog"
- @modified="getList"
- ></upload-business-data-dialog>
- </div>
- </template>
- <script>
- import {
- businessDataListPage,
- businessTotalData,
- businessTemplateDownload,
- businessDataExport
- } from "../api";
- import PreviewBusinessDetail from "../components/PreviewBusinessDetail";
- import UploadBusinessDataDialog from "../components/UploadBusinessDataDialog";
- import { downloadBlob, parseTimeRangeDateAndTime } from "@/plugins/utils";
- export default {
- name: "business-data-export",
- components: { PreviewBusinessDetail, UploadBusinessDataDialog },
- data() {
- return {
- filter: {
- printPlanId: "",
- courseCode: "",
- paperNumber: "",
- examPlace: "",
- examRoom: "",
- packageCode: ""
- },
- current: 1,
- size: this.GLOBAL.pageSize,
- total: 0,
- dataList: [],
- curRow: {},
- totalData: {},
- curPrintPlan: {},
- loading: false,
- // import
- uploadUrl: "/api/admin/exam/print/data_import",
- uploadData: {
- type: "FILE",
- printPlanId: ""
- }
- };
- },
- computed: {
- canImport() {
- return (
- this.curPrintPlan && ["NEW", "READY"].includes(this.curPrintPlan.status)
- );
- }
- },
- mounted() {
- this.search();
- },
- methods: {
- async getList() {
- if (!this.checkPrivilege("list", "list")) return;
- const datas = {
- ...this.filter,
- pageNumber: this.current,
- pageSize: this.size
- };
- const data = await businessDataListPage(datas);
- this.dataList = data.records.map(item => {
- const { date, time } = parseTimeRangeDateAndTime(
- item.examStartTime,
- item.examEndTime
- );
- item.examDate = date;
- item.examTime = time;
- return item;
- });
- this.total = data.total;
- },
- async getTotalData() {
- this.totalData = await businessTotalData(this.filter);
- },
- toPage(page) {
- this.current = page;
- this.getList();
- },
- search() {
- this.toPage(1);
- this.getTotalData();
- },
- printPlanChange() {
- this.filter.paperNumber = "";
- this.filter.courseCode = "";
- this.filter.examRoom = "";
- this.filter.examPlace = "";
- },
- toUpload() {
- this.$refs.UploadBusinessDataDialog.open();
- },
- async toExport() {
- // 异步导出
- if (this.loading) return;
- this.loading = true;
- const res = await businessDataExport({ ...this.filter }).catch(() => {});
- this.loading = false;
- if (res) {
- this.$message.success(
- "导出任务已提交,请在数据管理-任务管理中下载文件!"
- );
- } else {
- this.$message.error("导出任务提交失败,请重新尝试!");
- }
- },
- async toDownloadTemplate() {
- if (this.loading) return;
- this.loading = true;
- const res = await downloadBlob(() => {
- return businessTemplateDownload();
- }, `考务数据模板.xlsx`).catch(() => {});
- this.loading = false;
- if (res) {
- this.$message.success("文件下载成功!");
- } else {
- this.$message.error("文件下载失败,请重新尝试!");
- }
- },
- toPreview(row) {
- this.curRow = { ...row };
- this.$refs.PreviewBusinessDetail.open();
- }
- }
- };
- </script>
|