dedsudiyu 2 年之前
父节点
当前提交
fc6c8d7bd9

+ 56 - 12
src/utils/evacuationLayout.js

@@ -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
+}

+ 44 - 15
src/views/comprehensive/laboratoryManagement/building/buildingDetails.vue

@@ -230,7 +230,7 @@
         <img class="shade-big-img" src="@/assets/ZDimages/evacuation3_2/img_znwl_jt.png">
         <div class="shade-big-1-text-1">
           <img src="@/assets/ZDimages/evacuation3_2/img_xgbj_gd.png">
-          <p>道</p>
+          <p>道</p>
         </div>
         <div class="shade-big-1-text-2">
           <img src="@/assets/ZDimages/evacuation3_2/img_xgbj_yjck.png">
@@ -240,9 +240,9 @@
           <img src="@/assets/ZDimages/evacuation3_2/img_xgbj_fj.png">
           <p>房间</p>
         </div>
-        <p class="shade-big-1-text-4">过道绘制方法为点击拖拽至绘制区域,鼠标左键选中楼道可以调整过道的位置和尺寸。过道支持与其他过道衔接,衔接办法为选择矩形过道中线上的点位与另外一个矩形过的中线进行结合即可。</p>
+        <p class="shade-big-1-text-4">楼道绘制方法为点击拖拽至绘制区域,鼠标左键选中楼道可以调整楼道的位置和尺寸。楼道支持与其他楼道衔接,衔接办法为选择矩形楼道中线上的点位与另外一个矩形过的中线进行结合即可。</p>
         <p class="shade-big-1-text-5">应急出口为固定尺寸,点击拖拽至绘制区域即可。</p>
-        <p class="shade-big-1-text-6">房间可直接拖拽至绘制区域,鼠标左键选中房间可以调整道的位置和尺寸。</p>
+        <p class="shade-big-1-text-6">房间可直接拖拽至绘制区域,鼠标左键选中房间可以调整道的位置和尺寸。</p>
         <p class="shade-big-1-text-7" @click="shadeClick(3)">下一步</p>
       </div>
       <div v-if="shadeBoxType == 3" class="shade-max-box-3">
@@ -274,7 +274,7 @@
   import { getToken } from "@/utils/auth";
   import { checkDoorTo,checkLightDirection,checkRoom,calculateTrafficPoint,addDoorPoint,
     doorMoveJudge,lightMoveJudge,roomMove,roomAdd,lightAdd,addDoor,fourCornersZoom,
-    fourEdgeZoom,setJsData} from "@/utils/evacuationLayout";
+    fourEdgeZoom,setJsData,checkInstall} from "@/utils/evacuationLayout";
   import { subjectList} from "@/api/evacuation3_2/index";
   export default {
     name: "builDingDetails",
@@ -323,15 +323,15 @@
         boxIndex: "",
         //房间边框/角方向状态  1.上/右上 2.右/右下 3.下/左下 4.左/左上
         moveType:null,
-        //抓取类型 1.房间 2.道 3.应急出口 4.房门 6.疏散灯
+        //抓取类型 1.房间 2.道 3.应急出口 4.房门 6.疏散灯
         grab:null,
         //子类抓取下标
         minIndex:null,
         //***********************模拟数据列表*************************//
-        // 可选房间列表 //1.房间 2.道 3.应急出口
+        // 可选房间列表 //1.房间 2.道 3.应急出口
         roomList:[
           {
-            name:"道",
+            name:"道",
             type: '2',
             url:require('@/assets/ZDimages/evacuation3_2/img_xgbj_gd.png'),
           },
@@ -448,12 +448,45 @@
     },
     methods:{
       setDataButton(){
+        let self = this;
         if(checkRoom(this.mapList)&&
           checkDoorTo(this.mapList)&&
-          checkLightDirection(this.mapList)){
+          checkInstall(this.mapList)){
           let newMapList = JSON.parse(JSON.stringify(this.mapList))
           let obj = addDoorPoint(newMapList)
           console.log('obj',obj);
+
+          let roomList = [];
+          let lightList = [];
+          for(let i=0;i<obj.mapList.length;i++){
+            if(obj.mapList[i].type == 1){
+              let minObj = {
+                buildId:self.propsData.buildId,
+                floorId:self.propsData.floorId,
+                roomType:obj.mapList[i].roomType,
+                roomNum:obj.mapList[i].roomNum,
+                pointName:obj.mapList[i].key,
+              }
+              if(obj.mapList[i].roomType != '-99'){
+                minObj.subId = obj.mapList[i].subId
+              }else{
+                minObj.roomName = obj.mapList[i].roomName
+              }
+              roomList.push(minObj);
+            }else if(obj.mapList[i].type == 2){
+              for(let o=0;o<obj.mapList[i].lightList.length;o++){
+                let minObj = {
+                  buildId:self.propsData.buildId,
+                  floorId:self.propsData.floorId,
+                  pointName:obj.mapList[i].lightList[o].key,
+                  relayCode:obj.mapList[i].lightList[o].name2,
+                  relayBit:obj.mapList[i].lightList[o].name3,
+                }
+                lightList.push(minObj);
+              }
+            }
+          }
+
           let newObj = {
             imgUrl: this.imgUrl,
             canvasWidth: this.layerWidth,
@@ -461,8 +494,9 @@
             buildId: this.propsData.buildId,
             floorId: this.propsData.floorId,
             relationalData:obj.newList,//点数据
-            // buildFloorLayouts:obj.roomList,//房间数据
-            layoutData:obj.mapList,//布局数据
+            buildFloorLayouts:roomList,//房间数据
+            lightData:lightList,//灯数据
+            layoutData:JSON.parse(JSON.stringify(this.mapList)),//布局数据
           };
           console.log('newObj',newObj);
           // lineVertex(newObj).then(response => {
@@ -584,11 +618,6 @@
       //遮罩菜单选中事件
       clickShadeButton(type){
         if(type == 1){
-          if(this.mouseType == 1){
-            //房间
-          }else if(this.mouseType == 6){
-            //灯
-          }
           this.$set(this,'dialogOpen',true)
         }else if (type == 2){
           if(this.dialogOpenType == 1 || this.dialogOpenType == 2 || this.dialogOpenType == 3){

+ 0 - 1
src/views/studentViews/chemicalManagement/studentChemicalInfo/addPage.vue

@@ -177,7 +177,6 @@
                         :precision="2"
                         :step="0.01"
                         v-model="bigItem.chemicalAmount"
-                        :disabled="selectioned.chemicalUnit=='g'"
                         placeholder="请输入">
                       </el-input-number>
                       <p class="num-title-span">{{selectioned.chemicalUnit}}</p>