PushVideoList.vue 11 KB

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