|
@@ -54,6 +54,14 @@
|
|
>
|
|
>
|
|
导出
|
|
导出
|
|
</el-button>
|
|
</el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ size="small"
|
|
|
|
+ type="primary"
|
|
|
|
+ icon="el-icon-upload2"
|
|
|
|
+ @click="importOrgSettings"
|
|
|
|
+ >
|
|
|
|
+ 导入
|
|
|
|
+ </el-button>
|
|
<el-button size="small" type="primary" @click="back"
|
|
<el-button size="small" type="primary" @click="back"
|
|
>返 回</el-button
|
|
>返 回</el-button
|
|
>
|
|
>
|
|
@@ -303,6 +311,66 @@
|
|
</el-row>
|
|
</el-row>
|
|
</el-form>
|
|
</el-form>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
+
|
|
|
|
+ <!-- 导入弹窗 -->
|
|
|
|
+ <el-dialog
|
|
|
|
+ title="学习中心设置导入"
|
|
|
|
+ size="tiny"
|
|
|
|
+ :visible.sync="orgSettingsImportDialog"
|
|
|
|
+ >
|
|
|
|
+ <el-form :model="orgSettingsImportForm" ref="orgSettingsImportForm">
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-form-item style="margin-left:30px">
|
|
|
|
+ <el-upload
|
|
|
|
+ ref="upload"
|
|
|
|
+ accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
|
|
+ :action="uploadAction"
|
|
|
|
+ :headers="uploadHeaders"
|
|
|
|
+ :data="uploadData"
|
|
|
|
+ :on-success="uploadSuccess"
|
|
|
|
+ :on-error="uploadError"
|
|
|
|
+ :file-list="fileList"
|
|
|
|
+ :auto-upload="false"
|
|
|
|
+ :multiple="false"
|
|
|
|
+ >
|
|
|
|
+ <el-button size="small" slot="trigger" type="primary"
|
|
|
|
+ >选择文件</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button
|
|
|
|
+ size="small"
|
|
|
|
+ style="margin-left:10px;"
|
|
|
|
+ type="success"
|
|
|
|
+ @click="submitUpload"
|
|
|
|
+ >确认上传
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ size="small"
|
|
|
|
+ style="margin-left: 10px;"
|
|
|
|
+ type="danger"
|
|
|
|
+ @click="removeFile"
|
|
|
|
+ >清空文件
|
|
|
|
+ </el-button>
|
|
|
|
+ <div slot="tip" class="el-upload__tip">只能上传xlsx文件</div>
|
|
|
|
+ </el-upload>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-row>
|
|
|
|
+ </el-form>
|
|
|
|
+ </el-dialog>
|
|
|
|
+
|
|
|
|
+ <!-- 导入错误信息列表 -->
|
|
|
|
+ <el-dialog title="错误提示" :visible.sync="errDialog">
|
|
|
|
+ <div
|
|
|
|
+ class="text-danger"
|
|
|
|
+ v-for="errMessage in errMessages"
|
|
|
|
+ :key="errMessage.lineNum"
|
|
|
|
+ >
|
|
|
|
+ 第{{ errMessage.lineNum }}行:{{ errMessage.msg }}
|
|
|
|
+ </div>
|
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="errDialog = false">确定</el-button>
|
|
|
|
+ </span>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ <!--END-->
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
@@ -350,7 +418,16 @@ export default {
|
|
orgId: [
|
|
orgId: [
|
|
{ required: true, message: "请选择学习中心", trigger: "blur,change" }
|
|
{ required: true, message: "请选择学习中心", trigger: "blur,change" }
|
|
]
|
|
]
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ orgSettingsImportDialog: false,
|
|
|
|
+ orgSettingsImportForm: {},
|
|
|
|
+ uploadAction: null,
|
|
|
|
+ uploadHeaders: {},
|
|
|
|
+ uploadData: {},
|
|
|
|
+ fileList: [],
|
|
|
|
+ errDialog: false,
|
|
|
|
+ errMessages: []
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -504,6 +581,79 @@ export default {
|
|
this.user.token
|
|
this.user.token
|
|
);
|
|
);
|
|
},
|
|
},
|
|
|
|
+ importOrgSettings() {
|
|
|
|
+ this.fileList = [];
|
|
|
|
+ this.orgSettingsImportDialog = true;
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ uploadSuccess(response, file, fileList) {
|
|
|
|
+ console.log("uploadSuccess");
|
|
|
|
+ console.log(response);
|
|
|
|
+ console.log(file);
|
|
|
|
+ console.log(fileList);
|
|
|
|
+ this.$notify({
|
|
|
|
+ message: "上传成功",
|
|
|
|
+ type: "success"
|
|
|
|
+ });
|
|
|
|
+ this.fileLoading = false;
|
|
|
|
+ this.studentImportDialog = false;
|
|
|
|
+ this.resetPageAndSearch();
|
|
|
|
+ },
|
|
|
|
+ uploadError(response, file, fileList) {
|
|
|
|
+ console.log("uploadError");
|
|
|
|
+ console.log(response);
|
|
|
|
+ console.log(file);
|
|
|
|
+ console.log(fileList);
|
|
|
|
+ var json = JSON.parse(response.message);
|
|
|
|
+ if (response.status == 500) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ message: json.desc,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ this.fileLoading = false;
|
|
|
|
+ },
|
|
|
|
+ //清空文件
|
|
|
|
+ removeFile() {
|
|
|
|
+ // this.fileList = [];
|
|
|
|
+ this.$refs.upload.clearFiles();
|
|
|
|
+ },
|
|
|
|
+ //确定上传
|
|
|
|
+ submitUpload() {
|
|
|
|
+ if (!this.checkUpload()) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ this.$refs.upload.submit();
|
|
|
|
+ this.fileLoading = true;
|
|
|
|
+ },
|
|
|
|
+ checkUpload() {
|
|
|
|
+ var fileList = this.$refs.upload.uploadFiles;
|
|
|
|
+ if (fileList.length == 0) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ message: "上传文件不能为空",
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ if (fileList.length > 1) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ message: "每次只能上传一个文件",
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ for (let file of fileList) {
|
|
|
|
+ if (!file.name.endsWith(".xlsx")) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ message: "上传文件必须为xlsx格式",
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ this.fileList = [];
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ },
|
|
resetPageAndSearch() {
|
|
resetPageAndSearch() {
|
|
this.currentPage = 1;
|
|
this.currentPage = 1;
|
|
this.search();
|
|
this.search();
|
|
@@ -540,6 +690,12 @@ export default {
|
|
this.examId = this.$route.params.id;
|
|
this.examId = this.$route.params.id;
|
|
this.formSearch.examId = this.examId;
|
|
this.formSearch.examId = this.examId;
|
|
this.init();
|
|
this.init();
|
|
|
|
+ this.uploadHeaders = {
|
|
|
|
+ key: this.user.key,
|
|
|
|
+ token: this.user.token
|
|
|
|
+ };
|
|
|
|
+ this.uploadAction =
|
|
|
|
+ EXAM_WORK_API + "/exam/importExamOrgSettings/" + this.examId;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|