Changpeng Duan 5 роки тому
батько
коміт
2b2f55ca35
3 змінених файлів з 197 додано та 55 видалено
  1. 45 36
      src/api/getApiRes.js
  2. 152 18
      src/views/Equip.vue
  3. 0 1
      src/views/Region.vue

+ 45 - 36
src/api/getApiRes.js

@@ -3,41 +3,46 @@ import global from '../Global.js'
 
 // 基础方法进行封装
 function getApiBasic(url, postdata) {
-    return  axios.post(url, postdata).then(function(data){
+    return axios.post(url, postdata).then(function (data) {
         let json = data.data;
         return json
-    },function(response){
+    }, function (response) {
         console.info(response);
     })
 }
 
 // 调用的api改写成方法
 export function worldDetail(postdata) {
-        let url = headapi + 'worldDetail';
-        return getApiBasic(url,postdata);
+    let url = headapi + 'worldDetail';
+    return getApiBasic(url, postdata);
 }
 
 // 测试用接口
 export function editbasicinfo(postdata) {
     let url = headapi + 'editbasicinfo';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
+
 export function modPwd(postdata) {
     let url = headapi + 'modPwd';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
+
 export function getLoftInfo(postdata) {
     let url = headapi + 'getLoftInfo';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
+
 export function wifiSingle(postdata) {
     let url = headapi + 'wifiSingle';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
+
 export function Scan(postdata) {
     let url = headapi + 'Scan';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
+
 export function Watching(postdata) {
     // let url = headapi + 'Watching';
     // return getApiBasic(url,postdata);
@@ -62,56 +67,60 @@ export function Watching(postdata) {
 // 用户登录
 export function SignIn(postdata) {
     let url = headapi + 'v1/Auth/SignIn';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
+
 // 获取验证图片
 export function GenVerifyPic(postdata) {
     let url = headapi + 'v1/Auth/GenVerifyPic';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
+
 // 用户退出
 export function SignOut(postdata) {
     let url = headapi + 'v1/Auth/SignOut';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
 // 获取首页左侧组织结构信息
 export function GetRegionAndDectorSelect(postdata) {
     let url = headapi + 'v1/Auth/GetRegionAndDectorSelect';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
 // 获取统计数量集合
 export function GetStaticinfo(postdata) {
     // 获取统计数量集合,包括获取设备总数,在线设备,离线设备,禁用设备,当日报警数量,可疑事件总数
     let url = headapi + 'v1/Company/GetStaticinfo';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
 // 区域检出实时记录
 export function RegionDetInfolist(postdata) {
     // 最小区域检出实时记录
     let url = headapi + 'v1/Company/RegionDetInfolist';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
+
 // 单个设备检测实时记录
 export function SingleDetInfolist(postdata) {
     // 单个设备检测实时记录
     let url = headapi + 'v1/Company/SingleDetInfolist';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
+
 // Wifi柱状图信息传入探测器Id
 export function DetectorWifixyInfolist(postdata) {
     // Wifi柱状图信息
     let url = headapi + 'v1/Detector/DetectorWifixyInfolist';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
 // Wifi柱状图信息传入区域Id
 export function RegionWifixyInfolist(postdata) {
     // Wifi柱状图信息
     let url = headapi + 'v1/Detector/RegionWifixyInfolist';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
 
@@ -119,63 +128,63 @@ export function RegionWifixyInfolist(postdata) {
 export function Detector06GInfolist(postdata) {
     // 6G折线图信息传入设备Id
     let url = headapi + 'v1/Detector/Detector06GInfolist';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
 // 添加区域
 export function RegionAdd(postdata) {
     // 添加区域 第一级区域填0
     let url = headapi + 'v1/Company/RegionAdd';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
 // 修改区域信息
 export function RegionEdit(postdata) {
     // 修改区域 第一级区域填0
     let url = headapi + 'v1/Company/RegionEdit';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
 // 修改区域状态
 export function RegionStatusEdit(postdata) {
     // 修改内部区域状态设置为 9删除
     let url = headapi + 'v1/Company/RegionStatusEdit';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
 // 区域图片上传
 export function RegionPictureUpload(postdata) {
     // 上传区域图片
     let url = headapi + 'v1/Company/RegionPictureUpload';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
 // 查询信号 Wifi记录
 export function LogWifiDetectedQueryByDetector(postdata) {
     // 查询检测设备的Wifi信号记录
     let url = headapi + 'v1/Detector/LogWifiDetectedQueryByDetector';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
 // 查询手机信号记录
 export function LogPhoneDetectedQueryByDetector(postdata) {
     // 查询手机信号记录
     let url = headapi + 'v1/Detector/LogPhoneDetectedQueryByDetector';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
 // 获取单个区域信息
 export function GetRegiononeinfo(postdata) {
     // 获取单个区域信息
     let url = headapi + 'v1/Company/GetRegiononeinfo';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
 // 获取企业内部区域选择框信息
 export function GetRegionSelect(postdata) {
     // 根据企业id获取企业内部区域选择框信息 default:1
     let url = headapi + 'v1/Auth/GetRegionSelect';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
 // Detector part
@@ -184,40 +193,40 @@ export function GetRegionSelect(postdata) {
 export function DetectorQuery(postdata) {
     // 查询检测设备。上级区域id,区域id必传。regionid传0,查询supregionid对应所有子区域的检测设备。 如果supregionid,regionid都传0,默认查询企业ID下所有检测设备
     let url = headapi + 'v1/Detector/DetectorQuery';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
 // 添加检测设备
 export function DetectorAdd(postdata) {
     // 添加检测设备
     let url = headapi + 'v1/Detector/DetectorAdd';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
 // 修改检测设备信息
 export function DetectorEdit(postdata) {
     // 添加检测设备
     let url = headapi + 'v1/Detector/DetectorEdit';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
 // 修改检测设备状态
 export function DetectorEditStatus(postdata) {
-    // 修改检测设备状态  9删除
+    // 修改检测设备状态  //新状态0禁用1启用2已离线9删除
     let url = headapi + 'v1/Detector/DetectorEditStatus';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
-// 修改检测设备状态
+// 通过RegionId下载区域图片
 export function RegionPictureGetByRegionId(postdata) {
-    // 修改检测设备状态  9删除
+    // 通过RegionId下载区域图片
     let url = headapi + 'v1/Company/RegionPictureGetByRegionId';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }
 
 // 获取下级区域选择框信息
 export function GetChildRegionSelect(postdata) {
     // 获取下级区域选择框信息
     let url = headapi + 'v1/Auth/GetChildRegionSelect';
-    return getApiBasic(url,postdata);
+    return getApiBasic(url, postdata);
 }

+ 152 - 18
src/views/Equip.vue

@@ -20,12 +20,22 @@
                             <el-select v-model="panel.regionid">
                                 <el-option
                                         v-for="item in panel.regionidOptions"
-                                        :key="item.value"
-                                        :label="item.label"
-                                        :value="item.value">
+                                        :key="item.Id"
+                                        :label="item.Name"
+                                        :value="item.Id">
                                 </el-option>
                             </el-select>
                         </el-col>
+                        <!--<el-col :span="4" v-if="panel.regionidOptions2 != []">-->
+                        <!--<el-select v-model="panel.regionid2">-->
+                        <!--<el-option-->
+                        <!--v-for="item in panel.regionidOptions2"-->
+                        <!--:key="item.Id"-->
+                        <!--:label="item.Name"-->
+                        <!--:value="item.Id">-->
+                        <!--</el-option>-->
+                        <!--</el-select>-->
+                        <!--</el-col>-->
                         <el-col :span="4">
                             <el-button size="small" type="primary" @click="query">查询</el-button>
                         </el-col>
@@ -101,11 +111,17 @@
             </el-table-column>
             <el-table-column
                     prop="address"
-                    label="操作记录">
+                    label="操作记录"
+                    width="220"
+            >
                 <template slot-scope="scope">
-                    <el-button class="control_btn" type="text" @click="goPoster(scope.row)">记录</el-button>
-                    <el-button class="control_btn" type="text" @click="goPoster(scope.row)">时间轴</el-button>
-                    <el-button class="control_btn" type="text" @click="goPoster(scope.row)">禁用</el-button>
+                    <el-button class="" type="text" @click="goPhoneRecord(scope.row)">手机信号记录</el-button>
+                    <el-button class="" type="text" @click="goWifiRecord(scope.row)">WiFi记录</el-button>
+                    <!--<el-button class="" type="text" @click="goPoster(scope.row)">时间轴</el-button> 这个需要先不做-->
+                    <el-button v-if="scope.row.Status == 1" class="yellow" type="text" @click="pauseRow(scope.row)">禁用
+                    </el-button>
+                    <el-button v-if="scope.row.Status == 0" class="green" type="text" @click="runRow(scope.row)">启用
+                    </el-button>
                 </template>
             </el-table-column>
         </el-table>
@@ -173,7 +189,11 @@
 <script>
     import Global from '../Global.js'
     import dialog_referrer_list from '../components/dialog_referrer_list'
-    import {DetectorQuery} from '../api/getApiRes.js'
+    import {
+        DetectorQuery,
+        GetChildRegionSelect,
+        DetectorEditStatus
+    } from '../api/getApiRes.js'
 
     let qs = require('qs');
     export default {
@@ -200,6 +220,10 @@
                     keyword: '',
                     USERCODE: '',
                     taskstatus: 99,
+                    regionid: 0,
+                    regionid2: '',
+                    regionidOptions: [],
+                    regionidOptions2: [],
                     options: [
                         {value: 99, label: '全部'},
                         {value: 1, label: '进行中'},
@@ -207,12 +231,6 @@
                     ],
                     time1: globalBt2(),
                 },
-                pageination: {
-                    pageItem: 10,
-                    pageoptions: pageOptions(),
-                    total: 10,
-                    pageIndex: 1,
-                },
                 pageination: {
                     pageItem: 10,
                     pageoptions: pageOptions(),
@@ -239,12 +257,13 @@
             // 页面数据查询
             getTableQuery() {
                 let that = this;
+                this.getGetChildRegionSelect(0, 1);
                 that.loading = true;
                 // 查询检测设备。上级区域id,区域id必传。regionid传0,查询supregionid对应所有子区域的检测设备。 如果supregionid,regionid都传0,默认查询企业ID下所有检测设备
                 let param = {
                     token: localStorage.token,
                     supregionid: 0,//
-                    regionid: 0,//
+                    regionid: this.panel.regionid,//
                     comid: 1,//
                     tagname: that.panel.tagname,//标签名
                     start: 1,//
@@ -270,6 +289,35 @@
                     }
                 })
             },
+            // 获取下级列表
+            getGetChildRegionSelect(regionId, level) {
+                let that = this;
+                let param = {
+                    token: localStorage.token,
+                    regionId: regionId,
+                };
+                let postdata = qs.stringify(param);
+                GetChildRegionSelect(postdata).then(res => {
+                    let json = res;
+                    if (json.Code == 0) {
+                        if (level == 1) {
+                            that.panel.regionidOptions = json.Rs;
+                            that.panel.regionidOptions.unshift({Id: 0, Name: "全部"});
+                        } else {
+                            if (json.Rs) {
+                                that.panel.regionidOptions2 = json.Rs;
+                                that.panel.regionid2 = json.Rs[0].Id;
+                            } else {
+                                that.panel.regionidOptions2 = [];
+                                that.panel.regionid2 = ''
+                            }
+
+                        }
+                    } else {
+                        that.$message.error(json.Memo);
+                    }
+                })
+            },
             // 跳转tab页面
             goTab(url) {
                 this.$router.push({path: url});
@@ -365,9 +413,28 @@
                 }
             },
             // 探测记录
-            goRecord(row) {
-                console.log(row);
-                this.$router.push({path: '/record', query: {row: row}});
+            goPhoneRecord(row) {
+                this.$router.push({
+                    path: '/phoneSign',
+                    query:
+                        {
+                            detectorid: row.Id,
+                            comId: 1,
+                            regionId: row.RegionId,
+                        }
+                });
+            },
+            // 探测记录
+            goWifiRecord(row) {
+                this.$router.push({
+                    path: '/wifiSign',
+                    query:
+                        {
+                            detectorid: row.Id,
+                            comId: 1,
+                            regionId: row.RegionId,
+                        }
+                });
             },
             dialog_cancel() {
                 let that = this;
@@ -379,7 +446,72 @@
                 let name = that.field_name;
                 let id = that.field_id;
             },
+            // 修改设备状态
+            getDetectorEditStatus(detectorid, status, text) {
+                let that = this;
+                let param = {
+                    token: localStorage.token,
+                    detectorid: detectorid,
+                    status: status,
+                };
+                let postdata = qs.stringify(param);
+                DetectorEditStatus(postdata).then(res => {
+                    let json = res;
+                    if (json.Code == 0) {
+                        that.$message({
+                            showClose: true,
+                            message: text + '成功!',
+                            type: 'success'
+                        });
+                        // table 重载
+                        that.getTableQuery();
+                    } else {
+                        that.$message.error(json.Memo);
+                    }
+                })
+            },
+            // 禁用
+            pauseRow(row) {
+                console.log(row);
+                let that = this;
+                this.$confirm('是否禁用' + row.TagName + '设备?', '禁用操作', {
+                    confirmButtonText: '确定',
+                    cancelButtonText: '取消',
+                    type: 'warning'
+                }).then(() => {
+                    that.getDetectorEditStatus(row.Id, '禁用');
+                }).catch(() => {
+                    this.$message({
+                        type: 'info',
+                        message: '已取消禁用'
+                    });
+                });
+            },
+            // 启用
+            runRow(row) {
+                console.log(row);
+                let that = this;
+                this.$confirm('是否启用' + row.TagName + '设备?', '启用操作', {
+                    confirmButtonText: '确定',
+                    cancelButtonText: '取消',
+                    type: 'warning'
+                }).then(() => {
+                    that.getDetectorEditStatus(row.Id, '启用');
+                }).catch(() => {
+                    this.$message({
+                        type: 'info',
+                        message: '已取消启用'
+                    });
+                });
+            }
         },
+        // watch: {
+        //     'panel.regionid': function (val) {
+        //         let that = this;
+        //         console.log(val);
+        //         that.getGetChildRegionSelect(val,2)
+        //     },
+        // },
         components: {
             dialog_referrer_list
         }
@@ -397,9 +529,11 @@
     table span {
         cursor: pointer;
     }
+
     .down_btn {
         float: left;
     }
+
     .content {
         padding-left: 10px;
     }

+ 0 - 1
src/views/Region.vue

@@ -276,7 +276,6 @@
                     regionid: regionId,
                     newstatus: 9,
                 };
-                console.log(param);
                 let postdata = qs.stringify(param);
 
                 this.$confirm('是否删除' + name + '区域?', '删除操作', {