Kaynağa Gözat

todo 扫描控制

Changpeng Duan 5 yıl önce
ebeveyn
işleme
64d634256a

+ 16 - 0
src/Global.js

@@ -223,6 +223,9 @@ WirelessType = function () {
         }, {
             value: 12,
             label: '800M'
+        }, {
+            value: 13,
+            label: '0-6G扫描'
         },
     ];
     return option
@@ -387,6 +390,19 @@ filterTimeToString = function (value) {
     // 返回
     return result;
 };
+filterTimeToShortString = function (value) {
+    let date = new Date(value);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
+    let year = date.getFullYear(),
+        month = ("0" + (date.getMonth() + 1)).slice(-2),
+        sdate = ("0" + date.getDate()).slice(-2),
+        hour = ("0" + date.getHours()).slice(-2),
+        minute = ("0" + date.getMinutes()).slice(-2),
+        second = ("0" + date.getSeconds()).slice(-2);
+    // 拼接
+    let result =  hour + ":" + minute + ":" + second;
+    // 返回
+    return result;
+}
 
 // handle = function(row, column, event) {
 //     // list -- 已选的数据

+ 15 - 0
src/api/getApiRes.js

@@ -156,3 +156,18 @@ export function DevList(postdata) {
     let url = headapi + 'v1/Index/DevList';
     return getApiBasic(url, postdata);
 }
+// 开始无线扫描
+export function WirelessStart(postdata) {
+    let url = headapi + 'v1/DetectorControl/WirelessStart';
+    return getApiBasic(url, postdata);
+}
+// 无线扫描状态
+export function WirelessStatus(postdata) {
+    let url = headapi + 'v1/DetectorControl/WirelessStatus';
+    return getApiBasic(url, postdata);
+}
+// 扫描策略列表
+export function ScanStrategyList(postdata) {
+    let url = headapi + 'v1/ScanStrategy/List';
+    return getApiBasic(url, postdata);
+}

+ 1 - 1
src/components/Detecter.vue

@@ -11,7 +11,7 @@
         </div>
         <div class="detecterList">
             <ul>
-                <el-row :gutter="21">
+                <el-row :gutter="21" justify="space-between">
                     <el-col :span="8" v-for="(detecter,i) in detecterList">
                         <div :class="[{'detecterItem':true},{'active':loftIndex == i }]" @click="handleSelect(detecter.Id)">
                             <div class="grid-content bg-purple"> {{detecter.TagName}}</div>

+ 0 - 1
src/components/HistoryRecord.vue

