Changpeng Duan 5 vuotta sitten
vanhempi
commit
610a6258aa

+ 10 - 0
src/Global.js

@@ -118,6 +118,16 @@ globaltime2String = function (time) {
     return year + "-" + month + "-" + date;
 };
 
+// 校验MAC地址
+checkMac = function(val){
+    var regex = "(([A-Fa-f0-9]{2}-){5}[A-Fa-f0-9]{2})|(([A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2})"; // 含冒号
+    var regexp = new RegExp(regex);
+    if (!regexp.test(val)) {
+        return false;
+    }
+    return true;
+};
+
 // table配置项目
 
 // 每页选项

+ 12 - 0
src/api/getApiRes.js

@@ -179,6 +179,12 @@ export function GetRegiononeinfo(postdata) {
     let url = headapi + 'v1/Company/GetRegiononeinfo';
     return getApiBasic(url, postdata);
 }
+// 区域平面图用到的单条区域信息
+export function GetRegionplaneinfo(postdata) {
+    // 区域平面图用到的单条区域信息
+    let url = headapi + 'v1/Company/GetRegionplaneinfo';
+    return getApiBasic(url, postdata);
+}
 
 // 获取企业内部区域选择框信息
 export function GetRegionSelect(postdata) {
@@ -296,3 +302,9 @@ export function QrcodePictureGet(postdata) {
     let url = headapi + 'v1/Detector/QrcodePictureGet';
     return getApiBasic(url, postdata);
 }
+// 获取检测设备坐标
+export function GetDetectorCoords(postdata) {
+    // 获取检测设备坐标
+    let url = headapi + 'v1/Detector/GetDetectorCoords';
+    return getApiBasic(url, postdata);
+}

+ 14 - 7
src/components/Console.vue

@@ -178,6 +178,7 @@
             },
             // 获取楼层信息
             getLoftList() {
+                let that = this;
                 let param = {
                     'token': localStorage.token,
                 };
@@ -185,15 +186,21 @@
                 GetRegionAndDectorSelect(postdata).then(res => {
                     let json = res;
                     if (json.Code == 0) {
-                        this.loftList = json.Region1Rs;//所有1级
-                        this.manageList = json.Region2Rs;//所有2级
-                        this.RoomList = json.Region3Rs;//所有3级
-                        if(json.DectectorRs){
-                            this.equipList = json.DectectorRs;//所有设备
+                        that.loftList = json.Region1Rs;//所有1级
+                        that.manageList = json.Region2Rs;//所有2级
+                        that.RoomList = json.Region3Rs;//所有3级
+                        if (json.DectectorRs) {
+                            that.equipList = json.DectectorRs;//所有设备
                         }
-                        this.FullChildlRs = json.FullChildlRs;//全部关系
+                        that.FullChildlRs = json.FullChildlRs;//全部关系
                     } else {
-                        that.$message.error(json.Memo);
+
+                        if (json.Code == 1010) {
+                            that.$message.error(json.Memo);
+                            that.$router.push({path: '/login', query: {status: 1}});
+                        } else {
+                            that.$message.error(json.Memo);
+                        }
                     }
                 })
             }

+ 51 - 20
src/components/Loft.vue

@@ -1,12 +1,14 @@
 <template>
     <div class="Loft">
         <div class="curTitle">
-            {{regionName}}平面图
+            {{loftTitle}}平面图
         </div>
         <div class="loftContainer">
-            <div class="loftBg">
+            <div class="loftBg" :style="{backgroundImage:'url(' + loftMap + ')'}">
                 <ul>
-                    <li :class="{'active':p.state == 0}" v-for="p in points" :style="{ left: p.left, top: p.top}"><em>{{p.name}}</em><i></i></li>
+                    <li :class="{'active':p.DetectorWarnNum  != 0}" v-for="p in loftPoints"
+                        :style="{ left: p.DetselfInfo.Width*0.4+'PX', top: p.DetselfInfo.Height+'PX'}" @click="seeDet(p)">
+                        <em><i></i>{{p.DetselfInfo.TagName}}</em></li>
                 </ul>
             </div>
         </div>
@@ -17,19 +19,19 @@
     export default {
         data() {
             return {
-                regionName:'2楼',
-                points: [
-                    {name: 'Signal设备01', room: '201', left: '30px', top: '10px',state:1},
-                    {name: 'Signal设备02', room: '202', left: '70px', top: '10px',state:1},
-                    {name: 'Signal设备03', room: '203', left: '110px', top: '10px',state:0},
-                    {name: 'Signal设备04', room: '204', left: '180px', top: '10px',state:1},
-                    {name: 'Signal设备05', room: '205', left: '-380px', top: '240px',state:1},
-                    {name: 'Signal设备06', room: '206', left: '-330px', top: '240px',state:1},
-                    {name: 'Signal设备07', room: '207', left: '310px', top: '220px',state:0},
-                    {name: 'Signal设备08', room: '208', left: '410px', top: '220px',state:1},
-                ],
+                points: [],
             }
-        }
+        },
+        props: ['loftMap', 'loftTitle', 'loftPoints'],
+        methods: {
+            seeDet(row) {
+                this.$router.push(
+                    {
+                        path: '/equip', query: {RegionId: row.RegionId, TagName: row.TagName}
+                    }
+                );
+            }
+        },
     }
 </script>
 
