PushVideoList.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <div id="pushVideoList" style="width: 100%">
  3. <div class="page-header">
  4. <div class="page-title">推流列表</div>
  5. <div class="page-header-btn">
  6. 搜索:
  7. <el-input @input="getPushList" style="margin-right: 1rem; width: auto;" size="mini" placeholder="关键字"
  8. prefix-icon="el-icon-search" v-model="searchSrt" clearable></el-input>
  9. 流媒体:
  10. <el-select size="mini" @change="getPushList" style="margin-right: 1rem;" v-model="mediaServerId"
  11. placeholder="请选择" default-first-option>
  12. <el-option label="全部" value=""></el-option>
  13. <el-option
  14. v-for="item in mediaServerList"
  15. :key="item.id"
  16. :label="item.id"
  17. :value="item.id">
  18. </el-option>
  19. </el-select>
  20. 推流状态:
  21. <el-select size="mini" style="margin-right: 1rem;" @change="getPushList" v-model="pushing" placeholder="请选择"
  22. default-first-option>
  23. <el-option label="全部" value=""></el-option>
  24. <el-option label="推流进行中" value="true"></el-option>
  25. <el-option label="推流未进行" value="false"></el-option>
  26. </el-select>
  27. <el-button icon="el-icon-upload2" size="mini" style="margin-right: 1rem;" type="primary" @click="importChannel">
  28. 通道导入
  29. </el-button>
  30. <el-button icon="el-icon-download" size="mini" style="margin-right: 1rem;" type="primary">
  31. <a style="color: #FFFFFF; text-align: center; text-decoration: none" href="/static/file/推流通道导入.zip"
  32. download='推流通道导入.zip'>下载模板</a>
  33. </el-button>
  34. <el-button icon="el-icon-delete" size="mini" style="margin-right: 1rem;"
  35. :disabled="multipleSelection.length === 0" type="danger" @click="batchDel">批量移除
  36. </el-button>
  37. <el-button icon="el-icon-refresh-right" circle size="mini" @click="refresh()"></el-button>
  38. </div>
  39. </div>
  40. <devicePlayer ref="devicePlayer"></devicePlayer>
  41. <addStreamTOGB ref="addStreamTOGB"></addStreamTOGB>
  42. <el-table ref="pushListTable" :data="pushList" style="width: 100%" :height="winHeight"
  43. @selection-change="handleSelectionChange" :row-key="(row)=> row.app + row.stream">
  44. <el-table-column type="selection" :reserve-selection="true" min-width="55">
  45. </el-table-column>
  46. <el-table-column prop="name" label="名称" min-width="200">
  47. </el-table-column>
  48. <el-table-column prop="app" label="APP" min-width="200">
  49. </el-table-column>
  50. <el-table-column prop="stream" label="流ID" min-width="200">
  51. </el-table-column>
  52. <el-table-column prop="gbId" label="国标编码" min-width="200" >
  53. </el-table-column>
  54. <el-table-column prop="mediaServerId" label="流媒体" min-width="200" >
  55. </el-table-column>
  56. <el-table-column label="开始时间" min-width="200">
  57. <template slot-scope="scope">
  58. <el-button-group>
  59. {{ scope.row.pushTime == null? "-":scope.row.pushTime }}
  60. </el-button-group>
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="正在推流" min-width="100">
  64. <template slot-scope="scope">
  65. {{scope.row.status ? '是' : '否' }}
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="操作" min-width="360" fixed="right">
  69. <template slot-scope="scope">
  70. <el-button size="medium" icon="el-icon-video-play"
  71. v-if="(scope.row.status == false && scope.row.gbId == null) || scope.row.status"
  72. @click="playPush(scope.row)" type="text">播放
  73. </el-button>
  74. <el-divider direction="vertical"></el-divider>
  75. <el-button size="medium" icon="el-icon-delete" type="text" @click="stopPush(scope.row)" style="color: #f56c6c" >移除</el-button>
  76. <el-divider direction="vertical"></el-divider>
  77. <el-button size="medium" icon="el-icon-position" type="text" v-if="!!!scope.row.gbId"
  78. @click="addToGB(scope.row)">加入国标
  79. </el-button>
  80. <el-divider v-if="!!!scope.row.gbId" direction="vertical"></el-divider>
  81. <el-button size="medium" icon="el-icon-position" type="text" v-if="!!scope.row.gbId"
  82. @click="removeFromGB(scope.row)">移出国标
  83. </el-button>
  84. </template>
  85. </el-table-column>
  86. </el-table>
  87. <el-pagination
  88. style="float: right"
  89. @size-change="handleSizeChange"
  90. @current-change="currentChange"
  91. :current-page="currentPage"
  92. :page-size="count"
  93. :page-sizes="[15, 25, 35, 50]"
  94. layout="total, sizes, prev, pager, next"
  95. :total="total">
  96. </el-pagination>
  97. <streamProxyEdit ref="streamProxyEdit"></streamProxyEdit>
  98. <importChannel ref="importChannel"></importChannel>
  99. </div>
  100. </template>
  101. <script>
  102. import streamProxyEdit from './dialog/StreamProxyEdit.vue'
  103. import devicePlayer from './dialog/devicePlayer.vue'
  104. import addStreamTOGB from './dialog/addStreamTOGB.vue'
  105. import uiHeader from '../layout/UiHeader.vue'
  106. import importChannel from './dialog/importChannel.vue'
  107. import MediaServer from './service/MediaServer'
  108. export default {
  109. name: 'pushVideoList',
  110. components: {
  111. devicePlayer,
  112. addStreamTOGB,
  113. streamProxyEdit,
  114. uiHeader,
  115. importChannel,
  116. },
  117. data() {
  118. return {
  119. pushList: [], //设备列表
  120. currentPusher: {}, //当前操作设备对象
  121. updateLooper: 0, //数据刷新轮训标志
  122. currentDeviceChannelsLenth: 0,
  123. winHeight: window.innerHeight - 250,
  124. mediaServerObj: new MediaServer(),
  125. currentPage: 1,
  126. count: 15,
  127. total: 0,
  128. searchSrt: "",
  129. pushing: "",
  130. mediaServerId: "",
  131. mediaServerList: [],
  132. multipleSelection: [],
  133. getDeviceListLoading: false
  134. };
  135. },
  136. computed: {},
  137. mounted() {
  138. this.initData();
  139. this.updateLooper = setInterval(this.getPushList, 2000);
  140. },
  141. destroyed() {
  142. clearTimeout(this.updateLooper);
  143. },
  144. methods: {
  145. initData: function () {
  146. this.mediaServerObj.getOnlineMediaServerList((data) => {
  147. this.mediaServerList = data.data;
  148. })
  149. this.getPushList();
  150. },
  151. currentChange: function (val) {
  152. this.currentPage = val;
  153. this.getPushList();
  154. },
  155. handleSizeChange: function (val) {
  156. this.count = val;
  157. this.getPushList();
  158. },
  159. getPushList: function () {
  160. let that = this;
  161. this.getDeviceListLoading = true;
  162. this.$axios({
  163. method: 'get',
  164. url: `/api/push/list`,
  165. params: {
  166. page: that.currentPage,
  167. count: that.count,
  168. query: that.searchSrt,
  169. pushing: that.pushing,
  170. mediaServerId: that.mediaServerId,
  171. }
  172. }).then(function (res) {
  173. that.total = res.data.total;
  174. that.pushList = res.data.list;
  175. that.getDeviceListLoading = false;
  176. }).catch(function (error) {
  177. console.error(error);
  178. that.getDeviceListLoading = false;
  179. });
  180. },
  181. playPush: function (row) {
  182. let that = this;
  183. this.getListLoading = true;
  184. this.$axios({
  185. method: 'get',
  186. url: '/api/push/getPlayUrl',
  187. params: {
  188. app: row.app,
  189. stream: row.stream,
  190. mediaServerId: row.mediaServerId
  191. }
  192. }).then(function (res) {
  193. that.getListLoading = false;
  194. that.$refs.devicePlayer.openDialog("streamPlay", null, null, {
  195. streamInfo: res.data.data,
  196. hasAudio: true
  197. });
  198. }).catch(function (error) {
  199. console.error(error);
  200. that.getListLoading = false;
  201. });
  202. },
  203. stopPush: function (row) {
  204. let that = this;
  205. that.$axios({
  206. method: "post",
  207. url: "/api/push/stop",
  208. params: {
  209. app: row.app,
  210. streamId: row.stream
  211. }
  212. }).then((res) => {
  213. if (res.data == "success") {
  214. that.initData()
  215. }
  216. }).catch(function (error) {
  217. console.error(error);
  218. });
  219. },
  220. addToGB: function (row) {
  221. this.$refs.addStreamTOGB.openDialog({
  222. app: row.app,
  223. stream: row.stream,
  224. mediaServerId: row.mediaServerId
  225. }, this.initData);
  226. },
  227. removeFromGB: function (row) {
  228. let that = this;
  229. that.$axios({
  230. method: "delete",
  231. url: "/api/push/remove_form_gb",
  232. data: row
  233. }).then((res) => {
  234. if (res.data == "success") {
  235. that.initData()
  236. }
  237. }).catch(function (error) {
  238. console.error(error);
  239. });
  240. },
  241. importChannel: function () {
  242. this.$refs.importChannel.openDialog(() => {
  243. })
  244. },
  245. batchDel: function () {
  246. this.$confirm(`确定删除选中的${this.multipleSelection.length}个通道?`, '提示', {
  247. confirmButtonText: '确定',
  248. cancelButtonText: '取消',
  249. type: 'warning'
  250. }).then(() => {
  251. let that = this;
  252. that.$axios({
  253. method: "delete",
  254. url: "/api/push/batchStop",
  255. data: {
  256. gbStreams: this.multipleSelection
  257. }
  258. }).then((res) => {
  259. this.initData();
  260. this.$refs.pushListTable.clearSelection();
  261. }).catch(function (error) {
  262. console.error(error);
  263. });
  264. }).catch(() => {
  265. });
  266. },
  267. handleSelectionChange: function (val) {
  268. this.multipleSelection = val;
  269. },
  270. refresh: function () {
  271. this.initData();
  272. },
  273. }
  274. };
  275. </script>
  276. <style>
  277. .videoList {
  278. display: flex;
  279. flex-wrap: wrap;
  280. align-content: flex-start;
  281. }
  282. .video-item {
  283. position: relative;
  284. width: 15rem;
  285. height: 10rem;
  286. margin-right: 1rem;
  287. background-color: #000000;
  288. }
  289. .video-item-img {
  290. position: absolute;
  291. top: 0;
  292. bottom: 0;
  293. left: 0;
  294. right: 0;
  295. margin: auto;
  296. width: 100%;
  297. height: 100%;
  298. }
  299. .video-item-img:after {
  300. content: "";
  301. display: inline-block;
  302. position: absolute;
  303. z-index: 2;
  304. top: 0;
  305. bottom: 0;
  306. left: 0;
  307. right: 0;
  308. margin: auto;
  309. width: 3rem;
  310. height: 3rem;
  311. background-image: url("../assets/loading.png");
  312. background-size: cover;
  313. background-color: #000000;
  314. }
  315. .video-item-title {
  316. position: absolute;
  317. bottom: 0;
  318. color: #000000;
  319. background-color: #ffffff;
  320. line-height: 1.5rem;
  321. padding: 0.3rem;
  322. width: 14.4rem;
  323. }
  324. </style>