From ac1a4a027a7bd88efb32e9da666bdba4b5fa166f Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期五, 14 一月 2022 17:04:26 +0800
Subject: [PATCH] 支持国标级联的目录订阅功能

---
 web_src/src/components/control.vue |  181 +++++++++++++++++++++++++++++++++-----------
 1 files changed, 135 insertions(+), 46 deletions(-)

diff --git a/web_src/src/components/control.vue b/web_src/src/components/control.vue
index 51bcb0a..b5990da 100644
--- a/web_src/src/components/control.vue
+++ b/web_src/src/components/control.vue
@@ -7,6 +7,17 @@
         <el-main>
             <div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;">
                 <span style="font-size: 1rem; font-weight: bold;">鎺у埗鍙�</span>
+                <div style="position: absolute; right: 17rem; top: 0.3rem;">
+                  鑺傜偣閫夋嫨: <el-select size="mini" @change="chooseMediaChange" style="width: 18rem; margin-right: 8rem;" v-model="mediaServerChoose" placeholder="璇烽�夋嫨" default-first-option>
+                  <el-option
+                    v-for="item in mediaServerList"
+                    :key="item.id"
+                    :label="item.id + '( ' + item.streamIp + ' )'"
+                    :value="item.id">
+                  </el-option>
+                  </el-select>
+                  <span >{{loadCount}}</span>
+                </div>
                 <div style="position: absolute; right: 1rem; top: 0.3rem;">
                     <el-popover placement="bottom" width="750" height="300" trigger="click">
                         <div style="height: 600px;overflow:auto;">
@@ -17,9 +28,34 @@
                                 </tr>
                             </table>
                         </div>
-                        <el-button type="primary" slot="reference" size="mini" @click="getServerConfig()">鏌ョ湅鏈嶅姟鍣ㄩ厤缃�</el-button>
+                        <el-button type="primary" slot="reference" size="mini" @click="getServerConfig()">濯掍綋鏈嶅姟鍣ㄩ厤缃�</el-button>
                     </el-popover>
-                    <el-button style="margin-left: 1rem;" type="danger" size="mini" @click="reStartServer()">閲嶅惎鏈嶅姟鍣�</el-button>
+                    <el-popover placement="bottom" width="750" height="300" trigger="click">
+                        <div style="height: 600px;overflow:auto;">
+                          <div v-for="(value, key, index) in wvpServerConfig">
+                            {{ key }}锛�
+                            <table v-if="key != 'server.port'" class="table-c" cellspacing="0">
+                              <tr  v-for="(subValue, subKey, subIndex) in value">
+                                <td style="width: 18rem; text-align: right;">{{ subKey }}</td>
+                                <td style="width: 33rem; text-align:left">{{ subValue }}</td>
+                              </tr>
+                            </table>
+                            <span v-if="key == 'server.port'">{{ value }}</span>
+                          </div>
+
+                          <div style="margin-top: 1rem">
+                            鐗堟湰淇℃伅锛�
+                            <table class="table-c" cellspacing="0">
+                              <tr v-for="(value, key, index) in wvpServerVersion">
+                                <td style="width: 18rem; text-align: right;">{{ key }}</td>
+                                <td style="width: 33rem; text-align:left">{{ value }}</td>
+                              </tr>
+                            </table>
+                          </div>
+                        </div>
+                      <el-button type="primary" slot="reference" size="mini" @click="getWVPServerConfig()">淇′护鏈嶅姟鍣ㄩ厤缃�</el-button>
+                    </el-popover>
+                    <el-button style="margin-left: 1rem;" type="danger" size="mini" @click="reStartServer()">閲嶅惎濯掍綋鏈嶅姟鍣�</el-button>
                 </div>
             </div>
             <el-row :gutter="30">
@@ -53,6 +89,7 @@
 
 <script>
 import uiHeader from './UiHeader.vue'