@@ -87,7 +87,6 @@
         watch: {
             historyRs: {
                 handler(val, oldName) {
-                    console.log(val);
                     this.loading = false;
                     if (!val.Rs) {
                         this.allTableData = [];

+ 113 - 46
src/components/Task.vue

@@ -17,9 +17,9 @@
                         <el-select v-model="scan.tactics" placeholder="请选择">
                             <el-option
                                     v-for="item in tactics_options"
-                                    :key="item.value"
-                                    :label="item.label"
-                                    :value="item.value">
+                                    :key="item.Id"
+                                    :label="item.Name"
+                                    :value="item.Id">
                             </el-option>
                         </el-select>
                     </el-col>
@@ -27,7 +27,7 @@
                 <el-col :span="24">
                     <el-col :span="6"><em class="label">无线协议</em></el-col>
                     <el-col :span="18">
-                        <el-select v-model="scan.agreement"  multiple  placeholder="请选择">
+                        <el-select v-model="scan.agreement" multiple placeholder="请选择">
                             <el-option
                                     v-for="item in agreement_options"
                                     :key="item.value"
@@ -37,22 +37,22 @@
                         </el-select>
                     </el-col>
                 </el-col>
-                <el-col :span="24">
+                <el-col :span="24" v-if="scopeState">
                     <el-col :span="6"><em class="label">起始频率</em></el-col>
                     <el-col :span="18">
-                        <el-input v-model="scan.begin" type="number" placeholder="请输入内容"></el-input>
+                        <el-input v-model="scan.begin" type="number" placeholder="单位100K"></el-input>
                     </el-col>
                 </el-col>
-                <el-col :span="24">
+                <el-col :span="24" v-if="scopeState">
                     <el-col :span="6"><em class="label">截止频率</em></el-col>
                     <el-col :span="18">
-                        <el-input v-model="scan.end" placeholder="请输入内容"></el-input>
+                        <el-input v-model="scan.end" placeholder="单位100K"></el-input>
                     </el-col>
                 </el-col>
                 <el-col :span="24">
                     <el-col :span="6"><em class="label">扫描距离</em></el-col>
                     <el-col :span="18">
-                        <el-select v-model="scan.distance"  placeholder="请选择">
+                        <el-select v-model="scan.distance" placeholder="请选择">
                             <el-option
                                     v-for="item in distance_options"
                                     :key="item.value"
@@ -62,45 +62,46 @@
                         </el-select>
                     </el-col>
                 </el-col>
-                <el-col :span="24">
-                    <el-col :span="6"><em class="label">检测周期</em></el-col>
-                    <el-col :span="18">
-                        <el-input v-model="scan.cycle" type="number" placeholder="请输入内容"></el-input>
-                    </el-col>
-                </el-col>
                 <el-col :span="24">
                     <el-col :span="6"><em class="label_checked">
-                        <el-checkbox v-model="checked">信号录制</el-checkbox>
+                        <el-checkbox v-model="isRecording">信号录制</el-checkbox>
                     </em></el-col>
                     <el-col :span="18">
                         <el-button type="primary" plain size="small" @click="startScan">开始扫描</el-button>
                     </el-col>
                 </el-col>
                 <ul class="scan_detail">
+                    <li>
+                        <em>运行状态: </em>
+                        <span>{{taskText.IsStop |filterIsStop }}</span>
+                    </li>
                     <li>
                         <em>开始时间: </em>
-                        <span>{{result.begin}}</span>
+                        <span>{{taskText.BeginAt|filterBeginAt }}</span>
                     </li>
                     <li>
                         <em>持续时间: </em>
-                        <span>{{result.hold}}</span>
+                        <span>{{taskText.Duration |filterDuration}}</span>
                     </li>
                     <li>
                         <em>数据大小: </em>
-                        <span>{{result.date}}</span>
+                        <span>{{parseFloat(taskText.DataSize /1024).toFixed(2)}} MB</span>
                     </li>
                 </ul>
             </el-row>
-
         </div>
     </div>
 </template>
 
 <script>
+    import Global from "../Global"
+
+    let qs = require('qs');
     export default {
         data() {
             return {
-                checked: true,
+                scopeState: false,
+                isRecording: true,
                 scan: {
                     tactics: 0,
                     agreement: [],
@@ -108,24 +109,45 @@
                     end: 0,
                     distance: 1,
                     cycle: 0,
-                },
-                result: {
-                    begin: '',
-                    hold: '',
-                    date: '',
+
                 },
                 tactics_options: [
                     {
-                        value: 0,
-                        label: '自定义扫描'
+                        Id: 0,
+                        Name: '自定义扫描'
                     }
                 ],
+                taskText:{
+                    BeginAt:'',
+                    DataSize:'0',
+                    Duration:'',
+                    IsStop:false,
+                },
                 agreement_options: WirelessType(),
                 distance_options: WirelessRange(),
                 value: ''
             }
         },
+        props: ['taskInfo','taskResult'],
         watch: {
+            taskResult: {
+                handler(newName, oldName) {
+                    this.taskText.BeginAt = newName.BeginAt;
+                    this.taskText.DataSize = newName.DataSize;
+                    this.taskText.Duration = newName.Duration;
+                    this.taskText.IsStop = newName.IsStop;
+                },
+                deep: true,
+                immediate: true
+            },
+            taskInfo: {
+                handler(newName, oldName) {
+                    if(!newName.length) return false;
+                    this.tactics_options = newName;
+                },
+                deep: true,
+                immediate: true
+            },
             scan: {
                 handler(newName, oldName) {
                     if (parseInt(newName.begin) > 6000) {
@@ -164,33 +186,77 @@
                         return false
                     }
 
-                    // ...
+                    // 0-6G现实范围
+                    if (newName.agreement.indexOf(13) > -1) {
+                        this.scopeState = true
+                    } else {
+                        this.scopeState = false
+                    }
+
                 },
                 deep: true,
                 immediate: true
             }
         },
-        mounted() {
-            this.init()
-        },
         methods: {
-            init() {
-                this.writeScanResult();
-            },
             // 扫描开始
             startScan() {
-                this.$message({
-                    message: '扫描已开始',
-                    type: 'success'
-                });
-                this.writeScanResult();
+                let that = this;
+                let freq06G ={};
+                let signalList =[];
+                let token = localStorage.token;
+                if(that.scan.begin > 0){
+                    freq06G = {
+                        "begin": that.scan.begin,
+                        "end": that.scan.end
+                    }
+                }
+                if(that.scan.agreement.length == 0){
+                    that.$message({
+                        showClose: true,
+                        message: '无线协议不能为空!',
+                        type: 'error'
+                    });
+                    return false
+                }
+                for(var i = 0; i < that.scan.agreement.length; i++) {
+                    signalList[i] = {
+                        "range": that.scan.distance,
+                        "type": that.scan.agreement[i]
+                    }
+                }
+
+                let Rs = {
+                    freq06G:freq06G,
+                    isRecording:this.isRecording,
+                    signalList:signalList,
+                    token: token
+                };
+                this.$emit('GetScanClick', Rs);//触发事件
+            },
+        },
+        filters: {
+            filterIsStop: function (value) {
+                if (value) {
+                    return "扫描中"
+                } else {
+                    return "已停止";
+                }
+            },
+            filterBeginAt: function (value) {
+                if (!value) {
+                    return "未开始"
+                } else {
+                    return filterTimeToString(value);
+                }
+            },
+            filterDuration: function (value) {
+                if (!value) {
+                    return "未开始"
+                } else {
+                    return filterTimeToShortString(value);
+                }
             },
-            // 渲染扫描状态
-            writeScanResult() {
-                this.result.begin = "2021-01-02 09:05:21";
-                this.result.hold = "1小时23分21秒";
-                this.result.date = "21G";
-            }
         }
     }
 </script>
@@ -206,6 +272,7 @@
 
     .regionList {
         width: 100%;
+        height: 433px;
         overflow: hidden;
         display: block;
         margin: 0 auto;

+ 8 - 3
src/components/WifiSign.vue

@@ -68,7 +68,12 @@
                                 color: '#04E3FD',
                                 width: 1,//这里是为了突出显示加上的
                             }
-                        }
+                        },
+                        axisLabel: {
+                            show: true,
+                            interval: 'auto',
+                            formatter: '- {value} db'
+                        },
                     },
                     xAxis: {
                         splitLine: {
@@ -95,8 +100,8 @@
                     that.chartData.rows = [];
                 } else {
                     val.Rs.forEach(function (item) {
-                        item.X = "频道" + item.X
-                        // item.X = parseInt(item.X / 1000 / 1000).toString() + "M"
+                        item.X = "频道" + item.X;
+                        item.Y = 180 +  item.Y;
                     });
                     that.chartData.rows = val.Rs;
                 }

+ 11 - 2
src/components/signMap.vue

@@ -22,10 +22,10 @@
                 >
                       <el-popover
                               placement="top-start"
-                              title="标题"
+                              title="详细信息"
                               width="200"
                               trigger="hover"
-                              content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。">
+                              :content="s.popover">
                         <div slot="reference">
                              <em class="types">
                                  <img src="../assets/img/signMap/ydgsm.png" height="54" width="54"
@@ -99,6 +99,15 @@
                 this.YMax = val.Rs.YMax;
                 this.xLimit = parseInt(this.XMax / 12);
                 this.yLimit = parseInt(this.YMax / 28);
+                let Oem = "未知";
+                let Ssid = "未知";
+                if (this.scan) {
+                    this.scan.map(function (item) {
+                        Oem = item.Oem == '' ? "未知" : item.Oem;
+                        Ssid = item.Ssid == '' ? "未知" : item.Ssid;
+                        item.popover = "品牌:" + Oem + " SSID:" + Ssid
+                    })
+                }
             },
         },
         methods: {

+ 78 - 5
src/views/Main.vue

@@ -11,7 +11,7 @@
                 <Detecter :detecter-list="detectorList"></Detecter>
             </div>
             <div class="cube">
-                <Task></Task>
+                <Task :task-info="taskInfo" :task-result="taskResult"  @GetScanClick="ClickGetScan"></Task>
             </div>
         </div>
         <div :class="[{'md':true},{'bigMd':!showLeft}]">
@@ -70,6 +70,9 @@
         NetDevMonitor,
         WirelessMonitor,
         DevList,
+        WirelessStatus,
+        ScanStrategyList,
+        WirelessStart,
     } from '../api/getApiRes.js'
     import {mapGetters, mapActions, mapState} from "vuex";
     import Global from "../Global"
