|
@@ -12,7 +12,7 @@ import { SFloorParser } from "@saga-web/big";
|
|
|
import { FloorView } from "./../lib/FloorView";
|
|
|
import { EditScence } from "./mapClass/EditScence";
|
|
|
import bus from "@/bus";
|
|
|
-import { saveGroup, readGroup, queryTypeGraph } 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";
|
|
@@ -48,7 +48,10 @@ export default {
|
|
|
floorList: {},
|
|
|
urlMsg: {},
|
|
|
chiceItemList: [], //选中itemlist
|
|
|
- hasTypeList: [] // 当前类型下包含的typeid(提取)
|
|
|
+ hasTypeList: [], // 当前类型下包含的typeid(提取)
|
|
|
+ graphId:'',
|
|
|
+ initScale: 1, //加载好底图之后的,初始缩放比例
|
|
|
+ changeScaleByClick: false, //区分 滚轮,点击 事件改变的缩放比例
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
@@ -58,6 +61,7 @@ export default {
|
|
|
// 挂在bus
|
|
|
this.getBus();
|
|
|
store.dispatch("getElementType", { PageSize: 1000 });
|
|
|
+ window.vm = this
|
|
|
},
|
|
|
methods: {
|
|
|
init() {
|
|
@@ -90,9 +94,12 @@ export default {
|
|
|
loadings.close();
|
|
|
});
|
|
|
this.view.fitSceneToView();
|
|
|
+
|
|
|
});
|
|
|
// 获取主题数据
|
|
|
this.readGroup().then(data => {
|
|
|
+ this.graphId = data.Data[0].ID;
|
|
|
+ bus.$emit('setGraphId',this.graphId)
|
|
|
if (data.Data) {
|
|
|
const parserData = new STopologyParser(null);
|
|
|
parserData.parseData(data.Data[0].Elements);
|
|
@@ -174,6 +181,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 +276,7 @@ export default {
|
|
|
BuildingID: this.urlMsg.BuildingID, // 建筑ID
|
|
|
FloorID: this.urlMsg.FloorID // 楼层id
|
|
|
};
|
|
|
- Message({
|
|
|
+ Message({
|
|
|
message: '上传中,切勿关闭窗口!',
|
|
|
type: 'warning'
|
|
|
});
|
|
@@ -352,20 +362,36 @@ export default {
|
|
|
this.scene.upadatitemExplain(val);
|
|
|
});
|
|
|
//发布图
|
|
|
- // 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);
|
|
|
- // }
|
|
|
- // });
|
|
|
- // });
|
|
|
+ bus.$on("publishGraph", val => {
|
|
|
+ publishGraph({ graphId: this.graphId, pubUser: "" }).then(res => {
|
|
|
+ if (res.Result == "success") {
|
|
|
+ this.$message.success(res.Message);
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.Message);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
//创建区域是否点选
|
|
|
bus.$on("changeDrawType", val => {
|
|
|
this.scene.isSelecting = val == "select";
|
|
|
+ }),
|
|
|
+ //发布图
|
|
|
+ bus.$on("publishMap", () => {
|
|
|
+ this.publishBtn()
|
|
|
+ })
|
|
|
+ /**
|
|
|
+ * @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);
|
|
|
})
|
|
|
},
|
|
|
// 读取数据
|
|
@@ -379,6 +405,38 @@ export default {
|
|
|
};
|
|
|
return readGroup(data);
|
|
|
},
|
|
|
+ //发布
|
|
|
+ publishBtn() {
|
|
|
+ console.log(this.graphId);
|
|
|
+ const loadings = Loading.service({
|
|
|
+ lock: true,
|
|
|
+ text: "Loading",
|
|
|
+ spinner: "el-icon-loading",
|
|
|
+ background: "rgba(0, 0, 0, 0.7)"
|
|
|
+ });
|
|
|
+ const data = {
|
|
|
+ BuildingID: this.urlMsg.BuildingID,
|
|
|
+ CategoryID: this.urlMsg.categoryId,
|
|
|
+ FloorID: this.urlMsg.FloorID,
|
|
|
+ GraphId: this.graphId,
|
|
|
+ ProjectID: this.urlMsg.projectId,
|
|
|
+ PubUser: ""
|
|
|
+ };
|
|
|
+ publishGraph(data).then(res => {
|
|
|
+ loadings.close();
|
|
|
+ if (res.Result == "success") {
|
|
|
+ this.$message.success(res.Message);
|
|
|
+ const data = `categoryId=${this.urlMsg.categoryId}&projectId=${this.urlMsg.projectId}&BuildingID=${this.urlMsg.BuildingID}&FloorID=${this.urlMsg.FloorID}&fmapID=${this.urlMsg.fmapID}`;
|
|
|
+ const url =
|
|
|
+ window.location.origin +
|
|
|
+ "/wandaEditer/drafts?" +
|
|
|
+ encodeURIComponent(data);
|
|
|
+ window.open(url, true);
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.Message);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
// 获取typeid
|
|
|
getTypeId() {
|
|
|
const data = {
|
|
@@ -404,7 +462,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;
|