@@ -56,13 +58,12 @@
         width: 164px;
         height: 26px;
         line-height: 26px;
-        font-size: 18px;
         color: #6DC1FF;
         float: left;
         text-align: center;
         background: url("../assets/img/main/title.png") top center no-repeat;
-        /*background: url("../assets/img/op_title.png") top center no-repeat;*/
         background-size: 100% 100%;
+        font-size: 14px;
     }
 
     .loftBg {
@@ -71,7 +72,9 @@
         overflow: hidden;
         display: block;
         margin: 0 auto;
-        background: url("../assets/img/main/loftBg.png") top center no-repeat;
+        /*background: url("../assets/img/main/loftBg.png") top center no-repeat;*/
+        background-position: top center;
+        background-repeat: no-repeat;
         background-size: 100% 100%;
         margin-top: 24px;
     }
@@ -85,6 +88,7 @@
     }
 
     .loftBg li {
+        cursor: pointer;
         position: relative;
     }
 
@@ -97,8 +101,8 @@
     }
 
     .loftBg li i {
-        width: 22px;
-        height: 22px;
+        width: 18px;
+        height: 18px;
         float: left;
         text-align: center;
         line-height: 22px;
@@ -106,9 +110,36 @@
         border-radius: 250px;
         color: #BEE3FF;
         font-size: 10px;
+        margin-right: 5px;
     }
+
     .loftBg li.active i {
         background: #FFDD00;
         color: #2592E2;
+        animation: warn 1.8s linear;
+        animation-iteration-count: infinite !important;
+    }
+
+    @keyframes warn {
+        0% {
+            transform: scale(0);
+            opacity: 0.0;
+        }
+        25% {
+            transform: scale(0.25);
+            opacity: 0.1;
+        }
+        50% {
+            transform: scale(0.5);
+            opacity: 0.3;
+        }
+        75% {
+            transform: scale(0.75);
+            opacity: 0.5;
+        }
+        100% {
+            transform: scale(1);
+            opacity: 0.0;
+        }
     }
 </style>

+ 43 - 8
src/components/Room.vue

@@ -1,12 +1,14 @@
 <template>
     <div class="Room">
         <div class="curTitle">
-            2楼平面图
+            {{loftTitle}}平面图
         </div>
         <div class="RoomContainer">
             <div class="RoomBg">
                 <ul>
-                    <li :class="{'active':p.state == 0}" v-for="p in points" :style="{ left: p.left, top: p.top}"><em>{{p.name}}</em><i></i></li>
+                    <li :class="{'active':p.DetectorWarnNum != 0}" v-for="p in loftPoints"
+                        :style="{ left: p.DetselfInfo.Width+'PX', top: p.DetselfInfo.Height+'PX'}" @click="seeDet(p)">
+                        <em><i></i>{{p.DetselfInfo.TagName}}</em></li>
                 </ul>
             </div>
         </div>
@@ -17,12 +19,19 @@
     export default {
         data() {
             return {
-                points: [
-                    {name: 'Signal设备01', room: '201', left: '30px', top: '10px',state:1},
-                    {name: 'Signal设备02', room: '201', left: '310px', top: '300px',state:0},
-                ],
+                points: [],
             }
-        }
+        },
+        props: ['loftMap', 'loftTitle', 'loftPoints'],
+        methods: {
+            seeDet(row) {
+                this.$router.push(
+                    {
+                        path: '/equip', query: {RegionId: row.RegionId, TagName: row.TagName}
+                    }
+                );
+            }
+        },
     }
 </script>
 
@@ -49,13 +58,13 @@
         width: 164px;
         height: 26px;
         line-height: 26px;
-        font-size: 18px;
         color: #6DC1FF;
         float: left;
         text-align: center;
         background: url("../assets/img/main/title.png") top center no-repeat;
         /*background: url("../assets/img/op_title.png") top center no-repeat;*/
         background-size: 100% 100%;
+        font-size: 14px;
     }
 
     .RoomBg {
@@ -99,9 +108,35 @@
         border-radius: 250px;
         color: #BEE3FF;
         font-size: 10px;
+
     }
     .RoomBg li.active i {
         background: #FFDD00;
         color: #2592E2;
+        animation: warn 1.8s linear;
+        animation-iteration-count: infinite !important;
+    }
+
+    @keyframes warn {
+        0% {
+            transform: scale(0);
+            opacity: 0.0;
+        }
+        25% {
+            transform: scale(0.25);
+            opacity: 0.1;
+        }
+        50% {
+            transform: scale(0.5);
+            opacity: 0.3;
+        }
+        75% {
+            transform: scale(0.75);
+            opacity: 0.5;
+        }
+        100% {
+            transform: scale(1);
+            opacity: 0.0;
+        }
     }
 </style>

+ 4 - 3
src/components/SmallRader.vue

@@ -16,9 +16,7 @@
             {{timeShow}}
         </div>
         <em class="state" v-if="RaderState == 0">区域环境安全</em>
