CloudRecord.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. if (res.data.code === 0) {
  123. that.total = res.data.data.total;
  124. that.recordList = res.data.data.list;
  125. }
  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. if (res.data.code === 0) {
  173. that.total = res.data.data.total;
  174. that.recordList = res.data.data.list;
  175. }
  176. }).catch(function (error) {
  177. console.log(error);
  178. });
  179. }
  180. }
  181. };
  182. </script>
  183. <style>
  184. </style>