Pārlūkot izejas kodu

针对之江项目的修改

zhaojijng 3 gadi atpakaļ
vecāks
revīzija
e1a44db08a

+ 3 - 0
src/api/second.ts

@@ -1,4 +1,5 @@
 export default {
+    queryBuilding: "/daping/duoduo-service/object-service/object/building/query", //获取楼层
     queryFs: "/daping/duoduo-service/object-service/object/floor/queryFs", //获取楼层
     queryParam: "/daping/duoduo-service/object-service/object/floor/queryParam", //获取楼层详情
     getWeatherCurrent:
@@ -7,4 +8,6 @@ export default {
         "/daping/duoduo-service/review-service/energy/week/day/query", //上月每日能耗
     queryLastAllEnergy:
         "/daping/duoduo-service/review-service/sceneValue/query", //上月所有能耗
+
+        
 };

+ 5 - 5
src/router/index.ts

@@ -21,14 +21,14 @@ const routes: Array<RouteConfig> = [
         component: () => import("@/views/horizontalScreen.vue"),
     },
     {
-        path: "/horTwo",
-        name: "horTwo",
-        component: () => import("@/views/horTwo.vue"),
-    },
-    {
         path: "/horThree",
         name: "horThree",
         component: () => import("@/views/horThree.vue"),
+    },
+    {
+        path: "/mapdata",
+        name: "mapdata",
+        component: () => import("@/views/mapdata.vue"),
     }
 ];
 

+ 0 - 49
src/views/horTwo.vue

@@ -1,49 +0,0 @@
-<template>
-    <div class="horTwo">
-        <div class="bg">
-            <img
-                :src="bgImg"
-                alt=""
-            >
-        </div>
-        <div class="container">
-            <div class="hor-head">
-                <pageHead />
-            </div>
-            <div>
-                <HorFloorSpace />
-            </div>
-        </div>
-
-    </div>
-</template>
-<script lang="ts">
-import Vue from "vue";
-import pageHead from "./valueDelivery/pageHead.vue";
-import HorFloorSpace from "./valueDelivery/HorFloorSpace.vue";
-declare function require(img: string): string;
-const hor_big_bg = require("@/assets/horImg/hor_big_bg.png");
-
-export default Vue.extend({
-    components: { pageHead, HorFloorSpace },
-    data() {
-        return {
-            bgImg: hor_big_bg
-        };
-    },
-});
-</script>
-<style lang="less" scoped>
-.horTwo {
-    .hor-head {
-        display: flex;
-        justify-content: center;
-    }
-    .bg {
-        position: absolute;
-        z-index: -1;
-    }
-}
-</style>
-
-

+ 192 - 0
src/views/mapdata.vue

