PushVideoList.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <div id="pushVideoList">
  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>
  11. <devicePlayer ref="devicePlayer"></devicePlayer>
  12. <addStreamTOGB ref="addStreamTOGB"></addStreamTOGB>
  13. <el-table :data="pushList" border style="width: 100%" :height="winHeight">
  14. <el-table-column prop="app" label="APP" width="180" align="center">
  15. </el-table-column>
  16. <el-table-column prop="stream" label="流ID" width="240" align="center">
  17. </el-table-column>
  18. <el-table-column prop="gbId" label="国标编码" width="150" align="center">
  19. </el-table-column>
  20. <el-table-column prop="mediaServerId" label="流媒体" width="150" align="center">
  21. </el-table-column>
  22. <el-table-column label="开始时间" align="center" >
  23. <template slot-scope="scope">
  24. <el-button-group>
  25. {{dateFormat(parseInt(scope.row.createStamp))}}
  26. </el-button-group>
  27. </template>
  28. </el-table-column>
  29. <el-table-column label="正在推流" align="center" >
  30. <template slot-scope="scope">
  31. {{(scope.row.status == false && scope.row.gbId == null) || scope.row.status ?'是':'否'}}
  32. </template>
  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-play" @click="playPuhsh(scope.row)">播放</el-button>
  38. <el-button size="mini" icon="el-icon-switch-button" type="danger" v-if="!!scope.row.streamId" @click="stopPuhsh(scope.row)">停止</el-button>
  39. <el-button size="mini" icon="el-icon-position" type="primary" v-if="!!!scope.row.gbId" @click="addToGB(scope.row)">加入国标</el-button>
  40. <el-button size="mini" icon="el-icon-position" type="primary" v-if="!!scope.row.gbId" @click="removeFromGB(scope.row)">移出国标</el-button>
  41. </el-button-group>
  42. </template>
  43. </el-table-column>
  44. </el-table>
  45. <el-pagination
  46. style="float: right"
  47. @size-change="handleSizeChange"
  48. @current-change="currentChange"
  49. :current-page="currentPage"
  50. :page-size="count"
  51. :page-sizes="[15, 25, 35, 50]"
  52. layout="total, sizes, prev, pager, next"
  53. :total="total">
  54. </el-pagination>
  55. <streamProxyEdit ref="streamProxyEdit" ></streamProxyEdit>
  56. </el-main>
  57. </el-container>
  58. </div>
  59. </template>
  60. <script>
  61. import streamProxyEdit from './dialog/StreamProxyEdit.vue'
  62. import devicePlayer from './dialog/devicePlayer.vue'
  63. import addStreamTOGB from './dialog/addStreamTOGB.vue'
  64. import uiHeader from './UiHeader.vue'
  65. export default {
  66. name: 'pushVideoList',
  67. components: {
  68. devicePlayer,
  69. addStreamTOGB,
  70. streamProxyEdit,
  71. uiHeader
  72. },
  73. data() {
  74. return {
  75. pushList: [], //设备列表
  76. currentPusher: {}, //当前操作设备对象
  77. updateLooper: 0, //数据刷新轮训标志
  78. currentDeviceChannelsLenth:0,
  79. winHeight: window.innerHeight - 200,
  80. currentPage:1,
  81. count:15,
  82. total:0,
  83. getDeviceListLoading: false
  84. };
  85. },
  86. computed: {
  87. },
  88. mounted() {
  89. this.initData();
  90. this.updateLooper = setInterval(this.initData, 2000);
  91. },
  92. destroyed() {
  93. clearTimeout(this.updateLooper);
  94. },
  95. methods: {
  96. initData: function() {
  97. this.getPushList();
  98. },
  99. currentChange: function(val){
  100. this.currentPage = val;
  101. this.getPushList();
  102. },
  103. handleSizeChange: function(val){
  104. this.count = val;
  105. this.getPushList();
  106. },
  107. getPushList: function() {
  108. let that = this;
  109. this.getDeviceListLoading = true;
  110. this.$axios({
  111. method: 'get',
  112. url:`/api/push/list`,
  113. params: {
  114. page: that.currentPage,
  115. count: that.count
  116. }
  117. }).then(function (res) {
  118. console.log(res);
  119. console.log(res.data.list);
  120. that.total = res.data.total;
  121. that.pushList = res.data.list;
  122. that.getDeviceListLoading = false;
  123. }).catch(function (error) {
  124. console.log(error);
  125. that.getDeviceListLoading = false;
  126. });
  127. },
  128. playPuhsh: function(row){
  129. let that = this;
  130. this.getListLoading = true;
  131. this.$axios({
  132. method: 'get',
  133. url: '/api/media/stream_info_by_app_and_stream',
  134. params: {
  135. app: row.app,
  136. stream: row.stream,
  137. mediaServerId: row.mediaServerId
  138. }
  139. }).then(function (res) {
  140. that.getListLoading = false;
  141. that.$refs.devicePlayer.openDialog("streamPlay", null, null, {
  142. streamInfo: res.data.data,
  143. hasAudio: true
  144. });
  145. }).catch(function (error) {
  146. console.log(error);
  147. that.getListLoading = false;
  148. });
  149. },
  150. stopPuhsh: function(row){
  151. console.log(row)
  152. },
  153. addToGB: function(row){
  154. this.$refs.addStreamTOGB.openDialog({app: row.app, stream: row.stream, mediaServerId: row.mediaServerId}, this.initData);
  155. },
  156. removeFromGB: function(row){
  157. var that = this;
  158. that.$axios({
  159. method:"delete",
  160. url:"/api/push/remove_form_gb",
  161. data:row
  162. }).then((res)=>{
  163. if (res.data == "success") {
  164. that.initData()
  165. }
  166. }).catch(function (error) {
  167. console.log(error);
  168. });
  169. },
  170. dateFormat: function(/** timestamp=0 **/) {
  171. var ts = arguments[0] || 0;
  172. var t,y,m,d,h,i,s;
  173. t = ts ? new Date(ts*1000) : new Date();
  174. y = t.getFullYear();
  175. m = t.getMonth()+1;
  176. d = t.getDate();
  177. h = t.getHours();
  178. i = t.getMinutes();
  179. s = t.getSeconds();
  180. // 可根据需要在这里定义时间格式
  181. return y+'-'+(m<10?'0'+m:m)+'-'+(d<10?'0'+d:d)+' '+(h<10?'0'+h:h)+':'+(i<10?'0'+i:i)+':'+(s<10?'0'+s:s);
  182. }
  183. }
  184. };
  185. </script>
  186. <style>
  187. .videoList {
  188. display: flex;
  189. flex-wrap: wrap;
  190. align-content: flex-start;
  191. }
  192. .video-item {
  193. position: relative;
  194. width: 15rem;
  195. height: 10rem;
  196. margin-right: 1rem;
  197. background-color: #000000;
  198. }
  199. .video-item-img {
  200. position: absolute;
  201. top: 0;
  202. bottom: 0;
  203. left: 0;
  204. right: 0;
  205. margin: auto;
  206. width: 100%;
  207. height: 100%;
  208. }
  209. .video-item-img:after {
  210. content: "";
  211. display: inline-block;
  212. position: absolute;
  213. z-index: 2;
  214. top: 0;
  215. bottom: 0;
  216. left: 0;
  217. right: 0;
  218. margin: auto;
  219. width: 3rem;
  220. height: 3rem;
  221. background-image: url("../assets/loading.png");
  222. background-size: cover;
  223. background-color: #000000;
  224. }
  225. .video-item-title {
  226. position: absolute;
  227. bottom: 0;
  228. color: #000000;
  229. background-color: #ffffff;
  230. line-height: 1.5rem;
  231. padding: 0.3rem;
  232. width: 14.4rem;
  233. }
  234. </style>