Browse Source

3.8功能bug修改

haojianlong 4 years ago
parent
commit
761d3f0f7d

+ 1 - 1
package.json

@@ -20,7 +20,7 @@
   },
   "dependencies": {
     "@saga-web/base": "2.1.27",
-    "@saga-web/cad-engine": "2.0.581",
+    "@saga-web/cad-engine": "2.0.583",
     "@saga-web/draw": "2.1.110",
     "@saga-web/graph": "2.1.133",
     "axios": "^0.18.0",

+ 1 - 1
src/api/scan/request.js

@@ -1635,7 +1635,7 @@ export function floorQueryAndSign(param, success) {
 
 //查询建筑信息
 export function buildingQuery(param, success) {
-  let url = `${baseUrl}${dataCenter}/building/query`;
+  let url = `${baseUrl}${object}/building/query`;
   http.postJson(url, param, success)
 }
 

+ 59 - 15
src/views/ledger/facility/batchPoint.vue

@@ -2,9 +2,12 @@
   	<div id="manageTenantZone">
 		<el-row style="margin:5px 0 0 0;">
 			<el-button style="float:left;" size="small" type="default" icon="el-icon-back" @click="goback"></el-button>
-			<floor-cascader @change="changeFloor"></floor-cascader>
+			<div id="buildFloor">
+                <span class="buildFloor">建筑楼层</span>
+                <el-cascader ref="floorCascader" placeholder="请选择" :props="props" :options="bfOptions" filterable size="small" @change="changeFloor"></el-cascader>
+            </div>
 			<my-cascader ref="cascader" @change="changeDevice"></my-cascader>
-			<el-button type="primary" size="mini" @click="handleClickSave" style="float:right;">确认</el-button>
+			<el-button type="primary" size="mini" @click="handleClickSave" :disabled="!isChange" style="float:right;">确认</el-button>
 			<el-button size="mini" style="float:right;margin-right:10px;" @click="cancel">取消</el-button>
 		</el-row>
 		<el-row class="main-container">
@@ -59,7 +62,7 @@
 					<div class="no-data" v-show="!showCanvas">
 						<div class="position-icon">
 							<i class="icon-wushuju iconfont"></i>
-							数据暂无
+							暂无数据
 						</div>
 					</div>
 				</el-col>
@@ -87,7 +90,7 @@
 <script>
 import floorCascader from "@/components/ledger/lib/floorCascader";
 import myCascader from "@/components/ledger/lib/cascader";
-import { queryEquip, updateEquip } from '@/api/scan/request';
+import { queryEquip, updateEquip, buildingQuery } from '@/api/scan/request';
 import { LocationPointScene, FloorView, Opt, SpaceItem, ZoneItem } from "@saga-web/cad-engine/lib";
 import { SPoint, SColor } from "@saga-web/draw";
 import { mapGetters } from "vuex";
@@ -155,6 +158,13 @@ export default {
         total: 0,
         isChange: false, //平面图设备是否更改
         isMarking: false, // 标记是否选中的是无坐标的设备,true-打点,打完以后重置为false
+        props: {
+            value: 'id',
+            label: 'localName',
+            children: 'floor'
+        }, // 建筑楼层字段绑定
+        bfOptions: [], // 建筑楼层下拉
+        fIdToFloor: {}, // 楼层id映射楼层对象
 	};
   },
   computed: {
@@ -166,7 +176,9 @@ export default {
 		return this.loading || this.noMore
 	}
   },
-  created() { },
+  created() {
+      this.getCascader()
+  },
   mounted() {
     this.cadWidth = document.getElementById('canvasBox').offsetWidth;
     this.cadHeight = document.getElementById('canvasBox').offsetHeight;
@@ -183,6 +195,28 @@ export default {
             this.$router.push({ name: "facilityLedger" });
         })
     },
