index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <div>
  3. <!-- <a-card :bordered="false" style="margin-bottom: 10px;">
  4. &lt;!&ndash; 条件搜索 &ndash;&gt;
  5. <div class="table-page-search-wrapper">
  6. <a-form :labelCol="labelCol" :wrapperCol="wrapperCol">
  7. <a-row :gutter="48">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="公告标题">
  10. <a-input v-model="queryParam.noticeTitle" placeholder="请输入" allow-clear/>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="操作人员">
  15. <a-input v-model="queryParam.createBy" placeholder="请输入" allow-clear/>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="公告类型">
  20. <a-select placeholder="请选择" v-model="queryParam.noticeType" style="width: 100%" allow-clear>
  21. <a-select-option v-for="(d, index) in typeOptions" :key="index" :value="d.dictValue">{{ d.dictLabel }}</a-select-option>
  22. </a-select>
  23. </a-form-item>
  24. </a-col>
  25. <a-col>
  26. <span class="table-page-search-submitButtons" style="float: right;">
  27. <a-button type="primary" @click="handleQuery"><a-icon type="search" />查询</a-button>
  28. <a-button style="margin-left: 8px" @click="resetQuery"><a-icon type="redo" />重置</a-button>
  29. </span>
  30. </a-col>
  31. </a-row>
  32. </a-form>
  33. </div>
  34. </a-card>-->
  35. <a-card :bordered="false" class="table-card">
  36. <advance-table
  37. :columns="columns"
  38. :data-source="list"
  39. title="摄像头管理"
  40. :loading="loading"
  41. rowKey="id"
  42. size="middle"
  43. tableKey="system-notic-NoticIndex-table"
  44. @refresh="getList"
  45. :format-conditions="true"
  46. :pagination="{
  47. current: queryParam.pageNum,
  48. pageSize: queryParam.pageSize,
  49. total: total,
  50. showSizeChanger: true,
  51. showLessItems: true,
  52. showQuickJumper: true,
  53. showTotal: (total, range) => `第 ${range[0]}-${range[1]} 条,总计 ${total} 条`,
  54. onChange: changeSize,
  55. onShowSizeChange: onSizeChange,
  56. }"
  57. >
  58. <span slot="cameraType" slot-scope="{text, record}">
  59. <a-tag :color="text | noticeTypeFilter">
  60. {{ typeFormat(record) }}
  61. </a-tag>
  62. </span>
  63. <span slot="onlineStatus" slot-scope="{text, record}">
  64. <a-badge :status="Number(record.onlineStatus)===0?'error': 'processing'" :text="statusFormat(record) " />
  65. </span>
  66. <span slot="operation" slot-scope="{text, record}">
  67. <a @click="handleLive(record)" >
  68. 实时视频
  69. </a>
  70. </span>
  71. </advance-table>
  72. </a-card>
  73. <ant-modal
  74. modalWidth="1000"
  75. modalHeight="800"
  76. :visible="showLiveModal"
  77. modal-title="播放器"
  78. :adjust-size="true"
  79. @cancel="cancel"
  80. >
  81. <div class="videoPlayer" slot="content">
  82. <SpeedDial :url="videoUrl" @triggerEvent="triggerEvent" ></SpeedDial>
  83. </div>
  84. <template slot="footer">
  85. <div></div>
  86. </template>
  87. </ant-modal>
  88. </div>
  89. </template>
  90. <script>
  91. import { list, getLive } from '@/api/camera/camera'
  92. import SpeedDial from '@/views/camera/modules/player'
  93. import AdvanceTable from '@/components/pt/table/AdvanceTable'
  94. import AntModal from '@/components/pt/dialog/AntModal'
  95. export default {
  96. name: 'Camera',
  97. components: {
  98. SpeedDial, AdvanceTable, AntModal
  99. },
  100. data () {
  101. return {
  102. list: [],
  103. total: 0,
  104. // 类型数据字典
  105. typeOptions: [],
  106. statusOptions: [],
  107. labelCol: { span: 6 },
  108. wrapperCol: { span: 18 },
  109. queryParam: {
  110. pageNum: 1,
  111. pageSize: 10
  112. },
  113. columns: [
  114. {
  115. title: '设备号',
  116. dataIndex: 'deviceSn',
  117. ellipsis: true,
  118. width: '10%'
  119. },
  120. {
  121. title: '通道号',
  122. dataIndex: 'channelNo',
  123. align: 'center'
  124. },
  125. {
  126. title: '设备名称',
  127. dataIndex: 'deviceName',
  128. align: 'center'
  129. },
  130. {
  131. title: '固件版本',
  132. dataIndex: 'hwVer',
  133. align: 'center'
  134. },
  135. {
  136. title: '软件版本',
  137. dataIndex: 'swVer',
  138. align: 'center'
  139. },
  140. {
  141. title: '设备状态',
  142. dataIndex: 'onlineStatus',
  143. scopedSlots: { customRender: 'onlineStatus' },
  144. align: 'center'
  145. },
  146. {
  147. title: '摄像头类型',
  148. dataIndex: 'cameraType',
  149. scopedSlots: { customRender: 'cameraType' }
  150. },
  151. {
  152. title: '设备接入时间',
  153. dataIndex: 'createTime',
  154. scopedSlots: { customRender: 'createTime' }
  155. },
  156. {
  157. title: '操作',
  158. dataIndex: 'operation',
  159. width: '200',
  160. scopedSlots: { customRender: 'operation' }
  161. }
  162. ],
  163. showLiveModal: false,
  164. showEditModal: false,
  165. videoUrl: ''
  166. }
  167. },
  168. filters: {
  169. noticeTypeFilter (type) {
  170. let value = 'blue'
  171. if (type === 'CF') {
  172. value = 'orange'
  173. } else if (type === 'CG') {
  174. value = 'pink'
  175. } else if (type === 'CB') {
  176. value = 'green'
  177. } else if (type === 'CH') {
  178. value = 'cyan'
  179. }
  180. return value
  181. }
  182. },
  183. created () {
  184. this.getDicts('sys_camera_status').then(response => {
  185. this.statusOptions = response.data
  186. })
  187. this.getDicts('sys_camera_type').then(response => {
  188. this.typeOptions = response.data
  189. })
  190. this.getList()
  191. },
  192. computed: {
  193. },
  194. watch: {
  195. },
  196. methods: {
  197. /** 查询定时任务列表 */
  198. getList () {
  199. this.loading = true
  200. list(this.queryParam).then(response => {
  201. this.list = response.data.records
  202. this.total = response.data.total
  203. this.loading = false
  204. }
  205. )
  206. },
  207. // 状态字典翻译
  208. statusFormat (row) {
  209. return this.selectDictLabel(this.statusOptions, row.onlineStatus)
  210. },
  211. // 类型字典翻译
  212. typeFormat (row) {
  213. return this.selectDictLabel(this.typeOptions, row.cameraType)
  214. },
  215. /** 搜索按钮操作 */
  216. handleQuery () {
  217. this.queryParam.pageNum = 1
  218. this.getList()
  219. },
  220. /** 重置按钮操作 */
  221. resetQuery () {
  222. this.queryParam = {
  223. pageNum: 1,
  224. pageSize: 10
  225. }
  226. this.handleQuery()
  227. },
  228. onShowSizeChange (current, pageSize) {
  229. this.queryParam.pageSize = pageSize
  230. this.getList()
  231. },
  232. onSizeChange (current, size) {
  233. this.queryParam.pageNum = 1
  234. this.queryParam.pageSize = size
  235. this.getList()
  236. },
  237. changeSize (current, pageSize) {
  238. this.queryParam.pageNum = current
  239. this.queryParam.pageSize = pageSize
  240. this.getList()
  241. },
  242. onSelectChange (selectedRowKeys, selectedRows) {
  243. this.selectedRowKeys = selectedRowKeys
  244. this.selectedRows = selectedRows
  245. this.ids = this.selectedRows.map(item => item.id)
  246. this.single = selectedRowKeys.length !== 1
  247. this.multiple = !selectedRowKeys.length
  248. },
  249. toggleAdvanced () {
  250. this.advanced = !this.advanced
  251. },
  252. handleAdd () {
  253. this.showAddModal = true
  254. this.$nextTick(() => (
  255. this.$refs.noticeAddForm.handleAdd()
  256. ))
  257. },
  258. handleUpdate (record) {
  259. this.showEditModal = true
  260. this.$nextTick(() => (
  261. this.$refs.noticeEditForm.handleUpdate(record)
  262. ))
  263. },
  264. handleLive(record) {
  265. const _this = this
  266. getLive(record).then((response) => {
  267. console.log(response)
  268. // 初始话播放器
  269. _this.videoUrl = response.data.url
  270. _this.showLiveModal = true
  271. })
  272. },
  273. // 监听到子组件传过来的播放状态 true是播放 false是暂停
  274. triggerEvent(value) {
  275. console.log('是否播放:', value)
  276. },
  277. // 取消按钮
  278. cancel () {
  279. this.showLiveModal = false
  280. }
  281. }
  282. }
  283. </script>
  284. <style scoped>
  285. .videoPlayer{
  286. height: 100%;
  287. width: 100%;
  288. position: absolute;
  289. left: 10;
  290. top: 18;
  291. z-index: 99;
  292. }
  293. </style>