|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div class="group-settings">
|
|
|
+ <div class="group-settings" app-border dir-right>
|
|
|
<div class="ui-title-big">场景导航
|
|
|
<i class="iconfont icon-material_prompt tool-tip-for-editor" v-tooltip="'场景素材包括全景图和三维场景,您可自定义分组及场景的排列顺序。'">
|
|
|
</i>
|
|
@@ -11,133 +11,24 @@
|
|
|
新增分组
|
|
|
</button>
|
|
|
|
|
|
- <div class="obstructor"></div>
|
|
|
-
|
|
|
<div class="scene-group-wrap">
|
|
|
- <SceneGroupInEditor
|
|
|
- v-for="(item) of catalogTopology"
|
|
|
+ <InsertPositionTip position-debug="-1" :index="0"></InsertPositionTip>
|
|
|
+ <div
|
|
|
+ v-for="(item, index) of catalogTopology"
|
|
|
:key=item.id
|
|
|
- :groupNode="item"
|
|
|
- :level="1"
|
|
|
- @addGroup="onRequestForAddGroupLevel2"
|
|
|
- @renameScene="onRenameScene"
|
|
|
- @deleteScene="onDeleteScene"
|
|
|
- @renameGroup="onRenameGroup"
|
|
|
- @deleteGroup="onDeleteGroup"
|
|
|
- />
|
|
|
-
|
|
|
- <div class="pano-con">
|
|
|
- <tabList
|
|
|
- :deviation="-35"
|
|
|
- :list="info.catalogRoot"
|
|
|
- @clickItem="
|
|
|
- (item) => {
|
|
|
- taboneActive = item;
|
|
|
- }
|
|
|
- "
|
|
|
- :active="taboneActive"
|
|
|
- :id="'rand'"
|
|
|
- @addGroup="hadnleAddGroup"
|
|
|
- :subId="'rand1'"
|
|
|
- >
|
|
|
- <template slot="hover" slot-scope="{ item }">
|
|
|
- <ul>
|
|
|
- <li @click="$emit('addGroup', { type: 1, oper: 'edit', item })">
|
|
|
- 重命名
|
|
|
- </li>
|
|
|
- <li
|
|
|
- @click="
|
|
|
- $emit('addGroup', {
|
|
|
- type: 2,
|
|
|
- oper: 'add',
|
|
|
- item: { parentId: item.id },
|
|
|
- })
|
|
|
- "
|
|
|
- >
|
|
|
- 创建二级分组
|
|
|
- </li>
|
|
|
- <li @click="del(item, 'one')">删除</li>
|
|
|
- </ul>
|
|
|
- </template>
|
|
|
- </tabList>
|
|
|
-
|
|
|
- <tabList
|
|
|
- :deviation="-35"
|
|
|
- v-if="childTab.length > 1"
|
|
|
- :list="childTab"
|
|
|
- @clickItem="
|
|
|
- (item) => {
|
|
|
- tabtowActive = item;
|
|
|
- }
|
|
|
- "
|
|
|
- :active="tabtowActive"
|
|
|
- :id="'subrand'"
|
|
|
- @addGroup="
|
|
|
- $emit('addGroup', {
|
|
|
- type: 2,
|
|
|
- oper: 'add',
|
|
|
- item: { parentId: taboneActive.id },
|
|
|
- })
|
|
|
- "
|
|
|
- :subId="'subrand1'"
|
|
|
- >
|
|
|
- <template slot="hover" slot-scope="{ item }">
|
|
|
- <ul @mouseover.prevent @mouseleave.prevent>
|
|
|
- <li @click="$emit('addGroup', { type: 2, oper: 'edit', item })">
|
|
|
- 重命名
|
|
|
- </li>
|
|
|
- <li @click="del(item, 'two')">删除</li>
|
|
|
- </ul>
|
|
|
- </template>
|
|
|
- </tabList>
|
|
|
-
|
|
|
- <template v-if="scenes.length > 0">
|
|
|
- <draggable
|
|
|
- tag="ul"
|
|
|
- v-model="scenes"
|
|
|
- animation="300"
|
|
|
- @sort="uploadListSort"
|
|
|
- >
|
|
|
- <li v-for="(item, i) in scenes" :key="i">
|
|
|
- <div class="typeli">
|
|
|
- <i
|
|
|
- class="iconfont iconedit_type_3d"
|
|
|
- :class="{iconedit_type_panorama: item.type !== '4dkk' }"
|
|
|
- ></i>
|
|
|
- </div>
|
|
|
- <div class="img">
|
|
|
- <img :src="item.icon+`?${Math.random()}`" alt="" />
|
|
|
- </div>
|
|
|
- <div class="oper">
|
|
|
- <i class="iconfont iconmore"></i>
|
|
|
- <ul>
|
|
|
- <li @click="$emit('rename', item)">重命名</li>
|
|
|
- <li @click="delPano(item)">删除</li>
|
|
|
- </ul>
|
|
|
- </div>
|
|
|
- <div class="ui-title">
|
|
|
- <span>{{
|
|
|
- item.type == "house" ? item.roomName : item.sceneTitle
|
|
|
- }}</span>
|
|
|
- </div>
|
|
|
- </li>
|
|
|
- </draggable>
|
|
|
- </template>
|
|
|
- <div class="no-record" v-else>
|
|
|
- <i class="iconfont iconedit_list_default"></i>
|
|
|
- <p>暂无全景图或三维场景,可点击下方按钮进行添加</p>
|
|
|
- </div>
|
|
|
- <div class="add-btn">
|
|
|
- <button class="ui-button submit" @click="$emit('addPano')">
|
|
|
- 选择全景图
|
|
|
- </button>
|
|
|
- <button class="ui-button submit" @click="$emit('addScene')">
|
|
|
- 选择三维场景
|
|
|
- </button>
|
|
|
- </div>
|
|
|
+ >
|
|
|
+ <SceneGroupInEditor
|
|
|
+ :groupNode="item"
|
|
|
+ :level="1"
|
|
|
+ @addGroup="onRequestForAddGroupLevel2"
|
|
|
+ @renameScene="onRenameScene"
|
|
|
+ @deleteScene="onDeleteScene"
|
|
|
+ @renameGroup="onRenameGroup"
|
|
|
+ @deleteGroup="onDeleteGroup"
|
|
|
+ />
|
|
|
+ <InsertPositionTip position-debug="0" :index="index + 1"></InsertPositionTip>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
<popup v-if="addGroupLevel" :canClose="false">
|
|
|
<div class="ui-message ui-message-confirm dark add-group-window">
|
|
|
<div class="ui-message-header">
|
|
@@ -151,8 +42,9 @@
|
|
|
<input
|
|
|
class="name-input"
|
|
|
placeholder="请输入分组名称,限15个字"
|
|
|
- v-model="newGroupName"
|
|
|
+ v-model.trim="newGroupName"
|
|
|
maxlength="15"
|
|
|
+ @keydown.enter="newGroupName && onConfirmAddingGroup()"
|
|
|
>
|
|
|
</div>
|
|
|
|
|
@@ -162,6 +54,7 @@
|
|
|
</button>
|
|
|
<button
|
|
|
class="ui-button submit"
|
|
|
+ :class="{disable: !newGroupName}"
|
|
|
@click="onConfirmAddingGroup"
|
|
|
>
|
|
|
确定
|
|
@@ -173,124 +66,39 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import tabList from "@/components/tablist/index.vue";
|
|
|
-import browser from "@/utils/browser";
|
|
|
-import draggable from "vuedraggable";
|
|
|
import SceneGroupInEditor from "@/components/sceneGroupInEditor.vue";
|
|
|
import { mapGetters } from "vuex";
|
|
|
import { deepClone } from "@/utils/other.js";
|
|
|
import Popup from "@/components/shared/popup/index.vue";
|
|
|
+import InsertPositionTip from "@/components/insertPositionTipInEditor.vue";
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
- draggable,
|
|
|
- tabList,
|
|
|
SceneGroupInEditor,
|
|
|
Popup,
|
|
|
+ InsertPositionTip,
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters({
|
|
|
- vrlist: "vrlist",
|
|
|
info: "info",
|
|
|
catalogTopology: 'catalogTopology',
|
|
|
}),
|
|
|
- oneWidth() {
|
|
|
- let tmp = $("#tablist").width();
|
|
|
- return tmp;
|
|
|
- },
|
|
|
- menuWidth() {
|
|
|
- let tmp = $("#menucon").width();
|
|
|
- return tmp;
|
|
|
- },
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- taboneActive: { children: [] },
|
|
|
- tabtowActive: "",
|
|
|
- childTab: [],
|
|
|
- scenes: [],
|
|
|
- list: [],
|
|
|
-
|
|
|
addGroupLevel: 0, // 0: 没有在新增分组;1:在新增一级分组;2:在新增二级分组
|
|
|
newGroupName: '',
|
|
|
parentGroupId: '',
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
- "info.scenes": {
|
|
|
- deep: true,
|
|
|
- handler: function (newVal) {
|
|
|
- let arr = newVal.filter((item) => {
|
|
|
- return this.tabtowActive.id == item.category;
|
|
|
- });
|
|
|
- this.scenes = arr.sort((a,b)=>a.weight-b.weight)
|
|
|
- },
|
|
|
- },
|
|
|
- "info.catalogs": {
|
|
|
- deep: true,
|
|
|
- handler: function (newVal) {
|
|
|
- let temp = [];
|
|
|
- this.childTab = [];
|
|
|
- let id = this.taboneActive.id;
|
|
|
- let oneActive = this.info.catalogRoot.find((item) => item.id == id);
|
|
|
- if (!oneActive) {
|
|
|
- oneActive = this.info.catalogRoot[0]
|
|
|
- this.taboneActive = this.info.catalogRoot[0]
|
|
|
- }
|
|
|
- oneActive.children &&
|
|
|
- oneActive.children.forEach((item) => {
|
|
|
- newVal.forEach((sub) => {
|
|
|
- if (item == sub.id) {
|
|
|
- temp.push(sub);
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- this.childTab = temp;
|
|
|
- },
|
|
|
- },
|
|
|
- taboneActive: {
|
|
|
- immediate: true,
|
|
|
- deep: true,
|
|
|
- handler: function (newVal, oldVal) {
|
|
|
- if (!newVal.id) {
|
|
|
- this.taboneActive = this.info.catalogRoot[0];
|
|
|
- }
|
|
|
- let temp = [];
|
|
|
- newVal.children &&
|
|
|
- newVal.children.forEach((item) => {
|
|
|
- this.info.catalogs.forEach((sub) => {
|
|
|
- if (item == sub.id) {
|
|
|
- temp.push(sub);
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- this.childTab = temp;
|
|
|
- if (this.childTab.length == 1 || newVal != oldVal) {
|
|
|
- this.tabtowActive = this.childTab[0];
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- tabtowActive: {
|
|
|
- immediate: true,
|
|
|
- handler: function (newVal) {
|
|
|
- if (!newVal) {
|
|
|
- this.tabtowActive = this.childTab[0];
|
|
|
- } else {
|
|
|
- this.$emit("catalog", newVal);
|
|
|
- let arr = this.info.scenes.filter((item) => {
|
|
|
- return newVal.id == item.category;
|
|
|
- });
|
|
|
- this.scenes = arr.sort((a,b)=>a.weight-b.weight)
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
},
|
|
|
methods: {
|
|
|
onRequestForAddLevel1Group() {
|
|
|
this.newGroupName = ''
|
|
|
this.addGroupLevel = 1
|
|
|
},
|
|
|
- onConfirmAddingGroup() {
|
|
|
+ onConfirmAddingGroup() {
|
|
|
if (this.addGroupLevel === 1) {
|
|
|
let newGroupLevel2Id = 'c_' + this.$randomWord(true, 8, 8)
|
|
|
const newGroupLevel1 = {
|
|
@@ -300,7 +108,7 @@ export default {
|
|
|
}
|
|
|
this.info.catalogRoot.push(newGroupLevel1)
|
|
|
this.info.catalogs.push({
|
|
|
- newGroupLevel2Id,
|
|
|
+ id: newGroupLevel2Id,
|
|
|
name: '默认二级分组',
|
|
|
})
|
|
|
} else if (this.addGroupLevel === 2) {
|
|
@@ -357,10 +165,11 @@ export default {
|
|
|
},
|
|
|
onDeleteGroup(groupId, groupLevel) {
|
|
|
const deleteGroupLevel2 = (groupId) => {
|
|
|
- // 删除所属一级分组中的children中元素
|
|
|
- // 因为用户无法看到、操作默认二级分组,所以这里要删除的group不可能是默认二级分组
|
|
|
+ // 要删除的二级分组在catalogRoot[x].children中的索引
|
|
|
let targetGroupIdxLevel2 = null
|
|
|
+ // 要删除的二级分组所属的一级分组在catalogRoot中的索引
|
|
|
let belongGroupIdxLevel1 = null
|
|
|
+ // 确定上边两个变量的取值
|
|
|
for (const [groupIdxLevel1, groupLevel1] of this.info.catalogRoot.entries()) {
|
|
|
for (const [groupIdxLevel2, childId] of groupLevel1.children.entries()) {
|
|
|
if (childId === groupId) {
|
|
@@ -377,9 +186,11 @@ export default {
|
|
|
console.log(targetGroupIdxLevel2, belongGroupIdxLevel1);
|
|
|
throw('一级分组列表中没有找到要删除的二级分组!')
|
|
|
}
|
|
|
+
|
|
|
+ // 删除catalogRoot[x].children中那个二级分组条目
|
|
|
this.info.catalogRoot[belongGroupIdxLevel1].children.splice(targetGroupIdxLevel2, 1)
|
|
|
|
|
|
- // 删除二级分组列表中元素
|
|
|
+ // 删除catalogs中那个二级分组条目
|
|
|
const targetIdx = this.info.catalogs.findIndex((item) => {
|
|
|
return item.id === groupId
|
|
|
})
|
|
@@ -392,6 +203,17 @@ export default {
|
|
|
this.info.scenes = this.info.scenes.filter((item) => {
|
|
|
return item.category !== groupId
|
|
|
})
|
|
|
+
|
|
|
+ // 如果所属一级分组中没有任何二级分组了,则新增一个默认二级分组
|
|
|
+ if (this.info.catalogRoot[belongGroupIdxLevel1].children.length === 0) {
|
|
|
+ let newGroupLevel2Id = 'c_' + this.$randomWord(true, 8, 8)
|
|
|
+ this.info.catalogRoot[belongGroupIdxLevel1].children.push(newGroupLevel2Id)
|
|
|
+ this.info.catalogs.push({
|
|
|
+ id: newGroupLevel2Id,
|
|
|
+ name: '默认二级分组',
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -433,70 +255,6 @@ export default {
|
|
|
this.$store.commit("SetInfo", backup)
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
- hadnleAddGroup() {
|
|
|
- this.$emit("addGroup", { type: 1, oper: "add", item: {} });
|
|
|
- },
|
|
|
-
|
|
|
- uploadListSort() {
|
|
|
- this.scenes.forEach((item, i) => {
|
|
|
- item.weight = i+1
|
|
|
- });
|
|
|
-
|
|
|
- this.info.scenes.forEach((item)=>{
|
|
|
- this.scenes.forEach((sub, idx) => {
|
|
|
- sub.weight = idx+1
|
|
|
- if (item.sceneCode == sub.sceneCode) {
|
|
|
- item = sub
|
|
|
- }
|
|
|
- });
|
|
|
- })
|
|
|
-
|
|
|
- this.$store.commit("SetInfo", this.info);
|
|
|
- },
|
|
|
-
|
|
|
- delTree(data, type) {
|
|
|
- let fn = (ele) => {
|
|
|
- let tmp = [];
|
|
|
- this.info.catalogs.forEach((sub, i) => {
|
|
|
- if (ele == sub.id) {
|
|
|
- this.info.scenes.forEach((item) => {
|
|
|
- if (sub.id != item.category) {
|
|
|
- tmp.push(item);
|
|
|
- }
|
|
|
- });
|
|
|
- this.info.scenes = tmp;
|
|
|
- this.info.catalogs.splice(i, 1);
|
|
|
- }
|
|
|
- });
|
|
|
- };
|
|
|
- if (type == "one") {
|
|
|
- data.children.forEach((ele) => {
|
|
|
- fn(ele);
|
|
|
- });
|
|
|
- let idx = this.info.catalogRoot.findIndex((item) => item.id == data.id);
|
|
|
- this.info.catalogRoot.splice(idx, 1);
|
|
|
- this.taboneActive = this.info.catalogRoot[0];
|
|
|
- }
|
|
|
-
|
|
|
- if (type == "two") {
|
|
|
- let id = this.taboneActive.id;
|
|
|
- let oneActive = this.info.catalogRoot.find((item) => item.id == id);
|
|
|
- let idx = oneActive.children.findIndex((item) => item == data.id);
|
|
|
- oneActive.children.splice(idx, 1);
|
|
|
- fn(data.id);
|
|
|
-
|
|
|
- let temp = browser.CloneObject(this.taboneActive);
|
|
|
- this.taboneActive = "";
|
|
|
- this.taboneActive = temp;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- this.delFirstScene()
|
|
|
- this.$bus.emit('scenesChange')
|
|
|
- this.$store.commit("SetInfo", this.info);
|
|
|
- },
|
|
|
-
|
|
|
delFirstScene(){
|
|
|
if (this.info.firstScene) {
|
|
|
let firIdx = this.info.scenes.find(item=>{
|
|
@@ -505,42 +263,7 @@ export default {
|
|
|
!firIdx&&(this.info.firstScene='')
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
- del(data, type) {
|
|
|
- if (this.info.catalogRoot.length <= 1 && type == "one") {
|
|
|
- return this.$alert({
|
|
|
- content: "请至少保留一个分组",
|
|
|
- ok: () => {
|
|
|
- return;
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- this.$confirm({
|
|
|
- content: `分组“${data.name}”下所有${
|
|
|
- type == "one" ? "二级分组和" : ""
|
|
|
- }(场景/全景图)也都将会被删除,是否删除?`,
|
|
|
- ok: () => {
|
|
|
- this.delTree(data, type);
|
|
|
- this.$msg.success("删除成功")
|
|
|
- },
|
|
|
- });
|
|
|
- },
|
|
|
- delPano(item) {
|
|
|
- this.$confirm({
|
|
|
- content: `${item.type=='4dkk'?'场景':'全景图'}“${item.sceneTitle}”下所有设置也都将会被删除,是否删除?`,
|
|
|
- ok: () => {
|
|
|
- let idx = this.info.scenes.findIndex(ele=>ele.sceneCode==item.sceneCode)
|
|
|
- this.info.scenes.splice(idx,1)
|
|
|
- this.delFirstScene()
|
|
|
- this.$store.commit("SetInfo", this.info);
|
|
|
- this.$bus.emit('scenesChange')
|
|
|
- this.$msg.success("删除成功")
|
|
|
- },
|
|
|
- });
|
|
|
- },
|
|
|
},
|
|
|
-
|
|
|
mounted() {
|
|
|
this.$bus.on('getActive',data=>{
|
|
|
if (data.type == 1) {
|
|
@@ -552,6 +275,7 @@ export default {
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
+
|
|
|
<style lang="less" scoped>
|
|
|
.group-settings {
|
|
|
display: flex;
|
|
@@ -581,106 +305,15 @@ export default {
|
|
|
font-size: 14px;
|
|
|
}
|
|
|
}
|
|
|
- > .obstructor {
|
|
|
- position: absolute;
|
|
|
- top: 108px;
|
|
|
- left: 0px;
|
|
|
- right: 0px;
|
|
|
- height: 37px;
|
|
|
- // background: red;
|
|
|
- background: #252526;
|
|
|
- z-index: 1;
|
|
|
- }
|
|
|
> .scene-group-wrap {
|
|
|
flex: 1 1 auto;
|
|
|
height: 1px;
|
|
|
overflow: auto;
|
|
|
- padding-top: 32px;
|
|
|
- padding-bottom: 38px;
|
|
|
+ margin-top: 24px;
|
|
|
padding-left: 20px;
|
|
|
padding-right: 20px;
|
|
|
- &::-webkit-scrollbar-button {
|
|
|
- background-color: transparent; height: 38px;
|
|
|
- }
|
|
|
- .pano-con {
|
|
|
- padding: 20px 30px;
|
|
|
- height: calc(100vh - 250px);
|
|
|
- .menu-con {
|
|
|
- position: relative;
|
|
|
- > .iconfont {
|
|
|
- left: -20px;
|
|
|
- top: 8px;
|
|
|
- position: absolute;
|
|
|
- cursor: pointer;
|
|
|
- }
|
|
|
- > .icon_forward {
|
|
|
- right: 40px;
|
|
|
- left: auto;
|
|
|
- }
|
|
|
- .sub-menu {
|
|
|
- max-width: calc(100% - 70px);
|
|
|
- position: relative;
|
|
|
- overflow: hidden;
|
|
|
- height: 40px;
|
|
|
-
|
|
|
- > ul {
|
|
|
- max-width: unset;
|
|
|
- overflow: unset;
|
|
|
- position: absolute;
|
|
|
- left: 0;
|
|
|
- transition: 0.3s ease all;
|
|
|
- .fixed {
|
|
|
- position: absolute;
|
|
|
- right: 0;
|
|
|
- }
|
|
|
- // &::before{
|
|
|
- // width: calc(100% - 70px);
|
|
|
- // height: calc(100% - 10px);
|
|
|
- // pointer-events: none;
|
|
|
- // content: '';
|
|
|
- // background: linear-gradient(to right,rgba(#fff,0) 0%,rgba(#fff,0) 98%,rgba(#000,1) 100%);
|
|
|
- // position: absolute;
|
|
|
- // top: 0;
|
|
|
- // left: 0;
|
|
|
- // z-index: 999;
|
|
|
- // display: inline-block;
|
|
|
- // }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- > ul {
|
|
|
- max-height: calc(100% - 82px);
|
|
|
- overflow-y: auto;
|
|
|
- position: relative;
|
|
|
- left: -2px;
|
|
|
- > li {
|
|
|
- margin: 10px 20px 30px 0;
|
|
|
- }
|
|
|
- }
|
|
|
- .add-btn {
|
|
|
- z-index: 20;
|
|
|
- .ui-button {
|
|
|
- margin: 0 5px;
|
|
|
- }
|
|
|
- }
|
|
|
- .no-record {
|
|
|
- position: absolute;
|
|
|
- top: 50%;
|
|
|
- left: 50%;
|
|
|
- transform: translate(-50%, -50%);
|
|
|
- text-align: center;
|
|
|
- color: rgba(255, 255, 255, 0.5);
|
|
|
- > i {
|
|
|
- font-size: 40px;
|
|
|
- }
|
|
|
- > p {
|
|
|
- margin-top: 10px;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.ui-message {
|
|
|
> .ui-message-main {
|
|
|
> .name-input {
|