PushVideoList.vue 7.8 KB

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