@@ -0,0 +1,192 @@
+<template>
+    <div class="mapdata">
+        <!-- <textarea class="content" v-model="message"></textarea>
+        <button class="sure" v-on:click="onclick">提交</button> -->
+
+        <!-- <input class="" type="file" @change="getFile" /> -->
+        <div class="file-upload">
+            <div class="file-upload-text">上传文件</div>
+            <input
+                class="file-upload-input"
+                id="upfile"
+                type="file"
+                @change="getFile"
+            />
+        </div>
+        <div class="fileName">{{ fileName }}</div>
+    </div>
+</template>
+<script>
+import Vue from "vue";
+
+export default Vue.extend({
+    data() {
+        return {
+            name: "mapdata",
+            message: null,
+            fileName: "",
+        };
+    },
+    created() {
+        // console.log(this.name);
+    },
+    methods: {
+        getFile(e) {
+            console.log(e.target.files);
+            var fileSelect = e.target.files[0];
+            this.fileName = fileSelect.name;
+            let reader = new FileReader();
+            if (typeof FileReader === "undefined") {
+                console.log("您的浏览器不支持FileReader接口");
+                return;
+            }
+            reader.readAsText(fileSelect, "gb2312"); //注意读取中文的是用这个编码,不是utf-8
+            const _this = this;
+            reader.onload = function() {
+                // console.log(reader.result);
+                var result = reader.result;
+                // _this.$nextTick(() => {
+                //     _this.voiceContent = reader.result;
+                // });
+                _this.handleStr(result);
+            };
+            //console.log(reader);
+        },
+        // onclick() {
+        //     console.log(this.message);
+        //     this.handleStr(this.message);
+        // },
+        handleStr(mapstr) {
+            var maparr = mapstr.split("<DIV ");
+            //console.log("maparr", maparr);
+            var _this = this;
+            var allDiv = [];
+            //debugger;
+            maparr.map((item) => {
+                var divobj = {};
+                var divarr = item.split(" ");
+                //console.log("divarr", divarr);
+                divarr.map(function(item) {
+                    if (item.indexOf("id=") > -1) {
+                        var idarr = item.split("=");
+                        // debugger;
+                        var idstr = idarr[1];
+                        divobj.id = idstr;
+                        // console.log("idstr", idstr);
+                        return;
+                    }
+                });
+
+                divobj.height = this.getNum(item, "HEIGHT");
+                divobj.width = this.getNum(item, "WIDTH");
+                divobj.left = this.getNum(item, "LEFT");
+                divobj.top = this.getNum(item, "TOP");
+                if (divobj.width) {
+                    allDiv.push(divobj);
+                }
+
+                // var hindex = divarr.indexOf("HEIGHT:");
+                // var windex = divarr.indexOf("WIDTH:");
+                // var lindex = divarr.indexOf("LEFT:");
+                // var tindex = divarr.indexOf("TOP:");
+                //console.log(hindex, windex, lindex, tindex);
+            });
+            console.log("allDiv", allDiv);
+             console.log("allDiv-string",JSON.stringify(allDiv) );
+        },
+        getNum(str, param) {
+            //debugger;
+            var paindex = str.indexOf(param);
+            if (paindex > -1) {
+                var palength = param.length;
+                var otherstr = str.substr(paindex + palength);
+                var pxindex = otherstr.indexOf("px");
+                var numstr = otherstr.substr(0, pxindex);
+                numstr = numstr.replace(/:/, "");
+                return numstr ? Number(numstr) : "";
+            }
+            return "";
+        },
+    },
+});
+</script>
+<style lang="less" scoped>
+.mapdata {
+    padding: 30px;
+    position: relative;
+    // }
+    // .file-upload {
+    //     width: 90px;
+    //     height: 40px;
+    //     position: relative;
+    //     overflow: hidden;
+    //     border: 1px solid #0f996b;
+    //     display: inline-block;
+    //     border-radius: 4px;
+    //     font-size: 15px;
+    //     color: #000;
+    //     text-align: center;
+    //     line-height: 40px;
+    // }
+    // .file-upload-input {
+    //     background-color: transparent;
+    //     position: absolute;
+    //     width: 999px;
+    //     height: 999px;
+    //     top: 0px;
+    //     left: 0px;
+    //     cursor: pointer;
+    // }
+
+    .file-upload {
+        width: 90px;
+        height: 36px;
+        position: relative;
+        overflow: hidden;
+        border: 1px solid #0f996b;
+        display: inline-block;
+        border-radius: 4px;
+        font-size: 14px;
+        color: #0f996b;
+        text-align: center;
+        line-height: 36px;
+        margin: 10px 0 auto auto;
+    }
+    .file-upload-input {
+        background-color: transparent;
+        position: absolute;
+        width: 999px;
+        height: 999px;
+        top: -100px;
+        left: -100px;
+        cursor: pointer;
+    }
+    .fileName {
+        margin-top: 14px;
+        color: #000000;
+        font-size: 16px;
+    }
+    // .content {
+    //     width: 900px;
+    //     height: 700px;
+    // }
+    // .sure {
+    //     display: flex;
+    //     justify-content: center;
+    //     align-items: center;
+    //     cursor: pointer;
+    //     width: 60px;
+    //     height: 40px;
+    //     font-size: 16px;
+    //     color: #575271;
+    //     font-weight: 400;
+    //     line-height: 22px;
+    //     margin-left: 10px;
+    //     background: rgb(126, 216, 116);
+    //     border: 2px solid hsla(0, 0%, 100%, 0.8);
+    //     box-sizing: border-box;
+    //     border-radius: 8px;
+    //     margin-top: 20px;
+    // }
+}
+</style>

+ 58 - 10
src/views/valueDelivery/FloorSpace.vue

@@ -2,6 +2,7 @@
     <div class="floorCont">
         <div class="topChange">
             <div class="allIndicator">
+                <div>{{ nowBuildName }}</div>
                 <div
                     class="eachItem"
                     v-for="(item, index) in allIndicator"
@@ -67,7 +68,6 @@ import { Loading } from "element-ui";
 import moment from "moment";
 import { selectColor } from "@/utils/publicMethod";
 
-
 export default {
     name: "FloorSpace",
     data() {
@@ -117,7 +117,9 @@ export default {
                     fixed: 0,
                 },
             ],
-
+            allBuild: [],
+            nowBuildName: "",
+            nowBuildPage: 1, //目前是第几个建筑
             allFloor: [],
             firstPageParams: [],
             secondPageParams: [],
@@ -141,7 +143,7 @@ export default {
             //当前屏幕第几屏
             if (newv == 2) {
                 this.nowPage = 1;
-                this.queryFs();
+                this.queryBuild();
             }
         },
     },
