|
@@ -92,7 +92,11 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import ImportFile from "@/components/ImportFile.vue";
|
|
import ImportFile from "@/components/ImportFile.vue";
|
|
-import { questionImportFileUpload, importQuestionApi } from "../api";
|
|
|
|
|
|
+import {
|
|
|
|
+ questionImportWordFileUpload,
|
|
|
|
+ questionImportExcelFileUpload,
|
|
|
|
+ importQuestionApi,
|
|
|
|
+} from "../api";
|
|
import { QUESTION_API } from "@/constants/constants";
|
|
import { QUESTION_API } from "@/constants/constants";
|
|
import { mapState } from "vuex";
|
|
import { mapState } from "vuex";
|
|
|
|
|
|
@@ -199,13 +203,11 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
},
|
|
},
|
|
- mounted() {
|
|
|
|
- this.templateUrl = `${QUESTION_API}/import/paper/template?$key=${this.user.key}&$token=${this.user.token}`;
|
|
|
|
- },
|
|
|
|
methods: {
|
|
methods: {
|
|
visibleChange() {
|
|
visibleChange() {
|
|
this.modalForm = { ...initModalForm };
|
|
this.modalForm = { ...initModalForm };
|
|
this.fileData = {};
|
|
this.fileData = {};
|
|
|
|
+ this.importTypeChange();
|
|
},
|
|
},
|
|
cancel() {
|
|
cancel() {
|
|
this.modalIsShow = false;
|
|
this.modalIsShow = false;
|
|
@@ -216,6 +218,11 @@ export default {
|
|
importTypeChange() {
|
|
importTypeChange() {
|
|
this.modalForm.checkTotalScore = false;
|
|
this.modalForm.checkTotalScore = false;
|
|
this.modalForm.useOriginalPaper = false;
|
|
this.modalForm.useOriginalPaper = false;
|
|
|
|
+ const urlBody =
|
|
|
|
+ this.importType === "excel"
|
|
|
|
+ ? "word/parse/excel_template_download"
|
|
|
|
+ : "import/paper/template";
|
|
|
|
+ this.templateUrl = `${QUESTION_API}/${urlBody}?$key=${this.user.key}&$token=${this.user.token}`;
|
|
},
|
|
},
|
|
fileChange(fileData) {
|
|
fileChange(fileData) {
|
|
this.fileData = fileData;
|
|
this.fileData = fileData;
|
|
@@ -247,7 +254,9 @@ export default {
|
|
const uploadApi =
|
|
const uploadApi =
|
|
this.importType === "zip"
|
|
this.importType === "zip"
|
|
? importQuestionApi
|
|
? importQuestionApi
|
|
- : questionImportFileUpload;
|
|
|
|
|
|
+ : this.importType === "word"
|
|
|
|
+ ? questionImportWordFileUpload
|
|
|
|
+ : questionImportExcelFileUpload;
|
|
|
|
|
|
const res = await uploadApi(formData, {
|
|
const res = await uploadApi(formData, {
|
|
md5: this.fileData.md5,
|
|
md5: this.fileData.md5,
|
|
@@ -262,6 +271,7 @@ export default {
|
|
...res.data,
|
|
...res.data,
|
|
importData: this.modalForm,
|
|
importData: this.modalForm,
|
|
importType: this.importType,
|
|
importType: this.importType,
|
|
|
|
+ importFileTypes: this.importFileTypes,
|
|
});
|
|
});
|
|
this.cancel();
|
|
this.cancel();
|
|
},
|
|
},
|