@@ -78,6 +81,7 @@
     export default {
         data() {
             return {
+                CurrentRegionId:0,
                 WifiRs: {},
                 ScanRs: {},
                 signList: {},
@@ -89,18 +93,20 @@
                 regionId: '',
                 historyRs: {
                     Title: '区域无线设备列表',
-                    Url: 'runTime',
+                    Url: 'signEquip',
                     Rs: [],
                 }, runtimeRs: {
                     Title: '实时监控详情',
-                    Url: 'runTime',
+                    Url: 'record',
                     Rs: [],
                 },
                 detctorRs: {
                     Title: '探测设备工作监控',
-                    Url: 'record',
+                    Url: 'equip',
                     Rs: [],
                 },
+                taskInfo:{},
+                taskResult:{}
             }
         },
         mounted() {
@@ -139,6 +145,7 @@
                         that.regionList = json.Rs;
                         // 默认加载第一个区域
                         if (json.Rs) {
+                            this.CurrentRegionId = json.Rs[0].Id;
                             this.getDetectorList(json.Rs[0].Id);
                             this.getRegion06G(json.Rs[0].Id);
                             this.getWifiChannel(json.Rs[0].Id);
@@ -146,6 +153,8 @@
                             this.getNetDevMonitor(json.Rs[0].Id);
                             this.getWirelessMonitor(json.Rs[0].Id);
                             this.getDevList(json.Rs[0].Id);
+                            this.getWirelessStatus(json.Rs[0].Id);
+                            this.getScanStrategyList(json.Rs[0].Id);
                         }
                     } else {
                         that.$message.error(json.Memo);
@@ -187,7 +196,7 @@
                 })
             },
             ClickGetInfo(Id) {
-                // this.regionId = Id;
+                this.CurrentRegionId = Id;
                 this.getDetectorList(Id);
                 this.getRegion06G(Id);
                 this.getWifiChannel(Id);
@@ -195,6 +204,25 @@
                 this.getNetDevMonitor(Id);
                 this.getWirelessMonitor(Id);
                 this.getDevList(Id);
+                this.getWirelessStatus(Id);
+                this.getScanStrategyList(Id);
+            },
+            ClickGetScan(Rs){
+                let that = this;
+                Rs.regionId = that.CurrentRegionId;
+                let postdata = qs.stringify(Rs);
+                WirelessStart(postdata).then(res => {
+                    let json = res;
+                    if (json.Code == 0) {
+                        that.$message({
+                            showClose: true,
+                            message: '开始扫描!',
+                            type: 'success'
+                        });
+                    } else {
+                        that.$message.error(json.Memo);
+                    }
+                })
             },
             getRegion06G(id) {
                 let that = this;
@@ -284,6 +312,51 @@
                         that.$message.error(json.Memo);
                     }
                 })
