|
@@ -1,158 +1,160 @@
|
|
-<template>
|
|
|
|
- <Modal
|
|
|
|
- class="modify-unformal-grading-task"
|
|
|
|
- v-model="modalIsShow"
|
|
|
|
- title="创建试评任务"
|
|
|
|
- :mask-closable="false"
|
|
|
|
- @on-visible-change="visibleChange"
|
|
|
|
- >
|
|
|
|
- <div class="task-body" v-if="!unformalGradingIsRunning">
|
|
|
|
- <upload-button
|
|
|
|
- btn-icon="md-cloud-upload"
|
|
|
|
- :btn-content="uploadBtnName"
|
|
|
|
- :upload-url="uploadUrl"
|
|
|
|
- :upload-data="uploadData"
|
|
|
|
- :headers="headers"
|
|
|
|
- :format="['xls', 'xlsx']"
|
|
|
|
- :auto-upload="false"
|
|
|
|
- @upload-success="uploadSuccess"
|
|
|
|
- @file-change="selectedFile"
|
|
|
|
- ref="UploadButton"
|
|
|
|
- >
|
|
|
|
- <Button
|
|
|
|
- type="primary"
|
|
|
|
- shape="circle"
|
|
|
|
- :disabled="$refs.UploadButton && $refs.UploadButton.loading"
|
|
|
|
- @click="startUpload"
|
|
|
|
- style="margin-left: 10px"
|
|
|
|
- slot="extra"
|
|
|
|
- >开始上传</Button
|
|
|
|
- >
|
|
|
|
- </upload-button>
|
|
|
|
- </div>
|
|
|
|
- <div class="task-body" v-else>
|
|
|
|
- <p class="task-tips">当前已经开始试评</p>
|
|
|
|
- </div>
|
|
|
|
- <div class="task-action" slot="footer">
|
|
|
|
- <Button
|
|
|
|
- shape="circle"
|
|
|
|
- type="error"
|
|
|
|
- :disabled="isSubmit"
|
|
|
|
- @click="toOverTask"
|
|
|
|
- v-if="unformalGradingIsRunning"
|
|
|
|
- >结束并清空数据</Button
|
|
|
|
- >
|
|
|
|
- <Button shape="circle" @click="cancel">取消</Button>
|
|
|
|
- <Button
|
|
|
|
- shape="circle"
|
|
|
|
- type="primary"
|
|
|
|
- :disabled="isSubmit || !uploadFileIsSuccess"
|
|
|
|
- v-if="!unformalGradingIsRunning"
|
|
|
|
- @click="toStartTask"
|
|
|
|
- >开始试评</Button
|
|
|
|
- >
|
|
|
|
- </div>
|
|
|
|
- </Modal>
|
|
|
|
-</template>
|
|
|
|
-
|
|
|
|
-<script>
|
|
|
|
-import { createTryGradingTask, finishTryGradingTask } from "@/api";
|
|
|
|
-import UploadButton from "@/components/UploadButton";
|
|
|
|
-
|
|
|
|
-export default {
|
|
|
|
- name: "modify-unformal-grading-task",
|
|
|
|
- components: { UploadButton },
|
|
|
|
- props: {
|
|
|
|
- curSubject: {
|
|
|
|
- type: Object,
|
|
|
|
- default() {
|
|
|
|
- return {};
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- data() {
|
|
|
|
- return {
|
|
|
|
- modalIsShow: false,
|
|
|
|
- isSubmit: false,
|
|
|
|
- uploadData: {},
|
|
|
|
- headers: {
|
|
|
|
- Authorization: this.$ls.get("user", { token: "" }).token,
|
|
|
|
- workId: this.$route.params.workId,
|
|
|
|
- userId: this.$ls.get("user", { id: "" }).id
|
|
|
|
- },
|
|
|
|
- uploadBtnName: "导入考生数据",
|
|
|
|
- uploadUrl: this.GLOBAL.domain + "/api/import/students/batchAllForTrial",
|
|
|
|
- uploadFileIsSuccess: false,
|
|
|
|
- unformalGradingIsRunning: false
|
|
|
|
- };
|
|
|
|
- },
|
|
|
|
- created() {
|
|
|
|
- this.uploadData = {
|
|
|
|
- workId: this.curSubject.workId,
|
|
|
|
- subject: this.curSubject.subject
|
|
|
|
- };
|
|
|
|
- },
|
|
|
|
- methods: {
|
|
|
|
- visibleChange(visible) {
|
|
|
|
- if (visible) {
|
|
|
|
- this.uploadFileIsSuccess = false;
|
|
|
|
- this.isSubmit = false;
|
|
|
|
- this.unformalGradingIsRunning =
|
|
|
|
- this.curSubject.stage == "LEVEL" && this.curSubject.test === 2;
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- cancel() {
|
|
|
|
- this.modalIsShow = false;
|
|
|
|
- },
|
|
|
|
- open() {
|
|
|
|
- this.modalIsShow = true;
|
|
|
|
- },
|
|
|
|
- startUpload() {
|
|
|
|
- this.$refs.UploadButton.startUpload();
|
|
|
|
- },
|
|
|
|
- selectedFile(file) {
|
|
|
|
- this.uploadBtnName = file.name;
|
|
|
|
- },
|
|
|
|
- uploadSuccess(response) {
|
|
|
|
- this.uploadBtnName = "导入考生数据";
|
|
|
|
- this.uploadFileIsSuccess = true;
|
|
|
|
- },
|
|
|
|
- async toStartTask() {
|
|
|
|
- if (this.isSubmit) return;
|
|
|
|
- this.isSubmit = true;
|
|
|
|
- let result = true;
|
|
|
|
- await createTryGradingTask(this.uploadData).catch(() => {
|
|
|
|
- result = false;
|
|
|
|
- });
|
|
|
|
- this.isSubmit = false;
|
|
|
|
- if (!result) return;
|
|
|
|
-
|
|
|
|
- this.$Message.success("发布任务成功!");
|
|
|
|
- this.$emit("modified");
|
|
|
|
- this.cancel();
|
|
|
|
- },
|
|
|
|
- async toOverTask() {
|
|
|
|
- if (this.isSubmit) return;
|
|
|
|
- this.isSubmit = true;
|
|
|
|
-
|
|
|
|
- this.$Modal.confirm({
|
|
|
|
- content: "确定要结束试评任务并清空所有试评数据吗?",
|
|
|
|
- onOk: async () => {
|
|
|
|
- const data = await finishTryGradingTask(
|
|
|
|
- this.uploadData
|
|
|
|
- ).catch(() => {});
|
|
|
|
- this.isSubmit = false;
|
|
|
|
- if (!data) return;
|
|
|
|
-
|
|
|
|
- this.$Message.success("操作成功!");
|
|
|
|
- this.$emit("modified");
|
|
|
|
- this.cancel();
|
|
|
|
- },
|
|
|
|
- onCancel: () => {
|
|
|
|
- this.isSubmit = false;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-};
|
|
|
|
-</script>
|
|
|
|
|
|
+<template>
|
|
|
|
+ <Modal
|
|
|
|
+ class="modify-unformal-grading-task"
|
|
|
|
+ v-model="modalIsShow"
|
|
|
|
+ title="创建试评任务"
|
|
|
|
+ :mask-closable="false"
|
|
|
|
+ @on-visible-change="visibleChange"
|
|
|
|
+ >
|
|
|
|
+ <div class="task-body" v-if="!unformalGradingIsRunning">
|
|
|
|
+ <upload-button
|
|
|
|
+ btn-icon="md-cloud-upload"
|
|
|
|
+ :btn-content="uploadBtnName"
|
|
|
|
+ :upload-url="uploadUrl"
|
|
|
|
+ :upload-data="uploadData"
|
|
|
|
+ :headers="headers"
|
|
|
|
+ :format="['xls', 'xlsx']"
|
|
|
|
+ :auto-upload="false"
|
|
|
|
+ @upload-success="uploadSuccess"
|
|
|
|
+ @file-change="selectedFile"
|
|
|
|
+ ref="UploadButton"
|
|
|
|
+ >
|
|
|
|
+ <Button
|
|
|
|
+ type="primary"
|
|
|
|
+ shape="circle"
|
|
|
|
+ :disabled="$refs.UploadButton && $refs.UploadButton.loading"
|
|
|
|
+ @click="startUpload"
|
|
|
|
+ style="margin-left: 10px"
|
|
|
|
+ slot="extra"
|
|
|
|
+ >开始上传</Button
|
|
|
|
+ >
|
|
|
|
+ </upload-button>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="task-body" v-else>
|
|
|
|
+ <p class="task-tips">当前已经开始试评</p>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="task-action" slot="footer">
|
|
|
|
+ <Button
|
|
|
|
+ shape="circle"
|
|
|
|
+ type="error"
|
|
|
|
+ :disabled="isSubmit"
|
|
|
|
+ @click="toOverTask"
|
|
|
|
+ v-if="unformalGradingIsRunning"
|
|
|
|
+ >结束并清空数据</Button
|
|
|
|
+ >
|
|
|
|
+ <Button shape="circle" @click="cancel">取消</Button>
|
|
|
|
+ <Button
|
|
|
|
+ shape="circle"
|
|
|
|
+ type="primary"
|
|
|
|
+ :disabled="isSubmit || !uploadFileIsSuccess"
|
|
|
|
+ v-if="!unformalGradingIsRunning"
|
|
|
|
+ @click="toStartTask"
|
|
|
|
+ >开始试评</Button
|
|
|
|
+ >
|
|
|
|
+ </div>
|
|
|
|
+ </Modal>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import { createTryGradingTask, finishTryGradingTask } from "@/api";
|
|
|
|
+import UploadButton from "@/components/UploadButton";
|
|
|
|
+
|
|
|
|
+export default {
|
|
|
|
+ name: "modify-unformal-grading-task",
|
|
|
|
+ components: { UploadButton },
|
|
|
|
+ props: {
|
|
|
|
+ curSubject: {
|
|
|
|
+ type: Object,
|
|
|
|
+ default() {
|
|
|
|
+ return {};
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ modalIsShow: false,
|
|
|
|
+ isSubmit: false,
|
|
|
|
+ uploadData: {},
|
|
|
|
+ headers: {
|
|
|
|
+ Authorization: this.$ls.get("user", { token: "" }).token,
|
|
|
|
+ workId: this.$route.params.workId,
|
|
|
|
+ userId: this.$ls.get("user", { id: "" }).id
|
|
|
|
+ },
|
|
|
|
+ uploadBtnName: "导入考生数据",
|
|
|
|
+ uploadUrl: this.GLOBAL.domain + "/api/import/students/batchAllForTrial",
|
|
|
|
+ uploadFileIsSuccess: false,
|
|
|
|
+ unformalGradingIsRunning: false
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ created() {
|
|
|
|
+ this.uploadData = {
|
|
|
|
+ workId: this.curSubject.workId,
|
|
|
|
+ subject: this.curSubject.subject
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ visibleChange(visible) {
|
|
|
|
+ if (visible) {
|
|
|
|
+ this.uploadFileIsSuccess = false;
|
|
|
|
+ this.isSubmit = false;
|
|
|
|
+ this.unformalGradingIsRunning =
|
|
|
|
+ (this.curSubject.stage === "LEVEL" ||
|
|
|
|
+ this.curSubject.stage === "ROUGH_LEVEL") &&
|
|
|
|
+ this.curSubject.test === 2;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ cancel() {
|
|
|
|
+ this.modalIsShow = false;
|
|
|
|
+ },
|
|
|
|
+ open() {
|
|
|
|
+ this.modalIsShow = true;
|
|
|
|
+ },
|
|
|
|
+ startUpload() {
|
|
|
|
+ this.$refs.UploadButton.startUpload();
|
|
|
|
+ },
|
|
|
|
+ selectedFile(file) {
|
|
|
|
+ this.uploadBtnName = file.name;
|
|
|
|
+ },
|
|
|
|
+ uploadSuccess(response) {
|
|
|
|
+ this.uploadBtnName = "导入考生数据";
|
|
|
|
+ this.uploadFileIsSuccess = true;
|
|
|
|
+ },
|
|
|
|
+ async toStartTask() {
|
|
|
|
+ if (this.isSubmit) return;
|
|
|
|
+ this.isSubmit = true;
|
|
|
|
+ let result = true;
|
|
|
|
+ await createTryGradingTask(this.uploadData).catch(() => {
|
|
|
|
+ result = false;
|
|
|
|
+ });
|
|
|
|
+ this.isSubmit = false;
|
|
|
|
+ if (!result) return;
|
|
|
|
+
|
|
|
|
+ this.$Message.success("发布任务成功!");
|
|
|
|
+ this.$emit("modified");
|
|
|
|
+ this.cancel();
|
|
|
|
+ },
|
|
|
|
+ async toOverTask() {
|
|
|
|
+ if (this.isSubmit) return;
|
|
|
|
+ this.isSubmit = true;
|
|
|
|
+
|
|
|
|
+ this.$Modal.confirm({
|
|
|
|
+ content: "确定要结束试评任务并清空所有试评数据吗?",
|
|
|
|
+ onOk: async () => {
|
|
|
|
+ const data = await finishTryGradingTask(
|
|
|
|
+ this.uploadData
|
|
|
|
+ ).catch(() => {});
|
|
|
|
+ this.isSubmit = false;
|
|
|
|
+ if (!data) return;
|
|
|
|
+
|
|
|
|
+ this.$Message.success("操作成功!");
|
|
|
|
+ this.$emit("modified");
|
|
|
|
+ this.cancel();
|
|
|
|
+ },
|
|
|
|
+ onCancel: () => {
|
|
|
|
+ this.isSubmit = false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+</script>
|