123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639 |
- <template>
- <section class="content">
- <!-- 正文信息 -->
- <div class="box-body">
- <el-form
- :inline="true"
- :model="formSearch"
- label-position="right"
- label-width="90px"
- >
- <el-row>
- <el-col :span="6">
- <el-form-item label="考试名称">
- <el-select
- class="search_width"
- v-model="formSearch.examId"
- filterable
- :remote-method="getExams"
- remote
- clearable
- @change="getExamCourses"
- placeholder="请选择"
- size="small"
- >
- <el-option
- v-for="item in examList"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-form-item label="课程名称">
- <el-select
- filterable
- clearable
- v-model="formSearch.courseNo"
- placeholder="请选择"
- :remote-method="getCourses"
- remote
- >
- <el-option
- v-for="item in courseInfoSelect"
- :label="item.courseInfo"
- :value="item.courseNo"
- :key="item.courseNo"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item class="pull-right buttonframe">
- <el-button
- size="small"
- type="primary"
- icon="search"
- @click="searchRulePaper"
- >查询</el-button
- >
- <el-button
- size="small"
- type="primary"
- icon="plus"
- @click="markRules"
- >新增</el-button
- >
- <el-button
- size="small"
- type="primary"
- icon="upload2"
- @click="openBatchExportPaperDialog"
- >批量导出
- </el-button>
- </el-form-item>
- </el-row>
- </el-form>
- <!-- 页面列表 -->
- <el-table :data="tableData" border style="width: 100%;text-align:center;">
- <el-table-column prop="examName" label="考试名称"> </el-table-column>
- <el-table-column label="考试类型">
- <template slot-scope="scope">
- <div class="el_table_inner_left">
- <span v-show="scope.row.examType == 'ONLINE'">在线考试</span>
- <span v-show="scope.row.examType == 'TRADITION'">传统考试</span>
- <span v-show="scope.row.examType == 'PRACTICE'">练习考试</span>
- <span v-show="scope.row.examType == 'OFFLINE'">离线考试</span>
- <span v-show="scope.row.examType == 'PRINT_EXAM'"
- >分布式印刷考试</span
- >
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="courseName" label="课程名称"> </el-table-column>
- <el-table-column prop="courseCode" label="课程代码"> </el-table-column>
- <el-table-column label="调卷类型">
- <template slot-scope="scope">
- <div class="el_table_inner_left">
- <span v-show="scope.row.callType == 'WHOLE_SET'">成套调用</span>
- <span v-show="scope.row.callType == 'RESTRUCT'">重组调用</span>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="调卷规则">
- <template slot-scope="scope">
- <div class="el_table_inner_left">
- <span v-show="scope.row.id">
- <el-tag type="success">已制定</el-tag>
- </span>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="操作">
- <template slot-scope="scope">
- <div>
- <el-button
- v-if="scope.row.ifFinish == 1"
- size="small"
- type="primary"
- @click="openSingleExportPaperDialog(scope.row)"
- >
- 导出
- </el-button>
- <el-button
- v-if="scope.row.id"
- size="small"
- type="warning"
- @click="updateRules(scope.row)"
- >
- 修改
- </el-button>
- </div>
- </template>
- </el-table-column>
- </el-table>
- <div class="page pull-right">
- <el-pagination
- @current-change="handleCurrentChange"
- :current-page="currentPage"
- :page-size="pageSize"
- layout="total, prev, pager, next, jumper"
- :total="total"
- >
- </el-pagination>
- </div>
- </div>
- <el-dialog title="导出" :visible.sync="exportDialog">
- <el-form :model="exportModel" label-position="right" label-width="80px">
- <el-row>
- <el-col :md="24">
- <el-form-item label="考试名称">
- <el-select
- v-model="exportModel.examId"
- filterable
- clearable
- :disabled="
- exportDialog.exportWay == 'SINGLE' &&
- exportModel.courseCode != ''
- "
- @change="checkPaperStructure"
- >
- <el-option
- v-for="item in examList"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row v-show="exportModel.courseId">
- <el-col :md="24">
- <el-form-item label="课程名称">
- <el-input v-model="exportModel.courseName" disabled></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :md="24">
- <el-form-item
- label="导出内容"
- v-if="exportModel.examType != 'PRINT_EXAM'"
- >
- <el-checkbox-group
- v-model="exportModel.exportContentList"
- v-if="exportModel.exportType == 'NORMAL'"
- >
- <el-checkbox label="PAPER" :disabled="paperDisabled"
- >试卷</el-checkbox
- >
- <el-checkbox label="ANSWER" :disabled="answerDisabled"
- >答案</el-checkbox
- >
- <el-checkbox
- label="PAPER_STRUCTURE_OBJECTIVE,PAPER_STRUCTURE_SUBJECTIVE"
- :disabled="structureDisabled"
- >试卷结构
- </el-checkbox>
- </el-checkbox-group>
- <el-checkbox-group
- v-model="exportModel.exportContentList"
- v-if="exportModel.exportType == 'ONLINE'"
- >
- <el-checkbox
- label="COMPUTERTEST_PACKAGE"
- :disabled="onlineDisabled"
- >机考数据包
- </el-checkbox>
- </el-checkbox-group>
- </el-form-item>
- <el-form-item
- label="导出内容"
- v-if="exportModel.examType == 'PRINT_EXAM'"
- >
- <el-checkbox-group v-model="exportModel.exportContentList">
- <el-checkbox label="PAPER" :disabled="paperDisabled"
- >试卷</el-checkbox
- >
- <el-checkbox label="ANSWER" :disabled="answerDisabled"
- >答案</el-checkbox
- >
- <el-checkbox
- v-if="isShowPrintExamPackage"
- label="PRINT_EXAM_PACKAGE"
- >分布式印刷数据包
- </el-checkbox>
- <el-input
- v-if="isShowPrintExamPackagePassword"
- v-model="printExamPackagePassword"
- placeholder="加密密码 (可选)"
- type="password"
- style="width: 150px"
- ></el-input>
- </el-checkbox-group>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :md="24" class="text-center">
- <el-button type="primary" @click="exportPaperInfo"
- >开始导出</el-button
- >
- </el-col>
- </el-row>
- </el-form>
- </el-dialog>
- </section>
- </template>
- <script>
- import { CORE_API, EXAM_WORK_API, QUESTION_API } from "@/constants/constants";
- import { LEVEL_TYPE } from "../constants/constants";
- import { mapState } from "vuex";
- import _ from "lodash";
- export default {
- data() {
- return {
- isClear: 0,
- formSearch: {
- examId: "",
- courseNo: ""
- },
- tableData: [],
- currentPage: 1,
- levelList: LEVEL_TYPE,
- pageSize: 10,
- total: 0,
- examList: [], //考试list
- courseList: [], //课程list
- loading: false,
- paperModels: "",
- exportDialog: false,
- exportModel: {
- examType: "",
- examId: "",
- courseId: "",
- courseName: "",
- exportWay: "",
- exportType: "NORMAL",
- exportContentList: []
- },
- paperDisabled: true,
- answerDisabled: true,
- structureDisabled: true,
- onlineDisabled: true,
- courseAllList: [],
- isShowPrintExamPackage: false,
- isShowPrintExamPackagePassword: false,
- printExamPackagePassword: ""
- };
- },
- methods: {
- //初始化
- initialize(examId) {
- this.examList = [];
- //查询所有考试
- this.$http.get(EXAM_WORK_API + "/exam/" + examId).then(response => {
- this.examList.push(response.data);
- this.formSearch.examId = parseInt(examId);
- this.searchRulePaper();
- });
- },
- //查询列表
- searchRulePaper() {
- if (!this.formSearch.examId) {
- this.$notify({
- message: "请选择考试",
- type: "info"
- });
- return false;
- }
- this.loading = true;
- let currentPage = this.currentPage;
- this.$http
- .get(
- QUESTION_API +
- "/findPageExtractConfig/" +
- currentPage +
- "/" +
- this.pageSize +
- "?examId=" +
- this.formSearch.examId +
- "&courseNo=" +
- this.formSearch.courseNo
- )
- .then(response => {
- this.tableData = response.data.content;
- this.total = response.data.totalElements;
- this.loading = false;
- })
- .catch(error => {
- this.loading = false;
- this.$notify({
- message: error.body.desc,
- type: "error"
- });
- this.tableData = [];
- this.total = 0;
- });
- },
- //分页
- handleCurrentChange(val) {
- this.currentPage = val;
- this.searchRulePaper();
- },
- //制定调卷规则
- markRules() {
- this.$router.push({
- name: "extract_paper_info_add"
- });
- },
- //修改调卷规则
- updateRules(row) {
- sessionStorage.setItem("extract_paper_examId", row.examId);
- sessionStorage.setItem("extract_paper_courseNo", row.courseCode);
- sessionStorage.setItem("extract_paper_currentPage", this.currentPage);
- this.$router.push({
- name: "extract_paper_info_edit",
- params: { extractConfigId: row.id }
- });
- },
- openSingleExportPaperDialog(row) {
- this.exportModel = {
- examType: row.examType,
- examId: row.examId,
- examName: row.examName,
- courseId: row.courseCode,
- courseName: row.courseName,
- exportType: "NORMAL",
- exportWay: "SINGLE",
- exportContentList: []
- };
- this.checkPaperStructure();
- this.exportDialog = true;
- /* 分布式印刷数据包设置 */
- //this.exportModel.examType = 'PRINT_EXAM';//todo
- this.isShowPrintExamPackage = true;
- this.isShowPrintExamPackagePassword = false;
- this.printExamPackagePassword = "";
- },
- openBatchExportPaperDialog() {
- this.exportModel = {
- examType: "",
- examId: "",
- examName: "",
- courseId: "",
- courseName: "",
- exportType: "NORMAL",
- exportWay: "BATCH",
- exportContentList: []
- };
- this.resetDisabled();
- this.exportDialog = true;
- /* 分布式印刷数据包设置 */
- this.isShowPrintExamPackage = false;
- this.isShowPrintExamPackagePassword = false;
- this.printExamPackagePassword = "";
- },
- checkPaperStructure() {
- if (!this.exportModel.examId) {
- return false;
- }
- this.exportModel.exportContentList = [];
- let examFile = {
- examId: this.exportModel.examId,
- courseId: this.exportModel.courseId ? this.exportModel.courseId : null
- };
- this.resetDisabled();
- this.$http
- .post(QUESTION_API + "/findExamFile", examFile)
- .then(response => {
- let examFiles = response.data;
- if (examFiles != null && examFiles.length > 0) {
- this.paperDisabled = this.isDisabled(examFiles, "PAPER");
- this.answerDisabled = this.isDisabled(examFiles, "ANSWER");
- this.onlineDisabled = this.isDisabled(
- examFiles,
- "COMPUTERTEST_PACKAGE"
- );
- this.$http
- .get(
- QUESTION_API + "/findExportStructure/" + this.exportModel.examId
- )
- .then(response => {
- this.exportModel.exportType = response.data
- ? response.data.exportType
- : "NORMAL";
- this.structureDisabled = !response.data;
- if (this.exportModel.exportWay == "SINGLE") {
- this.structureDisabled = this.isDisabled(
- examFiles,
- "PAPER_STRUCTURE_OBJECTIVE"
- );
- }
- });
- } else {
- this.resetDisabled();
- }
- });
- },
- isDisabled(examFiles, fileType) {
- return (
- _.filter(examFiles, function(examFile) {
- return examFile.examFileType == fileType;
- }).length == 0
- );
- },
- resetDisabled() {
- this.paperDisabled = true;
- this.answerDisabled = true;
- this.structureDisabled = true;
- this.onlineDisabled = true;
- },
- exportPaperInfo() {
- let examId = this.exportModel.examId;
- let courseId = this.exportModel.courseId;
- let exportWay = this.exportModel.exportWay;
- if (!examId) {
- this.$notify({
- message: "请选择考试",
- type: "error"
- });
- return false;
- }
- if (this.exportModel.exportContentList.length == 0) {
- this.$notify({
- message: "请选择导出内容",
- type: "error"
- });
- return false;
- }
- if (this.printExamPackagePassword.length > 0) {
- var reg = /^[0-9A-Za-z]{6,12}$/;
- if (!reg.test(this.printExamPackagePassword)) {
- this.$notify({
- message: "加密密码请输入6至12位的数字或字母!",
- type: "error"
- });
- return false;
- }
- }
- let exportContentList = this.exportModel.exportContentList.toString();
- var key = this.user.key;
- var token = this.user.token;
- this.$http
- .get(
- QUESTION_API +
- "/exportBatchExamPaperInfoCheck/" +
- exportWay +
- "/" +
- examId +
- "?$key=" +
- key +
- "&$token=" +
- token
- )
- .then(
- response => {
- console.log(response);
- if (response.data) {
- this.$notify({
- message: response.data.desc,
- type: "error"
- });
- } else {
- var key = this.user.key;
- var token = this.user.token;
- if (exportWay == "SINGLE") {
- window.location.href =
- QUESTION_API +
- "/exportSingleExamPaperInfo/" +
- this.user.rootOrgName +
- "/" +
- exportWay +
- "/" +
- examId +
- "/" +
- courseId +
- "/" +
- exportContentList +
- "/" +
- this.user.displayName +
- "?psw=" +
- this.printExamPackagePassword +
- "&$key=" +
- key +
- "&$token=" +
- token;
- } else if (exportWay == "BATCH") {
- window.location.href =
- QUESTION_API +
- "/exportBatchExamPaperInfo/" +
- this.user.rootOrgName +
- "/" +
- exportWay +
- "/" +
- examId +
- "/" +
- exportContentList +
- "/" +
- this.user.displayName +
- "?$key=" +
- key +
- "&$token=" +
- token;
- }
- }
- },
- error => {
- console.log("aaa");
- this.$notify({
- message: error.body.desc,
- type: "error"
- });
- }
- );
- },
- removeItem() {
- sessionStorage.removeItem("extract_paper_currentPage");
- sessionStorage.removeItem("extract_paper_examId");
- sessionStorage.removeItem("extract_paper_courseNo");
- },
- //查询所有课程
- getCourses(query) {
- query = query.trim();
- if (query) {
- if (!(query.indexOf("(") > -1 && query.indexOf(")") > -1)) {
- this.courseLoading = true;
- this.$http
- .get(CORE_API + "/course/query?name=" + query + "&enable=true")
- .then(response => {
- this.courseList = response.data;
- this.courseLoading = false;
- });
- }
- } else {
- this.courseList = [];
- }
- },
- //查询考试
- getExams(query) {
- query = query.trim();
- this.$http
- .get(
- EXAM_WORK_API + "/exam/queryByNameLike?name=" + query + "&enable=true"
- )
- .then(response => {
- this.examList = response.data;
- });
- },
- //清空课程列表
- getExamCourses() {
- console.log("clean");
- this.formSearch.courseNo = "";
- }
- },
- computed: {
- ...mapState({ user: state => state.user }),
- courseInfoSelect() {
- var courseList = [];
- for (let course of this.courseList) {
- var courseInfo = course.name + "(" + course.code + ")";
- courseList.push({
- courseNo: course.code,
- courseName: course.name,
- courseInfo: courseInfo
- });
- }
- return courseList;
- }
- },
- created() {
- this.isClear = this.$route.params.isClear;
- if (this.isClear == 0 || !this.isClear) {
- this.removeItem();
- //查询所有考试
- this.getExams("");
- } else {
- this.formSearch.courseNo =
- sessionStorage.getItem("extract_paper_courseNo") == "null"
- ? ""
- : sessionStorage.getItem("extract_paper_courseNo");
- this.formSearch.examId = parseInt(
- sessionStorage.getItem("extract_paper_examId")
- );
- this.currentPage =
- sessionStorage.getItem("extract_paper_currentPage") == null
- ? 1
- : parseInt(sessionStorage.getItem("extract_paper_currentPage"));
- this.initialize(this.formSearch.examId);
- }
- }
- };
- </script>
|