|
@@ -394,89 +394,14 @@
|
|
|
>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
- <el-dialog
|
|
|
- :visible.sync="dialogDR"
|
|
|
- width="660px"
|
|
|
- :show-close="false"
|
|
|
- :close-on-click-modal="false"
|
|
|
- >
|
|
|
- <div slot="title" class="hearders">
|
|
|
- <div class="leftTitle">导入</div>
|
|
|
- <div class="rightBoxs">
|
|
|
- <img
|
|
|
- src="@/assets/images/Close@2x.png"
|
|
|
- alt=""
|
|
|
- @click="dialogDR = false"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <div class="swq">
|
|
|
- <img
|
|
|
- style="width: 182px; height: 168px"
|
|
|
- src="@/assets/images/dr.png"
|
|
|
- alt=""
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div style="padding-left: 100px">
|
|
|
- <p>第一步:下载导入模板</p>
|
|
|
- <p style="padding-left: 50px">
|
|
|
- <i class="el-icon-upload"></i
|
|
|
- ><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>
|
|
|
- </div>
|
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="dialogDR = false">取消</el-button>
|
|
|
- <!-- <el-button type="primary" @click="submitChecksDR">确定</el-button> -->
|
|
|
- </span>
|
|
|
- </el-dialog>
|
|
|
- <el-dialog
|
|
|
- append-to-body
|
|
|
- :visible.sync="dialogERROR"
|
|
|
- width="660px"
|
|
|
- :show-close="false"
|
|
|
- :close-on-click-modal="false"
|
|
|
- >
|
|
|
- <div slot="title" class="hearders">
|
|
|
- <div class="leftTitle">提示</div>
|
|
|
- <div class="rightBoxs">
|
|
|
- <img
|
|
|
- src="@/assets/images/Close@2x.png"
|
|
|
- alt=""
|
|
|
- @click="dialogERROR = false"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <h4 style="margin-top: 0px; font-weight: bold; text-align: center">
|
|
|
- 导入失败原因
|
|
|
- </h4>
|
|
|
- <el-input
|
|
|
- readonly
|
|
|
- type="textarea"
|
|
|
- :autosize="{ minRows: 6, maxRows: 24 }"
|
|
|
- v-model="errorData"
|
|
|
- >
|
|
|
- </el-input>
|
|
|
- </div>
|
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="dialogERROR = false">确定</el-button>
|
|
|
- </span>
|
|
|
- </el-dialog>
|
|
|
+ <batch-import-dialoga
|
|
|
+ :dialogVisible.sync="dialogDR"
|
|
|
+ temUrl="/oss/images/file/20220617/1655453121157.xlsx"
|
|
|
+ apiKey="CoursemoduleimportData"
|
|
|
+ checkKey="inquireCourseListchapter"
|
|
|
+ :param="{ businessJson: newSujectApis }"
|
|
|
+ @success="success"
|
|
|
+ ></batch-import-dialoga>
|
|
|
<addChapter ref="addChapter" @backData="backData" />
|
|
|
</div>
|
|
|
</template>
|
|
@@ -484,10 +409,11 @@
|
|
|
<script>
|
|
|
import * as baseUrls from "@/utils/request.js";
|
|
|
import addChapter from "../addChapter.vue";
|
|
|
+import batchImportDialoga from "@/components/Comon/batchImportDialog.vue";
|
|
|
import searchBoxNew from "@/components/searchBoxNew";
|
|
|
import pagination from "@/components/pagination";
|
|
|
export default {
|
|
|
- components: { searchBoxNew, pagination, addChapter },
|
|
|
+ components: { searchBoxNew, pagination, addChapter, batchImportDialoga },
|
|
|
name: "ModuleManagementAdd",
|
|
|
data() {
|
|
|
return {
|
|
@@ -537,7 +463,7 @@ export default {
|
|
|
{ label: "章编码", prop: "code", width: "120" },
|
|
|
{ label: "标题前缀", prop: "prefixName", width: "180" },
|
|
|
{ label: "章标题", prop: "name" },
|
|
|
- { label: "节数量", prop: "sectionNum" , width: "120" },
|
|
|
+ { label: "节数量", prop: "sectionNum", width: "120" },
|
|
|
{
|
|
|
label: "发布状态",
|
|
|
prop: "publishStatus",
|
|
@@ -595,9 +521,8 @@ export default {
|
|
|
disCheckList: [], //已选转禁用复选列表
|
|
|
activeLists: [],
|
|
|
localData: [],
|
|
|
- errorData: "",
|
|
|
- dialogERROR: false,
|
|
|
dialogDR: false,
|
|
|
+ loading: false,
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -630,123 +555,16 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
-
|
|
|
- /**
|
|
|
- * 下载Excel模板
|
|
|
- */
|
|
|
- getDowm() {
|
|
|
- let url =
|
|
|
- baseUrls.BASE_IMG_URL + "/oss/images/file/20220617/1655453121157.xlsx";
|
|
|
- let link = document.createElement("a");
|
|
|
- let fileName = "导入模板" + ".xlsx";
|
|
|
- document.body.appendChild(link);
|
|
|
- link.href = url;
|
|
|
- link.dowmload = fileName;
|
|
|
- link.click();
|
|
|
- link.remove();
|
|
|
- },
|
|
|
dialogDRFunc() {
|
|
|
if (!this.newSujectApis.length) {
|
|
|
this.$message.error("请添加科目");
|
|
|
return;
|
|
|
}
|
|
|
this.dialogDR = true;
|
|
|
- }
|
|
|
- /**
|
|
|
- *
|
|
|
- * @param {Object} e
|
|
|
- * @remards 导入逻辑
|
|
|
- */,
|
|
|
- importMobleadd(e) {
|
|
|
- if (!this.newSujectApis.length) {
|
|
|
- this.$message.error("请添加科目");
|
|
|
- return;
|
|
|
- }
|
|
|
- var self = this;
|
|
|
- var file = e.target.files[0];
|
|
|
- if (file === undefined) {
|
|
|
- e.target.value = ""
|
|
|
- return;
|
|
|
- }
|
|
|
- var type = e.target.value.toLowerCase().split(".").splice(-1);
|
|
|
- if (type[0] != "xlsx"&& type[0] != "xls") {
|
|
|
- self.$message.error("请上传excel文件,且上传格式需为:.xlsx");
|
|
|
- return;
|
|
|
- }
|
|
|
- let formData = new FormData();
|
|
|
- formData.append("businessJson", JSON.stringify(this.newSujectApis));
|
|
|
- formData.append("file", file);
|
|
|
- this.$api
|
|
|
- .CoursemoduleimportData(formData)
|
|
|
- .then(async (res) => {
|
|
|
- if (res.code === 200) {
|
|
|
- if (!res.data.errorLog) {
|
|
|
- await this.awaitGetFestivalList(res.data.importNo, 1)
|
|
|
- .then((result) => {
|
|
|
- self.dialogDR = false;
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- e.target.value = "";
|
|
|
- });
|
|
|
- } else {
|
|
|
- await this.awaitGetFestivalList(res.data.importNo, 2)
|
|
|
- .then((result) => {
|
|
|
- let ary = res.data.errorLog.split("\r\n");
|
|
|
- ary = ary
|
|
|
- .filter((item) => {
|
|
|
- return item.length > 0;
|
|
|
- })
|
|
|
- .reverse();
|
|
|
- self.$message({
|
|
|
- message: `${ary.length}条数据导入失败,请查看失败原因`,
|
|
|
- customClass: "myMessageClass",
|
|
|
- });
|
|
|
- ary = ary.join("\r\n");
|
|
|
- self.errorData = ary;
|
|
|
- self.dialogERROR = true;
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- e.target.value = "";
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- .finally(() => {
|
|
|
- e.target.value = "";
|
|
|
- });
|
|
|
},
|
|
|
- /**
|
|
|
- *
|
|
|
- * @param {Strings} ids 查询编码
|
|
|
- * @param {Number} type 1为成功2为失败
|
|
|
- * @remards 失败时也需查询是否有成功的数据导入数据库,如存在 则加列队列同时提示
|
|
|
- */
|
|
|
- awaitGetFestivalList(ids, type) {
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- this.$api
|
|
|
- .inquireCourseListchapter({ importNo: ids })
|
|
|
- .then((res) => {
|
|
|
- if (type === 2 && res.rows.length) {
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: `成功导入${res.rows.length}条数据,`,
|
|
|
- customClass: "myMessageClass",
|
|
|
- });
|
|
|
- }
|
|
|
- if (res.rows.length) {
|
|
|
- this.activeLists = res.rows;
|
|
|
- if (type === 1) {
|
|
|
- this.submitForm();
|
|
|
- } else {
|
|
|
- this.submitForm(1);
|
|
|
- }
|
|
|
- }
|
|
|
- resolve();
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- reject();
|
|
|
- });
|
|
|
- });
|
|
|
+ success(data) {
|
|
|
+ this.activeLists = data;
|
|
|
+ this.submitForm();
|
|
|
},
|
|
|
jumpChapter(v) {
|
|
|
const jump = () => {
|
|
@@ -1183,10 +1001,9 @@ export default {
|
|
|
},
|
|
|
/**
|
|
|
*
|
|
|
- * @param {Number} int 导入失败标识
|
|
|
* @remards 合并且排列节列表数据
|
|
|
*/
|
|
|
- submitForm(int) {
|
|
|
+ submitForm() {
|
|
|
if (this.activeLists.length === 0) {
|
|
|
this.dialogVisible = false;
|
|
|
return;
|
|
@@ -1208,14 +1025,7 @@ export default {
|
|
|
}
|
|
|
this.tableData = this.tableData.concat(this.activeLists);
|
|
|
this.dialogVisible = false;
|
|
|
- this.activeLists = []
|
|
|
- if (!int) {
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: `添加成功`,
|
|
|
- customClass: "myMessageClass",
|
|
|
- });
|
|
|
- }
|
|
|
+ this.activeLists = [];
|
|
|
},
|
|
|
delList(item) {
|
|
|
this.tableData.map((items, indexs) => {
|
|
@@ -1225,7 +1035,7 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- closedFunc(){
|
|
|
+ closedFunc() {
|
|
|
this.activeLists = [];
|
|
|
},
|
|
|
},
|
|
@@ -1233,14 +1043,6 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
-.swq {
|
|
|
- text-align: center;
|
|
|
- border-bottom: 1px solid #eee;
|
|
|
-}
|
|
|
-.dowmStys {
|
|
|
- color: blue;
|
|
|
- cursor: pointer;
|
|
|
-}
|
|
|
.boxWidth {
|
|
|
width: 800px;
|
|
|
}
|