|
@@ -16,13 +16,13 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import { PTopoScene, PTopoParser } from "@/components/editClass/persagy-edit";
|
|
|
+import { PTopoScene, PTopoParser, } from "@/components/editClass/persagy-edit";
|
|
|
import { SGraphView } from "@persagy-web/graph";
|
|
|
import { SFloorParser } from "@persagy-web/big/lib";
|
|
|
import topoTooltip from "./topoTooltip.vue";
|
|
|
import { mapState, mapMutations } from "vuex";
|
|
|
import bus from "@/bus/bus";
|
|
|
-import { saveGroup, readGroup, uploadGroup, getImageGroup } from "@/api/editer";
|
|
|
+import { saveGroup, readGroup, uploadGroup, getImageGroup, readPubGroup } from "@/api/editer";
|
|
|
export default {
|
|
|
components: { topoTooltip },
|
|
|
data() {
|
|
@@ -33,10 +33,11 @@ export default {
|
|
|
canvasHeight: 700, //画布高
|
|
|
havItem: false, //右击是否选中item
|
|
|
showTooltip: false, //是否显示tooltip
|
|
|
+ topoName: '', //拓扑图名称
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapState(["editCmd", "legendObj", "graphId", "id", "categoryId","projectId"]),
|
|
|
+ ...mapState(["editCmd", "legendObj", "graphId", "id", "isPub", "categoryId","projectId"]),
|
|
|
},
|
|
|
mounted() {
|
|
|
this.canvasWidth = this.$refs.baseTopo.offsetWidth;
|
|
@@ -67,6 +68,7 @@ export default {
|
|
|
"SETLEGENDOBJ",
|
|
|
"SETPROJECT",
|
|
|
"SETCATEGROY",
|
|
|
+ "SETISPUB",
|
|
|
]),
|
|
|
// 恢复命令状态
|
|
|
clearCmdStatus() {
|
|
@@ -125,7 +127,7 @@ export default {
|
|
|
const elements = this.scene.save();
|
|
|
const obj = {
|
|
|
elements,
|
|
|
- name: "1", // 名称
|
|
|
+ name: this.topoName, // 名称
|
|
|
categoryId: this.categoryId, // 图分类ID
|
|
|
projectId: this.projectId, // 项目ID
|
|
|
buildingId: "1", // 建筑ID
|
|
@@ -149,7 +151,22 @@ export default {
|
|
|
});
|
|
|
console.log(obj);
|
|
|
saveGroup(obj).then((res) => {
|
|
|
- console.log("res", res);
|
|
|
+ // 设置发布状态为 未发布
|
|
|
+ this.SETISPUB(0);
|
|
|
+ const gid = res.entityList[0].graphId;
|
|
|
+ const id = res.entityList[0].id
|
|
|
+ // 重设图id 与 id
|
|
|
+ this.SETPROJECT({graphId: gid, id: id});
|
|
|
+ // 修改url参数
|
|
|
+ this.$router.push({
|
|
|
+ name: 'Editer',
|
|
|
+ query: {
|
|
|
+ graphId: gid,
|
|
|
+ id: id,
|
|
|
+ categoryName: encodeURI(this.categoryName),
|
|
|
+ isPub: 0
|
|
|
+ }
|
|
|
+ })
|
|
|
});
|
|
|
});
|
|
|
// 设置实例置顶置底
|
|
@@ -163,12 +180,24 @@ export default {
|
|
|
},
|
|
|
// 读取拓扑图
|
|
|
readtopoMsg() {
|
|
|
- let obj = {
|
|
|
+ const obj = {
|
|
|
graphId: this.graphId,
|
|
|
- id: this.id,
|
|
|
+ id: this.id
|
|
|
};
|
|
|
- readGroup(obj).then((res) => {
|
|
|
+ if (this.isPub == 1) { // 已发布
|
|
|
+ readPubGroup(obj).then(res => {
|
|
|
+ this.getDataSuc(res);
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ readGroup(obj).then((res) => {
|
|
|
+ this.getDataSuc(res)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 读图成功回调
|
|
|
+ getDataSuc(res) {
|
|
|
this.SETCATEGROY(res.content.categoryId);
|
|
|
+ this.topoName = res.content.name;
|
|
|
const parse = new PTopoParser();
|
|
|
parse.parseData(res.content.elements);
|
|
|
parse.markers.forEach((item) => {
|
|
@@ -178,7 +207,6 @@ export default {
|
|
|
item.connect("onContextMenu", this, this.scene.getItem);
|
|
|
this.scene.addItem(item);
|
|
|
});
|
|
|
- });
|
|
|
},
|
|
|
readMapmsg() {
|
|
|
let parser = new SFloorParser();
|
|
@@ -209,8 +237,9 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
created() {
|
|
|
- console.log(this.$route.query)
|
|
|
this.SETPROJECT(this.$route.query);
|
|
|
+ this.SETISPUB(this.$route.query.isPub);
|
|
|
+ this.categoryName = decodeURI(this.$route.query.categoryName)
|
|
|
},
|
|
|
};
|
|
|
</script>
|