|
@@ -316,6 +316,7 @@ import config from '@/config';
|
|
import { mapState } from '@wepy/x';
|
|
import { mapState } from '@wepy/x';
|
|
import { saveCompanyConfig } from '@/service/companyConfig';
|
|
import { saveCompanyConfig } from '@/service/companyConfig';
|
|
import { getCompanyMapData } from '@/api/home';
|
|
import { getCompanyMapData } from '@/api/home';
|
|
|
|
+import {getFloorList} from '@/packagesEnv/api/mapApi.js'
|
|
|
|
|
|
let h5StaticPath = config.h5StaticPath + '/page-intelligent-control/';
|
|
let h5StaticPath = config.h5StaticPath + '/page-intelligent-control/';
|
|
const tarBarHeight = 96;
|
|
const tarBarHeight = 96;
|
|
@@ -383,7 +384,13 @@ wepy.component({
|
|
companyId: ''
|
|
companyId: ''
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
- ...mapState({ userInfo: state => state.user.userInfo })
|
|
|
|
|
|
+ ...mapState({
|
|
|
|
+ userInfo: state => state.user.userInfo,
|
|
|
|
+ projectId: state =>
|
|
|
|
+ state.company &&
|
|
|
|
+ state.company.companyConfig &&
|
|
|
|
+ state.company.companyConfig.sagacareProjectId
|
|
|
|
+ })
|
|
},
|
|
},
|
|
ready() {
|
|
ready() {
|
|
// 页面加载
|
|
// 页面加载
|
|
@@ -395,82 +402,86 @@ wepy.component({
|
|
this.canSlideExpanel = false;
|
|
this.canSlideExpanel = false;
|
|
}
|
|
}
|
|
|
|
|
|
- checkHasUserInfo()
|
|
|
|
- .then(userInfo => {
|
|
|
|
- // let companyId =
|
|
|
|
- // query.from !== 'visit' ? userInfo.companyId : query.companyId;
|
|
|
|
- let companyId = this.companyIdProp || userInfo.companyId;
|
|
|
|
- this.companyId = companyId;
|
|
|
|
- return getCompanyMapData(companyId);
|
|
|
|
- })
|
|
|
|
- .then(res => {
|
|
|
|
- CompanyMapData = JSON.parse(res.data);
|
|
|
|
- this.selectedFloor = CompanyMapData.floorInfo[0].floorId;
|
|
|
|
- this.floors = CompanyMapData.floorInfo;
|
|
|
|
- this.isShowLocationEntrance = CompanyMapData.sagaCareBluetooth || false;
|
|
|
|
- this.getMapSize();
|
|
|
|
- return this.getHistorySelectedArea();
|
|
|
|
- })
|
|
|
|
- .then(historyArea => {
|
|
|
|
- // let historyAreaInfo = CompanyMapData.mapInfo.find(
|
|
|
|
- // e => e.id == historyArea.spaceId
|
|
|
|
- // );
|
|
|
|
- return getMapInfoHttp(this.companyId).then(res => {
|
|
|
|
- const result = JSON.parse(res.data);
|
|
|
|
- const httpDdata = (result && result.content) || [];
|
|
|
|
- return {
|
|
|
|
- historyArea,
|
|
|
|
- httpDdata
|
|
|
|
- };
|
|
|
|
- });
|
|
|
|
- })
|
|
|
|
- .then(res => {
|
|
|
|
- const { httpDdata, historyArea } = res;
|
|
|
|
- let historyAreaInfo;
|
|
|
|
- let selectarea;
|
|
|
|
- let selectAraeId = null;
|
|
|
|
- if (from == 'officehome') {
|
|
|
|
- selectAraeId = this.spaceIdProp;
|
|
|
|
- } else {
|
|
|
|
- selectAraeId = historyArea.spaceId;
|
|
|
|
- }
|
|
|
|
- CompanyMapData.mapInfo.forEach(item => {
|
|
|
|
- item.canClick =
|
|
|
|
- typeof item.canClick === 'boolean'
|
|
|
|
- ? item.canClick
|
|
|
|
- : JSON.parse(item.canClick);
|
|
|
|
- item.borderRadius = item.borderRadius
|
|
|
|
- ? item.borderRadius instanceof Array
|
|
|
|
- ? item.borderRadius
|
|
|
|
- : item.borderRadius
|
|
|
|
- .slice(2, item.borderRadius.length - 2)
|
|
|
|
- .split(',')
|
|
|
|
- : undefined;
|
|
|
|
- });
|
|
|
|
- combinedData = httpDdata.reduce((acc, cur) => {
|
|
|
|
- let target = acc.find(e => e.id == cur.id);
|
|
|
|
-
|
|
|
|
- selectarea = acc.find(e => e.id == selectAraeId);
|
|
|
|
- if (target) {
|
|
|
|
- Object.assign(target, { title: cur.localName });
|
|
|
|
- } else {
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (target && target.id == selectAraeId) {
|
|
|
|
- selectarea = { ...target }; // 如果有新数据,则更新选中的数据
|
|
|
|
- }
|
|
|
|
- return acc;
|
|
|
|
- }, CompanyMapData.mapInfo);
|
|
|
|
- this.mapAreasInfo = combinedData;
|
|
|
|
- // 如果从博瑞尚格智慧空间过来,面板是折叠起来,并且不能滑动
|
|
|
|
- if (from == 'officehome') {
|
|
|
|
- this.foldPanelFun();
|
|
|
|
- this.doSelectArea(selectarea);
|
|
|
|
- // this.getSpaceTem();
|
|
|
|
- } else {
|
|
|
|
- this.autoSelectArea(selectarea);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ // 获取地图数据
|
|
|
|
+ this.getFloorList();
|
|
|
|
+
|
|
|
|
+ // checkHasUserInfo()
|
|
|
|
+ // .then(userInfo => {
|
|
|
|
+ // // let companyId =
|
|
|
|
+ // // query.from !== 'visit' ? userInfo.companyId : query.companyId;
|
|
|
|
+ // let companyId = this.companyIdProp || userInfo.companyId;
|
|
|
|
+ // this.companyId = companyId;
|
|
|
|
+ // return getCompanyMapData(companyId);
|
|
|
|
+ // })
|
|
|
|
+ // .then(res => {
|
|
|
|
+ // CompanyMapData = JSON.parse(res.data);
|
|
|
|
+ // this.selectedFloor = CompanyMapData.floorInfo[0].floorId;
|
|
|
|
+ // this.floors = CompanyMapData.floorInfo;
|
|
|
|
+ // this.isShowLocationEntrance = CompanyMapData.sagaCareBluetooth || false;
|
|
|
|
+ // this.getMapSize();
|
|
|
|
+ // return this.getHistorySelectedArea();
|
|
|
|
+ // })
|
|
|
|
+ // .then(historyArea => {
|
|
|
|
+ // // let historyAreaInfo = CompanyMapData.mapInfo.find(
|
|
|
|
+ // // e => e.id == historyArea.spaceId
|
|
|
|
+ // // );
|
|
|
|
+ // return getMapInfoHttp(this.companyId).then(res => {
|
|
|
|
+ // const result = JSON.parse(res.data);
|
|
|
|
+ // const httpDdata = (result && result.content) || [];
|
|
|
|
+ // return {
|
|
|
|
+ // historyArea,
|
|
|
|
+ // httpDdata
|
|
|
|
+ // };
|
|
|
|
+ // });
|
|
|
|
+ // })
|
|
|
|
+ // .then(res => {
|
|
|
|
+ // const { httpDdata, historyArea } = res;
|
|
|
|
+ // let historyAreaInfo;
|
|
|
|
+ // let selectarea;
|
|
|
|
+ // let selectAraeId = null;
|
|
|
|
+ // if (from == 'officehome') {
|
|
|
|
+ // selectAraeId = this.spaceIdProp;
|
|
|
|
+ // } else {
|
|
|
|
+ // selectAraeId = historyArea.spaceId;
|
|
|
|
+ // }
|
|
|
|
+ // CompanyMapData.mapInfo.forEach(item => {
|
|
|
|
+ // item.canClick =
|
|
|
|
+ // typeof item.canClick === 'boolean'
|
|
|
|
+ // ? item.canClick
|
|
|
|
+ // : JSON.parse(item.canClick);
|
|
|
|
+ // item.borderRadius = item.borderRadius
|
|
|
|
+ // ? item.borderRadius instanceof Array
|
|
|
|
+ // ? item.borderRadius
|
|
|
|
+ // : item.borderRadius
|
|
|
|
+ // .slice(2, item.borderRadius.length - 2)
|
|
|
|
+ // .split(',')
|
|
|
|
+ // : undefined;
|
|
|
|
+ // });
|
|
|
|
+ // combinedData = httpDdata.reduce((acc, cur) => {
|
|
|
|
+ // let target = acc.find(e => e.id == cur.id);
|
|
|
|
+
|
|
|
|
+ // selectarea = acc.find(e => e.id == selectAraeId);
|
|
|
|
+ // if (target) {
|
|
|
|
+ // Object.assign(target, { title: cur.localName });
|
|
|
|
+ // } else {
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // if (target && target.id == selectAraeId) {
|
|
|
|
+ // selectarea = { ...target }; // 如果有新数据,则更新选中的数据
|
|
|
|
+ // }
|
|
|
|
+ // return acc;
|
|
|
|
+ // }, CompanyMapData.mapInfo);
|
|
|
|
+ // this.mapAreasInfo = combinedData;
|
|
|
|
+ // // 如果从博瑞尚格智慧空间过来,面板是折叠起来,并且不能滑动
|
|
|
|
+ // if (from == 'officehome') {
|
|
|
|
+ // this.foldPanelFun();
|
|
|
|
+ // this.doSelectArea(selectarea);
|
|
|
|
+ // // this.getSpaceTem();
|
|
|
|
+ // } else {
|
|
|
|
+ // this.autoSelectArea(selectarea);
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
// 父亲传过来的空间id 搜索返回才会有这个传递
|
|
// 父亲传过来的空间id 搜索返回才会有这个传递
|
|
@@ -487,10 +498,10 @@ wepy.component({
|
|
/**
|
|
/**
|
|
* 查询楼层信息
|
|
* 查询楼层信息
|
|
*/
|
|
*/
|
|
- getFloorList(flag) {
|
|
|
|
|
|
+ getFloorList() {
|
|
let params = {
|
|
let params = {
|
|
criteria: {
|
|
criteria: {
|
|
- projectId: projectId
|
|
|
|
|
|
+ projectId: this.projectId
|
|
}
|
|
}
|
|
};
|
|
};
|
|
getFloorList(params).then(res => {});
|
|
getFloorList(params).then(res => {});
|
|
@@ -500,7 +511,7 @@ wepy.component({
|
|
*/
|
|
*/
|
|
getMapInfo() {
|
|
getMapInfo() {
|
|
let params = {
|
|
let params = {
|
|
- projectId: 'props.projectId',
|
|
|
|
|
|
+ projectId: '',
|
|
floorId: 'proxyData.floorItem.id'
|
|
floorId: 'proxyData.floorItem.id'
|
|
};
|
|
};
|
|
getMapInfo(params)
|
|
getMapInfo(params)
|