123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330 |
- <template>
- <div class="exam-task-manage">
- <div class="part-box part-box-filter part-box-flex">
- <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
- <el-form-item label="命题状态:">
- <el-select
- v-model="filter.status"
- style="width: 142px;"
- placeholder="请选择"
- clearable
- >
- <el-option
- v-for="(val, key) in EXAM_TASK_STATUS"
- :key="key"
- :value="key"
- :label="val"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="题卡规则:">
- <card-rule-select
- ref="CardRuleSelect"
- v-model.trim="filter.cardRuleId"
- placeholder="请选择"
- clearable
- ></card-rule-select>
- </el-form-item>
- <el-form-item label="课程(代码):" label-width="110px">
- <course-select
- ref="CourseSelect"
- v-model.trim="filter.courseCode"
- placeholder="请选择"
- clearable
- ></course-select>
- </el-form-item>
- <el-form-item label="试卷编号:">
- <paper-number-select
- ref="PaperNumberSelect"
- v-model="filter.paperNumber"
- placeholder="请选择"
- clearable
- ></paper-number-select>
- </el-form-item>
- <el-form-item label="命题时间:">
- <el-date-picker
- v-model="createTime"
- type="datetimerange"
- :picker-options="pickerOptions"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- value-format="timestamp"
- align="right"
- unlink-panels
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item label="启用/禁用:" label-width="90px">
- <el-select
- v-model="filter.enable"
- style="width: 142px;"
- placeholder="请选择"
- clearable
- >
- <el-option
- v-for="(val, key) in ABLE_TYPE"
- :key="key"
- :value="key * 1"
- :label="val"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label-width="0px">
- <el-button type="primary" icon="icon icon-search" @click="toPage(1)"
- >查询</el-button
- >
- </el-form-item>
- </el-form>
- <div class="part-box-action">
- <el-button icon="icon icon-plus" type="warning" @click="toBatchAdd">
- 批量新建命题任务
- </el-button>
- <el-button icon="icon icon-plus" type="primary" @click="toAdd">
- 新建命题任务
- </el-button>
- </div>
- </div>
- <div class="part-box">
- <el-table ref="TableList" :data="examTasks" border stripe>
- <el-table-column
- type="index"
- label="序号"
- width="70"
- align="center"
- :index="indexMethod"
- ></el-table-column>
- <el-table-column
- prop="paperNumber"
- label="试卷编号"
- width="120"
- ></el-table-column>
- <el-table-column prop="courseName" label="课程(代码)">
- <template slot-scope="scope">
- {{ scope.row.courseName }}({{ scope.row.courseCode }})
- </template>
- </el-table-column>
- <el-table-column
- prop="specialty"
- label="适用专业(方向)"
- ></el-table-column>
- <el-table-column prop="cardRuleName" label="题卡规则">
- </el-table-column>
- <el-table-column
- prop="userName"
- label="命题老师"
- width="100"
- ></el-table-column>
- <el-table-column prop="startTime" label="命题开始时间">
- <span slot-scope="scope">{{
- scope.row.startTime | timestampFilter
- }}</span>
- </el-table-column>
- <el-table-column prop="endTime" label="命题结束时间">
- <span slot-scope="scope">{{
- scope.row.endTime | timestampFilter
- }}</span>
- </el-table-column>
- <el-table-column prop="status" label="命题状态" width="100">
- <template slot-scope="scope">
- {{ scope.row.status | examTaskStatusFilter }}
- </template>
- </el-table-column>
- <el-table-column prop="enable" label="启用/禁用" width="100">
- <template slot-scope="scope">
- {{ scope.row.enable | enableFilter }}
- </template>
- </el-table-column>
- <el-table-column
- class-name="action-column"
- label="操作"
- align="center"
- width="120px"
- >
- <template slot-scope="scope">
- <el-button
- v-if="scope.row.status !== 'FINISH'"
- class="btn-table-icon"
- type="text"
- :icon="
- scope.row.enable
- ? 'icon icon-circle-stop'
- : 'icon icon-circle-caret-right'
- "
- @click="toEnable(scope.row)"
- :title="scope.row.enable ? '禁用' : '启用'"
- ></el-button>
- <el-button
- v-if="
- (scope.row.status === 'READY' && !scope.row.enable) ||
- scope.row.status === 'NEW'
- "
- class="btn-table-icon"
- type="text"
- icon="icon icon-edit"
- @click="toEdit(scope.row)"
- :title="scope.row.status === 'NEW' ? '指派' : '更改'"
- ></el-button>
- <el-button
- 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 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>
- <!-- ModifyExamTask -->
- <modify-exam-task
- ref="ModifyExamTask"
- :instance="curExamTask"
- :edit-type="editType"
- @modified="getList"
- ></modify-exam-task>
- <!-- BatchAddExamTask -->
- <batch-add-exam-task
- ref="BatchAddExamTask"
- @modified="getList"
- ></batch-add-exam-task>
- </div>
- </template>
- <script>
- import ModifyExamTask from "../components/ModifyExamTask";
- import BatchAddExamTask from "../components/BatchAddExamTask";
- import { ABLE_TYPE, EXAM_TASK_STATUS } from "@/constants/enumerate";
- import pickerOptions from "@/constants/datePickerOptions";
- import { examTaskListPage, ableExamTask } from "../api";
- export default {
- name: "exam-task-manage",
- components: {
- ModifyExamTask,
- BatchAddExamTask
- },
- data() {
- return {
- filter: {
- status: "",
- cardRuleId: "",
- courseCode: "",
- paperNumber: "",
- startTime: null,
- endTime: null,
- enable: null
- },
- current: 1,
- size: this.GLOBAL.pageSize,
- total: 0,
- editType: "ADD",
- ABLE_TYPE,
- EXAM_TASK_STATUS,
- examTasks: [],
- curExamTask: {},
- // date-picker
- createTime: [],
- pickerOptions
- };
- },
- created() {
- this.getList();
- },
- methods: {
- async getList() {
- const datas = {
- ...this.filter,
- pageNumber: this.current,
- pageSize: this.size
- };
- if (datas.enable !== null && datas.enable !== "")
- datas.enable = !!datas.enable;
- if (this.createTime) {
- datas.startTime = this.createTime[0];
- datas.endTime = this.createTime[1];
- }
- const data = await examTaskListPage(datas);
- this.examTasks = data.records;
- this.total = data.total;
- },
- toPage(page) {
- this.current = page;
- this.getList();
- },
- async toEnable(row) {
- const msgs = [
- [
- "命题任务取消后,有如下后果:",
- "1.命题老师将无法看到该命题任务;",
- "2.该任务无法审核和与考试计划关联;",
- "3.该任务已绑定的题卡将取消绑定。",
- "您确定要取消命题任务吗?"
- ],
- [
- "命题任务启用后:",
- "1.命题老师将重新看到该命题任务;",
- "2.该任务将允许继续审核及与考试计划关联;",
- "3.该任务需重新绑定题卡。",
- "您确定要启用命题任务吗?"
- ]
- ];
- const msg = row.enable ? msgs[0] : msgs[1];
- const msgHtml = msg
- .map(item => `<p class="text-left">${item}</p>`)
- .join("");
- this.$confirm(msgHtml, "提示", {
- cancelButtonClass: "el-button--danger is-plain",
- confirmButtonClass: "el-button--primary",
- dangerouslyUseHTMLString: true,
- type: "warning"
- })
- .then(async () => {
- const enable = !row.enable;
- await ableExamTask({
- id: row.id,
- enable
- });
- row.enable = enable;
- this.$message.success("操作成功!");
- // 启用之后,更新列表。
- // 因为禁用时会解绑题卡,影响命题任务状态。
- if (enable) this.getList();
- })
- .catch(() => {});
- },
- toBatchAdd() {
- this.$refs.BatchAddExamTask.open();
- },
- toAdd() {
- this.curExamTask = {};
- this.editType = "ADD";
- this.$refs.ModifyExamTask.open();
- },
- toEdit(row) {
- this.curExamTask = row;
- this.editType = "EDIT";
- this.$refs.ModifyExamTask.open();
- },
- toPreview(row) {
- this.curExamTask = row;
- this.editType = "PREVIEW";
- this.$refs.ModifyExamTask.open();
- }
- }
- };
- </script>
|