+    getCascader() {
+      let param = {
+        cascade: [
+          { name: "floor", orders: "floorSequenceID desc" }
+        ],
+        orders: "localName asc",
+        pageNumber: 1,
+        pageSize: 50
+      }
+      buildingQuery(param, res => {
+        this.fIdToFloor = {}
+        this.bfOptions = res.content.map(t => {
+            if (t.floor && t.floor.length) {
+                 t.floor = t.floor.map(item => {
+                    this.fIdToFloor[item.id] = item;
+                    return item
+                }).filter(it => it)
+            }
+            return t
+        })
+      })
+    },
     // 二次确认
     confirm(callback) {
         if (this.isChange) {
@@ -374,8 +408,7 @@ export default {
 		this.getEquipData();
 	},
     //修改楼层
-    changeFloor(value, data) {
-        this.floorData = data;
+    changeFloor(value) {
 		this.showCanvas = false;
 		this.clearGraphy();
 		if (value[0]) {
@@ -383,24 +416,26 @@ export default {
 		}
 		if (value[1]) {
 			this.floorId = value[1];
+            this.floorData = this.fIdToFloor[value[1]];
 		} else {
 			this.floorId = "";
+            this.floorData = {}
         }
-		if (data.infos && data.infos.floorMap) {
-			this.floorMap = data.infos.floorMap;
+		if (this.floorData.infos && this.floorData.infos.floorMap) {
+			this.floorMap = this.floorData.infos.floorMap;
 			this.showCanvas = true;
 			this.getGraphy();
 		} else {
 			this.initParams();
 			this.floorMap = "";
         }
-        if (data.infos && data.infos.height) {
-            this.maxHeight = data.infos.height;
+        if (this.floorData.infos && this.floorData.infos.height) {
+            this.maxHeight = this.floorData.infos.height;
         } else {
             this.maxHeight = 99000;
         }
-		if (data.outline && data.outline.length) {
-			this.floorOutline = data.outline;
+		if (this.floorData.outline && this.floorData.outline.length) {
+			this.floorOutline = this.floorData.outline;
 		} else {
 			this.floorOutline = null;
 		}
@@ -424,7 +459,8 @@ export default {
     },
     // 保存数据
     handleClickSave() {
-        if (this.scene && this.scene.iconList.length) {
+        if (this.scene && this.scene.iconList.length && this.isChange) {
+            this.isChange = false
             let param = {content: []}
             this.scene.iconList.map((item) => {
                 if (item.data.id) {
@@ -435,7 +471,6 @@ export default {
                 }
             })
             updateEquip(param, () => {
-                this.isChange = false
                 this.$message({message: '保存成功!', type: 'success'});
             })
         }
@@ -522,6 +557,15 @@ export default {
 #manageTenantZone {
   position: relative;
   height: 100%;
+  #buildFloor{
+    margin-left: 10px;
+    float: left;
+    .buildFloor {
+        color: #999999;
+        font-size: 14px;
+        margin-right: 12px;
+    }
+  }
   .main-container {
     margin-top: 10px;
     background: #fff;

+ 18 - 2
src/views/ready/buildfloor/repetitionGraphy.vue

@@ -3,8 +3,8 @@
   <div id='repetitionGraphy'>
     <div class='buttons'>
       <el-button icon='el-icon-back' size='mini' @click='backRouter'></el-button>
-      <template v-if="!hasModel">
-        <el-upload class='upload-demo' action='string' :http-request='uploadAndSubmit' :show-file-list='false' v-if="step==-1" accept=".jpg,.png">
+      <template v-if="!!hasModel">
+        <el-upload class='upload-demo' action='string' :http-request='uploadAndSubmit' :show-file-list='false' v-if="step==-1" accept=".jpg,.png" :before-upload="beforeUpload">
           <el-button size="mini">{{hasGraph?'替换平面图图片':'上传平面图图片'}}</el-button>
         </el-upload>
         <el-button style='float:right;' size='mini' type='primary' v-if="step==0" @click="nextStep" :disabled="nextStepBtnDisable">下一步</el-button>
@@ -274,6 +274,22 @@ export default {
       }
       reader.readAsArrayBuffer(file)
     },
+    // 上传前判断
+    beforeUpload(file) {
+      // 拿到当前上传图片的name,判断其后缀名是否符合
+      let type = this.isImage(file.name);
+      if (!type) {
+          this.$message.error('仅支持png、jpg格式的图片');
+          return false
+      }
+      return true
+    },
+    // 封装一个判断图片文件后缀名的方法
+    isImage(fileName) {
+      if (typeof fileName !== 'string') return;
+      let name = fileName.toLowerCase();
+      return name.endsWith('.png') || name.endsWith('.jpg');
+    },
     // 更新楼层key 为图片,同时更新比例尺
     updateFloorKey() {
       const scaleItem = this.$refs.drawFloor.scaleItem;