Browse Source

将原来的table模块化

谢杰标 3 years ago
parent
commit
4a2f0fd64d

+ 10 - 0
src/views/education/classManageMent/classHoursReview/component/ChapterTable.vue

@@ -0,0 +1,10 @@
+<template>
+  <div>2</div>
+</template>
+
+<script>
+export default {};
+</script>
+
+<style>
+</style>

+ 10 - 0
src/views/education/classManageMent/classHoursReview/component/LessonTable.vue

@@ -0,0 +1,10 @@
+<template>
+  <div>3</div>
+</template>
+
+<script>
+export default {};
+</script>
+
+<style>
+</style>

+ 10 - 0
src/views/education/classManageMent/classHoursReview/component/ModulTable.vue

@@ -0,0 +1,10 @@
+<template>
+  <div>1</div>
+</template>
+
+<script>
+export default {};
+</script>
+
+<style>
+</style>

+ 32 - 0
src/views/education/classManageMent/classHoursReview/component/StudyTables.vue

@@ -0,0 +1,32 @@
+<template>
+  <div>
+    <component
+      :is="key"
+      v-for="key in Object.keys(tablesData)"
+      :key="key"
+    ></component>
+  </div>
+</template>
+
+<script>
+import ModulTable from "./ModulTable.vue";
+import ChapterTable from "./ChapterTable.vue";
+import LessonTable from "./LessonTable.vue";
+export default {
+  props: {
+    tablesData: {
+      type: Object,
+      default: () => {
+        return {};
+      },
+    },
+  },
+  data() {
+    return {};
+  },
+  components: { ModulTable, LessonTable, ChapterTable },
+};
+</script>
+
+<style>
+</style>

+ 25 - 4
src/views/education/classManageMent/classHoursReview/studyTimes.vue

@@ -186,6 +186,7 @@
         </span>
       </div>
     </div>
+    <Study-tables :tablesData="tablesData"></Study-tables>
     <div style="flex: 1; flex-shrink: 0; overflow: auto">
       <el-checkbox-group
         v-model="checkList"
@@ -1015,6 +1016,7 @@
 </template>
 
 <script>
+import StudyTables from "./component/StudyTables.vue";
 export default {
   props: ["setData"],
   data() {
@@ -1220,6 +1222,7 @@ export default {
       allArrays: [], //审核中-所有数据
       popback: false, //打回待审核弹窗
       approvedOK: false, //确认审核通过结果
+      tablesData: {},
     };
   },
   computed: {
@@ -1789,6 +1792,19 @@ export default {
           });
       });
     },
+    changeData(data) {
+      const keys = [
+        "ModulTable",
+        "ChapterTable",
+        "LessonTable",
+        "",
+        "ChapterTable",
+      ];
+      let obj = {};
+      data.forEach((e) => (obj[keys[e.type-1]] || (obj[keys[e.type-1]] = [])).push(e));
+      this.tablesData = obj;
+      console.log(this.tablesData,1234)
+    },
     //获取学时审核数据
     search() {
       var self = this;
@@ -1804,6 +1820,7 @@ export default {
           /**
            * 将模块 章 节进行分类 tab1/tab2/tab3
            */
+          this.changeData(res.rows);
           let tab1 = [];
           let tab2 = [];
           let tab3 = [];
@@ -1828,10 +1845,11 @@ export default {
            */
           let getAllList1 = [];
           tab1.forEach((item) => {
-            item.classPeriods.forEach((items) => {
-              // if(items.type == 5){
-              //   continue
-              // }
+            item.classPeriods.forEach((items, i) => {
+              if (items.type == 5) {
+                (item.arr || (item.arr = [])).push(items);
+                item.classPeriods.splice(i, 1);
+              }
               items.classPeriodSectionList &&
                 items.classPeriodSectionList.forEach((itemsxs) => {
                   if (self.userData.periodStatus === 3) {
@@ -1923,6 +1941,9 @@ export default {
         checkedCount > 0 && checkedCount < this.getAllList.length;
     },
   },
+  components: {
+    StudyTables,
+  },
   /**
    * 离开页面前销毁定时器
    */