|
@@ -110,8 +110,17 @@ export function setJsData(data) {
|
|
|
* let obj = addDoorPoint(newMapList)
|
|
|
*/
|
|
|
export function addDoorPoint(newMapList) {
|
|
|
+ let labNum = 0;
|
|
|
+ let escapeNum = 0;
|
|
|
for (let i = 0; i < newMapList.length; i++) {
|
|
|
if (newMapList[i].type == 1 || newMapList[i].type == 3) {
|
|
|
+ if(newMapList[i].type == 1){
|
|
|
+ newMapList[i].key = 'lab'+labNum;
|
|
|
+ labNum++
|
|
|
+ }else if(newMapList[i].type == 3){
|
|
|
+ newMapList[i].key = 'escape'+escapeNum;
|
|
|
+ escapeNum++
|
|
|
+ }
|
|
|
//生成门点
|
|
|
let x = 0
|
|
|
let y = 0
|
|
@@ -152,6 +161,8 @@ export function addDoorPoint(newMapList) {
|
|
|
ly = obj.y
|
|
|
}
|
|
|
newMapList[j].lightList.push({
|
|
|
+ // key:newMapList[i].type == 1 ? 'lab'+labNum : 'escape'+escapeNum,
|
|
|
+ key:newMapList[i].key,
|
|
|
type: newMapList[i].type == 1 ? 'lab' : 'escape',
|
|
|
w: 4,
|
|
|
h: 4,
|
|
@@ -261,10 +272,7 @@ export function addDoorPoint(newMapList) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //测试用
|
|
|
return { mapList: newMapList, newList: connectionPoint(newMapList) }
|
|
|
- //正常返回
|
|
|
- // return connectionPoint(newMapList,minHeight,minWidth,tentaclesLength);
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -384,6 +392,9 @@ export function calculateAssociatedLength(newMapList, bigObj, minObj) {
|
|
|
pointAttribute: minObj.type == 'escape' ? 1 : (minObj.type == 'light' ? 2 : minObj.type == 'lab' ? 4 : 3),
|
|
|
pointVOList: []
|
|
|
}
|
|
|
+ if(minObj.type == 'escape' || minObj.type == 'lab'){
|
|
|
+ obj.key = minObj.key;
|
|
|
+ }
|
|
|
//按顺序写入假数据
|
|
|
for (let i = 0; i < newMapList.length; i++) {
|
|
|
if (newMapList[i].type == 2) {
|
|
@@ -843,10 +854,10 @@ export function lightAdd(event, scrollLeft, scrollTop, mapList, grab) {
|
|
|
if (x > mapList[i].x && x < (mapList[i].x + mapList[i].w) &&
|
|
|
y > mapList[i].y && y < (mapList[i].y + mapList[i].h)) {
|
|
|
if (mapList[i].type == '1') {
|
|
|
- //实验室
|
|
|
+ //房间
|
|
|
if (grab != '4' && grab != '5') {
|
|
|
Message({
|
|
|
- message: '实验室只可添加门',
|
|
|
+ message: '房间只可添加门',
|
|
|
type: 'error',
|
|
|
offset: 100
|
|
|
})
|
|
@@ -866,7 +877,7 @@ export function lightAdd(event, scrollLeft, scrollTop, mapList, grab) {
|
|
|
//疏散通道
|
|
|
if (grab != '4' && grab != '5') {
|
|
|
Message({
|
|
|
- message: '疏散通道只可添加门',
|
|
|
+ message: '楼道只可添加门',
|
|
|
type: 'error',
|
|
|
offset: 100
|
|
|
})
|
|
@@ -925,9 +936,9 @@ export function addDoor(event, mapList, scrollLeft, scrollTop, grab) {
|
|
|
if (x > mapList[i].x && x < (mapList[i].x + mapList[i].w) &&
|
|
|
y > mapList[i].y && y < (mapList[i].y + mapList[i].h)) {
|
|
|
if (mapList[i].type == '1' || mapList[i].type == '3') {
|
|
|
- //实验室
|
|
|
+ //房间
|
|
|
if (grab != '4' && grab != '5') {
|
|
|
- this.msgError('实验室与疏散通道只可添加门窗')
|
|
|
+ this.msgError('房间与楼道只可添加门窗')
|
|
|
return
|
|
|
}
|
|
|
} else if (mapList[i].type == '2') {
|
|
@@ -1439,7 +1450,7 @@ export function checkRoom(mapList) {
|
|
|
}
|
|
|
if (num1 === 0) {
|
|
|
Message({
|
|
|
- message: '请添加实验室',
|
|
|
+ message: '请添加房间',
|
|
|
type: 'error',
|
|
|
offset: 100
|
|
|
})
|
|
@@ -1447,7 +1458,7 @@ export function checkRoom(mapList) {
|
|
|
}
|
|
|
if (num2 === 0) {
|
|
|
Message({
|
|
|
- message: '请添加逃生通道',
|
|
|
+ message: '请添加应急出口',
|
|
|
type: 'error',
|
|
|
offset: 100
|
|
|
})
|
|
@@ -1463,7 +1474,7 @@ export function checkRoom(mapList) {
|
|
|
}
|
|
|
if (num4 < (num1 + num2)) {
|
|
|
Message({
|
|
|
- message: '请在每个实验室与逃生通道内添加门',
|
|
|
+ message: '请在每个房间与应急出口内添加门',
|
|
|
type: 'error',
|
|
|
offset: 100
|
|
|
})
|
|
@@ -1652,7 +1663,6 @@ export function placementOverlapCheck(x, y, type, mapList) {
|
|
|
* if(placementOverlapCheck(x,y,type,mapList)){}
|
|
|
*/
|
|
|
export function childrenOverlapCheck(bigObj) {
|
|
|
- console.log('bigObj',bigObj);
|
|
|
if (bigObj.type == 1 || bigObj.type == 3) {
|
|
|
let num = 0
|
|
|
for (let i = 0; i < bigObj.doorList.length; i++) {
|
|
@@ -1713,3 +1723,37 @@ export function childrenOverlapCheck(bigObj) {
|
|
|
return num == 0
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+/*
|
|
|
+* 检查实验室/灯设置
|
|
|
+* 传入:mapList-布局数据
|
|
|
+* 返回:true 或者 false
|
|
|
+* 示例:(本JS内部调用)
|
|
|
+* if(checkInstall(this.mapList){}
|
|
|
+*/
|
|
|
+export function checkInstall(mapList){
|
|
|
+ for(let i=0;i<mapList.length;i++){
|
|
|
+ if(mapList[i].type == 1){
|
|
|
+ if(!mapList[i].roomType){
|
|
|
+ Message({
|
|
|
+ message: '请给每一个房间设定参数',
|
|
|
+ type: 'error',
|
|
|
+ offset: 100
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }else if(mapList[i].type == 2){
|
|
|
+ for(let o=0;o<mapList[i].lightList.length;o++){
|
|
|
+ if(!mapList[i].lightList[o].state){
|
|
|
+ Message({
|
|
|
+ message: '请给每一个灯设定参数',
|
|
|
+ type: 'error',
|
|
|
+ offset: 100
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true
|
|
|
+}
|