|
@@ -3,7 +3,7 @@
|
|
|
<div class="task-title">
|
|
|
<h2>
|
|
|
<span>考试名称: {{ task.examName }} </span>
|
|
|
- <span>科目名称:{{ task.courseName }}</span>
|
|
|
+ <span>科目名称:{{ task.courseNameCode }}</span>
|
|
|
</h2>
|
|
|
<div class="task-title-infos">
|
|
|
<el-checkbox v-model="pTypeEnable" @change="pTypeEnableChange"
|
|
@@ -21,14 +21,14 @@
|
|
|
<tr v-for="(attachment, index) in curPaperAttachments" :key="index">
|
|
|
<td>{{ attachment.name }}卷</td>
|
|
|
<td class="td-link">
|
|
|
- <span @click="toUpload(attachment)">
|
|
|
+ <span @click="toUpload(attachment)" title="点击上传试卷">
|
|
|
<i
|
|
|
:class="[
|
|
|
'icon',
|
|
|
attachment.id ? 'icon-files-act' : 'icon-files'
|
|
|
]"
|
|
|
></i
|
|
|
- >点击上传试卷文件
|
|
|
+ >{{ attachment.id ? attachment.filename : "点击上传试卷文件" }}
|
|
|
</span>
|
|
|
</td>
|
|
|
<td
|
|
@@ -36,37 +36,62 @@
|
|
|
:rowspan="pTypeEnable ? curPaperAttachments.length : 1"
|
|
|
v-if="index === 0"
|
|
|
>
|
|
|
- <span><i class="icon icon-plus-act"></i>创建答题卡</span>
|
|
|
+ <span @click="toCreateCard"
|
|
|
+ ><i class="icon icon-plus-act"></i
|
|
|
+ >{{ task.cardId ? "预览题卡" : "创建答题卡" }}</span
|
|
|
+ >
|
|
|
</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
|
|
|
<div class="task-action">
|
|
|
- <el-button type="primary" style="width:105px;">确认提交</el-button>
|
|
|
- <el-button style="width:88px;">暂存</el-button>
|
|
|
+ <el-button type="primary" style="width:105px;" @click="toSubmit"
|
|
|
+ >确认提交</el-button
|
|
|
+ >
|
|
|
+ <el-button style="width:88px;" @click="toSave">暂存</el-button>
|
|
|
<el-button @click="goback" style="width:88px;">取消</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <!-- file-upload-view -->
|
|
|
- <file-upload-view ref="FileUploadView"></file-upload-view>
|
|
|
+ <!-- upload-paper-dialog -->
|
|
|
+ <upload-paper-dialog
|
|
|
+ :paper-attachment="curAttachment"
|
|
|
+ @confirm="uploadConfirm"
|
|
|
+ ref="UploadPaperDialog"
|
|
|
+ ></upload-paper-dialog>
|
|
|
+ <!-- card-option-dialog -->
|
|
|
+ <card-option-dialog
|
|
|
+ :data="task"
|
|
|
+ ref="CardOptionDialog"
|
|
|
+ @confirm="cardConfirm"
|
|
|
+ ></card-option-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { waitTaskDetail, saveWaitTask } from "../api";
|
|
|
-import FileUploadView from "../components/FileUploadView";
|
|
|
+import { waitTaskDetail, saveWaitTask, submitWaitTask } from "../api";
|
|
|
+import UploadPaperDialog from "../components/UploadPaperDialog";
|
|
|
+import CardOptionDialog from "../components/CardOptionDialog";
|
|
|
|
|
|
export default {
|
|
|
name: "wait-task-detail",
|
|
|
components: {
|
|
|
- FileUploadView
|
|
|
+ UploadPaperDialog,
|
|
|
+ CardOptionDialog
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
taskId: this.$route.params.taskId,
|
|
|
PAPER_TYPE_FIELDS: ["A", "B"],
|
|
|
- task: {},
|
|
|
+ task: {
|
|
|
+ id: "",
|
|
|
+ taskId: "",
|
|
|
+ enablePaperType: "A",
|
|
|
+ paperAttachmentId: "",
|
|
|
+ cardId: "",
|
|
|
+ cardSource: "",
|
|
|
+ refCardId: ""
|
|
|
+ },
|
|
|
pTypeEnable: false,
|
|
|
paperAttachments: [],
|
|
|
curPaperAttachments: [],
|
|
@@ -83,26 +108,27 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
async getData() {
|
|
|
- this.task = await waitTaskDetail(this.taskId);
|
|
|
+ const data = await waitTaskDetail(this.taskId);
|
|
|
+ this.task = Object.assign(this.task, data);
|
|
|
this.pTypeEnable = this.task.enablePaperType.split(",").length > 1;
|
|
|
this.parsePaperAttachment();
|
|
|
+ this.pTypeEnableChange(this.pTypeEnable);
|
|
|
},
|
|
|
parsePaperAttachment() {
|
|
|
const paperAttachment =
|
|
|
this.task.paperAttachmentId && JSON.parse(this.task.paperAttachmentId);
|
|
|
- const pagers = paperAttachment && paperAttachment.paper;
|
|
|
- let pagerDict = {};
|
|
|
- if (pagers) {
|
|
|
- pagers.map(paper => {
|
|
|
- pagerDict[paper.name] = paper;
|
|
|
+ const papers = paperAttachment && paperAttachment.paper;
|
|
|
+ let paperDict = {};
|
|
|
+ if (papers) {
|
|
|
+ papers.map(paper => {
|
|
|
+ paperDict[paper.name] = paper;
|
|
|
});
|
|
|
}
|
|
|
this.paperAttachments = this.PAPER_TYPE_FIELDS.map(paperType => {
|
|
|
- const paperInfo = pagerDict[paperType];
|
|
|
+ const paperInfo = paperDict[paperType];
|
|
|
let paper = {
|
|
|
id: "",
|
|
|
- name: paperType,
|
|
|
- path: ""
|
|
|
+ name: paperType
|
|
|
};
|
|
|
return paperInfo ? Object.assign({}, paper, paperInfo) : paper;
|
|
|
});
|
|
@@ -113,14 +139,57 @@ export default {
|
|
|
: [this.paperAttachments[0]];
|
|
|
},
|
|
|
toUpload(attachment) {
|
|
|
- this.curAttachment = attachment;
|
|
|
- this.$refs.FileUploadView.open();
|
|
|
+ this.curAttachment = { ...attachment };
|
|
|
+ this.$refs.UploadPaperDialog.open();
|
|
|
+ },
|
|
|
+ uploadConfirm(attachment) {
|
|
|
+ this.curAttachment = Object.assign(this.curAttachment, attachment);
|
|
|
+ const index = this.paperAttachments.findIndex(
|
|
|
+ item => item.name === attachment.name
|
|
|
+ );
|
|
|
+ this.paperAttachments.splice(index, 1, { ...this.curAttachment });
|
|
|
+ this.pTypeEnableChange(this.pTypeEnable);
|
|
|
+ },
|
|
|
+ toCreateCard() {
|
|
|
+ if (this.task.cardId) {
|
|
|
+ window.open(`/card/preview/${this.task.cardId}/view`);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$refs.CardOptionDialog.open();
|
|
|
+ },
|
|
|
+ cardConfirm(options) {
|
|
|
+ this.task = Object.assign(this.task, options);
|
|
|
},
|
|
|
- async save() {
|
|
|
+ getTaskData() {
|
|
|
let datas = { ...this.task };
|
|
|
- if (this.pTypeEnable)
|
|
|
- datas.enablePaperType = this.PAGE_TYPE_FIELDS.join();
|
|
|
- await saveWaitTask(datas);
|
|
|
+ datas.taskId = this.taskId;
|
|
|
+ datas.paperAttachmentId = JSON.stringify({
|
|
|
+ paper: this.curPaperAttachments
|
|
|
+ });
|
|
|
+ datas.enablePaperType = this.curPaperAttachments
|
|
|
+ .map(item => item.name)
|
|
|
+ .join(",");
|
|
|
+ return datas;
|
|
|
+ },
|
|
|
+ toSubmit() {
|
|
|
+ this.$confirm(
|
|
|
+ "任务确定提交后,则不可更改试卷及答题卡内容,确定提交该任务?",
|
|
|
+ "提示",
|
|
|
+ {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }
|
|
|
+ ).then(async () => {
|
|
|
+ await submitWaitTask(this.getTaskData());
|
|
|
+ this.$message.success("提交成功!");
|
|
|
+ this.goback();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async toSave() {
|
|
|
+ await saveWaitTask(this.getTaskData());
|
|
|
+ this.$message.success("保存成功!");
|
|
|
+ this.goback();
|
|
|
}
|
|
|
}
|
|
|
};
|