4670101279
2 years ago
3 changed files with 338 additions and 20 deletions
File diff suppressed because one or more lines are too long
@ -0,0 +1,319 @@
@@ -0,0 +1,319 @@
|
||||
<template> |
||||
<div class="app-container"> |
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
||||
<el-form-item label="设备名" prop="name"> |
||||
<el-input |
||||
v-model="queryParams.name" |
||||
placeholder="请输入设备名" |
||||
clearable |
||||
@keyup.enter.native="handleQuery" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item label="序列号" prop="devsn"> |
||||
<el-input |
||||
v-model="queryParams.devsn" |
||||
placeholder="请输入设备序列号" |
||||
clearable |
||||
@keyup.enter.native="handleQuery" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
|
||||
<el-row :gutter="10" class="mb8"> |
||||
<el-col :span="1.5"> |
||||
<el-button |
||||
type="danger" |
||||
plain |
||||
icon="el-icon-delete" |
||||
size="mini" |
||||
:disabled="multiple" |
||||
@click="handleDelete" |
||||
v-hasPermi="['web:camera:remove']" |
||||
>删除</el-button> |
||||
</el-col> |
||||
<el-col :span="1.5"> |
||||
<el-button |
||||
type="warning" |
||||
plain |
||||
icon="el-icon-download" |
||||
size="mini" |
||||
@click="handleExport" |
||||
v-hasPermi="['web:camera:export']" |
||||
>导出</el-button> |
||||
</el-col> |
||||
<el-col :span="1.5"> |
||||
<el-button |
||||
type="success" |
||||
plain |
||||
icon="el-icon-refresh" |
||||
size="mini" |
||||
@click="register" |
||||
v-hasPermi="['web:camera:reboot']" |
||||
>重启服务</el-button> |
||||
</el-col> |
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
||||
</el-row> |
||||
|
||||
<el-table v-loading="loading" :data="cameraList" @selection-change="handleSelectionChange"> |
||||
<el-table-column type="selection" width="55" align="center" /> |
||||
<el-table-column min-width="60" align="center" label="序号"> |
||||
<template slot-scope="scope"> |
||||
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="设备名" align="center" prop="name" /> |
||||
<el-table-column label="设备ip" align="center" prop="ip" /> |
||||
<el-table-column label="设备序列号" align="center" prop="devsn" /> |
||||
<el-table-column label="首次注册时间" align="center" prop="firstTime" /> |
||||
<el-table-column label="状态" align="center" prop="status"> |
||||
<template slot-scope="scope"> |
||||
<span v-if="scope.row.status == 1"><el-tag type="success">在线</el-tag></span> |
||||
<span v-if="scope.row.status == 0"><el-tag type="info">离线</el-tag></span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
||||
<template slot-scope="scope"> |
||||
<el-button |
||||
size="mini" |
||||
type="text" |
||||
icon="el-icon-search" |
||||
@click="showVideo(scope.row)" |
||||
v-hasPermi="['web:camera:edit']" |
||||
>查看视频</el-button> |
||||
<el-button |
||||
size="mini" |
||||
type="text" |
||||
icon="el-icon-edit" |
||||
@click="handleUpdate(scope.row)" |
||||
v-hasPermi="['web:camera:edit']" |
||||
>修改</el-button> |
||||
<el-button |
||||
size="mini" |
||||
type="text" |
||||
icon="el-icon-refresh" |
||||
@click="reboot(scope.row)" |
||||
v-hasPermi="['web:camera:remove']" |
||||
>重启</el-button> |
||||
<el-button |
||||
size="mini" |
||||
type="text" |
||||
icon="el-icon-delete" |
||||
@click="handleDelete(scope.row)" |
||||
v-hasPermi="['web:camera:remove']" |
||||
>删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
|
||||
<pagination |
||||
v-show="total>0" |
||||
:total="total" |
||||
:page.sync="queryParams.pageNum" |
||||
:limit.sync="queryParams.pageSize" |
||||
@pagination="getList" |
||||
/> |
||||
|
||||
<!-- 添加或修改摄像机对话框 --> |
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> |
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
||||
<el-form-item label="序列号" prop="devsn"> |
||||
<el-input v-model="form.devsn" placeholder="" :disabled="true"/> |
||||
</el-form-item> |
||||
<el-form-item label="设备名" prop="name"> |
||||
<el-input v-model="form.name" placeholder="请输入设备名" /> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
<el-button @click="cancel">取 消</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: "Camera", |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 选中数组 |
||||
ids: [], |
||||
// 非单个禁用 |
||||
single: true, |
||||
// 非多个禁用 |
||||
multiple: true, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 摄像机表格数据 |
||||
cameraList: [], |
||||
// 弹出层标题 |
||||
title: "", |
||||
// 是否显示弹出层 |
||||
open: false, |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNum: 1, |
||||
pageSize: 10, |
||||
name: null, |
||||
ip: null, |
||||
port: null, |
||||
username: null, |
||||
password: null, |
||||
devsn: null, |
||||
status: null |
||||
}, |
||||
// 表单参数 |
||||
form: {}, |
||||
// 表单校验 |
||||
rules: { |
||||
} |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
/** 查询摄像机列表 */ |
||||
async getList() { |
||||
this.loading = true; |
||||
let res = await this.$axiosGet('/web/camera/list',this.queryParams); |
||||
if(res.code === 0){ |
||||
this.cameraList = res.data; |
||||
this.total = res.count; |
||||
} |
||||
this.loading = false; |
||||
}, |
||||
// 取消按钮 |
||||
cancel() { |
||||
this.open = false; |
||||
this.reset(); |
||||
}, |
||||
// 表单重置 |
||||
reset() { |
||||
this.form = { |
||||
id: null, |
||||
name: null, |
||||
ip: null, |
||||
port: null, |
||||
username: null, |
||||
password: null, |
||||
devsn: null, |
||||
status: "0" |
||||
}; |
||||
this.resetForm("form"); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNum = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
// 多选框选中数据 |
||||
handleSelectionChange(selection) { |
||||
this.ids = selection.map(item => item.id) |
||||
this.single = selection.length!==1 |
||||
this.multiple = !selection.length |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.reset(); |
||||
this.open = true; |
||||
this.title = "添加摄像机"; |
||||
}, |
||||
/** 修改按钮操作 */ |
||||
async handleUpdate(row) { |
||||
this.reset(); |
||||
const id = row.id || this.ids |
||||
let res = await this.$axiosGet('/web/camera/info/'+id); |
||||
if(res.code === 0){ |
||||
this.form = res.data; |
||||
this.open = true; |
||||
this.title = "修改"; |
||||
} |
||||
}, |
||||
async reboot(row) { |
||||
const id = row.id; |
||||
const status = row.status; |
||||
if(status != 1){ |
||||
this.$modal.msg("设备未在线"); |
||||
return; |
||||
} |
||||
let res = await this.$axiosGet('/web/camera/reboot/'+id); |
||||
if(res.code === 0){ |
||||
this.$modal.msgSuccess("执行成功"); |
||||
this.getList(); |
||||
} |
||||
}, |
||||
async showVideo(row) { |
||||
const id = row.id |
||||
const status = row.status; |
||||
if(status != 1){ |
||||
this.$modal.msg("设备未在线"); |
||||
return; |
||||
} |
||||
let res = await this.$axiosGet('/web/camera/showVideo/'+id); |
||||
}, |
||||
async register() { |
||||
let res = await this.$axiosGet('/web/camera/register'); |
||||
if(res.code === 0){ |
||||
this.$modal.msgSuccess("执行成功"); |
||||
} |
||||
}, |
||||
async addMethod(){ |
||||
let res = await this.$axiosPost('/web/camera/add',this.form); |
||||
if(res.code === 0){ |
||||
this.$modal.msgSuccess("新增成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
} |
||||
}, |
||||
async editMethod(){ |
||||
let res = await this.$axiosPost('/web/camera/edit',this.form); |
||||
if(res.code === 0){ |
||||
this.$modal.msgSuccess("修改成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
} |
||||
}, |
||||
/** 提交按钮 */ |
||||
submitForm() { |
||||
this.$refs["form"].validate(valid => { |
||||
if (valid) { |
||||
if (this.form.id != null) { |
||||
this.editMethod(); |
||||
} else { |
||||
this.addMethod(); |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
async handleDelete(row) { |
||||
const ids = row.id || this.ids; |
||||
let res = await this.$axiosDelete('/web/camera/delete/'+ids); |
||||
if(res.code === 0){ |
||||
this.$modal.msgSuccess("删除成功"); |
||||
this.getList(); |
||||
} |
||||
}, |
||||
/** 导出按钮操作 */ |
||||
handleExport() { |
||||
this.download('web/camera/export', { |
||||
...this.queryParams |
||||
}, `camera_${new Date().getTime()}.xlsx`) |
||||
} |
||||
} |
||||
}; |
||||
</script> |
Loading…
Reference in new issue