PushVideoList.vue 6.4 KB

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