瀏覽代碼

更新问题

lex-xin 3 年之前
父節點
當前提交
c6d189939c
共有 1 個文件被更改,包括 13 次插入2 次删除
  1. 13 2
      src/views/teachManager/index.vue

+ 13 - 2
src/views/teachManager/index.vue

@@ -126,7 +126,7 @@
                   <el-button
                     type="text"
                     @click="operationTeachClass('create', scope.row)"
-                    v-if="!scope.row.enable && formatParentId(scope.row.id, tableList).length < 4"
+                    v-if="!scope.row.enable && scope.row.level < 4"
                     >添加</el-button
                   >
                 </auth>
@@ -203,6 +203,15 @@ import {
   enableSysMusicScore,
   removeSysMusicScore,
 } from "./api";
+const formatList = (list, level = 1) => {
+  for (let item of list) {
+    item.level = level;
+    if (item.sysMusicScoreCategoriesList && item.sysMusicScoreCategoriesList.length) {
+      formatList(item.sysMusicScoreCategoriesList, level + 1)
+    }
+  }
+  return list
+}
 export default {
   components: { pagination, teachClass },
   data() {
@@ -245,7 +254,9 @@ export default {
          ...rest
         });
         console.log(res)
-        this.tableList = res.data;
+        const result = formatList(res.data)
+        console.log(result)
+        this.tableList = result
       } catch (e) {}
     },
     search() {