CloudRecord.vue 5.9 KB

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