|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div class="info-exam-task">
|
|
|
- <div class="part-box part-box-pad part-box-border">
|
|
|
+ <div class="part-box part-box-pad part-box-border part-box-gray">
|
|
|
<el-form
|
|
|
ref="examTaskComp"
|
|
|
:model="examTask"
|
|
@@ -18,27 +18,27 @@
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item prop="courseCode" label="课程(代码):">
|
|
|
- <course-select
|
|
|
+ <el-select
|
|
|
v-model="examTask.courseCode"
|
|
|
- :teaching-room-id="examTask.teachingRoomId"
|
|
|
+ placeholder="请选择"
|
|
|
+ filterable
|
|
|
@change="courseChange"
|
|
|
- ></course-select>
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in courses"
|
|
|
+ :key="item.code"
|
|
|
+ :value="item.code"
|
|
|
+ :label="`${item.name}(${item.code})`"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item prop="cardRuleId" label="题卡规则:">
|
|
|
- <card-rule-select
|
|
|
- ref="CardRuleSelect"
|
|
|
- v-model.trim="examTask.cardRuleId"
|
|
|
- placeholder="请选择"
|
|
|
- clearable
|
|
|
- @change="clearCard"
|
|
|
- ></card-rule-select>
|
|
|
- <p class="tips-info">
|
|
|
- 说明:若选择全部通卡,则命题老师只能选择通卡,若选择题卡规则,则专卡和通卡均可选择
|
|
|
- </p>
|
|
|
+ <el-input v-model.trim="cardRuleName" readonly></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
@@ -77,32 +77,6 @@
|
|
|
</el-form>
|
|
|
</div>
|
|
|
|
|
|
- <div class="task-apply-steps" v-if="flows.length">
|
|
|
- <el-steps align-center>
|
|
|
- <el-step
|
|
|
- v-for="flow in flows"
|
|
|
- :key="flow.taskKey"
|
|
|
- :title="flow.taskName"
|
|
|
- :status="flow.status"
|
|
|
- >
|
|
|
- <div slot="description">
|
|
|
- <div class="step-info" v-if="flow.firstUser">
|
|
|
- <span>{{ flow.firstUser }}</span>
|
|
|
- <el-popover
|
|
|
- v-if="flow.moreUser"
|
|
|
- placement="top-start"
|
|
|
- width="300"
|
|
|
- trigger="hover"
|
|
|
- :content="flow.moreUser"
|
|
|
- >
|
|
|
- <span class="color-primary ml-1" slot="reference">更多</span>
|
|
|
- </el-popover>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </el-step>
|
|
|
- </el-steps>
|
|
|
- </div>
|
|
|
-
|
|
|
<div class="apply-content task-detail">
|
|
|
<div class="task-body">
|
|
|
<div class="mb-2 text-right">
|
|
@@ -146,19 +120,15 @@
|
|
|
{{ createCardTypeName }}
|
|
|
</td>
|
|
|
<td :rowspan="paperAttachments.length" v-if="index === 0">
|
|
|
- <el-button
|
|
|
- type="text"
|
|
|
- class="btn-primary"
|
|
|
- @click="toCreateOrViewCard"
|
|
|
- >{{ cardTodoName }}</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- v-if="examTaskDetail.makeMethod"
|
|
|
- size="mini"
|
|
|
- type="primary"
|
|
|
- @click="changeCreateCardType"
|
|
|
- >切换题卡创建方式</el-button
|
|
|
- >
|
|
|
+ <el-select v-model="examTaskDetail.cardId" placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item in cards"
|
|
|
+ :key="item.id"
|
|
|
+ :value="item.id"
|
|
|
+ :label="item.title"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</td>
|
|
|
<td>
|
|
|
<el-button
|
|
@@ -245,13 +215,6 @@
|
|
|
@confirm="uploadConfirm"
|
|
|
ref="UploadPaperDialog"
|
|
|
></upload-paper-dialog>
|
|
|
- <!-- card-option-dialog -->
|
|
|
- <card-option-dialog
|
|
|
- ref="CardOptionDialog"
|
|
|
- :data="task"
|
|
|
- @upload-sample-over="initData"
|
|
|
- @confirm="cardConfirm"
|
|
|
- ></card-option-dialog>
|
|
|
<!-- image-preview -->
|
|
|
<simple-image-preview
|
|
|
:cur-image="curImage"
|
|
@@ -264,14 +227,14 @@
|
|
|
|
|
|
<script>
|
|
|
import UploadPaperDialog from "../UploadPaperDialog";
|
|
|
-import CardOptionDialog from "../CardOptionDialog";
|
|
|
import SimpleImagePreview from "@/components/SimpleImagePreview";
|
|
|
import { CARD_SOURCE_TYPE } from "@/constants/enumerate";
|
|
|
-import { switchCardCreateMethod, taskAllApproverPeople } from "../../api";
|
|
|
+import { cardForSelectList } from "../../api";
|
|
|
+import { courseQuery } from "../../../base/api";
|
|
|
|
|
|
export default {
|
|
|
name: "info-exam-task",
|
|
|
- components: { UploadPaperDialog, CardOptionDialog, SimpleImagePreview },
|
|
|
+ components: { UploadPaperDialog, SimpleImagePreview },
|
|
|
props: {
|
|
|
datas: {
|
|
|
type: Object,
|
|
@@ -283,32 +246,6 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
task: {},
|
|
|
- flows: [
|
|
|
- {
|
|
|
- flowId: "160684605807001600",
|
|
|
- taskName: "提交试卷",
|
|
|
- taskKey: "usertask1",
|
|
|
- setup: 1,
|
|
|
- status: "process",
|
|
|
- desc: "进行中"
|
|
|
- },
|
|
|
- {
|
|
|
- flowId: "160684605807001600",
|
|
|
- taskName: "审核试卷",
|
|
|
- taskKey: "usertask2",
|
|
|
- setup: 2,
|
|
|
- status: "wait",
|
|
|
- desc: "待进行"
|
|
|
- },
|
|
|
- {
|
|
|
- flowId: "160684605807001600",
|
|
|
- taskName: "审核试卷",
|
|
|
- taskKey: "usertask3",
|
|
|
- setup: 3,
|
|
|
- status: "wait",
|
|
|
- desc: "待进行"
|
|
|
- }
|
|
|
- ],
|
|
|
rules: {
|
|
|
teachingRoomId: [
|
|
|
{
|
|
@@ -332,8 +269,12 @@ export default {
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
+ examTask: {},
|
|
|
+ cards: [],
|
|
|
+ courses: [],
|
|
|
+ cardRuleName: "全部通卡",
|
|
|
// exam-task-detail
|
|
|
- examTaskDetail: {},
|
|
|
+ examTaskDetail: { makeMethod: "" },
|
|
|
paperConfirmAttachmentId: { attachmentId: "", filename: "", url: "" },
|
|
|
paperAttachments: [],
|
|
|
paperConfirmAttachments: [],
|
|
@@ -347,21 +288,6 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
- cardTodoName() {
|
|
|
- let name = "创建答题卡";
|
|
|
- if (this.examTaskDetail.cardId) {
|
|
|
- if (this.examTaskDetail.makeMethod === "SELECT") {
|
|
|
- name = "选择题卡";
|
|
|
- } else if (this.examTaskDetail.makeMethod === "SELF") {
|
|
|
- name = "编辑题卡";
|
|
|
- } else {
|
|
|
- // 已经审核的题卡可以自行编辑,未审核的题卡只能查看
|
|
|
- name =
|
|
|
- this.examTaskDetail.status === "SUBMIT" ? "编辑题卡" : "查看题卡";
|
|
|
- }
|
|
|
- }
|
|
|
- return name;
|
|
|
- },
|
|
|
createCardTypeName() {
|
|
|
return CARD_SOURCE_TYPE[this.examTaskDetail.makeMethod] || "";
|
|
|
},
|
|
@@ -375,7 +301,76 @@ export default {
|
|
|
this.initData();
|
|
|
},
|
|
|
methods: {
|
|
|
- initData() {},
|
|
|
+ initData() {
|
|
|
+ console.log(this.datas.examTask);
|
|
|
+ this.examTask = { ...this.datas.examTask };
|
|
|
+ this.examTaskDetail = { ...this.datas.examTaskDetail };
|
|
|
+ this.paperAttachments = this.examTaskDetail.paperAttachmentIds
|
|
|
+ ? JSON.parse(this.examTaskDetail.paperAttachmentIds)
|
|
|
+ : [];
|
|
|
+
|
|
|
+ if (!this.paperAttachments.length) {
|
|
|
+ this.addAtachment();
|
|
|
+ }
|
|
|
+
|
|
|
+ this.paperConfirmAttachments = this.examTaskDetail
|
|
|
+ .paperConfirmAttachmentIds
|
|
|
+ ? JSON.parse(this.examTaskDetail.paperConfirmAttachmentIds)
|
|
|
+ : [];
|
|
|
+
|
|
|
+ this.getCourses();
|
|
|
+ this.getCardList();
|
|
|
+
|
|
|
+ this.$emit("on-ready");
|
|
|
+ },
|
|
|
+ async getCardList() {
|
|
|
+ if (!this.examTask.courseCode) return;
|
|
|
+ const data = await cardForSelectList({
|
|
|
+ courseCode: this.examTask.courseCode,
|
|
|
+ paperType: this.paperAttachments.map(item => item.name).join(","),
|
|
|
+ cardRuleId: this.examTask.cardRuleId
|
|
|
+ });
|
|
|
+ this.cards = data || [];
|
|
|
+ },
|
|
|
+ async getCourses() {
|
|
|
+ if (!this.examTask.teachingRoomId) return;
|
|
|
+ const res = await courseQuery({
|
|
|
+ teachingRoomId: this.examTask.teachingRoomId
|
|
|
+ });
|
|
|
+ this.courses = res || [];
|
|
|
+ },
|
|
|
+ async checkData() {
|
|
|
+ const valid = await this.$refs.examTaskComp.validate().catch(() => {});
|
|
|
+ if (!valid) {
|
|
|
+ this.$emit("on-ready");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const attachmentValid = !this.paperAttachments.some(
|
|
|
+ item => !item.attachmentId
|
|
|
+ );
|
|
|
+ // 设置了入库强制包含试卷时,校验试卷是否上传。
|
|
|
+ if (this.examTaskDetail.includePaper && !attachmentValid) {
|
|
|
+ this.$message.error("请完成试卷文件上传!");
|
|
|
+ this.$emit("on-ready");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // if (!this.paperConfirmAttachments.length) {
|
|
|
+ // this.$message.error("请上传入库审核表!");
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+
|
|
|
+ if (!this.examTaskDetail.cardId) {
|
|
|
+ this.$message.error("请选择题卡!");
|
|
|
+ this.$emit("on-ready");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$emit("next-step", {
|
|
|
+ examTask: this.examTask,
|
|
|
+ examTaskDetail: this.getTaskDetailData()
|
|
|
+ });
|
|
|
+ },
|
|
|
// exam-task-detail edit
|
|
|
addAtachment() {
|
|
|
if (this.paperAttachments.length >= this.attachmentLimitCount) return;
|
|
@@ -443,119 +438,28 @@ export default {
|
|
|
})
|
|
|
);
|
|
|
},
|
|
|
- toEditCard() {
|
|
|
- this.cachePrepareTcpCard();
|
|
|
- this.$router.push({
|
|
|
- name: "CardDesign",
|
|
|
- params: {
|
|
|
- cardId: this.examTaskDetail.cardId
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- cachePrepareTcpCard() {
|
|
|
- this.$ls.set("prepareTcPCard", {
|
|
|
- examTaskId: this.examTask.id,
|
|
|
- courseCode: this.examTask.courseCode,
|
|
|
- courseName: this.examTask.courseName,
|
|
|
- makeMethod: this.examTaskDetail.makeMethod,
|
|
|
- cardRuleId: this.examTask.cardRuleId
|
|
|
- });
|
|
|
- },
|
|
|
- async toCreateOrViewCard() {
|
|
|
- const result = await this.toSave(1);
|
|
|
- if (!result) return;
|
|
|
- this.task = {
|
|
|
- ...this.examTask,
|
|
|
- ...this.examTaskDetail,
|
|
|
- examTaskId: this.examTask.id
|
|
|
- };
|
|
|
- if (!this.examTaskDetail.cardId) {
|
|
|
- this.$refs.CardOptionDialog.open();
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (this.examTaskDetail.makeMethod === "SELECT") {
|
|
|
- this.$refs.CardOptionDialog.open();
|
|
|
- } else if (this.examTaskDetail.makeMethod === "SELF") {
|
|
|
- this.toEditCard();
|
|
|
- } else {
|
|
|
- // 客服制卡:制作完毕则可以编辑,未制作完毕则可以查看
|
|
|
- if (this.examTaskDetail.status === "SUBMIT") {
|
|
|
- this.toEditCard();
|
|
|
- } else {
|
|
|
- this.toViewCard();
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
cardConfirm(data) {
|
|
|
this.examTaskDetail = this.$objAssign(this.examTaskDetail, data);
|
|
|
},
|
|
|
- async changeCreateCardType() {
|
|
|
- const h = this.$createElement;
|
|
|
- const result = await this.$msgbox({
|
|
|
- title: "切换题卡操作说明",
|
|
|
- message: h("div", null, [
|
|
|
- h("p", null, "1、切换题卡会将之前选择题卡数据删除。"),
|
|
|
- h(
|
|
|
- "p",
|
|
|
- null,
|
|
|
- "2、之前选择专卡进行绘制,切换题卡后再次选择专卡,需要重新开始绘制。"
|
|
|
- )
|
|
|
- ]),
|
|
|
- showCancelButton: true,
|
|
|
-
|
|
|
- type: "warning"
|
|
|
- }).catch(() => {});
|
|
|
- if (result !== "confirm") return;
|
|
|
-
|
|
|
- await this.clearMakeMethod();
|
|
|
- this.toCreateOrViewCard();
|
|
|
- },
|
|
|
- async clearMakeMethod() {
|
|
|
- // 清除后台记录的题卡
|
|
|
- if (this.examTask.id && this.examTaskDetail.cardId)
|
|
|
- await switchCardCreateMethod(this.examTask.id);
|
|
|
-
|
|
|
- this.examTaskDetail.makeMethod = "";
|
|
|
- this.examTaskDetail.cardId = "";
|
|
|
- },
|
|
|
teachingRoomChange() {
|
|
|
this.examTask.courseCode = "";
|
|
|
this.examTask.courseName = "";
|
|
|
- this.clearCard();
|
|
|
+ this.courses = [];
|
|
|
+ this.examTaskDetail.cardId = "";
|
|
|
+ this.cards = [];
|
|
|
+ this.getCourses();
|
|
|
},
|
|
|
courseChange(val) {
|
|
|
- if (!val || !val.code) {
|
|
|
- this.examTask.courseCode = "";
|
|
|
+ if (val) {
|
|
|
+ const course = this.courses.find(item => item.code === val);
|
|
|
+ this.examTask.courseName = course.name;
|
|
|
+ } else {
|
|
|
this.examTask.courseName = "";
|
|
|
- return;
|
|
|
}
|
|
|
- this.examTask.courseName = val.name;
|
|
|
- this.clearCard();
|
|
|
- this.updateApproverPeople();
|
|
|
- },
|
|
|
- clearCard() {
|
|
|
- this.clearMakeMethod();
|
|
|
- },
|
|
|
- async updateApproverPeople() {
|
|
|
- const data = await taskAllApproverPeople({
|
|
|
- courseCode: this.examTask.courseCode
|
|
|
- });
|
|
|
- let approvePeople = {};
|
|
|
- data.approveUserList.forEach(item => {
|
|
|
- item.users = item.approveUser.map(
|
|
|
- user => `${user.realName}(${user.orgName})`
|
|
|
- );
|
|
|
- item.firstUser = item.users[0];
|
|
|
- item.moreUser = item.users.length > 1 ? item.users.join(",") : null;
|
|
|
- approvePeople[item.setup] = item;
|
|
|
- });
|
|
|
- this.flows = this.flows.map(flow => {
|
|
|
- return {
|
|
|
- ...flow,
|
|
|
- ...approvePeople[flow.setup]
|
|
|
- };
|
|
|
- });
|
|
|
+
|
|
|
+ this.examTaskDetail.cardId = "";
|
|
|
+ this.cards = [];
|
|
|
+ this.getCardList();
|
|
|
},
|
|
|
getTaskDetailData() {
|
|
|
let data = { ...this.examTaskDetail };
|
|
@@ -566,35 +470,7 @@ export default {
|
|
|
data.paperConfirmAttachmentIds = JSON.stringify(
|
|
|
this.paperConfirmAttachments
|
|
|
);
|
|
|
- this.examTaskDetail = data;
|
|
|
- },
|
|
|
- checkDataValid() {
|
|
|
- const attachmentValid = !this.paperAttachments.some(
|
|
|
- item => !item.attachmentId
|
|
|
- );
|
|
|
- // 设置了入库强制包含试卷时,校验试卷是否上传。
|
|
|
- if (this.examTaskDetail.includePaper && !attachmentValid) {
|
|
|
- this.$message.error("请完成试卷文件上传!");
|
|
|
- return;
|
|
|
- }
|
|
|
- // if (!this.paperConfirmAttachments.length) {
|
|
|
- // this.$message.error("请上传入库审核表!");
|
|
|
- // return;
|
|
|
- // }
|
|
|
-
|
|
|
- if (!this.examTaskDetail.cardId) {
|
|
|
- this.$message.error("请选择题卡创建方式!");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (
|
|
|
- this.examTaskDetail.makeMethod !== "SELECT" &&
|
|
|
- this.examTaskDetail.status !== "SUBMIT"
|
|
|
- ) {
|
|
|
- this.$message.error("请先提交题卡!");
|
|
|
- return;
|
|
|
- }
|
|
|
- return true;
|
|
|
+ return data;
|
|
|
},
|
|
|
// image-preview
|
|
|
toPreview(index) {
|