فهرست منبع

Merge branch 'dev' of http://192.168.0.115:3000/chenzhiguang/qjkankan_v1.1.1 into dev

rindy 5 ماه پیش
والد
کامیت
283d8cb786

+ 20 - 9
packages/qjkankan-editor/src/components/dragTree/index.vue

@@ -192,7 +192,6 @@ export default {
                 }
               }
             }
-
           });
         }
       },
@@ -277,7 +276,6 @@ export default {
       console.log("节点展开", data);
       // 当节点展开时,将其id添加到数组中
       this.expandedNodes.push(data.id);
- 
 
       this.nodesMap = {};
       for (let key in this.$refs.sceneTree.store.nodesMap) {
@@ -496,6 +494,8 @@ export default {
         this.inputData.name = this.$i18n.t("navigation.default_group_two");
       } else if (this.inputData.name == "一级分组") {
         this.inputData.name = this.$i18n.t("navigation.group_one");
+      } else if (this.inputData.name == "二级分组") {
+        this.inputData.name = this.$i18n.t("navigation.group_two");
       } else {
         // this.inputData .name = data.name;
       }
@@ -517,7 +517,19 @@ export default {
         this.reNameId = null;
         return;
       }
-      data.name = this.inputData.name;
+      let name = "";
+      if (this.inputData.name == this.$i18n.t("navigation.default_group_two")) {
+        name = "默认二级分组";
+      } else if (this.inputData.name == this.$i18n.t("navigation.group_one")) {
+        this.inputData.name = this.$i18n.t("navigation.group_one");
+        name = "一级分组";
+      } else if (this.inputData.name == this.$i18n.t("navigation.group_two")) {
+        this.inputData.name = this.$i18n.t("navigation.group_two");
+        name = "二级分组";
+      } else {
+        name = this.inputData.name;
+      }
+      data.name = name;
       this.reNameId = null;
       // this.isRenaming = false;
       // if (!this.inputData.name.trim()) {
@@ -548,7 +560,6 @@ export default {
         return;
       }
 
-
       if (this.info.navigationTrees.length == 1 && node.level == 1) {
         this.$alert({
           content: this.$i18n.t("navigation.keep_one_group"),
@@ -644,7 +655,7 @@ export default {
       let group = {
         id: "add_" + roundId,
         sid: "sid_" + getRandomSid(), //用于修改导航之后的标识
-        name: data ? this.$i18n.t("navigation.group_two") : this.$i18n.t("navigation.group_one"),
+        name: data ? "二级分组" : "一级分组",
         type: "group",
         level: data ? 1 : 0,
         children: [],
@@ -692,7 +703,7 @@ export default {
                 id: "add_" + (this.getRoundId() + 1),
                 sid: "sid_" + getRandomSid(), //用于修改导航之后的标识
                 sort: 0,
-                name: this.$i18n.t("navigation.default_group_two"),
+                name: "默认二级分组",
                 type: "group",
                 children: panoList,
               };
@@ -708,7 +719,7 @@ export default {
                 id: "add_" + (this.getRoundId() + 1),
                 sid: "sid_" + getRandomSid(), //用于修改导航之后的标识
                 sort: 0,
-                name: this.$i18n.t("navigation.default_group_two"),
+                name: "默认二级分组",
                 type: "group",
                 children: [],
               };
@@ -732,13 +743,13 @@ export default {
             break;
           case "drag":
             if (panoList.length && groupList.length) {
-              //新增目录到二级目录。且二级目录只有场景的时候
+              //拖拽目录到二级目录。且二级目录只有场景的时候
               let list = [];
               let defaultDir = {
                 id: "add_" + (this.getRoundId() + 1),
                 sid: "sid_" + getRandomSid(), //用于修改导航之后的标识
                 sort: 0,
-                name: this.$i18n.t("navigation.default_group_two"),
+                name: "默认二级分组",
                 type: "group",
                 children: panoList,
               };

+ 78 - 8
packages/qjkankan-view/src/components/UIGather/list.vue

@@ -68,11 +68,12 @@
       </div>
     </div>
     <div class="bottom-com">
-      <div v-if="metadata?.navigationTrees?.length > 1" :style="`width:${catalogRootW}px;`" class="root-group-list swiper-container" ref="root-group">
+      <!-- <div v-if="metadata?.navigationTrees?.length > 1" :style="`width:${catalogRootW}px;`" class="root-group-list swiper-container" ref="root-group"> -->
+      <div v-if="rootTabShow" :style="`width:${catalogRootW}px;`" class="root-group-list swiper-container" ref="root-group">
         <div class="swiper-wrapper root-group-wrapper">
           <template v-for="(item, index) in metadata?.navigationTrees">
             <div
-              v-if="item.children.length"
+              v-if="getCurrentTabScenes(item).length"
               class="swiper-slide root-group-slide"
               :class="{
                 active: currentRootId == item.id,
@@ -111,7 +112,9 @@ const spanlength = ref(5);
 
 const metadata = computed(() => store.getters["scene/metadata"]);
 const scenes = computed(() => store.getters["scene/list"]);
-const currentScene = computed(() => store.getters["scene/currentScene"]);
+const currentScene = computed(() => {
+  return store.getters["scene/currentScene"];
+});
 const currentSecondId = computed(() => store.getters["scene/currentSecondId"]);
 const currentRootId = computed(() => store.getters["scene/currentRootId"]);
 
@@ -124,7 +127,9 @@ const secondaryList = computed(() => store.getters["scene/secondaryList"]);
 
 const isShowScenesList = computed(() => store.getters["functions/isShowScenesList"]);
 
-const currentScenesList = computed(() => store.getters["scene/currentScenesList"]);
+const currentScenesList = computed(() => {
+  return store.getters["scene/currentScenesList"];
+});
 
 const show = ref(false);
 const swidth = ref({
@@ -144,7 +149,18 @@ const rootTabIndex = computed(() => {
   }
   return idx;
 });
-
+const getCurrentTabScenes = (item) => {
+  let list = [];
+  item.children.forEach((i) => {
+    if (i.type != "group") {
+      list.push(i);
+    } else {
+      let res = i.children.filter((t) => t.type != "group");
+      list = list.concat(res);
+    }
+  });
+  return list;
+};
 const secondTabIndex = computed(() => {
   let idx = 0;
   if (metadata.value && metadata.value?.navigationTrees) {
@@ -166,8 +182,59 @@ const secondaryW = computed(() => {
   let list = metadata.value?.navigationTrees[rootTabIndex.value].children.filter((item) => item.children.length);
   return list.length * (swidth.value["swSecondary"] + 10) - 10;
 });
+const rootTabShow = computed(() => {
+  let list = [];
+
+  metadata.value.navigationTrees.forEach((item) => {
+    let show = false;
+    item.children.forEach((i) => {
+      if (i.type != "group") {
+        // list.push(i);
+        show = true;
+      } else {
+        let res = i.children.filter((t) => t.type != "group");
+        if (res.length) {
+          show = true;
+        }
+        // list = list.concat(res);
+      }
+    });
+    if (show) {
+      list.push(item);
+    }
+  });
+
+  return list.length > 1 ? true : false;
+});
 const catalogRootW = computed(() => {
-  let list = metadata.value.navigationTrees.filter((item) => item.children.length);
+  let list = [];
+
+  metadata.value.navigationTrees.forEach((item) => {
+    let show = false;
+    item.children.forEach((i) => {
+      if (i.type != "group") {
+        // list.push(i);
+        show = true;
+      } else {
+        let res = i.children.filter((t) => t.type != "group");
+        if (res.length) {
+          show = true;
+        }
+        // list = list.concat(res);
+      }
+    });
+    if (show) {
+      list.push(item);
+    }
+    // return list.length * (swidth.value["swcatalogRoot"] + 10);
+  });
+  // if (i.type != "group") {
+  //     list.push(i);
+  //   } else {
+  //     let res = i.children.filter((t) => t.type != "group");
+  //     list = list.concat(res);
+  //   }
+  // let list = metadata.value.navigationTrees.filter((item) => item.children.length);
   return list.length * (swidth.value["swcatalogRoot"] + 10);
 });
 
@@ -270,13 +337,16 @@ const changeSceneList = () => {
   let currentList = null;
 
   if (metadata.value.navigationTrees[rootTabIndex.value].children.length && metadata.value.navigationTrees[rootTabIndex.value].children[0].type == "group") {
-    store.commit("scene/setData", { currentSecondId: metadata.value.navigationTrees[rootTabIndex.value].children[0].id });
+    // store.commit("scene/setData", { currentSecondId: metadata.value.navigationTrees[rootTabIndex.value].children[0].id });
 
     //如果有当前视图则选择二级目录
     metadata.value.navigationTrees[rootTabIndex.value].children.forEach((item, index) => {
       if (item.children.length) {
+
+        store.commit("scene/setData", { currentSecondId: item.id });
         item.children.forEach((t_item, t_index) => {
           if (t_item.id == currentScene.value.id || (t_item.sid && currentScene.value.sid && t_item.sid == currentScene.value.sid)) {
+            // store.commit("scene/setData", { currentSecondId: item.id });
             store.commit("scene/setData", { currentSecondId: item.id });
           }
         });
@@ -288,7 +358,7 @@ const changeSceneList = () => {
   }
 
   if (secondTabIndex.value == -1) {
-    console.log("没有二级目录");
+    console.error("没有二级目录");
     let rootList = metadata.value.navigationTrees.find((item) => item.id == currentRootId.value);
     store.commit("scene/setCurrentScenesList", rootList.children);
   }