+import MediaServer from './service/MediaServer'
 
 import echarts from 'echarts';
 export default {
@@ -87,68 +124,102 @@
             chartInterval: 0, //鏇存柊鍥捐〃缁熻鍥惧畾鏃朵换鍔℃爣璇�
             allSessionData: [],
             visible: false,
-            serverConfig: {}
+            wvpVisible: false,
+            serverConfig: {},
+            wvpServerConfig: {},
+            wvpServerVersion: {},
+            mediaServer : new MediaServer(),
+            mediaServerChoose : null,
+            loadCount : 0,
+            mediaServerList : []
         };
     },
     mounted() {
-        this.getAllSession();
+
         this.initTable();
-        this.updateData();
         this.chartInterval = setInterval(this.updateData, 3000);
+        this.mediaServer.getOnlineMediaServerList((data)=>{
+          this.mediaServerList = data.data;
+          if (this.mediaServerList && this.mediaServerList.length > 0) {
+            this.mediaServerChoose = this.mediaServerList[0].id
+            this.loadCount = this.mediaServerList[0].count;
+            this.updateData();
+          }
+        })
     },
     destroyed() {
         clearInterval(this.chartInterval); //閲婃斁瀹氭椂浠诲姟
     },
     methods: {
+        chooseMediaChange: function (val) {
+            this.loadCount = 0
+            this.initTable()
+            this.updateData();
+        },
         updateData: function () {
             this.getThreadsLoad();
+            this.getLoadCount();
+            this.getAllSession();
         },
         /**
          * 鑾峰彇绾跨▼鐘舵��
          */
         getThreadsLoad: function () {
             let that = this;
-            this.$axios({
+            if (that.mediaServerChoose != null) {
+              this.$axios({
                 method: 'get',
-                url: '/zlm/index/api/getThreadsLoad'
-            }).then(function (res) {
+                url: '/zlm/' + that.mediaServerChoose +'/index/api/getThreadsLoad'
+              }).then(function (res) {
                 if (res.data.code == 0) {
-                    that.tableOption.xAxis.data.push(new Date().toLocaleTimeString('chinese', {
-                        hour12: false
-                    }));
-                    that.table1Option.xAxis.data.push(new Date().toLocaleTimeString('chinese', {
-                        hour12: false
-                    }));
+                  that.tableOption.xAxis.data.push(new Date().toLocaleTimeString('chinese', {
+                    hour12: false
+                  }));
+                  that.table1Option.xAxis.data.push(new Date().toLocaleTimeString('chinese', {
+                    hour12: false
+                  }));
 
-                    for (var i = 0; i < res.data.data.length; i++) {
-                        if (that.tableOption.series[i] === undefined) {
-                            let data = {
-                                data: [],
-                                type: 'line'
-                            };
-                            let data1 = {
-                                data: [],
-                                type: 'line'
-                            };
-                            data.data.push(res.data.data[i].delay);
-                            data1.data.push(res.data.data[i].load);
-                            that.tableOption.series.push(data);
-                            that.table1Option.series.push(data1);
-                        } else {
-                            that.tableOption.series[i].data.push(res.data.data[i].delay);
-                            that.table1Option.series[i].data.push(res.data.data[i].load);
-                        }
+                  for (var i = 0; i < res.data.data.length; i++) {
+                    if (that.tableOption.series[i] === undefined) {
+                      let data = {
+                        data: [],
+                        type: 'line'
+                      };
+                      let data1 = {
+                        data: [],
+                        type: 'line'
+                      };
+                      data.data.push(res.data.data[i].delay);
+                      data1.data.push(res.data.data[i].load);
+                      that.tableOption.series.push(data);
+                      that.table1Option.series.push(data1);
+                    } else {
+                      that.tableOption.series[i].data.push(res.data.data[i].delay);
+                      that.table1Option.series[i].data.push(res.data.data[i].load);
                     }
-                    that.tableOption.dataZoom[0].start = that.charZoomStart;
-                    that.tableOption.dataZoom[0].end = that.charZoomEnd;
-                    that.table1Option.dataZoom[0].start = that.charZoomStart;
-                    that.table1Option.dataZoom[0].end = that.charZoomEnd;
-                    //that.myChart = echarts.init(document.getElementById('ThreadsLoad'));
-                    that.myChart.setOption(that.tableOption, true);
-                    // that.myChart1 = echarts.init(document.getElementById('WorkThreadsLoad'));
-                    that.myChart1.setOption(that.table1Option, true);
+                  }
+                  that.tableOption.dataZoom[0].start = that.charZoomStart;
+                  that.tableOption.dataZoom[0].end = that.charZoomEnd;
+                  that.table1Option.dataZoom[0].start = that.charZoomStart;
+                  that.table1Option.dataZoom[0].end = that.charZoomEnd;
+                  //that.myChart = echarts.init(document.getElementById('ThreadsLoad'));
+                  that.myChart.setOption(that.tableOption, true);
+                  // that.myChart1 = echarts.init(document.getElementById('WorkThreadsLoad'));
+                  that.myChart1.setOption(that.table1Option, true);
                 }
-            });
+              });
+            }
+
+        },
+        getLoadCount: function (){
+          let that = this;
+          if (that.mediaServerChoose != null) {
+            that.mediaServer.getMediaServer(that.mediaServerChoose, (data)=>{
+              if (data.code == 0) {
+                that.loadCount = data.data.count
+              }
+            })
+          }
         },
         initTable: function () {
             let that = this;
@@ -242,10 +313,9 @@
         getAllSession: function () {
             let that = this;
             that.allSessionData = [];
-            console.log("鍦板潃锛�" + '/zlm/index/api/getAllSession');
             this.$axios({
                 method: 'get',
-                url: '/zlm/index/api/getAllSession'
+                url: '/zlm/' + that.mediaServerChoose +'/index/api/getAllSession'
             }).then(function (res) {
                 res.data.data.forEach(item => {
                     let data = {
@@ -262,10 +332,29 @@
             let that = this;
             this.$axios({
                 method: 'get',
-                url: '/zlm/index/api/getServerConfig'
+                url: '/zlm/' + that.mediaServerChoose +'/index/api/getServerConfig'
             }).then(function (res) {
                 that.serverConfig = res.data.data[0];
                 that.visible = true;
+            });
+        },
+        getWVPServerConfig: function () {
+            let that = this;
+            this.$axios({
+                method: 'get',
+                url: '/api/server/config'
+            }).then(function (res) {
+                console.log(res)
+                that.wvpServerConfig = res.data.data;
+                that.wvpVisible = true;
+            });
+            this.$axios({
+                method: 'get',
+                url: '/api/server/version'
+            }).then(function (res) {
+                console.log(res)
+                that.wvpServerVersion = res.data.data;
+                that.wvpVisible = true;
             });
         },
         reStartServer: function () {
@@ -278,7 +367,7 @@
                 let that = this;
                 this.$axios({
                     method: 'get',
-                    url: '/zlm/index/api/restartServer'
+                    url: '/zlm/' + that.mediaServerChoose +'/index/api/restartServer'
                 }).then(function (res) {
                     that.getAllSession();
                     if (res.data.code == 0) {
@@ -313,7 +402,7 @@
             let that = this;
             this.$axios({
                 method: 'get',
-                url: '/zlm/index/api/kick_session&id=' + id
+                url: '/zlm/' + that.mediaServerChoose +'/index/api/kick_session&id=' + id
             }).then(function (res) {
                 that.getAllSession();
                 that.$message({

--
Gitblit v1.8.0