PushVideoList.vue 11 KB

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