|
@@ -48,7 +48,9 @@ export default {
|
|
|
floorList: {},
|
|
|
urlMsg: {},
|
|
|
chiceItemList: [], //选中itemlist
|
|
|
- hasTypeList: [] // 当前类型下包含的typeid(提取)
|
|
|
+ hasTypeList: [], // 当前类型下包含的typeid(提取)
|
|
|
+ initScale: 1, //加载好底图之后的,初始缩放比例
|
|
|
+ changeScaleByClick: false, //区分 滚轮,点击 事件改变的缩放比例
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
@@ -58,6 +60,7 @@ export default {
|
|
|
// 挂在bus
|
|
|
this.getBus();
|
|
|
store.dispatch("getElementType", { PageSize: 1000 });
|
|
|
+ window.vm = this
|
|
|
},
|
|
|
methods: {
|
|
|
init() {
|
|
@@ -90,6 +93,7 @@ export default {
|
|
|
loadings.close();
|
|
|
});
|
|
|
this.view.fitSceneToView();
|
|
|
+
|
|
|
});
|
|
|
// 获取主题数据
|
|
|
this.readGroup().then(data => {
|
|
@@ -174,6 +178,9 @@ export default {
|
|
|
this.loading = false;
|
|
|
this.isQuerying = false;
|
|
|
console.log("success");
|
|
|
+ // 设置初始化缩放比例
|
|
|
+ this.initScale = this.view.scale
|
|
|
+ bus.$emit('initScale', this.view.scale)
|
|
|
});
|
|
|
} else {
|
|
|
console.log("楼层不正确");
|
|
@@ -266,7 +273,7 @@ export default {
|
|
|
BuildingID: this.urlMsg.BuildingID, // 建筑ID
|
|
|
FloorID: this.urlMsg.FloorID // 楼层id
|
|
|
};
|
|
|
- Message({
|
|
|
+ Message({
|
|
|
message: '上传中,切勿关闭窗口!',
|
|
|
type: 'warning'
|
|
|
});
|
|
@@ -354,19 +361,33 @@ export default {
|
|
|
//发布图
|
|
|
// bus.$on("publishGraph", val => {
|
|
|
// this.spinning = true;
|
|
|
- // publishGraph({ graphId: this.graphId, pubUser: "" }).then(res => {
|
|
|
- // this.spinning = false;
|
|
|
- // if (res.Result == "success") {
|
|
|
- // this.$message.success(res.Message);
|
|
|
- // } else {
|
|
|
- // this.$message.error(res.Message);
|
|
|
- // }
|
|
|
- // });
|
|
|
- // });
|
|
|
+ // publishGraph({ graphId: this.graphId, pubUser: "" }).then(res => {
|
|
|
+ // this.spinning = false;
|
|
|
+ // if (res.Result == "success") {
|
|
|
+ // this.$message.success(res.Message);
|
|
|
+ // } else {
|
|
|
+ // this.$message.error(res.Message);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // });
|
|
|
//创建区域是否点选
|
|
|
bus.$on("changeDrawType", val => {
|
|
|
this.scene.isSelecting = val == "select";
|
|
|
})
|
|
|
+ /**
|
|
|
+ * @name changeScale缩放底图
|
|
|
+ * @param { Number } zoom 缩放比例
|
|
|
+ *
|
|
|
+ */
|
|
|
+ // TODO: changeScale缩放底图
|
|
|
+ bus.$on('changeScale', zoom => {
|
|
|
+ let { scale } = this.view;
|
|
|
+ this.changeScaleByClick = true
|
|
|
+ this.view.scaleByPoint(zoom, this.canvasWidth / 2, this.canvasHeight / 2)
|
|
|
+ this.changeScaleByClick = false
|
|
|
+ setTimeout(() => {
|
|
|
+ }, 100);
|
|
|
+ })
|
|
|
},
|
|
|
// 读取数据
|
|
|
readGroup() {
|
|
@@ -404,7 +425,17 @@ export default {
|
|
|
this.$emit("setCmdType", cmd);
|
|
|
},
|
|
|
deep: true
|
|
|
- }
|
|
|
+ },
|
|
|
+ // 监听scale的变化
|
|
|
+ 'view.scale': {
|
|
|
+ handler(scale) {
|
|
|
+
|
|
|
+ // 滚轮触发的缩放
|
|
|
+ if (!this.changeScaleByClick) {
|
|
|
+ bus.$emit('mouseScale', scale / this.initScale)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
created() {
|
|
|
const href = window.location.href;
|