You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
duoji-frontend/src/views/alarmVideos/index.vue

186 lines
5.9 KiB
Vue

<template>
<div class="alarm bg-white">
<div class="ant-advanced-search-form">
<a-form layout="inline" :label-col="labelCol" :wrapper-col="wrapperCol" :form="queryParam">
<a-row :gutter="24">
<a-col :span="5" style="text-align: left">
<a-form-item label="时间">
<a-range-picker @change="onTimeChange" v-model="time"
format="YYYY-MM-DD HH:mm">
<a-icon slot="suffixIcon" type="calendar"/>
</a-range-picker>
</a-form-item>
</a-col>
<a-col :span="19" style="text-align: right">
<a-button type="primary" @click="handleSearch">搜索</a-button>
<a-button style="margin-left: 15px" @click="reset">重置</a-button>
</a-col>
</a-row>
</a-form>
</div>
<a-table
:columns="columns"
:row-key="record => record.id"
:data-source="data"
:pagination="pagination"
@change="handleGetalarmList"
>
<span slot="videoPath1" slot-scope="text">
<a-button type="link" v-if="text.videoPath1" @click="showModel(text.videoPath1)">
查看视频
</a-button>
<span v-else>
--
</span>
</span>
<span slot="videoPath2" slot-scope="text">
<a-button type="link" v-if="text.videoPath2" @click="showModel(text.videoPath2)">
</a-button>
<span v-else>
--
</span>
</span>
</a-table>
<Model
:visible.sync="visible"
:vid.sync="vid"
@close="closeModel"
/>
</div>
</template>
<script>
import Model from "./model.vue"
import {videoUrl} from "@/api/importExcel";
export default {
name: "historyMonitoring",
components: {
// videoPlayer
Model
},
data() {
return {
labelCol: { span: 6 },
wrapperCol: { span: 18 },
queryParam: {},
time:[],
pageNum:1,
pageSize:10,
data: [],
pagination:{
total:0,
defaultPageSize:10, // 默认每页显示数量
showTotal: total => `${total} 条数据`, // 显示总数
showSizeChanger:true, // 显示可改变每页数量
pageSizeOptions: ['10', '20', '30'],
onShowSizeChange:(current, pageSize)=>this.pageSize = pageSize // 改变每页数量时更新显示
},
loading: false,
columns: [
{
title: "时间",
dataIndex: "startTime",
},
{
title: "球机所属巷道 ",
dataIndex: "streetName",
},
{
title: "视频时长",
dataIndex: "timeLength",
},
{
title: "球机1",
// dataIndex: "videoPath1",
scopedSlots: {customRender: 'videoPath1'}
},
{
title: "球机2",
// dataIndex: "videoPath2",
scopedSlots: {customRender: 'videoPath2'}
},
],
visible: false,
vid: ''
};
},
mounted() {
this.handleGetalarmList()
},
methods: {
handleSearch(){
console.log(this.queryParam)
this.handleGetalarmList()
},
handleGetalarmList(pagination) {
console.log(pagination)
if(pagination){
this.pagination.current = pagination.current;
this.pagination.pageSize = pagination.pageSize;
this.pageNum = pagination.current;
this.pageSize = pagination.pageSize;
}
this.request();
},
request() {
this.$api.httpApi.warnList({
data: {
pageNum: this.pageNum,
pageSize: this.pageSize,
...this.queryParam
}
}).then(res => {
const pagination = {...this.pagination};
pagination.total = res.data.total;
this.pagination = pagination;
this.data = res.data.list
}).catch(err => {
});
},
onTimeChange(date, dateString) {
this.handleReset()
console.log(date)
console.log(date[0].format('YYYY-MM-DD HH:mm:ss'))
this.queryParam.startTime = date[0].format('YYYY-MM-DD HH:mm:ss')
this.queryParam.endTime = date[1].format('YYYY-MM-DD HH:mm:ss')
},
handleReset() {
this.queryParam.startTime = ""
this.queryParam.endTime = ""
},
showModel(data) {
this.visible = true
this.vid = videoUrl + data
},
closeModel(visible, data) {
this.visible = visible
this.vid = data
},
reset() {
this.queryParam.startTime = ""
this.queryParam.endTime = ""
this.time = []
this.handleGetalarmList()
},
},
};
</script>
<style lang="scss" scoped>
.alarm {
padding: 24px;
}
.ant-drawer-content-wrapper {
height: auto !important;
}
.ant-drawer-body {
text-align: center;
}
.ant-advanced-search-form .ant-form-item {
display: flex;
width: 100%;
}
</style>