|
|
@@ -2,7 +2,7 @@
|
|
|
<div>
|
|
|
<setting @select="handleInitScene"></setting>
|
|
|
<toolbar
|
|
|
- @catalog="handleCatalog"
|
|
|
+ @catalog="data=>activeCataLog = data"
|
|
|
@addPano="onAddPano"
|
|
|
@addGroup="onAddGroup"
|
|
|
@addScene="onAddScene"
|
|
|
@@ -25,8 +25,8 @@
|
|
|
<input
|
|
|
class="ui-input"
|
|
|
type="text"
|
|
|
- maxlength="50"
|
|
|
- placeholder="请输入分组名,限50个字"
|
|
|
+ maxlength="15"
|
|
|
+ placeholder="请输入分组名,限15个字"
|
|
|
v-model="currentTabAtri.name"
|
|
|
/>
|
|
|
</div>
|
|
|
@@ -36,7 +36,11 @@
|
|
|
<button class="ui-button cancel" @click="showAddGroup = false">
|
|
|
取消
|
|
|
</button>
|
|
|
- <button class="ui-button submit" :class="{disable:!currentTabAtri.name}" @click="handleAddGroup()">
|
|
|
+ <button
|
|
|
+ class="ui-button submit"
|
|
|
+ :class="{ disable: !currentTabAtri.name }"
|
|
|
+ @click="handleAddGroup()"
|
|
|
+ >
|
|
|
确定
|
|
|
</button>
|
|
|
</div>
|
|
|
@@ -47,7 +51,7 @@
|
|
|
<div class="ui-message ui-message-confirm dark" style="width: 400px">
|
|
|
<div class="ui-message-header">
|
|
|
<span>重命名</span>
|
|
|
- <span @click="showRename = false">
|
|
|
+ <span @click="handleRenameClose">
|
|
|
<i class="iconfont icon_close"></i>
|
|
|
</span>
|
|
|
</div>
|
|
|
@@ -56,18 +60,22 @@
|
|
|
<input
|
|
|
class="ui-input"
|
|
|
type="text"
|
|
|
- maxlength="15"
|
|
|
+ maxlength="50"
|
|
|
placeholder="输入名字"
|
|
|
- v-model="reNameItem.reName"
|
|
|
+ v-model="reNameItem.sceneTitle"
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="ui-message-footer">
|
|
|
- <button class="ui-button cancel" @click="showRename = false">
|
|
|
+ <button class="ui-button cancel" @click="handleRenameClose">
|
|
|
取消
|
|
|
</button>
|
|
|
- <button class="ui-button submit" :class="{disable:!reNameItem.reName}" @click="handleRename()">
|
|
|
+ <button
|
|
|
+ class="ui-button submit"
|
|
|
+ :class="{ disable: !reNameItem.sceneTitle }"
|
|
|
+ @click="handleRename()"
|
|
|
+ >
|
|
|
确定
|
|
|
</button>
|
|
|
</div>
|
|
|
@@ -96,13 +104,11 @@ import Toolbar from "./Toolbar";
|
|
|
import Popup from "@/components/shared/popup";
|
|
|
import {
|
|
|
getSceneList,
|
|
|
- editPanoName,
|
|
|
- editCatalogName,
|
|
|
getMaterialList,
|
|
|
} from "@/api";
|
|
|
import Table from "@/components/tableSelect";
|
|
|
import { mapGetters } from "vuex";
|
|
|
-import { editTabName, savePanoToWorks } from "@/api";
|
|
|
+import { savePanoToWorks } from "@/api";
|
|
|
|
|
|
export default {
|
|
|
name: "home",
|
|
|
@@ -115,14 +121,13 @@ export default {
|
|
|
computed: {
|
|
|
...mapGetters({
|
|
|
sceneList: "sceneList",
|
|
|
- tablist: "tablist",
|
|
|
- temptablist: "temptablist",
|
|
|
+ info: "info",
|
|
|
+ backupInfo: "backupInfo"
|
|
|
}),
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
activeCataLog: "",
|
|
|
- activeCataLog2: "",
|
|
|
type: "scene",
|
|
|
currentTabAtri: "",
|
|
|
showAddGroup: false,
|
|
|
@@ -131,7 +136,7 @@ export default {
|
|
|
showInitScene: true,
|
|
|
reNameItem: {
|
|
|
id: "",
|
|
|
- reName: "",
|
|
|
+ sceneTitle: "",
|
|
|
},
|
|
|
key: "",
|
|
|
paging: {
|
|
|
@@ -148,7 +153,7 @@ export default {
|
|
|
|
|
|
watch: {
|
|
|
"paging.pageNum": function () {
|
|
|
- this.getSceneList();
|
|
|
+ this.type == "scene" ? this.getSceneList() : this.getMaterialList();
|
|
|
},
|
|
|
showList(newVal) {
|
|
|
if (!newVal) {
|
|
|
@@ -164,13 +169,6 @@ export default {
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
- handleCatalog(data) {
|
|
|
- if (data.level == 1) {
|
|
|
- this.activeCataLog = data.data;
|
|
|
- } else {
|
|
|
- this.activeCataLog2 = data.data;
|
|
|
- }
|
|
|
- },
|
|
|
handleInitScene() {
|
|
|
this.showInitScene = true;
|
|
|
},
|
|
|
@@ -179,59 +177,43 @@ export default {
|
|
|
this.type == "scene" ? this.getSceneList() : this.getMaterialList();
|
|
|
},
|
|
|
handleSelect(data) {
|
|
|
- let catalog = this.activeCataLog;
|
|
|
- let catalog2 = this.activeCataLog2;
|
|
|
-
|
|
|
- let cid = this.$isCacheId(catalog.id) ? null : catalog.id;
|
|
|
- let cname = this.$isCacheId(catalog.id) ? catalog.name : null;
|
|
|
-
|
|
|
- let c2id =
|
|
|
- catalog2 &&
|
|
|
- (this.$isCacheId(catalog2.id) ? null : catalog2.id);
|
|
|
- let c2name =
|
|
|
- catalog2 &&
|
|
|
- (this.$isCacheId(catalog2.id) ? catalog2.name : null);
|
|
|
-
|
|
|
- let params = {
|
|
|
- catalogId: catalog2 ? c2id : cid,
|
|
|
- catalogName: catalog2 ? c2name : cname,
|
|
|
- parentId: catalog2 ? cid : null,
|
|
|
- parentName: catalog2 ? cname : null,
|
|
|
- scenes: [],
|
|
|
- };
|
|
|
-
|
|
|
+ let params = ''
|
|
|
+ let id = this.info.scenes.length+1
|
|
|
if (this.type == "scene") {
|
|
|
- params.scenes = data.map((item) => {
|
|
|
+ params = data.map((item) => {
|
|
|
return {
|
|
|
icon: item.thumb,
|
|
|
sceneCode: item.num,
|
|
|
sceneTitle: item.sceneName,
|
|
|
type: "4dkk",
|
|
|
+ category:this.activeCataLog.id,
|
|
|
+ id
|
|
|
};
|
|
|
});
|
|
|
} else {
|
|
|
- params.scenes = data.map((item) => {
|
|
|
+ params = data.map((item) => {
|
|
|
return {
|
|
|
icon: item.icon,
|
|
|
sceneCode: item.sceneCode,
|
|
|
sceneTitle: item.name,
|
|
|
+ category:this.activeCataLog.id,
|
|
|
type: "pano",
|
|
|
+ id
|
|
|
};
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- savePanoToWorks(params, (data) => {
|
|
|
- let cid = !catalog2 ? catalog.id : catalog2.id;
|
|
|
-
|
|
|
- let temp = this.temptablist.findIndex((item) => {
|
|
|
- return item.id == cid;
|
|
|
- });
|
|
|
-
|
|
|
- this.temptablist.splice(temp, 1);
|
|
|
- this.tablist.push(data.data[0]);
|
|
|
- this.$bus.emit("changeActive", data.data[0]);
|
|
|
- this.showList = false;
|
|
|
+ params.forEach(item => {
|
|
|
+ let temp = this.info.scenes.find(sub=>sub.sceneCode == item.sceneCode)
|
|
|
+ if (temp) {
|
|
|
+ this.$tips({ content: `已添加${item.type=='4dkk'?'场景':'全景图'}${item.sceneTitle},无法重复添加`, icon: "ok" });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ !temp&&this.info.scenes.push(item)
|
|
|
});
|
|
|
+
|
|
|
+ this.$store.commit("SetInfo", this.info);
|
|
|
+ this.showList = false;
|
|
|
},
|
|
|
|
|
|
changeCurrent(data) {
|
|
|
@@ -245,27 +227,21 @@ export default {
|
|
|
},
|
|
|
|
|
|
onRename(data) {
|
|
|
- this.reNameItem.id = data.id;
|
|
|
- this.reNameItem.reName = data.sceneTitle;
|
|
|
+ this.reNameItem = data;
|
|
|
this.showRename = true;
|
|
|
},
|
|
|
|
|
|
+ handleRenameClose(){
|
|
|
+ this.showRename = false
|
|
|
+ this.$store.commit("SetInfo", this.backupInfo);
|
|
|
+ },
|
|
|
+
|
|
|
handleRename() {
|
|
|
if (!this.reNameItem) {
|
|
|
return this.$alert({ content: "请输入名字" });
|
|
|
}
|
|
|
-
|
|
|
- editPanoName(
|
|
|
- {
|
|
|
- id: this.reNameItem.id,
|
|
|
- name: this.reNameItem.reName,
|
|
|
- },
|
|
|
- () => {
|
|
|
- this.$tips({ content: "重命名成功", icon: "ok" });
|
|
|
- this.showRename = false;
|
|
|
- this.$bus.emit("refresh");
|
|
|
- }
|
|
|
- );
|
|
|
+ this.$tips({ content: "重命名成功", icon: "ok" });
|
|
|
+ this.showRename = false;
|
|
|
},
|
|
|
|
|
|
onAddGroup(data) {
|
|
|
@@ -277,91 +253,49 @@ export default {
|
|
|
if (!this.currentTabAtri.name) {
|
|
|
return this.$alert({ content: "请输入名字" });
|
|
|
}
|
|
|
-
|
|
|
let tmp = this.currentTabAtri.item;
|
|
|
-
|
|
|
-
|
|
|
if (this.currentTabAtri.oper == "edit") {
|
|
|
- if (this.$isCacheId(tmp.id)) {
|
|
|
- tmp.name= this.currentTabAtri.name
|
|
|
- this.$tips({ content: "重命名成功", icon: "ok" });
|
|
|
- this.showAddGroup = false;
|
|
|
- }
|
|
|
- else{
|
|
|
- editCatalogName(
|
|
|
- {
|
|
|
- id: tmp.id,
|
|
|
- name: this.currentTabAtri.name,
|
|
|
- },
|
|
|
- () => {
|
|
|
- this.$tips({ content: "重命名成功", icon: "ok" });
|
|
|
- this.showAddGroup = false;
|
|
|
- this.$bus.emit("refresh");
|
|
|
- }
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- let temp = {
|
|
|
- children: [],
|
|
|
- id: "tmp" + this.$randomWord(true,6,8),
|
|
|
- name: this.currentTabAtri.name,
|
|
|
- scenes: [],
|
|
|
- };
|
|
|
-
|
|
|
- if (this.currentTabAtri.type == 1) {
|
|
|
- this.temptablist.push(temp);
|
|
|
+ tmp.name = this.currentTabAtri.name;
|
|
|
} else {
|
|
|
- if (this.$isCacheId(tmp.parentId)) {
|
|
|
- this.temptablist.forEach((item) => {
|
|
|
- if (item.id == tmp.parentId) {
|
|
|
- item.children.push(temp);
|
|
|
- }
|
|
|
+ if (this.currentTabAtri.type == 1) {
|
|
|
+ let id = 'c_'+this.$randomWord(true,8,8)
|
|
|
+ this.info.catalogRoot.push({
|
|
|
+ id: 'r_'+this.$randomWord(true,8,8),
|
|
|
+ name: this.currentTabAtri.name,
|
|
|
+ children: [id],
|
|
|
+ });
|
|
|
+ this.info.catalogs.push({
|
|
|
+ id,
|
|
|
+ name: '默认二级分组',
|
|
|
});
|
|
|
- } else {
|
|
|
- this.tablist.forEach((item) => {
|
|
|
- if (item.id == tmp.parentId) {
|
|
|
- if (item.children.length <= 0) {
|
|
|
- editTabName(
|
|
|
- {
|
|
|
- id: tmp.id,
|
|
|
- name: this.currentTabAtri.name,
|
|
|
- parentId: tmp.parentId,
|
|
|
- },
|
|
|
- () => {
|
|
|
- this.$tips({ content: "操作成功", icon: "ok" });
|
|
|
- this.showAddGroup = false;
|
|
|
- this.$bus.emit("refresh");
|
|
|
- }
|
|
|
- );
|
|
|
- } else {
|
|
|
- item.children.push(temp);
|
|
|
- }
|
|
|
- }
|
|
|
+ console.log(this.info.catalogs);
|
|
|
+ }
|
|
|
+ if (this.currentTabAtri.type == 2) {
|
|
|
+ let id = 'c_'+this.$randomWord(true,8,8)
|
|
|
+ let item = this.info.catalogRoot.find(
|
|
|
+ (item) => item.id == tmp.parentId
|
|
|
+ );
|
|
|
+ item.children.push(id);
|
|
|
+ this.info.catalogs.push({
|
|
|
+ id,
|
|
|
+ name: this.currentTabAtri.name,
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ this.$store.commit("SetInfo", this.info);
|
|
|
this.$tips({ content: "操作成功", icon: "ok" });
|
|
|
this.showAddGroup = false;
|
|
|
},
|
|
|
|
|
|
onAddScene() {
|
|
|
- if (!this.activeCataLog) {
|
|
|
- return this.$alert({ content: "请新建并选择标签" });
|
|
|
- }
|
|
|
this.type = "scene";
|
|
|
this.getSceneList();
|
|
|
this.showList = true;
|
|
|
},
|
|
|
|
|
|
onAddPano() {
|
|
|
- if (!this.activeCataLog) {
|
|
|
- return this.$alert({ content: "请新建并选择标签" });
|
|
|
- }
|
|
|
this.type = "pano";
|
|
|
this.getMaterialList();
|
|
|
this.showList = true;
|