123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296 |
- <template>
- <div>
-
- {{ d.dictLabel }}
- <a-card :bordered="false" class="table-card">
- <advance-table
- :columns="columns"
- :data-source="list"
- title="摄像头管理"
- :loading="loading"
- rowKey="id"
- size="middle"
- tableKey="system-notic-NoticIndex-table"
- @refresh="getList"
- :format-conditions="true"
- :pagination="{
- current: queryParam.pageNum,
- pageSize: queryParam.pageSize,
- total: total,
- showSizeChanger: true,
- showLessItems: true,
- showQuickJumper: true,
- showTotal: (total, range) => `第 ${range[0]}-${range[1]} 条,总计 ${total} 条`,
- onChange: changeSize,
- onShowSizeChange: onSizeChange,
- }"
- >
- <span slot="cameraType" slot-scope="{text, record}">
- <a-tag :color="text | noticeTypeFilter">
- {{ typeFormat(record) }}
- </a-tag>
- </span>
- <span slot="onlineStatus" slot-scope="{text, record}">
- <a-badge :status="Number(record.onlineStatus)===0?'error': 'processing'" :text="statusFormat(record) " />
- </span>
- <span slot="operation" slot-scope="{text, record}">
- <a @click="handleLive(record)" >
- 实时视频
- </a>
- </span>
- </advance-table>
- </a-card>
- <ant-modal
- modalWidth="1000"
- modalHeight="800"
- :visible="showLiveModal"
- modal-title="播放器"
- :adjust-size="true"
- @cancel="cancel"
- >
- <div class="videoPlayer" slot="content">
- <SpeedDial :url="videoUrl" @triggerEvent="triggerEvent" ></SpeedDial>
- </div>
- <template slot="footer">
- <div></div>
- </template>
- </ant-modal>
- </div>
- </template>
- <script>
- import { list, getLive } from '@/api/camera/camera'
- import SpeedDial from '@/views/camera/modules/player'
- import AdvanceTable from '@/components/pt/table/AdvanceTable'
- import AntModal from '@/components/pt/dialog/AntModal'
- export default {
- name: 'Camera',
- components: {
- SpeedDial, AdvanceTable, AntModal
- },
- data () {
- return {
- list: [],
- total: 0,
-
- typeOptions: [],
- statusOptions: [],
- labelCol: { span: 6 },
- wrapperCol: { span: 18 },
- queryParam: {
- pageNum: 1,
- pageSize: 10
- },
- columns: [
- {
- title: '设备号',
- dataIndex: 'deviceSn',
- ellipsis: true,
- width: '10%'
- },
- {
- title: '通道号',
- dataIndex: 'channelNo',
- align: 'center'
- },
- {
- title: '设备名称',
- dataIndex: 'deviceName',
- align: 'center'
- },
- {
- title: '固件版本',
- dataIndex: 'hwVer',
- align: 'center'
- },
- {
- title: '软件版本',
- dataIndex: 'swVer',
- align: 'center'
- },
- {
- title: '设备状态',
- dataIndex: 'onlineStatus',
- scopedSlots: { customRender: 'onlineStatus' },
- align: 'center'
- },
- {
- title: '摄像头类型',
- dataIndex: 'cameraType',
- scopedSlots: { customRender: 'cameraType' }
- },
- {
- title: '设备接入时间',
- dataIndex: 'createTime',
- scopedSlots: { customRender: 'createTime' }
- },
- {
- title: '操作',
- dataIndex: 'operation',
- width: '200',
- scopedSlots: { customRender: 'operation' }
- }
- ],
- showLiveModal: false,
- showEditModal: false,
- videoUrl: ''
- }
- },
- filters: {
- noticeTypeFilter (type) {
- let value = 'blue'
- if (type === 'CF') {
- value = 'orange'
- } else if (type === 'CG') {
- value = 'pink'
- } else if (type === 'CB') {
- value = 'green'
- } else if (type === 'CH') {
- value = 'cyan'
- }
- return value
- }
- },
- created () {
- this.getDicts('sys_camera_status').then(response => {
- this.statusOptions = response.data
- })
- this.getDicts('sys_camera_type').then(response => {
- this.typeOptions = response.data
- })
- this.getList()
- },
- computed: {
- },
- watch: {
- },
- methods: {
-
- getList () {
- this.loading = true
- list(this.queryParam).then(response => {
- this.list = response.data.records
- this.total = response.data.total
- this.loading = false
- }
- )
- },
-
- statusFormat (row) {
- return this.selectDictLabel(this.statusOptions, row.onlineStatus)
- },
-
- typeFormat (row) {
- return this.selectDictLabel(this.typeOptions, row.cameraType)
- },
-
- handleQuery () {
- this.queryParam.pageNum = 1
- this.getList()
- },
-
- resetQuery () {
- this.queryParam = {
- pageNum: 1,
- pageSize: 10
- }
- this.handleQuery()
- },
- onShowSizeChange (current, pageSize) {
- this.queryParam.pageSize = pageSize
- this.getList()
- },
- onSizeChange (current, size) {
- this.queryParam.pageNum = 1
- this.queryParam.pageSize = size
- this.getList()
- },
- changeSize (current, pageSize) {
- this.queryParam.pageNum = current
- this.queryParam.pageSize = pageSize
- this.getList()
- },
- onSelectChange (selectedRowKeys, selectedRows) {
- this.selectedRowKeys = selectedRowKeys
- this.selectedRows = selectedRows
- this.ids = this.selectedRows.map(item => item.id)
- this.single = selectedRowKeys.length !== 1
- this.multiple = !selectedRowKeys.length
- },
- toggleAdvanced () {
- this.advanced = !this.advanced
- },
- handleAdd () {
- this.showAddModal = true
- this.$nextTick(() => (
- this.$refs.noticeAddForm.handleAdd()
- ))
- },
- handleUpdate (record) {
- this.showEditModal = true
- this.$nextTick(() => (
- this.$refs.noticeEditForm.handleUpdate(record)
- ))
- },
- handleLive(record) {
- const _this = this
- getLive(record).then((response) => {
- console.log(response)
-
- _this.videoUrl = response.data.url
- _this.showLiveModal = true
- })
- },
-
- triggerEvent(value) {
- console.log('是否播放:', value)
- },
-
- cancel () {
- this.showLiveModal = false
- }
- }
- }
- </script>
- <style scoped>
- .videoPlayer{
- height: 100%;
- width: 100%;
- position: absolute;
- left: 10;
- top: 18;
- z-index: 99;
- }
- </style>
|