+            },
+            getScanStrategyList(id) {
+                let that = this;
+                let param = {
+                    token: localStorage.token,
+                    regionId: id,
+                    limit: 6,
+                };
+                let postdata = qs.stringify(param);
+                ScanStrategyList(postdata).then(res => {
+                    let json = res;
+                    if (json.Code == 0) {
+                        json.Rs.push({
+                            Id: 0,
+                            Name: '自定义扫描'
+                        });
+                        // todo
+                        // this.taskInfo = json.Rs;
+                    } else {
+                        this.taskInfo = [];
+                        that.$message.error(json.Memo);
+                    }
+                })
+            },
+            getWirelessStatus(id) {
+                let that = this;
+                let param = {
+                    token: localStorage.token,
+                    regionId: id,
+                };
+                let postdata = qs.stringify(param);
+                WirelessStatus(postdata).then(res => {
+                    let json = res;
+                    if (json.Code == 0) {
+                        this.taskResult = json.Rs;
+                    } else {
+                        this.taskResult = {
+                            BeginAt:'',
+                            DataSize:'0',
+                            Duration:'',
+                            IsStop:false,
+                        };
+                        that.$message.error(json.Memo);
+                    }
+                })
             }
         },
         components: {

+ 56 - 40
src/views/addTactics.vue

@@ -9,7 +9,7 @@
         </div>
         <div class="panel">
             <div class="panel-body">
-                <div class=" panel_control">
+                <div class="panel_row">
                     <div class="panel_title">
                         <i></i>
                         基本信息
@@ -17,11 +17,11 @@
                 </div>
                 <div class=" panel_control">
                     <div class="pline">
-                        <em>设备ID:</em>
+                        <em>策略名称:</em>
                         <el-input v-model="panel.tagname" placeholder=""></el-input>
                     </div>
                     <div class="pline">
-                        <em>MAC地址:</em>
+                        <em>持续时间:</em>
                         <el-input v-model="panel.tagname" placeholder=""></el-input>
                     </div>
                     <div class="pline">
@@ -35,17 +35,19 @@
                             </el-option>
                         </el-select>
                     </div>
+                    <div class="pline">
+                        <el-col :span="6"><em class="label_checked">
+                            <el-checkbox v-model="checked">信号录制</el-checkbox>
+                        </em></el-col>
+                    </div>
                 </div>
-                <div class="panel_control">
+                <div class="panel_row">
                     <div class="panel_title">
                         <i></i>
                         扫描选项
                     </div>
                 </div>
-                <div class="panel_control">
-                    <div class="pline">
-                        <el-button size="medium" type="primary" @click="query">查询</el-button>
-                    </div>
+                <div class="panel_row">
                     <div class="pline pull-right">
                         <el-button size="medium" type="primary" @click="addList">添加</el-button>
                         <el-button size="medium" type="primary" @click="editList">修改</el-button>
@@ -79,45 +81,31 @@
             </el-table-column>
             <el-table-column
                     prop="Mac"
-                    label="区域名称"
+                    label="无线协议"
             >
             </el-table-column>
             <el-table-column
                     prop="Xmax"
-                    label="长/m"
+                    label="起始频率"
             >
             </el-table-column>
             <el-table-column
                     prop="Ymax"
-                    label="宽/m"
+                    label="截止频率"
             >
             </el-table-column>
             <el-table-column
                     prop="Memo"
-                    label="备注"
+                    label="扫描距离"
             >
             </el-table-column>
-            <el-table-column
-                    prop="address"
-                    label="操作记录"
-                    width="220"
-            >
-                <template slot-scope="scope">
-                    <!--<el-button class="" type="text" @click="goPhoneRecord(scope.row)">手机信号记录</el-button>-->
-                    <el-button class="" type="primary" size="small" @click="goWifiRecord(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>
         <br>
         <!--<el-pagination-->
-                <!--background-->
-                <!--:total="pageination.total"-->
-                <!--:page-size="pageination.pageItem"-->
-                <!--@current-change="pageChange"-->
+        <!--background-->
+        <!--:total="pageination.total"-->
+        <!--:page-size="pageination.pageItem"-->
+        <!--@current-change="pageChange"-->
         <!--&gt;</el-pagination>-->
         <div class="btm_control">
             <el-button size="medium" type="primary" @click="addList">取消</el-button>
@@ -135,28 +123,29 @@
                 <el-row :gutter="24">
                     <el-col :span="24">
                         <label>
-                            区域名称
+                            无线协议
                         </label>
                         <el-input v-model="dialog.mac" @keyup.native="autoCompleteMac"
                                   :disabled="dialog_type == 2"></el-input>
                     </el-col>
-                    <el-col :span="12">
+                    <el-col :span="24">
                         <label>
-                            长/m
+                            扫描距离
                         </label>
-                        <el-input v-model="dialog.tagname"></el-input>
+                        <el-input v-model="dialog.mac" @keyup.native="autoCompleteMac"
+                                  :disabled="dialog_type == 2"></el-input>
                     </el-col>
                     <el-col :span="12">
                         <label>
-                            宽/m
+                            起始频率
                         </label>
-                        <el-input v-model="dialog.tagname"></el-input>
+                        <el-input v-model="dialog.tagname" type="number"></el-input>
                     </el-col>
-                    <el-col :span="24">
+                    <el-col :span="12">
                         <label>
-                            备注
+                            截止频率
                         </label>
-                        <el-input v-model="dialog.memo"  type="textarea"></el-input>
+                        <el-input v-model="dialog.tagname" type="number"></el-input>
                     </el-col>
                 </el-row>
             </div>
@@ -431,7 +420,7 @@
             },
             addList() {
                 this.dialog_state = true;
-                this.dialog_title = '添加监控区域';
+                this.dialog_title = '添加扫描选项';
                 this.dialog_type = 1;
 
                 // 重载地区列表
@@ -954,4 +943,31 @@
     .yellow {
         color: #fd0;
     }
+
+    .panel_title {
+        width: 180px;
+        float: left;
+        text-align: left;
+        color: #00FEFF;
+        font-size: 14px;
+        line-height: 14px;
+        margin-left: 30px;
+    }
+
+    .panel_title i {
+        width: 3px;
+        height: 14px;
+        float: left;
+        background: #00FEFF;
+        margin-right: 10px;
+    }
+    .panel_row {
+        width: 100%;
+        overflow: hidden;
+        display: block;
+        margin: 0 auto;
+        padding-top: 20px;
+        padding-bottom: 10px;
+        background: rgba(27,86,200,0.14)
+    }
 </style>