|
@@ -370,7 +370,7 @@
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
<el-dialog
|
|
|
- :visible.sync="dialogDR"
|
|
|
+ :visible.sync="loading"
|
|
|
width="660px"
|
|
|
:show-close="false"
|
|
|
:close-on-click-modal="false"
|
|
@@ -400,18 +400,29 @@
|
|
|
><span class="dowmStys" @click="getDowm">下载模板</span>
|
|
|
</p>
|
|
|
<p>第二步:(批量新增):点击“上传Excel”完成导入</p>
|
|
|
- <label
|
|
|
- for="mobles"
|
|
|
- class="el-button el-button--primary"
|
|
|
- style="margin-left: 50px; padding: 10px 20px"
|
|
|
- >上传Excel</label
|
|
|
- ><input
|
|
|
- style="display: none"
|
|
|
- type="file"
|
|
|
- id="mobles"
|
|
|
- ref="input1"
|
|
|
- @change="importMobleadd"
|
|
|
- />
|
|
|
+ <div
|
|
|
+ v-loading="loading"
|
|
|
+ element-loading-text="正在处理中"
|
|
|
+ style="
|
|
|
+ margin-left: 50px;
|
|
|
+ padding: 10px 20px;
|
|
|
+ width: 130px;
|
|
|
+ height: 60px;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <label
|
|
|
+ v-show="!loading"
|
|
|
+ for="mobles"
|
|
|
+ class="el-button el-button--primary"
|
|
|
+ >上传Excel</label
|
|
|
+ ><input
|
|
|
+ style="display: none"
|
|
|
+ type="file"
|
|
|
+ id="mobles"
|
|
|
+ ref="input1"
|
|
|
+ @change="importMobleadd"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
@@ -419,9 +430,18 @@
|
|
|
<!-- <el-button type="primary" @click="submitChecksDR">确定</el-button> -->
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
+ <batch-import-dialoga
|
|
|
+ :dialogVisible.sync="dialogDR"
|
|
|
+ :isShowErr.sync="dialogERROR"
|
|
|
+ :errorData="errorData"
|
|
|
+ temUrl="/oss/images/file/20220617/1655453121157.xlsx"
|
|
|
+ apiKey="CoursemoduleimportData"
|
|
|
+ :newSujectApis="newSujectApis"
|
|
|
+ @success="success"
|
|
|
+ ></batch-import-dialoga>
|
|
|
<el-dialog
|
|
|
append-to-body
|
|
|
- :visible.sync="dialogERROR"
|
|
|
+ :visible.sync="dialogVisible"
|
|
|
width="660px"
|
|
|
:show-close="false"
|
|
|
:close-on-click-modal="false"
|
|
@@ -461,9 +481,10 @@ import * as baseUrls from "@/utils/request.js";
|
|
|
import searchBoxNew from "@/components/searchBoxNew";
|
|
|
import pagination from "@/components/pagination";
|
|
|
import addChapter from "../addChapter.vue";
|
|
|
+import batchImportDialoga from "@/components/Comon/batchImportDialog.vue";
|
|
|
export default {
|
|
|
name: "ModuleManagementEdit",
|
|
|
- components: { searchBoxNew, pagination, addChapter },
|
|
|
+ components: { searchBoxNew, pagination, addChapter, batchImportDialoga },
|
|
|
data() {
|
|
|
return {
|
|
|
disabledBtn: false,
|
|
@@ -574,6 +595,7 @@ export default {
|
|
|
errorData: "",
|
|
|
dialogERROR: false,
|
|
|
dialogDR: false,
|
|
|
+ loading: false,
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -631,13 +653,12 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
this.dialogDR = true;
|
|
|
- }
|
|
|
+ },
|
|
|
/**
|
|
|
*
|
|
|
* @param {Object} e
|
|
|
* @remards 导入逻辑
|
|
|
- */,
|
|
|
- importMobleadd(e) {
|
|
|
+ */ importMobleadd(e) {
|
|
|
if (!this.newSujectApis.length) {
|
|
|
this.$message.error("请添加科目");
|
|
|
return;
|
|
@@ -645,14 +666,15 @@ export default {
|
|
|
var self = this;
|
|
|
var file = e.target.files[0];
|
|
|
if (file === undefined) {
|
|
|
- e.target.value = ""
|
|
|
+ e.target.value = "";
|
|
|
return;
|
|
|
}
|
|
|
var type = e.target.value.toLowerCase().split(".").splice(-1);
|
|
|
- if (type[0] != "xlsx"&& type[0] != "xls") {
|
|
|
+ if (type[0] != "xlsx" && type[0] != "xls") {
|
|
|
self.$message.error("请上传excel文件,且上传格式需为:.xlsx");
|
|
|
return;
|
|
|
}
|
|
|
+ this.loading = true;
|
|
|
let formData = new FormData();
|
|
|
formData.append("businessJson", JSON.stringify(this.newSujectApis));
|
|
|
formData.append("file", file);
|
|
@@ -693,6 +715,7 @@ export default {
|
|
|
})
|
|
|
.finally(() => {
|
|
|
e.target.value = "";
|
|
|
+ this.loading = false;
|
|
|
});
|
|
|
},
|
|
|
/**
|
|
@@ -728,6 +751,32 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
+ success({ importNo, errorLog }) {
|
|
|
+ console.log(importNo, errorLog)
|
|
|
+ this.awaitGetFestivalList(importNo, errorLog ? 2 : 1)
|
|
|
+ .then((result) => {
|
|
|
+ if (!errorLog) {
|
|
|
+ self.dialogDR = false;
|
|
|
+ } else {
|
|
|
+ let ary = errorLog.split("\r\n");
|
|
|
+ ary = ary
|
|
|
+ .filter((item) => {
|
|
|
+ return item.length > 0;
|
|
|
+ })
|
|
|
+ .reverse();
|
|
|
+ this.$message({
|
|
|
+ message: `${ary.length}条数据导入失败,请查看失败原因`,
|
|
|
+ customClass: "myMessageClass",
|
|
|
+ });
|
|
|
+ ary = ary.join("\r\n");
|
|
|
+ this.errorData = ary;
|
|
|
+ this.dialogERROR = true;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ e.target.value = "";
|
|
|
+ });
|
|
|
+ },
|
|
|
jumpChapter(v) {
|
|
|
const jump = () => {
|
|
|
this.$store.dispatch("changemodulePage", {
|
|
@@ -1177,7 +1226,7 @@ export default {
|
|
|
}
|
|
|
this.tableData = this.tableData.concat(this.activeLists);
|
|
|
this.dialogVisible = false;
|
|
|
- this.activeLists = []
|
|
|
+ this.activeLists = [];
|
|
|
if (!int) {
|
|
|
this.$message({
|
|
|
type: "success",
|