web_src/src/components/channelList.vue
@@ -31,17 +31,38 @@
            <el-table ref="channelListTable" :data="deviceChannelList" :height="winHeight" border style="width: 100%">
               <el-table-column prop="channelId" label="通道编号" width="210">
                  </el-table-column>
                  <el-table-column prop="name" label="通道名称" width="500">
                  <el-table-column prop="name" label="通道名称">
                  </el-table-column>
                  <el-table-column prop="subCount" label="子节点数">
                  </el-table-column>
                  <el-table-column prop="ptztypeText" label="云台类型">
                  </el-table-column>
                  <el-table-column label="操作" width="240" align="center" fixed="right">
          <el-table-column label="开启音频" align="center">
            <template slot-scope="scope">
              <el-switch
                @change="updateChannel(scope.row)"
                v-model="scope.row.hasAudio"
                active-color="#409EFF">
              </el-switch>
            </template>
          </el-table-column>
          <el-table-column label="状态" width="180" align="center">
            <template slot-scope="scope">
              <div slot="reference" class="name-wrapper">
                <el-tag size="medium" v-if="scope.row.status == 1">在线</el-tag>
                <el-tag size="medium" type="info" v-if="scope.row.status == 0">离线</el-tag>
              </div>
            </template>
          </el-table-column>
            <el-table-column prop="ptztypeText" label="云台类型">
            </el-table-column>
                  <el-table-column label="操作" width="280" align="center" fixed="right">
                     <template slot-scope="scope">
                        <el-button size="mini" icon="el-icon-video-play" v-if="scope.row.parental == 0" @click="sendDevicePush(scope.row)">预览视频</el-button>
                        <el-button size="mini" icon="el-icon-s-open"  type="primary" v-if="scope.row.parental == 1" @click="changeSubchannel(scope.row)">查看子目录</el-button>
                        <!-- <el-button size="mini" @click="sendDevicePush(scope.row)">录像查询</el-button> -->
                <el-button-group>
                  <el-button size="mini" icon="el-icon-video-play" v-if="scope.row.parental == 0" @click="sendDevicePush(scope.row)">播放</el-button>
                  <el-button size="mini" icon="el-icon-switch-button" type="danger" v-if="scope.row.play" @click="stopDevicePush(scope.row)">停止</el-button>
                  <el-button size="mini" icon="el-icon-s-open"  type="primary" v-if="scope.row.parental == 1" @click="changeSubchannel(scope.row)">查看</el-button>
<!--                  <el-button size="mini" icon="el-icon-video-camera" type="primary" >设备录象</el-button>-->
                  <!-- <el-button size="mini" @click="sendDevicePush(scope.row)">录像查询</el-button> -->
                </el-button-group>
                     </template>
                  </el-table-column>
            </el-table>
@@ -58,17 +79,20 @@
         </el-main>
      </el-container>
    <Loading v-if="isLoging" marginTop="-50%"></Loading>
   </div>
</template>
<script>
    import devicePlayer from './gb28181/devicePlayer.vue'
    import uiHeader from './UiHeader.vue'
   import Loading from './Loading.vue'
   export default {
      name: 'channelList',
      components: {
         devicePlayer,
         uiHeader
         uiHeader,
      Loading
      },
      data() {
         return {
@@ -85,7 +109,8 @@
            currentPage: parseInt(this.$route.params.page),
            count: parseInt(this.$route.params.count),
            total:0,
            beforeUrl:"/videoList"
            beforeUrl:"/videoList",
        isLoging: false
         };
      },
@@ -177,12 +202,13 @@
                  message: '请求成功',
                  type: 'success'
               });
            });;
            });
         },
         //通知设备上传媒体流
         sendDevicePush: function(itemData) {
           console.log(itemData)
            let deviceId = this.deviceId;
        this.isLoging = true;
            let channelId = itemData.channelId;
            console.log("通知设备推流1:" + deviceId + " : " + channelId);
            let that = this;
@@ -190,11 +216,30 @@
               method: 'get',
               url: '/api/play/' + deviceId + '/' + channelId
            }).then(function(res) {
          console.log(res.data)
               let ssrc = res.data.ssrc;
               that.$refs.devicePlayer.play(res.data,deviceId,channelId);
          that.isLoging = false
          if (!!ssrc) {
            that.$refs.devicePlayer.play(res.data,deviceId,channelId,itemData.hasAudio);
            that.initData();
          }else {
            that.$message.error(res.data);
          }
            }).catch(function(e) {
            });
         },
      stopDevicePush: function(itemData) {
           console.log(itemData)
        var that = this;
        this.$axios({
          method: 'post',
          url: '/api/play/' + itemData.ssrc + '/stop'
        }).then(function(res) {
          console.log(JSON.stringify(res));
          that.initData();
        });
      },
         showDevice: function(){
            this.$router.push(this.beforeUrl).then(()=>{
               this.initParam();
@@ -243,6 +288,16 @@
            this.currentPage = 1;
            this.total = 0;
            this.initData();
         },
      updateChannel: function(row) {
            console.log(row)
        this.$axios({
          method: 'post',
          url: `/api/channel/update/${this.deviceId}`,
          params: row
        }).then(function(res) {
          console.log(JSON.stringify(res));
        });
         }
      }