|
@@ -12,14 +12,19 @@ import { SFloorParser } from "@saga-web/big";
|
|
|
import { FloorView } from "./../lib/FloorView";
|
|
|
import { EditScence } from "./mapClass/EditScence";
|
|
|
import bus from "@/bus";
|
|
|
-import { saveGroup, readGroup, queryTypeGraph, publishGraph } from "@/api/editer.js";
|
|
|
+import {
|
|
|
+ saveGroup,
|
|
|
+ readGroup,
|
|
|
+ queryTypeGraph,
|
|
|
+ publishGraph
|
|
|
+} from "@/api/editer.js";
|
|
|
import { STopologyParser } from "./../lib/parsers/STopologyParser";
|
|
|
import { uuid } from "@/components/mapClass/until";
|
|
|
import { SImageItem } from "@saga-web/graph/lib";
|
|
|
import { SPainter, SColor, SFont, SPoint } from "@saga-web/draw";
|
|
|
import store from "../store";
|
|
|
import { Loading } from "element-ui";
|
|
|
-import { Message } from 'element-ui';
|
|
|
+import { Message } from "element-ui";
|
|
|
let fengmap = null;
|
|
|
//// 底图空间增加字段 isExtracted:boolean true 已被提取过
|
|
|
export default {
|
|
@@ -49,9 +54,9 @@ export default {
|
|
|
urlMsg: {},
|
|
|
chiceItemList: [], //选中itemlist
|
|
|
hasTypeList: [], // 当前类型下包含的typeid(提取)
|
|
|
- graphId: '',
|
|
|
- initScale: 1, //加载好底图之后的,初始缩放比例
|
|
|
- changeScaleByClick: false, //区分 滚轮,点击 事件改变的缩放比例
|
|
|
+ graphId: "",
|
|
|
+ initScale: 1, //加载好底图之后的,初始缩放比例
|
|
|
+ changeScaleByClick: false //区分 滚轮,点击 事件改变的缩放比例
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
@@ -61,7 +66,23 @@ export default {
|
|
|
// 挂在bus
|
|
|
this.getBus();
|
|
|
store.dispatch("getElementType", { PageSize: 1000 });
|
|
|
- window.vm = this
|
|
|
+ window.vm = this;
|
|
|
+ const that = this;
|
|
|
+ document.onkeydown = function(event) {
|
|
|
+ const e = event || window.event || arguments.callee.caller.arguments[0];
|
|
|
+ if (e && e.key == "Control") {
|
|
|
+ // 按 ctrl
|
|
|
+ that.scene.isDownCtrl = true;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ document.onkeyup = function(event) {
|
|
|
+ const e = event || window.event || arguments.callee.caller.arguments[0];
|
|
|
+ if (e && e.key == "Control") {
|
|
|
+ // 按 ctrl
|
|
|
+ that.scene.isDownCtrl = false;
|
|
|
+ this.scene.setCmd = 'choice'
|
|
|
+ }
|
|
|
+ };
|
|
|
},
|
|
|
methods: {
|
|
|
init() {
|
|
@@ -91,7 +112,7 @@ export default {
|
|
|
.then(response => {
|
|
|
console.log("获取rf成功", response);
|
|
|
this.parserData(floorid);
|
|
|
- this.readGraph()
|
|
|
+ this.readGraph();
|
|
|
loadings.close();
|
|
|
});
|
|
|
this.view.fitSceneToView();
|
|
@@ -124,7 +145,7 @@ export default {
|
|
|
}
|
|
|
this.fParser = new SFloorParser(null);
|
|
|
this.fParser.parseData(res);
|
|
|
- this.scene.fidToItem = {}
|
|
|
+ this.scene.fidToItem = {};
|
|
|
this.fParser.spaceList.forEach(t => {
|
|
|
t.zOrder = t.zOrder + t.data.Height;
|
|
|
t.selectable = true;
|
|
@@ -143,8 +164,8 @@ export default {
|
|
|
this.isQuerying = false;
|
|
|
console.log("success");
|
|
|
// 设置初始化缩放比例
|
|
|
- this.initScale = this.view.scale
|
|
|
- bus.$emit('initScale', this.view.scale);
|
|
|
+ this.initScale = this.view.scale;
|
|
|
+ bus.$emit("initScale", this.view.scale);
|
|
|
});
|
|
|
} else {
|
|
|
console.log("楼层不正确");
|
|
@@ -155,7 +176,7 @@ export default {
|
|
|
readGraph() {
|
|
|
this.readGroup().then(data => {
|
|
|
this.graphId = data.Data[0].ID;
|
|
|
- bus.$emit('setGraphId', this.graphId)
|
|
|
+ bus.$emit("setGraphId", this.graphId);
|
|
|
if (data.Data) {
|
|
|
const parserData = new STopologyParser(null);
|
|
|
parserData.parseData(data.Data[0].Elements);
|
|
@@ -164,7 +185,7 @@ export default {
|
|
|
this.scene.addItem(t);
|
|
|
// 记录提取
|
|
|
if (t.data.Properties && t.data.Properties.FID) {
|
|
|
- this.scene.fidToItem[t.data.Properties.FID].isExtracted = true
|
|
|
+ this.scene.fidToItem[t.data.Properties.FID].isExtracted = true;
|
|
|
}
|
|
|
this.scene.Nodes.push(t);
|
|
|
});
|
|
@@ -184,14 +205,14 @@ export default {
|
|
|
this.scene.Markers.push(t);
|
|
|
});
|
|
|
// 增加图标类图例(此item需在管线item添加之前添加)
|
|
|
- const ancToAnchor = {}
|
|
|
+ const ancToAnchor = {};
|
|
|
parserData.imageLegendList.forEach(t => {
|
|
|
this.scene.addItem(t);
|
|
|
this.scene.Nodes.push(t);
|
|
|
if (t.anchorList && t.anchorList.length) {
|
|
|
t.anchorList.forEach(anc => {
|
|
|
- ancToAnchor[anc.id] = anc
|
|
|
- })
|
|
|
+ ancToAnchor[anc.id] = anc;
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
// 增加管线类(需在图标类图例添加后添加)
|
|
@@ -200,16 +221,16 @@ export default {
|
|
|
this.scene.Relations.push(t);
|
|
|
// 设置锚点
|
|
|
if (t.anchor1ID) {
|
|
|
- const startAnc = ancToAnchor[t.anchor1ID]
|
|
|
- startAnc.isConnected = true
|
|
|
- startAnc.parent?.connect('changePos', t, t.changePos)
|
|
|
- t.startAnchor = startAnc || null
|
|
|
+ const startAnc = ancToAnchor[t.anchor1ID];
|
|
|
+ startAnc.isConnected = true;
|
|
|
+ startAnc.parent?.connect("changePos", t, t.changePos);
|
|
|
+ t.startAnchor = startAnc || null;
|
|
|
}
|
|
|
if (t.anchor2ID) {
|
|
|
- const endAnc = ancToAnchor[t.anchor2ID]
|
|
|
- endAnc.isConnected = true
|
|
|
- endAnc.parent?.connect('changePos', t, t.changePos)
|
|
|
- t.endAnchor = endAnc || null
|
|
|
+ const endAnc = ancToAnchor[t.anchor2ID];
|
|
|
+ endAnc.isConnected = true;
|
|
|
+ endAnc.parent?.connect("changePos", t, t.changePos);
|
|
|
+ t.endAnchor = endAnc || null;
|
|
|
}
|
|
|
});
|
|
|
this.view.fitSceneToView();
|
|
@@ -304,25 +325,27 @@ export default {
|
|
|
FloorID: this.urlMsg.FloorID // 楼层id
|
|
|
};
|
|
|
Message({
|
|
|
- message: '上传中,切勿关闭窗口!',
|
|
|
- type: 'warning'
|
|
|
+ message: "保存中,切勿关闭窗口!",
|
|
|
+ type: "warning"
|
|
|
});
|
|
|
- saveGroup(data).then(res => {
|
|
|
- Message.close()
|
|
|
- this.graphId = res.Data;
|
|
|
- }).catch((err)=>{
|
|
|
- Message({
|
|
|
- message: '上传失败!',
|
|
|
- type: 'error'
|
|
|
- });
|
|
|
- })
|
|
|
+ saveGroup(data)
|
|
|
+ .then(res => {
|
|
|
+ Message.close();
|
|
|
+ this.graphId = res.Data;
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ Message({
|
|
|
+ message: "保存失败!",
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ });
|
|
|
});
|
|
|
bus.$on("exportByKey", val => {
|
|
|
const list = this.fParser.spaceList
|
|
|
.map(t => {
|
|
|
if (t.data.Type == val.key) {
|
|
|
if (!t.isExtracted) {
|
|
|
- t.isExtracted = true
|
|
|
+ t.isExtracted = true;
|
|
|
return {
|
|
|
ID: uuid(),
|
|
|
Name: val.name,
|
|
@@ -412,31 +435,34 @@ export default {
|
|
|
}),
|
|
|
//发布图
|
|
|
bus.$on("publishMap", () => {
|
|
|
- if (this.graphId == '') {
|
|
|
- this.$message.error('请先保存');
|
|
|
+ if (this.graphId == "") {
|
|
|
+ this.$message.error("请先保存");
|
|
|
return false;
|
|
|
}
|
|
|
- this.publishBtn()
|
|
|
- })
|
|
|
+ this.publishBtn();
|
|
|
+ });
|
|
|
/**
|
|
|
* @name changeScale缩放底图
|
|
|
* @param { Number } zoom 缩放比例
|
|
|
*
|
|
|
*/
|
|
|
// TODO: changeScale缩放底图
|
|
|
- bus.$on('changeScale', zoom => {
|
|
|
+ bus.$on("changeScale", zoom => {
|
|
|
const { scale } = this.view;
|
|
|
- this.changeScaleByClick = true
|
|
|
- this.view.scaleByPoint(zoom, this.canvasWidth / 2, this.canvasHeight / 2)
|
|
|
- this.changeScaleByClick = false
|
|
|
- setTimeout(() => {
|
|
|
- }, 100);
|
|
|
- })
|
|
|
+ this.changeScaleByClick = true;
|
|
|
+ this.view.scaleByPoint(
|
|
|
+ zoom,
|
|
|
+ this.canvasWidth / 2,
|
|
|
+ this.canvasHeight / 2
|
|
|
+ );
|
|
|
+ this.changeScaleByClick = false;
|
|
|
+ setTimeout(() => {}, 100);
|
|
|
+ });
|
|
|
// 更改图例数据工程化数据
|
|
|
- bus.$on('changeAttachObjectIds', arr => {
|
|
|
- console.log(arr);
|
|
|
- this.scene.upadatAttachObjectIds(arr);
|
|
|
- })
|
|
|
+ bus.$on("changeAttachObjectIds", arr => {
|
|
|
+ console.log(arr);
|
|
|
+ this.scene.upadatAttachObjectIds(arr);
|
|
|
+ });
|
|
|
},
|
|
|
// 读取数据
|
|
|
readGroup() {
|
|
@@ -444,7 +470,7 @@ export default {
|
|
|
categoryId: this.urlMsg.categoryId,
|
|
|
projectId: this.urlMsg.projectId,
|
|
|
BuildingID: this.urlMsg.BuildingID, // 建筑ID
|
|
|
- FloorID: this.urlMsg.FloorID, // 楼层id
|
|
|
+ FloorID: this.urlMsg.FloorID // 楼层id
|
|
|
};
|
|
|
return readGroup(data);
|
|
|
},
|
|
@@ -468,7 +494,7 @@ export default {
|
|
|
publishGraph(data).then(res => {
|
|
|
loadings.close();
|
|
|
if (res.Result == "success") {
|
|
|
- this.$message.success('发布成功');
|
|
|
+ this.$message.success("发布成功");
|
|
|
setTimeout(() => {
|
|
|
const data = `categoryId=${this.urlMsg.categoryId}&projectId=${this.urlMsg.projectId}&BuildingID=${this.urlMsg.BuildingID}&FloorID=${this.urlMsg.FloorID}&fmapID=${this.urlMsg.fmapID}`;
|
|
|
const url =
|
|
@@ -509,15 +535,14 @@ export default {
|
|
|
deep: true
|
|
|
},
|
|
|
// 监听scale的变化
|
|
|
- 'view.scale': {
|
|
|
+ "view.scale": {
|
|
|
handler(scale) {
|
|
|
-
|
|
|
// 滚轮触发的缩放
|
|
|
if (!this.changeScaleByClick) {
|
|
|
- bus.$emit('mouseScale', scale / this.initScale)
|
|
|
+ bus.$emit("mouseScale", scale / this.initScale);
|
|
|
}
|
|
|
}
|
|
|
- },
|
|
|
+ }
|
|
|
},
|
|
|
created() {
|
|
|
const href = window.location.href;
|