channel.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <div style="padding-left: 20px">
  3. <el-row :gutter="10" class="mb8">
  4. <el-col :span="1.5">
  5. <el-button type="warning" plain icon="el-icon-refresh" size="mini" @click="getList">{{ $t('refresh') }}</el-button>
  6. </el-col>
  7. </el-row>
  8. <el-table :border="false" v-loading="loading" :data="channelList" size="mini">
  9. <el-table-column :label="$t('sip.channel.998532-0')" align="center" prop="deviceSipId" />
  10. <el-table-column :label="$t('sip.channel.998532-1')" align="center" prop="channelSipId" />
  11. <el-table-column :label="$t('sip.channel.998532-2')" min-width="120">
  12. <template v-slot:default="scope">
  13. <el-image v-if="isVideoChannel(scope.row)" :src="getSnap(scope.row)" :preview-src-list="getBigSnap(scope.row)" :fit="'contain'" style="width: 60px">
  14. <div slot="error" class="image-slot">
  15. <i class="el-icon-picture-outline"></i>
  16. </div>
  17. </el-image>
  18. </template>
  19. </el-table-column>
  20. <el-table-column :label="$t('sip.channel.998532-3')" align="center" prop="channelName" />
  21. <el-table-column :label="$t('sip.channel.998532-4')" align="center" prop="model" />
  22. <el-table-column :abel="$t('sip.channel.998532-9')" align="center" prop="streamPush">
  23. <template slot-scope="scope">
  24. <el-tag type="warning" v-if="scope.row.streamPush === 0">{{ $t('sip.channel.998532-10') }}</el-tag>
  25. <el-tag type="success" v-if="scope.row.streamPush === 1">{{ $t('sip.channel.998532-11') }}</el-tag>
  26. </template>
  27. </el-table-column>
  28. <el-table-column :label="$t('sip.channel.998532-12')" align="center" prop="streamRecord">
  29. <template slot-scope="scope">
  30. <el-tag type="warning" v-if="scope.row.streamRecord === 0">{{ $t('sip.channel.998532-13') }}</el-tag>
  31. <el-tag type="success" v-if="scope.row.streamRecord === 1">{{ $t('sip.channel.998532-14') }}</el-tag>
  32. </template>
  33. </el-table-column>
  34. <el-table-column :label="$t('sip.channel.998532-15')" align="center" prop="videoRecord">
  35. <template slot-scope="scope">
  36. <el-tag type="warning" v-if="scope.row.videoRecord === 0">{{ $t('sip.channel.998532-16') }}</el-tag>
  37. <el-tag type="success" v-if="scope.row.videoRecord === 1">{{ $t('sip.channel.998532-17') }}</el-tag>
  38. </template>
  39. </el-table-column>
  40. <el-table-column :label="$t('sip.channel.998532-5')" align="center" prop="status" width="80">
  41. <template slot-scope="scope">
  42. <dict-tag :options="dict.type.iot_device_status" :value="scope.row.status" size="mini" />
  43. </template>
  44. </el-table-column>
  45. <el-table-column :label="$t('opation')" align="center" width="120" class-name="small-padding fixed-width">
  46. <template slot-scope="scope">
  47. <el-button size="small" type="success" icon="el-icon-video-play" style="padding: 5px" :disabled="scope.row.status !== 3" @click="sendDevicePush(scope.row)">{{ $t('sip.channel.998532-6') }}</el-button>
  48. </template>
  49. </el-table-column>
  50. </el-table>
  51. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
  52. </div>
  53. </template>
  54. <script>
  55. import { listChannel, getChannel, delChannel } from '@/api/pms/video/channel';
  56. export default {
  57. name: 'Channel',
  58. dicts: ['iot_device_status', 'video_type', 'channel_type'],
  59. props: {
  60. device: {
  61. type: Object,
  62. default: null,
  63. },
  64. },
  65. watch: {
  66. // 获取到父组件传递的device后
  67. device: function (newVal, oldVal) {
  68. this.deviceInfo = newVal;
  69. if (this.deviceInfo && this.deviceInfo.deviceId != 0) {
  70. this.queryParams.deviceSipId = this.deviceInfo.serialNumber;
  71. }
  72. },
  73. },
  74. data() {
  75. return {
  76. loadSnap: {},
  77. // 设备信息
  78. deviceInfo: {},
  79. // 遮罩层
  80. loading: true,
  81. // 选中数组
  82. ids: [],
  83. // 非单个禁用
  84. single: true,
  85. // 非多个禁用
  86. multiple: true,
  87. // 显示搜索条件
  88. showSearch: true,
  89. // 总条数
  90. total: 0,
  91. // 监控设备通道信息表格数据
  92. channelList: [],
  93. // 弹出层标题
  94. title: '',
  95. // 是否显示弹出层
  96. open: false,
  97. // 查询参数
  98. queryParams: {
  99. pageNum: 1,
  100. pageSize: 10,
  101. deviceSipId: null,
  102. },
  103. // 表单参数
  104. form: {},
  105. };
  106. },
  107. created() {
  108. this.queryParams.deviceSipId = this.device.serialNumber;
  109. this.getList();
  110. },
  111. methods: {
  112. //通知设备上传媒体流
  113. sendDevicePush: function (itemData) {
  114. var data = { tabName: 'sipPlayer', channelId: itemData.channelSipId };
  115. this.$emit('playerEvent', data);
  116. console.log('通知设备推流:' + itemData.deviceSipId + ' : ' + itemData.channelSipId);
  117. },
  118. /** 查询监控设备通道信息列表 */
  119. getList() {
  120. this.loading = true;
  121. listChannel(this.queryParams).then((response) => {
  122. console.log(response);
  123. this.channelList = response.rows;
  124. this.total = response.total;
  125. this.loading = false;
  126. });
  127. },
  128. // 取消按钮
  129. cancel() {
  130. this.open = false;
  131. this.reset();
  132. },
  133. // 表单重置
  134. reset() {
  135. this.form = {
  136. channelId: null,
  137. channelSipId: null,
  138. deviceSipId: null,
  139. channelName: null,
  140. manufacture: null,
  141. model: null,
  142. owner: null,
  143. civilcode: null,
  144. block: null,
  145. address: null,
  146. parentid: null,
  147. ipaddress: null,
  148. port: null,
  149. password: null,
  150. ptztype: null,
  151. ptztypetext: null,
  152. status: 0,
  153. longitude: null,
  154. latitude: null,
  155. streamid: null,
  156. subcount: null,
  157. parental: 1,
  158. hasaudio: 1,
  159. };
  160. this.resetForm('form');
  161. },
  162. /** 搜索按钮操作 */
  163. handleQuery() {
  164. this.queryParams.pageNum = 1;
  165. this.getList();
  166. },
  167. /** 修改按钮操作 */
  168. handleUpdate(row) {
  169. this.reset();
  170. const channelId = row.channelId || this.ids;
  171. getChannel(channelId).then((response) => {
  172. this.form = response.data;
  173. this.open = true;
  174. this.title = this.$t('sip.channel.998532-7');
  175. });
  176. },
  177. /** 删除按钮操作 */
  178. handleDelete(row) {
  179. const channelIds = row.channelId || this.ids;
  180. this.$modal
  181. .confirm(this.$t('sip.channel.998532-8', [channelIds]))
  182. .then(function () {
  183. return delChannel(channelIds);
  184. })
  185. .then(() => {
  186. this.getList();
  187. this.$modal.msgSuccess(this.$t('sip.channel.998532-18'));
  188. })
  189. .catch(() => {});
  190. },
  191. getSnap: function (row) {
  192. console.log('getSnap:' + process.env.VUE_APP_BASE_API + '/profile/snap/' + row.deviceSipId + '_' + row.channelSipId + '.jpg');
  193. return process.env.VUE_APP_BASE_API + '/profile/snap/' + row.deviceSipId + '_' + row.channelSipId + '.jpg';
  194. },
  195. getBigSnap: function (row) {
  196. return [this.getSnap(row)];
  197. },
  198. isVideoChannel: function (row) {
  199. let channelType = row.channelSipId.substring(10, 13);
  200. // 111-DVR编码;112-视频服务器编码;118-网络视频录像机(NVR)编码;131-摄像机编码;132-网络摄像机(IPC)编码
  201. return !(channelType !== '111' && channelType !== '112' && channelType !== '118' && channelType !== '131' && channelType !== '132');
  202. },
  203. },
  204. };
  205. </script>