Ver código fonte

批量导入完成模块章节

xiejiebiao 2 anos atrás
pai
commit
09c78c4a1e

+ 62 - 17
src/components/Comon/batchImportDialog.vue

@@ -63,9 +63,7 @@
             </el-input>
           </div>
           <span slot="footer" class="dialog-footer">
-            <el-button @click="$emit('update:isShowErr', false)"
-              >确定</el-button
-            >
+            <el-button @click="isShowErr = false">确定</el-button>
           </span>
         </div>
       </Base-dialog>
@@ -87,24 +85,25 @@ export default {
     apiKey: {
       type: String,
     },
+    checkKey: {
+      type: String,
+    },
     newSujectApis: {
       type: Array,
       default: () => {
         return [];
       },
     },
-    isShowErr: {
+    isCheck: {
       type: Boolean,
-      default: false,
-    },
-    errorData: {
-      type: String,
-      default: "",
+      default: true,
     },
   },
   data() {
     return {
       loading: false,
+      errorData: [],
+      isShowErr: false,
     };
   },
   methods: {
@@ -119,10 +118,6 @@ export default {
       link.remove();
     },
     importMobleadd(e) {
-      if (!this.newSujectApis.length) {
-        this.$message.error("请添加科目");
-        return;
-      }
       var self = this;
       var file = e.target.files[0];
       if (file === undefined) {
@@ -136,12 +131,14 @@ export default {
       }
       this.loading = true;
       let formData = new FormData();
-      formData.append("businessJson", JSON.stringify(this.newSujectApis));
+      this.isCheck &&
+        formData.append("businessJson", JSON.stringify(this.newSujectApis));
       formData.append("file", file);
       this.$api[this.apiKey](formData)
-        .then(async (res) => {
+        .then((res) => {
           if (res.code === 200) {
-            this.$emit("success", res.data);
+            this.isCheck && this.getFestivalList(res.data);
+            this.getErrorData(res.data.errorLog);
           }
         })
         .finally(() => {
@@ -149,6 +146,52 @@ export default {
           this.loading = false;
         });
     },
+    /**
+     *
+     * @param {Strings} ids 查询编码
+     * @param {Number} type 1为成功2为失败
+     * @remards 失败时也需查询是否有成功的数据导入数据库,如存在 则加列队列同时提示
+     */
+    getFestivalList({ importNo, errorLog }) {
+      this.$api[checkKey]({ importNo })
+        .then((res) => {
+          if (res.rows.length) {
+            !errorLog &&
+              this.$message({
+                type: "success",
+                message: `成功导入${res.rows.length}条数据,`,
+                customClass: "myMessageClass",
+              });
+            this.$emit("success", res.rows);
+          }
+        })
+        .catch(() => {});
+    },
+    getErrorData(errorLog) {
+      if (errorLog) {
+        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.isShowErr = true;
+      } else {
+        this.$message({
+          type: "success",
+          message: `添加成功`,
+          customClass: "myMessageClass",
+        });
+        this.$emit("success", []);
+        this.isShow = false;
+      }
+    },
   },
   computed: {
     isShow: {
@@ -161,7 +204,9 @@ export default {
     },
   },
   watch: {
-    dialogVisible(val) {},
+    dialogVisible(val) {
+      this.isShowErr = false;
+    },
   },
 };
 </script>

+ 26 - 91
src/views/resource/videoManagement/chapter/add/index.vue

@@ -415,90 +415,14 @@
         >
       </span>
     </el-dialog>
-    <el-dialog
-      @closed="closedFunc"
-      :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/20220518/1652842582633.xlsx"
+      apiKey="drCourseSectionimportDataBusiness"
+      checkKey="inquireCourseSection"
+      :newSujectApis="newSujectApis"
+      @success="success"
+    ></batch-import-dialoga>
     <video-preview ref="preview" />
     <add-section ref="addSection" @backData="backData" />
   </div>
@@ -508,10 +432,17 @@
 import * as baseUrls from "@/utils/request.js";
 import searchBoxNew from "@/components/searchBoxNew";
 import pagination from "@/components/pagination";
+import batchImportDialoga from "@/components/Comon/batchImportDialog.vue";
 import videoPreview from "@/components/videoPreview";
 import addSection from "../addSection.vue";
 export default {
-  components: { searchBoxNew, pagination, videoPreview,addSection },
+  components: {
+    searchBoxNew,
+    pagination,
+    videoPreview,
+    addSection,
+    batchImportDialoga,
+  },
   name: "ChapterAdd",
   data() {
     return {
@@ -684,7 +615,7 @@ export default {
      * 添加节-返回数据
      */
     backData(v) {
-      console.log(v)
+      console.log(v);
       this.$api.inquireCourseSection({ sectionIds: v }).then((res) => {
         this.activeLists = res.rows;
         this.submitForm();
@@ -734,12 +665,12 @@ export default {
       link.click();
       link.remove();
     },
-    dialogDRFunc(){
+    dialogDRFunc() {
       if (!this.newSujectApis.length) {
         this.$message.error("请添加科目");
         return;
       }
-      this.dialogDR = true
+      this.dialogDR = true;
     },
     importMobleadd(e) {
       if (!this.newSujectApis.length) {
@@ -749,11 +680,11 @@ 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;
       }
@@ -826,6 +757,10 @@ export default {
           });
       });
     },
+    success(data) {
+      this.activeLists = data;
+      this.submitForm();
+    },
     unTime(val) {
       let a = `${val.businessId}-${val.subjectId}`;
       if (this.sujectApis.includes(a)) {
@@ -1230,7 +1165,7 @@ export default {
       }
       this.tableData = this.tableData.concat(this.activeLists);
       this.dialogVisible = false;
-      this.activeLists = []
+      this.activeLists = [];
       if (!int) {
         this.$message({
           type: "success",

+ 23 - 87
src/views/resource/videoManagement/chapter/edit/index.vue

@@ -388,89 +388,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/20220518/1652842582633.xlsx"
+      apiKey="drCourseSectionimportDataBusiness"
+      checkKey="inquireCourseSection"
+      :newSujectApis="newSujectApis"
+      @success="success"
+    ></batch-import-dialoga>
     <video-preview ref="preview" />
     <add-section ref="addSection" @backData="backData" />
   </div>
@@ -480,10 +405,17 @@
 import * as baseUrls from "@/utils/request.js";
 import searchBoxNew from "@/components/searchBoxNew";
 import pagination from "@/components/pagination";
+import batchImportDialoga from "@/components/Comon/batchImportDialog.vue";
 import videoPreview from "@/components/videoPreview";
 import addSection from "../addSection.vue";
 export default {
-  components: { searchBoxNew, pagination, videoPreview,addSection },
+  components: {
+    searchBoxNew,
+    pagination,
+    videoPreview,
+    addSection,
+    batchImportDialoga,
+  },
   name: "ChapterEdit",
   data() {
     return {
@@ -734,11 +666,11 @@ 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;
       }
@@ -817,6 +749,10 @@ export default {
           });
       });
     },
+    success(data) {
+      this.activeLists = data;
+      this.submitForm();
+    },
     /**
      * 科目复选框发生变化时触发
      */
@@ -1320,7 +1256,7 @@ export default {
         });
       }
       this.tableData = this.tableData.concat(this.activeLists);
-      this.activeLists = []
+      this.activeLists = [];
       this.dialogVisible = false;
       if (!int) {
         this.$message({

+ 12 - 95
src/views/resource/videoManagement/festival/index.vue

@@ -41,100 +41,13 @@
       @handleSizeChange="handleSizeChange"
       @handleCurrentChange="handleCurrentChange"
     />
-    <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>
-          <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">
-        <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/20220304/1646382321115.xlsx"
+      apiKey="drCourseSectionimportData"
+      :isCheck="false"
+      @success="success"
+    ></batch-import-dialoga>
   </div>
 </template>
 
@@ -142,11 +55,12 @@
 import * as baseUrls from "@/utils/request.js";
 import searchBoxNew from "@/components/searchBoxNew";
 import tableList from "@/components/tableList";
+import batchImportDialoga from "@/components/Comon/batchImportDialog.vue";
 import pagination from "@/components/pagination";
 import { sectionBatchDel } from "@/api/resource/videoManagement";
 export default {
   name: "Festival",
-  components: { searchBoxNew, tableList, pagination },
+  components: { searchBoxNew, tableList, pagination,batchImportDialoga },
   data() {
     return {
       dialogDR: false, //导入窗口
@@ -427,6 +341,9 @@ export default {
           this.loading = false;
         });
     },
+    success() {
+      this.search();
+    },
     moreActive() {
       this.dialogDR = true;
     },

+ 19 - 166
src/views/resource/videoManagement/moduleManagement/add/index.vue

@@ -394,92 +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>
-         <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">
-        <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"
+      :newSujectApis="newSujectApis"
+      @success="success"
+    ></batch-import-dialoga>
     <addChapter ref="addChapter" @backData="backData" />
   </div>
 </template>
@@ -487,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 {
@@ -540,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",
@@ -601,7 +524,7 @@ export default {
       errorData: "",
       dialogERROR: false,
       dialogDR: false,
-      loading:false
+      loading: false,
     };
   },
   watch: {
@@ -634,7 +557,6 @@ export default {
     }
   },
   methods: {
-    
     /**
      * 下载Excel模板
      */
@@ -655,71 +577,6 @@ export default {
         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;
-      }
-      this.loading = true
-      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 = "";
-          this.loading = false
-        });
     },
     /**
      *
@@ -754,6 +611,10 @@ export default {
           });
       });
     },
+    success(data) {
+      this.activeLists = data;
+      this.submitForm();
+    },
     jumpChapter(v) {
       const jump = () => {
         this.$store.dispatch("changemodulePage", {
@@ -1189,10 +1050,9 @@ export default {
     },
     /**
      *
-     * @param {Number} int 导入失败标识
      * @remards 合并且排列节列表数据
      */
-    submitForm(int) {
+    submitForm() {
       if (this.activeLists.length === 0) {
         this.dialogVisible = false;
         return;
@@ -1214,14 +1074,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) => {
@@ -1231,7 +1084,7 @@ export default {
         }
       });
     },
-    closedFunc(){
+    closedFunc() {
       this.activeLists = [];
     },
   },

+ 4 - 256
src/views/resource/videoManagement/moduleManagement/edit/index.vue

@@ -369,109 +369,14 @@
         >
       </span>
     </el-dialog>
-    <el-dialog
-      :visible.sync="loading"
-      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>
-          <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">
-        <el-button @click="dialogDR = false">取消</el-button>
-        <!-- <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"
+      checkKey="inquireCourseListchapter"
       apiKey="CoursemoduleimportData"
       :newSujectApis="newSujectApis"
       @success="success"
     ></batch-import-dialoga>
-    <el-dialog
-      append-to-body
-      :visible.sync="dialogVisible"
-      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>
     <addChapter ref="addChapter" @backData="backData" />
   </div>
 </template>
@@ -654,70 +559,6 @@ export default {
       }
       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;
-      }
-      this.loading = true;
-      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 = "";
-          this.loading = false;
-        });
-    },
     /**
      *
      * @param {Strings} ids 查询编码
@@ -751,31 +592,9 @@ 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 = "";
-        });
+    success(data) {
+      this.activeLists = data;
+      this.submitForm();
     },
     jumpChapter(v) {
       const jump = () => {
@@ -1251,20 +1070,9 @@ export default {
 </script>
 
 <style lang="less" scoped>
-.swq {
-  text-align: center;
-  border-bottom: 1px solid #eee;
-}
-.dowmStys {
-  color: blue;
-  cursor: pointer;
-}
 .boxWidth {
   width: 800px;
 }
-.numInputs {
-  width: 150px;
-}
 .checkboxSty {
   max-height: 210px;
   overflow: auto;
@@ -1294,14 +1102,6 @@ export default {
   align-items: center;
   flex-wrap: wrap;
 }
-.imgBoxins {
-  width: 375px;
-  height: 220px;
-  text-align: center;
-  img {
-    height: 100%;
-  }
-}
 .iconStsz {
   font-size: 40px;
   color: #67c23a;
@@ -1313,12 +1113,6 @@ export default {
   justify-content: space-between;
   margin-bottom: 10px;
 }
-.comInputsty {
-  width: 50px;
-  height: 24px;
-  text-align: center;
-  border: none;
-}
 /deep/.el-button {
   border-radius: 8px;
 }
@@ -1362,50 +1156,4 @@ export default {
     }
   }
 }
-.imgBox {
-  width: 100%;
-  // height: 210px;
-  border: 1px solid #e2e2e2;
-  border-radius: 8px;
-  padding: 8px 8px 3px;
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  .imgLabel {
-    flex: 1;
-    width: 100%;
-    border: 1px dotted #e2e2e2;
-    color: #999;
-    font-size: 14px;
-    cursor: pointer;
-    border-radius: 8px;
-    .msPhoto {
-      display: flex;
-      justify-content: center;
-      align-items: center;
-      max-width: 100%;
-      max-height: 270px;
-      img {
-        max-width: 100%;
-        max-height: 270px;
-      }
-    }
-    .imgbbx {
-      display: flex;
-      flex-direction: column;
-      align-items: center;
-      justify-content: center;
-      width: 100%;
-      height: 100%;
-      i {
-        font-weight: bold;
-        margin: 14px 0;
-        font-size: 24px;
-      }
-    }
-  }
-  p {
-    margin: 5px 0px;
-  }
-}
 </style>