CloudRecord.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <div id="app" style="width: 100%">
  3. <div class="page-header">
  4. <div class="page-title">云端录像</div>
  5. <div class="page-header-btn">
  6. 节点选择:
  7. <el-select size="mini" @change="chooseMediaChange" style="width: 16rem; margin-right: 1rem;" v-model="mediaServerId" placeholder="请选择" :disabled="recordDetail">
  8. <el-option
  9. v-for="item in mediaServerList"
  10. :key="item.id"
  11. :label="item.id"
  12. :value="item.id">
  13. </el-option>
  14. </el-select>
  15. <el-button v-if="!recordDetail" icon="el-icon-refresh-right" circle size="mini" :loading="loading" @click="getRecordList()"></el-button>
  16. </div>
  17. </div>
  18. <div v-if="!recordDetail">
  19. <!--设备列表-->
  20. <el-table :data="recordList" style="width: 100%" :height="winHeight">
  21. <el-table-column prop="app" label="应用名" >
  22. </el-table-column>
  23. <el-table-column prop="stream" label="流ID" >
  24. </el-table-column>
  25. <el-table-column prop="time" label="时间" >
  26. </el-table-column>
  27. <el-table-column label="操作" width="360" fixed="right">
  28. <template slot-scope="scope">
  29. <el-button size="medium" icon="el-icon-folder-opened" type="text" @click="showRecordDetail(scope.row)">查看</el-button>
  30. <!-- <el-button size="mini" icon="el-icon-delete" type="danger" @click="deleteRecord(scope.row)">删除</el-button>-->
  31. </template>
  32. </el-table-column>
  33. </el-table>
  34. <el-pagination
  35. style="float: right"
  36. @size-change="handleSizeChange"
  37. @current-change="currentChange"
  38. :current-page="currentPage"
  39. :page-size="count"
  40. :page-sizes="[15, 25, 35, 50]"
  41. layout="total, sizes, prev, pager, next"
  42. :total="total">
  43. </el-pagination>
  44. </div>
  45. <cloud-record-detail ref="cloudRecordDetail" v-if="recordDetail" :recordFile="chooseRecord" :mediaServerId="mediaServerId" :mediaServerPath="mediaServerPath" ></cloud-record-detail>
  46. </div>
  47. </template>
  48. <script>
  49. import uiHeader from '../layout/UiHeader.vue'
  50. import cloudRecordDetail from './CloudRecordDetail.vue'
  51. import MediaServer from './service/MediaServer'
  52. export default {
  53. name: 'app',
  54. components: {
  55. uiHeader, cloudRecordDetail
  56. },
  57. data() {
  58. return {
  59. mediaServerList: [], // 滅体节点列表
  60. mediaServerId: null, // 媒体服务
  61. mediaServerPath: null, // 媒体服务地址
  62. recordList: [], // 设备列表
  63. chooseRecord: null, // 媒体服务
  64. updateLooper: 0, //数据刷新轮训标志
  65. winHeight: window.innerHeight - 250,
  66. currentPage:1,
  67. count:15,
  68. total:0,
  69. loading: false,
  70. mediaServerObj : new MediaServer(),
  71. recordDetail: false
  72. };
  73. },
  74. computed: {
  75. },
  76. mounted() {
  77. this.initData();
  78. },
  79. destroyed() {
  80. // this.$destroy('videojs');
  81. },
  82. methods: {
  83. initData: function() {
  84. // 获取媒体节点列表
  85. this.getMediaServerList();
  86. // this.getRecordList();
  87. },
  88. currentChange: function(val){
  89. this.currentPage = val;
  90. this.getRecordList();
  91. },
  92. handleSizeChange: function(val){
  93. this.count = val;
  94. this.getRecordList();
  95. },
  96. getMediaServerList: function (){
  97. let that = this;
  98. that.mediaServerObj.getOnlineMediaServerList((data)=>{
  99. that.mediaServerList = data.data;
  100. if (that.mediaServerList.length > 0) {
  101. that.mediaServerId = that.mediaServerList[0].id
  102. let port = that.mediaServerList[0].httpPort;
  103. if (location.protocol === "https:" && that.mediaServerList[0].httpSSlPort) {
  104. port = that.mediaServerList[0].httpSSlPort
  105. }
  106. that.mediaServerPath = location.protocol + "//" + that.mediaServerList[0].streamIp + ":" + port
  107. that.getRecordList();
  108. }
  109. })
  110. },
  111. getRecordList: function (){
  112. let that = this;
  113. this.$axios({
  114. method: 'get',
  115. url:`/record_proxy/${that.mediaServerId}/api/record/list`,
  116. params: {
  117. page: that.currentPage,
  118. count: that.count
  119. }
  120. }).then(function (res) {
  121. console.log(res)
  122. that.total = res.data.data.total;
  123. that.recordList = res.data.data.list;
  124. that.loading = false;
  125. }).catch(function (error) {
  126. console.log(error);
  127. that.loading = false;
  128. });
  129. },
  130. backToList(){
  131. this.recordDetail= false;
  132. },
  133. chooseMediaChange(val){
  134. console.log(val)
  135. this.total = 0;
  136. this.recordList = [];
  137. this.getRecordList();
  138. },
  139. showRecordDetail(row){
  140. this.recordDetail = true;
  141. this.chooseRecord = row;
  142. // 查询是否存在录像
  143. // this.$axios({
  144. // method: 'delete',
  145. // url:`/record_proxy/api/record/delete`,
  146. // params: {
  147. // page: this.currentPage,
  148. // count: this.count
  149. // }
  150. // }).then((res) => {
  151. // console.log(res)
  152. // this.total = res.data.data.total;
  153. // this.recordList = res.data.data.list;
  154. // }).catch(function (error) {
  155. // console.log(error);
  156. // });
  157. },
  158. deleteRecord(){
  159. // TODO
  160. let that = this;
  161. this.$axios({
  162. method: 'delete',
  163. url:`/record_proxy/api/record/delete`,
  164. params: {
  165. page: that.currentPage,
  166. count: that.count
  167. }
  168. }).then(function (res) {
  169. console.log(res)
  170. that.total = res.data.data.total;
  171. that.recordList = res.data.data.list;
  172. }).catch(function (error) {
  173. console.log(error);
  174. });
  175. }
  176. }
  177. };
  178. </script>
  179. <style>
  180. </style>