@@ -163,12 +165,20 @@ export default {
                     _this.nowIndicatorIndex = _this.nowIndicatorIndex + 1; //湿度等指标的轮询变化
                     if (_this.nowIndicatorIndex == 5) {
                         if (_this.pageNum == _this.nowPage) {
-                            //如果指标轮询结束
+                            //如果指标轮询结束 通知切换
                             _this.nowIndicatorIndex = 0;
-                            _this.$emit("donetowpage");
-                            clearTimeout(timeoutsign);
+                            _this.nowPage = 1;
+                            if (_this.nowBuildPage == _this.allBuild.length) {
+                                // _this.$emit("donetowpage");
+                                clearTimeout(timeoutsign);
+                            } else {
+                                //换下一个建筑
+                                _this.nowBuildPage = _this.nowBuildPage + 1;
+                                _this.queryFs();
+                            }
                             return;
                         }
+                        //如果是两页 并且nowPage是第一页
                         if (_this.pageNum == 2 && _this.nowPage == 1) {
                             _this.nowPage = 2;
                             _this.nowIndicatorIndex = 0;
@@ -178,13 +188,39 @@ export default {
                 }, 1200);
             });
         },
+        queryBuild() {
+            var _this = this;
+            this.$axios
+                .post(this.$api.queryBuilding, {
+                    criteria: {
+                        projectId: projectId,
+                    },
+                })
+                .then((res) => {
+                    debugger;
+                    var data = (res.data || {}).content || [];
+                    _this.allBuild = data;
+                    _this.nowBuildPage = 1;
+                    _this.queryFs();
+                })
+                .catch((res) => {
+                    // loading.close();
+                });
+        },
         queryFs() {
             // var loading = this.$loading({ fullscreen: true });
-            console.log('projectId',projectId);
+            var _this = this;
+            var buildId = (this.allBuild[this.nowBuildPage - 1] || {}).id;
+            if (!buildId) {
+                return;
+            }
+
             this.$axios
                 .post(this.$api.queryFs, {
                     criteria: {
                         projectId: projectId,
+                        //'Bd3301100002bba81f4830e04cde87d4b6e5652c0d5e',
+                        buildingId: buildId,
                     },
                     size: 14, //最多14层
                     page: 1,
@@ -197,11 +233,23 @@ export default {
                 })
                 .then((res) => {
                     //loading.close();
-
                     var allFloor = res.data.content || [];
                     allFloor = allFloor.filter(function(item) {
                         return item.spaceNum > 0;
                     });
+                    //如果该建筑的所有楼层 没有空间 则请求下一个建筑
+                    if (allFloor.length == 0) {
+                        _this.nowBuildPage = _this.nowBuildPage + 1;
+                        if (_this.nowBuildPage > _this.allBuild.length) {
+                            // _this.$emit("donetowpage");
+                            return;
+                        }
+                        _this.queryFs();
+                        return;
+                    }
+
+                    _this.nowBuildName =
+                        _this.allBuild[_this.nowBuildPage - 1].localName;
                     this.allFloor = allFloor;
                     var allFloorNum = allFloor.length;
                     //如果超过7层 就显示两屏幕 第一屏 firstPageNum
@@ -221,7 +269,7 @@ export default {
                     var sendMaxSpace = this.floorHandle(secondPageNum);
                     var firstPageFloors = allFloor.slice(0, firstPageNum); //第一屏 所有楼层
                     var secondPageFloors = allFloor.slice(firstPageNum);
-
+                    debugger;
                     this.firstPageParams = firstPageFloors.map((item) => {
                         var obj = {};
                         obj.id = item.id;
@@ -435,7 +483,7 @@ export default {
                 border-radius: 8px;
                 background: #d9f5d6;
                 text-align: center;
-                padding:0 8px;
+                padding: 0 8px;
                 box-sizing: border-box;
             }
         }

+ 58 - 6
src/views/valueDelivery/HorFloorSpace.vue

@@ -1,6 +1,7 @@
 <template>
     <div class="floorSpace" ref="floorSpace">
         <div class="leftChange">
+            <div>{{nowBuildName}}</div>
             <div class="allIndicator">
                 <div
                     class="eachItem "
@@ -97,6 +98,9 @@ export default {
                 unit: 'ug/m³',
                 fixed:0
             }],
+            allBuild: [],
+            nowBuildName: '',
+            nowBuildPage: 1, //目前是第几个建筑
 
             allFloor: [],
             firstPageParams: [],
@@ -120,7 +124,7 @@ export default {
             //当前展示为第二屏时
             if(newv==2){
                    this.nowPage = 1;
-                   this.queryFs();
+                   this.queryBuild();
             }
         }
     },
@@ -145,14 +149,24 @@ export default {
             this.queryParam(floorparam).then(() => {
                 var timeoutsign = setTimeout(() => {
                     _this.nowIndicatorIndex = _this.nowIndicatorIndex + 1;//湿度等指标的轮询变化
-                    if (_this.nowIndicatorIndex == 5) {
+                    if (_this.nowIndicatorIndex == 5) {//指标切换完毕
                         //debugger;
                          if (_this.pageNum == _this.nowPage) {
-                             _this.nowIndicatorIndex = 0;
-                             _this.$emit('donetowpage');
-                           // clearTimeout(timeoutsign);
+                             //一个建筑的所有楼层 切换完毕
+                            _this.nowIndicatorIndex = 0;
+                            _this.nowPage = 1;
+                             //所有建筑指标轮询结束 通知切换
+                            if (_this.nowBuildPage == _this.allBuild.length) {
+                                //_this.$emit("donetowpage");
+                                clearTimeout(timeoutsign);
+                            } else {
+                                //换下一个建筑
+                                _this.nowBuildPage = _this.nowBuildPage + 1;
+                                _this.queryFs();
+                            }
                             return;
                         }
+                          //如果是两页 并且nowPage是第一页
                         if (_this.pageNum == 2 && _this.nowPage == 1) {
                             _this.nowPage = 2;
                             _this.nowIndicatorIndex = 0;
@@ -163,12 +177,37 @@ export default {
                 }, 1200);
             });
         },
+         queryBuild() {
+            var _this = this;
+            this.$axios
+                .post(this.$api.queryBuilding, {
+                    criteria: {
+                        projectId: projectId,
+                    },
+                })
+                .then((res) => {
+                    debugger;
+                    var data = (res.data || {}).content || [];
+                    _this.allBuild = data;
+                    _this.nowBuildPage = 1;
+      
+                    _this.queryFs();
+                })
+                .catch((res) => {
+                    // loading.close();
+                });
+        },
         queryFs() {
             //var loading = this.$loading({ fullscreen: true });
+            var _this=this;
+            var buildId= (this.allBuild[this.nowBuildPage - 1]||{}).id;
+            if(!buildId){return;} 
+
             this.$axios
                 .post(this.$api.queryFs, {
                     criteria: {
                         projectId: projectId,
+                           buildingId: buildId,
                     },
                     size: 14,//最多14层
                     page: 1,
@@ -185,6 +224,19 @@ export default {
                     allFloor = allFloor.filter(function(item) {
                         return item.spaceNum > 0;
                     });
+                    debugger;
+                    //如果该建筑的所有楼层 没有空间 则请求下一个建筑
+                    if (allFloor.length == 0) {
+                        _this.nowBuildPage = _this.nowBuildPage + 1;
+                        if (_this.nowBuildPage > _this.allBuild.length) {
+                            //_this.$emit("donetowpage");
+                            return;
+                        }
+                        _this.queryFs();
+                        return;
+                    }
+                     _this.nowBuildName = _this.allBuild[_this.nowBuildPage - 1].localName;
+                    
                     this.allFloor = allFloor;
                     var allFloorNum = allFloor.length;
                     //如果超过7层 就显示两屏幕 第一屏 firstPageNum
@@ -220,7 +272,7 @@ export default {
                         obj.spaceNum = sendMaxSpace;
                         return obj;
                     });
-                  
+                     debugger;
                 
                     this.nowIndicatorIndex=0;
                     this.getTimeFloorParam();

+ 2 - 2
src/views/valueDelivery/TemChart.vue

@@ -221,9 +221,9 @@ export default {
             var timestr = nowtime.format("YYYY.MM.DD");
             const tooltipHtml = `<div style='line-height:22px;color:#fff;background: rgba(35,204,249,0.7);padding:10px 12px;border-radius:5px;'>
                 <div style='font-size:13px;font-weight:600;'><span style='margin-right:5px'>${timestr}</span>${
-                lastpoint.time
+                lastpoint&&lastpoint.time
             }</div>
-                <div style='font-size:16px;font-weight:600;'>室内温度:${lastpoint.temp.toFixed(
+                <div style='font-size:16px;font-weight:600;'>室内温度:${lastpoint&&lastpoint.temp.toFixed(
                     1
                 )}℃</div></div>`;
             chart.guide().html({

+ 3 - 3
src/views/valueDelivery/lastEnergyChart.vue

@@ -183,13 +183,13 @@ export default {
             // ];
 
             if (this.screenType == "hor") {
-                var end = cdata[cdata.length - 1].Date;
+                var end = cdata[cdata.length - 1]&&cdata[cdata.length - 1].Date;
             } else {
-                var end = cdata[11].Date;
+                var end = cdata[11]&&cdata[11].Date;
             }
             var ds = new DataSet({
                 state: {
-                    start: cdata[0].Date,
+                    start: cdata[0]&&cdata[0].Date,
                     end: end,
                 },
             });