|
@@ -80,7 +80,7 @@ export default {
|
|
|
if (e && e.key == "Control") {
|
|
|
// 按 ctrl
|
|
|
that.scene.isDownCtrl = false;
|
|
|
- this.scene.setCmd = 'choice'
|
|
|
+ this.scene.setCmd = "choice";
|
|
|
}
|
|
|
};
|
|
|
},
|
|
@@ -179,7 +179,7 @@ export default {
|
|
|
bus.$emit("setGraphId", this.graphId);
|
|
|
if (data.Data) {
|
|
|
const parserData = new STopologyParser(null);
|
|
|
- const itemMap = {}
|
|
|
+ const itemMap = {};
|
|
|
parserData.parseData(data.Data[0].Elements);
|
|
|
// 多边形(此item需在直线item添加之前添加)
|
|
|
parserData.zoneLegendList.forEach(t => {
|
|
@@ -210,7 +210,7 @@ export default {
|
|
|
if (t.anchorList && t.anchorList.length) {
|
|
|
t.anchorList.forEach(anc => {
|
|
|
itemMap[anc.id] = anc;
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
// 增加直线
|
|
@@ -220,13 +220,13 @@ export default {
|
|
|
// 设置关联Item
|
|
|
if (t.data.Properties && t.data.Properties.StartItemId) {
|
|
|
const startItem = itemMap[t.data.Properties.StartItemId];
|
|
|
- startItem?.connect('onMove', t, t.changePos);
|
|
|
- t.startItem = startItem || null
|
|
|
+ startItem?.connect("onMove", t, t.changePos);
|
|
|
+ t.startItem = startItem || null;
|
|
|
}
|
|
|
if (t.data.Properties && t.data.Properties.EndItemId) {
|
|
|
const endItem = itemMap[t.data.Properties.EndItemId];
|
|
|
- endItem?.connect('onMove', t, t.changePos);
|
|
|
- t.endItem = endItem || null
|
|
|
+ endItem?.connect("onMove", t, t.changePos);
|
|
|
+ t.endItem = endItem || null;
|
|
|
}
|
|
|
});
|
|
|
// 增加管线类(需在图标类图例添加后添加)
|
|
@@ -235,16 +235,16 @@ export default {
|
|
|
this.scene.Relations.push(t);
|
|
|
// 设置锚点
|
|
|
if (t.anchor1ID) {
|
|
|
- const startAnc = itemMap[t.anchor1ID]
|
|
|
- startAnc.isConnected = true
|
|
|
- startAnc.parent?.connect('changePos', t, t.changePos)
|
|
|
- t.startAnchor = startAnc || null
|
|
|
+ const startAnc = itemMap[t.anchor1ID];
|
|
|
+ startAnc.isConnected = true;
|
|
|
+ startAnc.parent?.connect("changePos", t, t.changePos);
|
|
|
+ t.startAnchor = startAnc || null;
|
|
|
}
|
|
|
if (t.anchor2ID) {
|
|
|
- const endAnc = itemMap[t.anchor2ID]
|
|
|
- endAnc.isConnected = true
|
|
|
- endAnc.parent?.connect('changePos', t, t.changePos)
|
|
|
- t.endAnchor = endAnc || null
|
|
|
+ const endAnc = itemMap[t.anchor2ID];
|
|
|
+ endAnc.isConnected = true;
|
|
|
+ endAnc.parent?.connect("changePos", t, t.changePos);
|
|
|
+ t.endAnchor = endAnc || null;
|
|
|
}
|
|
|
});
|
|
|
this.view.fitSceneToView();
|
|
@@ -306,7 +306,6 @@ export default {
|
|
|
});
|
|
|
bus.$on("extractItem", () => {
|
|
|
const map = {};
|
|
|
- console.log(this.hasTypeList);
|
|
|
this.fParser.spaceList.forEach(t => {
|
|
|
if (this.hasTypeList.indexOf(t.data.Type) > -1) {
|
|
|
if (map[t.data.Type]) {
|
|
@@ -329,32 +328,7 @@ export default {
|
|
|
bus.$emit("exportItem", data);
|
|
|
});
|
|
|
bus.$on("saveMsgItem", () => {
|
|
|
- const Elements = this.scene.saveMsgItem();
|
|
|
- const Seq = Number(this.urlMsg.seq);
|
|
|
- const data = {
|
|
|
- Elements,
|
|
|
- Name: this.appName, // 名称
|
|
|
- CategoryId: this.urlMsg.categoryId,
|
|
|
- ProjectID: this.urlMsg.projectId, // 项目ID
|
|
|
- BuildingID: this.urlMsg.BuildingID, // 建筑ID
|
|
|
- FloorID: this.urlMsg.FloorID, // 楼层id
|
|
|
- Seq // 楼层id
|
|
|
- };
|
|
|
- Message({
|
|
|
- message: "保存中,切勿关闭窗口!",
|
|
|
- type: "warning"
|
|
|
- });
|
|
|
- saveGroup(data)
|
|
|
- .then(res => {
|
|
|
- Message.close();
|
|
|
- this.graphId = res.Data;
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- Message({
|
|
|
- message: "保存失败!",
|
|
|
- type: "error"
|
|
|
- });
|
|
|
- });
|
|
|
+ this.saveMsg()
|
|
|
});
|
|
|
bus.$on("exportByKey", val => {
|
|
|
const list = this.fParser.spaceList
|
|
@@ -453,6 +427,8 @@ export default {
|
|
|
bus.$on("publishMap", () => {
|
|
|
if (this.graphId == "") {
|
|
|
this.$message.error("请先保存");
|
|
|
+ // 如果没有保存则先保存
|
|
|
+ bus.$emit("saveMsgItem");
|
|
|
return false;
|
|
|
}
|
|
|
this.publishBtn();
|
|
@@ -479,14 +455,14 @@ export default {
|
|
|
this.scene.upadatAttachObjectIds(arr);
|
|
|
});
|
|
|
// redo
|
|
|
- bus.$on('changeRedo',()=>{
|
|
|
- this.scene.redo()
|
|
|
- })
|
|
|
+ bus.$on("changeRedo", () => {
|
|
|
+ this.scene.redo();
|
|
|
+ });
|
|
|
|
|
|
// uodo/
|
|
|
- bus.$on('changeUndo',()=>{
|
|
|
- this.scene.undo()
|
|
|
- })
|
|
|
+ bus.$on("changeUndo", () => {
|
|
|
+ this.scene.undo();
|
|
|
+ });
|
|
|
},
|
|
|
// 读取数据
|
|
|
readGroup() {
|
|
@@ -540,6 +516,34 @@ export default {
|
|
|
queryTypeGraph(data).then(res => {
|
|
|
this.hasTypeList = res.Data.map(t => Number(t));
|
|
|
});
|
|
|
+ },
|
|
|
+ saveMsg() {
|
|
|
+ const Elements = this.scene.saveMsgItem();
|
|
|
+ const Seq = Number(this.urlMsg.seq);
|
|
|
+ const data = {
|
|
|
+ Elements,
|
|
|
+ Name: this.appName, // 名称
|
|
|
+ CategoryId: this.urlMsg.categoryId,
|
|
|
+ ProjectID: this.urlMsg.projectId, // 项目ID
|
|
|
+ BuildingID: this.urlMsg.BuildingID, // 建筑ID
|
|
|
+ FloorID: this.urlMsg.FloorID, // 楼层id
|
|
|
+ Seq // 楼层id
|
|
|
+ };
|
|
|
+ Message({
|
|
|
+ message: "保存中,切勿关闭窗口!",
|
|
|
+ type: "warning"
|
|
|
+ });
|
|
|
+ saveGroup(data)
|
|
|
+ .then(res => {
|
|
|
+ Message.close();
|
|
|
+ this.graphId = res.Data;
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ Message({
|
|
|
+ message: "保存失败!",
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
watch: {
|