-        <em class="warning" v-else>
-            <img src="../assets/img/main/waning.png" alt="">
-            发现可疑信号</em>
+            <em class="warning" v-if="RaderState != 0"><img src="../assets/img/main/waning.png" alt="">发现可疑信号</em>
     </div>
 </template>
 
@@ -27,10 +25,12 @@
         data() {
             return {
                 seconds: 0,
+                show: true,
                 RaderState: 0,
                 timeShow: ' 00 : 00 : 00'
             }
         },
+
         props: ['totalRs'],
         watch: {
             totalRs: function (val) {
@@ -456,6 +456,7 @@
         color: #FFDD00;
         text-align: center;
         font-size: 16px;
+        /*animation: warn 3s infinite;*/
     }
 
     .warning img {

+ 343 - 45
src/views/Equip.vue

@@ -10,12 +10,12 @@
         <div class="panel">
             <div class="panel-body">
                 <div class=" panel_control">
-                    <el-row :gutter="20">
-                        <el-col :span="4">
+                    <el-row :gutter="24">
+                        <el-col :span="5">
                             <em>标签名:</em>
                             <el-input v-model="panel.tagname" placeholder="请输入标签名"></el-input>
                         </el-col>
-                        <el-col :span="4">
+                        <el-col :span="5">
                             <em>所属区域:</em>
                             <el-select v-model="panel.regionid">
                                 <el-option
@@ -35,8 +35,8 @@
         </div>
         <div class="contorl">
             <el-button size="small" type="primary" @click="addList">添加</el-button>
+            <el-button size="small" type="primary" @click="editList">修改</el-button>
             <el-button size="small" type="primary" @click="delList">删除</el-button>
-            <el-button size="small" type="primary" @click="changeList">修改</el-button>
         </div>
         <el-table
                 :data="tableData"
@@ -66,6 +66,13 @@
                     prop="Location"
                     label="位置"
             >
+                <template slot-scope="scope">
+                    <el-tooltip class="item" effect="dark" :content="scope.row.Location" placement="top-start">
+                            <span>
+                                    {{ scope.row.Location.length > 12 ?  scope.row.Location.substr(0,12)+'...' : scope.row.Location }}
+                            </span>
+                    </el-tooltip>
+                </template>
             </el-table-column>
             <el-table-column
                     prop="FirmwareVersion"
@@ -135,33 +142,65 @@
                 @dialog_ok="dialog_ok"
         >
             <div class="dialogContent">
-                <el-row :gutter="20">
-                    <el-col :span="10">
+                <el-row :gutter="24">
+                    <el-col :span="12">
                         <label>
-                            MAC地址
+                            MAC地址*
                         </label>
-                        <el-input v-model="dialog.name"></el-input>
+                        <el-input v-model="dialog.mac" @keyup.native="autoCompleteMac"></el-input>
                     </el-col>
-                    <el-col :span="10">
+                    <el-col :span="12">
                         <label>
-                            标签名
+                            标签名*
                         </label>
                         <el-input v-model="dialog.tagname "></el-input>
                     </el-col>
-                    <el-col :span="10">
+                    <el-col :span="12">
+                        <label>
+                            硬件版本
+                        </label>
+                        <el-input v-model="dialog.HardwareVersion "></el-input>
+                    </el-col>
+                    <el-col :span="12">
+                        <label>
+                            esp固件版本
+                        </label>
+                        <el-input v-model="dialog.FirmwareVersion "></el-input>
+                    </el-col>
+                    <el-col :span="12">
+                        <label>
+                            M4固件版本
+                        </label>
+                        <el-input v-model="dialog.FirmwareScanM4Version "></el-input>
+                    </el-col>
+                    <el-col :span="12">
+                        <label>
+                            M0固件版本
+                        </label>
+                        <el-input v-model="dialog.FirmwareScanM0Version "></el-input>
+                    </el-col>
+                    <el-col :span="12">
+                        <label>
+                            购买来源
+                        </label>
+                        <el-input v-model="dialog.purchasesrc"></el-input>
+                    </el-col>
+                    <el-col :span="12">
                         <label>
                             设备所属区域
                         </label>
-                        <el-select class="selectStyle" v-model="dialog.regionlevelOneId" placeholder="请选择所属区域">
+                        <el-select class="selectStyle" ref="regionlevelOne" v-model="dialog.regionlevelOneId"
+                                   placeholder="请选择所属区域">
                             <el-option
                                     v-for="item in dialog.regionlevelOneIdOptions"
                                     :key="item.Id"
                                     :label="item.Name"
-                                    :value="item.Id">
+                                    :value="item.Id"
+                            >
                             </el-option>
                         </el-select>
                     </el-col>
-                    <el-col :span="10">
+                    <el-col :span="12">
                         <label>
                             设备所属房间
                         </label>
@@ -170,32 +209,32 @@
                                     v-for="item in dialog.regionIdRoomOptions"
                                     :key="item.Id"
                                     :label="item.Name"
-                                    :value="item.Id">
+                                    :value="item.Id"
+                            >
                             </el-option>
                         </el-select>
                     </el-col>
-                    <el-col :span="20">
+                    <el-col :span="12">
                         <label>
                             坐标说明
                         </label>
                         <el-input v-model="dialog.coords_memo "></el-input>
                     </el-col>
-                    <el-col :span="20">
+                    <el-col :span="12">
                         <label>
                             备注
                         </label>
                         <el-input type="textarea" v-model="dialog.memo"></el-input>
                     </el-col>
-                    <el-col :span="20">
+                    <el-col :span="24">
                         <label>
                             位置标注
                         </label>
                         <div class="imgContianer">
                             <img :src="dialog.plateImgSrc" alt="">
-                            <div class="pointers">
-                                <i></i>
-                                <i></i>
-                                <i></i>
+                            <div class="pointers" @click="addPoint">
+                                <i v-for="point in dialog.points"
+                                   :style="{left:point.x*1+'px',top:point.y * 1+'px'}"></i>
                             </div>
                         </div>
                     </el-col>
@@ -213,6 +252,9 @@
         GetChildRegionSelect,
         DetectorEditStatus,
         RegionPictureGetByRegionId,
+        DetectorAdd,
+        DetectorEdit,
+        GetDetectorCoords,
     } from '../api/getApiRes.js'
 
     let qs = require('qs');
@@ -220,8 +262,8 @@
         data() {
             return {
                 // dialog
-                dialog_state: true,
-                dialog_title: '添加主建筑',
+                dialog_state: false,
+                dialog_title: '',
                 dialog_type: '',//类型,1是添加,2是修改
                 dialog: {
                     mac: '',
@@ -231,14 +273,18 @@
                     tagname: '',
                     longitude: 0,
                     latitude: 0,
+                    HardwareVersion: '',
+                    FirmwareVersion: '',
+                    FirmwareScanM4Version: '',
+                    FirmwareScanM0Version: '',
                     location: '',
-                    x: 0,
-                    y: 0,
                     coords_memo: '',
                     memo: '',
                     plateImgSrc: '',
                     regionlevelOneIdOptions: [],
                     regionIdRoomOptions: [],
+                    points: [],
+                    CoordsId: 0,
                 },
                 tabIndex: 0,
                 tabs: [
@@ -283,6 +329,12 @@
             }
         },
         mounted() {
+            if(this.$route.query.RegionId){
+                this.panel.regionid = this.$route.query.RegionId;
+                this.panel.tagname = this.$route.query.TagName;
+            }
+
+
             this.getTableQuery();
         },
         methods: {
@@ -366,7 +418,6 @@
                             that.dialog.regionlevelOneId = json.Rs[0].Id;
                         } else {
                             if (json.Rs) {
-                                console.log(json.Rs);
                                 that.dialog.regionIdRoomOptions = json.Rs;
 
                                 that.dialog.regionId = json.Rs[0].Id;
@@ -389,9 +440,9 @@
                 this.getTableQuery();
                 this.$message.success('查询完毕');
             },
+
             handleSelectionChange(val) {
                 this.multipleSelection = val;
-                console.log(val);
             },
             // 设置分页数据
             setPaginations() {
@@ -436,27 +487,78 @@
             },
             // 过滤时间
             filterFmtDate(value, row, column) {
-                let that = this;
                 return globalfmtDate(column, 11);
             },
             addList() {
                 this.dialog_state = true;
                 this.dialog_title = '添加设备';
-                this.dialogGetGetChildRegionSelect(0,1);
+                this.dialog_type = 1;
+                // clear dialog
+                this.dialog.mac = '';
+                this.dialog.regionId = '';
+                this.dialog.tagname = '';
+                this.dialog.HardwareVersion = '';
+                this.dialog.FirmwareVersion = '';
+                this.dialog.FirmwareScanM4Version = '';
+                this.dialog.FirmwareScanM0Version = '';
+                this.dialog.location = '';
+                this.dialog.purchasesrc = '';
+                this.dialog.memo = '';
+                this.dialog.coords_memo = '';
+                this.dialog.points = [{}];
+
+                // 加载默认的平面图
+                this.dialogGetGetChildRegionSelect(0, 1);
             },
             delList() {
+                let that = this;
                 // checkNum
                 if (!this.multipleSelection.length) {
-                    this.$message({
+                    that.$message({
                         showClose: true,
                         message: '错了哦,需要先选中至少一条记录',
                         type: 'error'
                     });
                     return false
                 }
-                // todo delEquip
+                let detectorid = that.multipleSelection[0].Id;
+
+                let param = {
+                    token: localStorage.token,
+                    detectorid: detectorid,
+                    status: 9,//0禁用1启用9删除
+                };
+                let postdata = qs.stringify(param);
+
+                this.$confirm('此操作将永久删除该设备, 是否继续?', '提示', {
+                    confirmButtonText: '确定',
+                    cancelButtonText: '取消',
+                    type: 'warning'
+                }).then(() => {
+                    DetectorEditStatus(postdata).then(res => {
+                        let json = res;
+                        if (json.Code == 0) {
+                            that.$message({
+                                showClose: true,
+                                message: '选中的设备已删除!',
+                                type: 'success'
+                            });
+                            // 重载列表
+                            that.getTableQuery();
+                            that.dialog_state = false;
+                        } else {
+                            that.$message.error(json.Memo);
+                        }
+                    });
+                }).catch(() => {
+                    this.$message({
+                        type: 'info',
+                        message: '已取消删除'
+                    });
+                });
             },
-            changeList() {
+            editList() {
+                let that = this;
                 // checkNum
                 if (!this.multipleSelection.length) {
                     this.$message({
@@ -474,6 +576,52 @@
                     });
                     return false
                 }
+                this.dialog_state = true;
+                this.dialog_title = '修改设备信息';
+                this.dialog_type = 2;
+
+                // 读取本条记录
+                let row = this.multipleSelection[0];
+                this.dialog.eqId = row.Id;
+                this.dialog.mac = row.Mac;
+                this.dialog.regionId = row.RegionId;
+                this.dialog.tagname = row.TagName;
+                this.dialog.HardwareVersion = row.HardwareVersion;
+                this.dialog.FirmwareVersion = row.FirmwareVersion;
+                this.dialog.FirmwareScanM4Version = row.FirmwareScanM4Version;
+                this.dialog.FirmwareScanM0Version = row.FirmwareScanM0Version;
+                this.dialog.location = row.location;
+                this.dialog.purchasesrc = row.purchasesrc;
+                this.dialog.memo = row.memo;
+                this.dialog.coords_memo = row.coords_memo;
+
+                let param = {
+                    token: localStorage.token,
+                    detectorId: row.Id,
+                };
+                let postdata = qs.stringify(param);
+                GetDetectorCoords(postdata).then(res => {
+                    let json = res;
+                    if (json.Code == 0) {
+                        if(json.Rs.length != 0){
+                            console.log(json.Rs);
+                            that.dialog.points = [{x: json.Rs[0].Width, y: json.Rs[0].Height}];
+                            that.dialog.CoordsId = json.Rs[0].CoordsId;
+                        }else{
+                            that.dialog.points = [{x: 0, y: 0}];
+                            that.dialog.CoordsId = 0;
+                        }
+                    } else {
+                        that.$message.error(json.Memo);
+                    }
+                })
+            },
+            // 自动补全MAC
+            autoCompleteMac() {
+                let text = this.dialog.mac;
+                if (text.length == 2 || text.length == 5 || text.length == 8 || text.length == 11 || text.length == 14) {
+                    this.dialog.mac = this.dialog.mac.toUpperCase() + ":"
+                }
             },
             // 探测记录
             goPhoneRecord(row) {
@@ -504,10 +652,134 @@
                 that.dialog_state = false;
             },
             dialog_ok() {
+                if (this.dialog_type == 1) {
+                    this.confirmAddEquip();
+                } else {
+                    this.confirmEditEquip();
+                }
+            },
+            // 提交增加新设备
+            confirmAddEquip() {
                 let that = this;
-                let dialog_type = that.dialog_type;
-                let name = that.field_name;
-                let id = that.field_id;
+                // checkVal
+                if (!that.dialog.mac) {
+                    this.$message.error('错了哦,mac不能为空');
+                    return false
+                }
+                if (!checkMac(that.dialog.mac)) {
+                    this.$message.error('错了哦,mac格式不正确');
+                    return false
+                }
+                if (!that.dialog.regionId) {
+                    this.$message.error('错了哦,所属区域不能为空');
+                    return false
+                }
+                if (!that.dialog.tagname) {
+                    this.$message.error('错了哦,标签名不能为空');
+                    return false
+                }
+                if (that.dialog.tagname.length > 20) {
+                    this.$message.error('错了哦,标签名不能超过20个字符');
+                    return false
+                }
+                this.selectRegionLabel(that.dialog.regionId);
+                let param = {
+                    token: localStorage.token,
+                    mac: that.dialog.mac,
+                    comId: 1,
+                    regionId: that.dialog.regionId,
+                    tagname: that.dialog.tagname,
+                    HardwareVersion: that.dialog.HardwareVersion,
+                    FirmwareVersion: that.dialog.FirmwareVersion,
+                    FirmwareScanM4Version: that.dialog.FirmwareScanM4Version,
+                    FirmwareScanM0Version: that.dialog.FirmwareScanM0Version,
+                    location: that.dialog.location,
+                    purchasesrc: that.dialog.purchasesrc,
+                    x: that.dialog.points[0].x,
+                    y: that.dialog.points[0].y,
+                    coords_memo: that.dialog.coords_memo,
+                    memo: that.dialog.memo,
+                };
+                let postdata = qs.stringify(param);
+                DetectorAdd(postdata).then(res => {
+                    let json = res;
+                    if (json.Code == 0) {
+                        that.$message({
+                            showClose: true,
+                            message: '设备添加成功!',
+                            type: 'success'
+                        });
+                        // 重载列表
+                        that.getTableQuery();
+                        that.dialog_state = false;
+
+                    } else {
+                        that.$message.error(json.Memo);
+                    }
+                });
+            },
+            // 提交修改设备信息
+            confirmEditEquip() {
+                let that = this;
+                // checkVal
+                if (!that.dialog.mac) {
+                    this.$message.error('错了哦,mac不能为空');
+                    return false
+                }
+                if (!checkMac(that.dialog.mac)) {
+                    this.$message.error('错了哦,mac格式不正确');
+                    return false
+                }
+                if (!that.dialog.regionId) {
+                    this.$message.error('错了哦,所属区域不能为空');
+                    return false
+                }
+                if (!that.dialog.tagname) {
+                    this.$message.error('错了哦,标签名不能为空');
+                    return false
+                }
+                if (that.dialog.tagname.length > 20) {
+                    this.$message.error('错了哦,标签名不能超过20个字符');
+                    return false
+                }
+                this.selectRegionLabel(that.dialog.regionId);
+                let param = {
+                    token: localStorage.token,
+                    detectorid: that.dialog.eqId,
+                    mac: that.dialog.mac,
+                    comId: 1,
+                    regionId: that.dialog.regionId,
+                    tagname: that.dialog.tagname,
+                    HardwareVersion: that.dialog.HardwareVersion,
+                    FirmwareVersion: that.dialog.FirmwareVersion,
+                    FirmwareScanM4Version: that.dialog.FirmwareScanM4Version,
+                    FirmwareScanM0Version: that.dialog.FirmwareScanM0Version,
+                    location: that.dialog.location,
+                    purchasesrc: that.dialog.purchasesrc,
+                    x: that.dialog.points[0].x,
+                    y: that.dialog.points[0].y,
+                    coords_memo: that.dialog.coords_memo,
+                    memo: that.dialog.memo,
+                    coordsType: 1,//坐标状态 0:禁用, 1:启用, 9:删除,没有就传0
+                    coordsID: that.dialog.CoordsId,
+                };
+                let postdata = qs.stringify(param);
+                DetectorEdit(postdata).then(res => {
+                    let json = res;
+                    if (json.Code == 0) {
+                        that.$message({
+                            showClose: true,
+                            message: '设备添加成功!',
+                            type: 'success'
+                        });
+                        // 重载列表
+                        that.getTableQuery();
+                        that.dialog_state = false;
+
+                    } else {
+                        that.$message.error(json.Memo);
+                    }
+                });
             },
             // 修改设备状态
             getDetectorEditStatus(detectorid, status, text) {
@@ -561,7 +833,7 @@
                     let json = res;
                     that.dialog.plateImgSrc = '';
                     if (json.Code == 0) {
-                        that.dialog.plateImgSrc = json.EncodeString
+                        that.dialog.plateImgSrc = json.EncodeString;
                     } else {
                         that.$message.error(json.Memo);
                     }
@@ -583,14 +855,31 @@
                         message: '已取消启用'
                     });
                 });
+            },
+            // 添加探测器位置的点坐标
+            addPoint(e) {
+                let x = e.offsetX;
+                let y = e.offsetY;
+                this.dialog.points = [{x: x, y: y}];
+            },
+            // 获取位置的文字内容
+            selectRegionLabel(id) {
+                let that = this;
+                let selectedWorkName = {};
+                selectedWorkName = this.dialog.regionIdRoomOptions.filter(item => {
+                    if (item.Id === id) {
+                        that.dialog.location = item.Name;
+                    }
+                });
             }
         },
         watch: {
             'dialog.regionlevelOneId': function (val) {
-                this.dialogGetGetChildRegionSelect(val,2)
+                this.dialogGetGetChildRegionSelect(val, 2)
             },
             'dialog.regionId': function (val) {
                 this.getRegionPictureGetByRegionId(val);
+
             },
         },
         components: {
@@ -632,6 +921,7 @@
         position: relative;
         top: 35px;
     }
+
     .imgContianer {
         width: 100%;
         height: 340px;
@@ -639,6 +929,7 @@
         display: block;
         margin: 0 auto;
     }
+
     .imgContianer img {
         width: 100%;
         height: 100%;
@@ -646,25 +937,32 @@
         display: block;
         margin: 0 auto;
     }
+
     .pointers {
         position: relative;
-        bottom: 200px;
+        bottom: 340px;
         width: 100%;
         height: 100%;
         overflow: hidden;
         display: block;
         margin: 0 auto;
-        background: red;
     }
+
     .imgContianer i {
         position: relative;
-        width: 5px;
-        height: 5px;
+        width: 10px;
+        height: 10px;
+        float: left;
         border-radius: 250px;
-        background: #6DC1FF;
+        background: #FFDD00;
     }
+
     /deep/ .modal-dialog {
-        height: 750px;
-        margin-top: 3%;
+        height: 880px;
+        margin-top: 0;
+    }
+
+    /deep/ textarea {
+        color: #6DC1FF;
     }
 </style>

+ 73 - 32
src/views/Hardware.vue

@@ -7,24 +7,24 @@
                 </li>
             </ul>
         </div>
-        <div class="upload">
-            <h5>固件上传</h5>
-            <div class="uploadContainer">
-                <el-upload
-                        class="upload-demo"
-                        action="/api/v1/AdminSettings/FirmwareUpdate"
-                        :on-change="handleChange"
-                        :auto-upload="true"
-                        :file-list="fileList">
-                    <el-button size="small" type="primary">点击上传</el-button>
-                </el-upload>
-                <em class="addMemo" v-show="fileList.length == 0" @click="addMemo">
-                    <i></i>添加固件
-                </em>
-            </div>
-        </div>
+        <!--<div class="upload">-->
+        <!--<h5>固件上传</h5>-->
+        <!--<div class="uploadContainer">-->
+        <!--<el-upload-->
+        <!--class="upload-demo"-->
+        <!--action="/api/v1/AdminSettings/FirmwareUpdate"-->
+        <!--:on-change="handleChange"-->
+        <!--:auto-upload="true"-->
+        <!--:file-list="fileList">-->
+        <!--<el-button size="small" type="primary">点击上传</el-button>-->
+        <!--</el-upload>-->
+        <!--&lt;!&ndash;<em class="addMemo" v-show="fileList.length == 0" @click="addMemo">&ndash;&gt;-->
+        <!--&lt;!&ndash;<i></i>添加固件&ndash;&gt;-->
+        <!--&lt;!&ndash;</em>&ndash;&gt;-->
+        <!--</div>-->
+        <!--</div>-->
         <div class="hardwareList">
-            <h5>设备列表</h5>
+            <h5>升级设备列表</h5>
             <div class="panel">
                 <div class="panel-body">
                     <div class=" panel_control">
@@ -56,15 +56,27 @@
                 </div>
             </div>
             <div class="contorl">
-                <el-button size="small" type="primary" @click="startUpdate">开始更新</el-button>
+                <!--<el-button size="small" type="primary" @click="startUpdate">开始更新</el-button>-->
                 <div class="version">
-                    <em>NEW</em>
-                    <span>最新固件版本:v{{LastVerion}} {{VersionTime}}</span>
+                    <em>NEW </em>
+                    <span>最新固件版本:M0固件:v{{FirmwareScanM0Version}}   M4固件: v{{FirmwareScanM4Version}}   esp固件 :v{{FirmwareVersion}} </span>
                 </div>
-                <el-tooltip class="item" effect="dark" content="一键更新全部设备固件" placement="top">
-                    <i class="question"></i>
-                </el-tooltip>
-                <el-button class="allItem" size="small" type="primary" @click="changeList">全部更新</el-button>
+                <!--<el-tooltip class="item" effect="dark" content="一键更新全部设备固件" placement="top">-->
+                <!--<i class="question"></i>-->
+                <!--</el-tooltip>-->
+                <!--<el-button class="allItem" size="small" type="primary" @click="changeList">全部更新</el-button>-->
+
+                <el-upload
+                        class="upload-demo"
+                        action="/api/v1/AdminSettings/FirmwareUpdate"
+                        :on-change="handleChange"
+                        :on-success="successResave"
+                        :before-upload="handleupload"
+                        :data="uploadData"
+                        :auto-upload="true"
+                        :file-list="fileList">
+                    <el-button size="small" type="primary">点击上传</el-button>
+                </el-upload>
 
             </div>
             <br>
@@ -72,7 +84,8 @@
                     :data="tableData"
                     is-horizontal-resize
                     :default-sort="{prop: 'date', order: 'descending'}"
-                    v-loading="loading" element-loading-background="rgba(0, 0, 0, 0.8)"
+                    v-loading="loading"
+                    element-loading-background="rgba(0, 0, 0, 0.8)"
                     class=""
                     @selection-change="handleSelectionChange"
                     stripe
@@ -207,7 +220,9 @@
     export default {
         data() {
             return {
-                LastVerion: '',
+                FirmwareScanM0Version: '',
+                FirmwareScanM4Version: '',
+                FirmwareVersion: '',
                 VersionTime: '',
                 // dialog
                 dialog_state: false,
@@ -226,6 +241,9 @@
                     // {name: 'food.jpeg',
                     // url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}
                 ],
+                uploadData: {
+                    token: localStorage.token
+                },
                 // panel 配置项目
                 panel: {
                     usercode: '',
@@ -316,8 +334,9 @@
                 GetLastVerionFirmwareinfo(postdata).then(res => {
                     let json = res;
                     if (json.Code == 0) {
-                        that.LastVerion = json.Firmware.Version;
-                        that.VersionTime = globalfmtDate(json.Firmware.CreateTime);
+                        that.FirmwareScanM0Version = json.FirmwareScanM0Version;
+                        that.FirmwareScanM4Version = json.FirmwareScanM4Version;
+                        that.FirmwareVersion = json.FirmwareVersion;
                     } else {
                         that.$message.error(json.Memo);
                     }
@@ -365,10 +384,22 @@
                 this.multipleSelection = val;
                 console.log(val);
             },
+            successResave(response) {
+                if (response.Code == 0) {
+                    this.$message.success('上传成功,等待系统自动更新中....');
+                    this.getTableQuery();
+                } else {
+                    this.$message.error(response.Memo);
+                }
+            },
             handleChange(file, fileList) {
                 this.fileList = fileList.slice(-3);
-                // todo 加上token
-                console.log( this.fileList);
+            },
+            handleupload(file) {
+                if (file.type != 'application/x-zip-compressed') {
+                    this.$message.error('只允许上传压缩文件,当前文件格式为' + file.type);
+                    return false
+                }
             },
             handleClose() {
                 console.log(123);
@@ -579,8 +610,9 @@
     }
 
     /deep/ .el-upload-list {
-        width: 200px;
+        width: 600px;
         float: left;
+        overflow: hidden;
     }
 
     /deep/ .el-upload-list__item-name [class^=el-icon] {
@@ -681,8 +713,17 @@
         margin-top: 7px;
         margin-left: 13px;
     }
+
     /deep/ textarea {
-        color:#6DC1FF ;
+        color: #6DC1FF;
         outline: none;
     }
+
+    .upload-demo {
+        /*float: right;*/
+    }
+    /deep/ .el-upload-list__item {
+        width: 160px;
+        float: left;
+    }
 </style>

+ 11 - 1
src/views/Login.vue

@@ -203,7 +203,7 @@
 
     .box-card {
         width: 626px;
-        height: 389px;
+        height: 419px;
         overflow: hidden;
         display: block;
         margin: 0 auto;
@@ -270,4 +270,14 @@
         text-align: center;
         color: #6DC1FF;
     }
+    /*响应式调整*/
+
+        @media (min-width:481px) and (max-width: 1537px) {
+            .box-card {
+                height: 399px;
+            }
+            .center {
+                margin-top: 5px;
+            }
+        }
 </style>

+ 43 - 5
src/views/Main.vue

@@ -32,7 +32,7 @@
                                 <SmallRader :total-rs="totalRs"></SmallRader>
                             </div>
                             <div class="trt">
-                                <Loft></Loft>
+                                <Loft :loft-points="loftPoints" :loft-map="loftMap" :loft-title="loftTitle" ></Loft>
                             </div>
                         </div>
                         <div class="RoomContainer" v-if="pageLevel == 3">
@@ -41,7 +41,7 @@
                                 <SmallRader :total-rs="totalRs"></SmallRader>
                             </div>
                             <div class="trt">
-                                <Room></Room>
+                                <Room :loft-points="loftPoints" :loft-map="loftMap" :loft-title="loftTitle"></Room>
                             </div>
                         </div>
                     </div>
@@ -91,7 +91,10 @@
         Detector06GInfolist,
         LogWifiDetectedQueryByDetector,
         GetStaticinfo,
-        LogFullDetectedQueryByDetector
+        LogFullDetectedQueryByDetector,
+        RegionPictureGetByRegionId,
+        GetRegiononeinfo,
+        GetRegionplaneinfo,
     } from '../api/getApiRes.js'
 
     let qs = require('qs');
@@ -112,6 +115,9 @@
                 ScanRs: [],
                 historyRs: [],
                 equipRs: [],
+                loftPoints:[],
+                loftMap:'',
+                loftTitle:'',
                 autoTime: 115000,//定时刷新的时间间隔
                 // pageLevel: 1,//当前为楼层
                 // pageLevel: 2,//当前为楼层区域
@@ -156,12 +162,16 @@
                     let param = {
                         token: localStorage.token,
                         detectorId: 0,
+                        comid: 1,
                         regionId: this.regionId,
-                        detidstr:0,
+                        regionID: this.regionId,
+                        regionid: this.regionId,
+                        supregionid: 0,
+                        detidstr: 0,
                         bt: globaltime2String(globalBt2()[0]) + ' 00:00:01',//开始时间
                         et: globaltime2String(globalBt2()[1]) + ' 23:59:59',//结束时间
                         start: 1,//
-                        tableMax: 30,//
+                        tableMax: 10,//
                     };
                     let postdata = qs.stringify(param);
                     // wifi柱状图信息传入区域Id
@@ -175,6 +185,10 @@
                     that.getDetector06GInfolist(postdata);
                     that.getGetStaticinfo(postdata);
 
+                    // 楼层和房间层级有平面图的
+                    if (that.pageLevel == 2 || that.pageLevel == 3) {
+                        that.seeLoftMapAndPoints(postdata)
+                    }
                 } else {
                     // 单个设备层级
                     // todo
@@ -295,6 +309,30 @@
                         that.$message.error(json.Memo);
                     }
                 })
+            },
+            // 读取地图和点
+            seeLoftMapAndPoints(postdata) {
+                let that = this;
+                // 平面图
+                RegionPictureGetByRegionId(postdata).then(res => {
+                    let json = res;
+                    if (json.Code == 0) {
+                        that.loftMap = json.EncodeString;
+                    } else {
+                        that.$message.error(json.Memo);
+                    }
+                });
+                // 点
+                GetRegionplaneinfo(postdata).then(res => {
+                    let json = res;
+                    if (json.Code == 0) {
+                        that.loftTitle = json.Rs.Region.Name;
+                        that.loftPoints = json.Rs.DetAndFindRs;
+                    } else {
+                        that.$message.error(json.Memo);
+                    }
+                });
+
             }
         },
         components: {

+ 0 - 1
src/views/Qrcodemanage.vue

@@ -543,7 +543,6 @@
                 that.dialog_state = false;
             },
             dialog_ok() {
-                console.log(this.dialog_type);
                 if (this.dialog_type == 1) {
                     this.confirmAddQrcode();
                 } else {

+ 1 - 0
src/views/Region.vue

@@ -265,6 +265,7 @@
             // 修改建筑 弹窗
             editLoft(node) {
                 let that = this;
+                that.clearDialog();
                 that.dialog_state = true;
                 that.dialog_title = '修改';
                 that.dialog_type = 2;