CloudRecord.vue 6.3 KB

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