|
@@ -2,7 +2,7 @@
|
|
<template>
|
|
<template>
|
|
<div class="CameraManagement">
|
|
<div class="CameraManagement">
|
|
<el-row :gutter="20">
|
|
<el-row :gutter="20">
|
|
- <el-col :span="2">
|
|
|
|
|
|
+ <!-- <el-col :span="2">
|
|
<span style="line-height:32px;">工具栏:</span>
|
|
<span style="line-height:32px;">工具栏:</span>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
@@ -14,12 +14,12 @@
|
|
>
|
|
>
|
|
<el-button slot="append" icon="el-icon-search" @click="getDeviceList"></el-button>
|
|
<el-button slot="append" icon="el-icon-search" @click="getDeviceList"></el-button>
|
|
</el-input>
|
|
</el-input>
|
|
- </el-col>
|
|
|
|
|
|
+ </el-col> -->
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
<el-button @click="add" type="primary" icon="el-icon-document-add">新建</el-button>
|
|
<el-button @click="add" type="primary" icon="el-icon-document-add">新建</el-button>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
- <hr style="border-top: 2px solid #eee;margin: 10px 0;">
|
|
|
|
|
|
+ <hr style="border-top: 2px solid #eee;margin: 10px 0;" />
|
|
<el-row>
|
|
<el-row>
|
|
<el-table :data="deviceList">
|
|
<el-table :data="deviceList">
|
|
<el-table-column prop="id" label="序号" width="120px"></el-table-column>
|
|
<el-table-column prop="id" label="序号" width="120px"></el-table-column>
|
|
@@ -27,8 +27,7 @@
|
|
<el-table-column prop="deviceNo" label="MAC/SN"></el-table-column>
|
|
<el-table-column prop="deviceNo" label="MAC/SN"></el-table-column>
|
|
<el-table-column prop="sVer" label="软件版本"></el-table-column>
|
|
<el-table-column prop="sVer" label="软件版本"></el-table-column>
|
|
<el-table-column prop="hVer" label="硬件版本"></el-table-column>
|
|
<el-table-column prop="hVer" label="硬件版本"></el-table-column>
|
|
- <el-table-column prop="meta.period" label="数据频率"></el-table-column>
|
|
|
|
- <el-table-column prop="status" label="在线状态"></el-table-column>
|
|
|
|
|
|
+ <el-table-column prop="status" label="摄像头状态"></el-table-column>
|
|
<el-table-column prop="description" label="描述"></el-table-column>
|
|
<el-table-column prop="description" label="描述"></el-table-column>
|
|
<el-table-column label="最后一次">
|
|
<el-table-column label="最后一次">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
@@ -60,12 +59,17 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="设备类型:">
|
|
<el-form-item label="设备类型:">
|
|
- <cascader
|
|
|
|
|
|
+ <el-cascader
|
|
:options="cameraInfoTree"
|
|
:options="cameraInfoTree"
|
|
- @expand-change="expandChange"
|
|
|
|
- @change="change"
|
|
|
|
- :props="{ children: 'childs', label: 'nodeName' ,value:'id'}"
|
|
|
|
- ></cascader>
|
|
|
|
|
|
+ :props="{ checkStrictly: true, children: 'childs', label: 'nodeName' ,value:'id'}"
|
|
|
|
+ v-model="formData.categoryId"
|
|
|
|
+ clearable
|
|
|
|
+ >
|
|
|
|
+ <template slot-scope="{ node, data }">
|
|
|
|
+ <span>{{ data.nodeName }}</span>
|
|
|
|
+ <span v-if="!node.isLeaf">({{ data.childs.length }})</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-cascader>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="设备序列号:" prop="deviceNo">
|
|
<el-form-item label="设备序列号:" prop="deviceNo">
|
|
@@ -162,26 +166,23 @@ const rules = {
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "CameraManagement",
|
|
name: "CameraManagement",
|
|
- components: { rtspPlayer, cascader },
|
|
|
|
|
|
+ components: { rtspPlayer },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
id: "",
|
|
id: "",
|
|
cameraInfoTree: [],
|
|
cameraInfoTree: [],
|
|
deviceList: [],
|
|
deviceList: [],
|
|
isShowDialog: false,
|
|
isShowDialog: false,
|
|
- searchParams: "",
|
|
|
|
formData: {
|
|
formData: {
|
|
name: "",
|
|
name: "",
|
|
- categoryId: "",
|
|
|
|
|
|
+ categoryId: [],
|
|
deviceNo: "",
|
|
deviceNo: "",
|
|
status: "",
|
|
status: "",
|
|
sVer: "",
|
|
sVer: "",
|
|
hVer: "",
|
|
hVer: "",
|
|
description: ""
|
|
description: ""
|
|
},
|
|
},
|
|
- meta: [
|
|
|
|
- { rtsp: "", ws: "" }
|
|
|
|
- ],
|
|
|
|
|
|
+ meta: [{ rtsp: "", ws: "" }],
|
|
isShowVideo: false,
|
|
isShowVideo: false,
|
|
videoData: {
|
|
videoData: {
|
|
title: null,
|
|
title: null,
|
|
@@ -202,9 +203,7 @@ export default {
|
|
submitForm(formName) {
|
|
submitForm(formName) {
|
|
this.$refs[formName].validate(valid => {
|
|
this.$refs[formName].validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
-
|
|
|
|
- console.log(this.formData);
|
|
|
|
- this.save()
|
|
|
|
|
|
+ this.save();
|
|
} else {
|
|
} else {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
@@ -215,9 +214,9 @@ export default {
|
|
this.fetch({
|
|
this.fetch({
|
|
api: "/publics/treenode/getTreeByCode",
|
|
api: "/publics/treenode/getTreeByCode",
|
|
method: "POST",
|
|
method: "POST",
|
|
- data: { code }, //目前只有一个组织,其他参数调整钟
|
|
|
|
|
|
+ data: { code }, //目前只有一个组织,其他参数调整钟
|
|
success: res => {
|
|
success: res => {
|
|
- this.id = res.id
|
|
|
|
|
|
+ this.id = res.id;
|
|
this.getDeviceList(res.id);
|
|
this.getDeviceList(res.id);
|
|
this.getCameraList(res.id);
|
|
this.getCameraList(res.id);
|
|
},
|
|
},
|
|
@@ -236,7 +235,7 @@ export default {
|
|
},
|
|
},
|
|
getDeviceList(categoryId) {
|
|
getDeviceList(categoryId) {
|
|
this.fetch({
|
|
this.fetch({
|
|
- api: "/device/list",
|
|
|
|
|
|
+ api: "/device/device/list",
|
|
method: "POST",
|
|
method: "POST",
|
|
data: { categoryId }, //目前只有一个组织,其他参数调整钟 732971735112749056
|
|
data: { categoryId }, //目前只有一个组织,其他参数调整钟 732971735112749056
|
|
success: res => {
|
|
success: res => {
|
|
@@ -273,16 +272,44 @@ export default {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- // 选择改变
|
|
|
|
- expandChange(value) {
|
|
|
|
- console.log(value);
|
|
|
|
- this.formData.categoryId = value[value.length-1];
|
|
|
|
|
|
+ // 编辑的保存按钮
|
|
|
|
+ save() {
|
|
|
|
+ this.formData.meta = { channel: JSON.stringify(this.meta) };
|
|
|
|
+ let categoryId = this.formData.categoryId
|
|
|
|
+ if( categoryId instanceof Array ){
|
|
|
|
+ this.formData.categoryId = categoryId[categoryId.length-1]
|
|
|
|
+ }
|
|
|
|
+ let api = this.isAdd ? "/device/device/add" : "/device/device/update";
|
|
|
|
+ this.fetch({
|
|
|
|
+ api,
|
|
|
|
+ data: this.formData,
|
|
|
|
+ success: res => {
|
|
|
|
+ this.getDeviceList(this.id); //重新加载
|
|
|
|
+ // this.isShowDialog = false;
|
|
|
|
+ this.$message.success(this.isAdd?"添加摄像头数据成功!":"修改摄像头数据成功!")
|
|
|
|
+ },
|
|
|
|
+ fail: err => {
|
|
|
|
+ console.log(err);
|
|
|
|
+ if (err.errMsg) this.$message.error(err.errMsg);
|
|
|
|
+ else this.$message.error("服务器发生异常");
|
|
|
|
+ }
|
|
|
|
+ });
|
|
},
|
|
},
|
|
- change(value) {
|
|
|
|
- console.log(value);
|
|
|
|
- this.formData.categoryId = value[value.length-1];
|
|
|
|
|
|
+ // 请求删除
|
|
|
|
+ reqDelete(id) {
|
|
|
|
+ this.fetch({
|
|
|
|
+ api: "/device/delete",
|
|
|
|
+ data: { id },
|
|
|
|
+ success: res => {
|
|
|
|
+ this.getDeviceList(this.id); //重新加载
|
|
|
|
+ },
|
|
|
|
+ fail: err => {
|
|
|
|
+ console.log(err);
|
|
|
|
+ if (err.errMsg) this.$message.error(err.errMsg);
|
|
|
|
+ else this.$message.error("服务器发生异常");
|
|
|
|
+ }
|
|
|
|
+ });
|
|
},
|
|
},
|
|
-
|
|
|
|
add() {
|
|
add() {
|
|
this.isAdd = true;
|
|
this.isAdd = true;
|
|
// this.formData = {
|
|
// this.formData = {
|
|
@@ -316,31 +343,16 @@ export default {
|
|
edit(row) {
|
|
edit(row) {
|
|
console.log(row);
|
|
console.log(row);
|
|
this.isAdd = false;
|
|
this.isAdd = false;
|
|
- // 判断是为了重复点击不会重复格式化
|
|
|
|
- if (typeof row.meta == "object") {
|
|
|
|
- row.meta = JSON.stringify(row.meta, null, 4);
|
|
|
|
- }
|
|
|
|
- // orgId: 1,
|
|
|
|
- // name: "",
|
|
|
|
- // categoryId: null,
|
|
|
|
- // deviceNo: "",
|
|
|
|
- // description: "",
|
|
|
|
- // meta: ""
|
|
|
|
-
|
|
|
|
- if (this.formData.id) {
|
|
|
|
- delete this.formData.id;
|
|
|
|
- delete this.formData.name;
|
|
|
|
- delete this.formData.categoryId;
|
|
|
|
- delete this.formData.deviceNo;
|
|
|
|
- delete this.formData.meta;
|
|
|
|
- delete this.formData.description;
|
|
|
|
- }
|
|
|
|
- this.formData = Object.assign({}, this.formData, row);
|
|
|
|
this.isShowDialog = true;
|
|
this.isShowDialog = true;
|
|
|
|
+ this.formData = row;
|
|
|
|
+ this.meta = JSON.parse(row.meta.channel);
|
|
|
|
+ console.log(row.categoryId)
|
|
|
|
+ this.createArr(row.categoryId)
|
|
},
|
|
},
|
|
// 删除
|
|
// 删除
|
|
del(row) {
|
|
del(row) {
|
|
console.log(row);
|
|
console.log(row);
|
|
|
|
+ this.reqDelete(row.id);
|
|
},
|
|
},
|
|
// 子设备管理
|
|
// 子设备管理
|
|
subDeviceAdmin(row) {
|
|
subDeviceAdmin(row) {
|
|
@@ -349,34 +361,39 @@ export default {
|
|
query: row
|
|
query: row
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- // 编辑的保存按钮
|
|
|
|
- save() {
|
|
|
|
- this.formData.meta = {channel:JSON.stringify(this.meta)}
|
|
|
|
- let api = this.isAdd
|
|
|
|
- ? "/device/add"
|
|
|
|
- : "/device/update";
|
|
|
|
- this.fetch({
|
|
|
|
- api,
|
|
|
|
- data: this.formData,
|
|
|
|
- success: res => {
|
|
|
|
- this.getDeviceList(this.id); //重新加载
|
|
|
|
- // this.isShowDialog = false;
|
|
|
|
- },
|
|
|
|
- fail: err => {
|
|
|
|
- console.log(err);
|
|
|
|
- if (err.errMsg) this.$message.error(err.errMsg);
|
|
|
|
- else this.$message.error("服务器发生异常");
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
|
|
+
|
|
// 配置项增加
|
|
// 配置项增加
|
|
plus() {
|
|
plus() {
|
|
- this.meta.push({ rtsp: "", ws: "" })
|
|
|
|
|
|
+ this.meta.push({ rtsp: "", ws: "" });
|
|
},
|
|
},
|
|
// 配置项减少
|
|
// 配置项减少
|
|
minus() {
|
|
minus() {
|
|
if (this.meta.length <= 1) return;
|
|
if (this.meta.length <= 1) return;
|
|
- this.meta.splice(this.meta.length-1,1)
|
|
|
|
|
|
+ this.meta.splice(this.meta.length - 1, 1);
|
|
|
|
+ },
|
|
|
|
+ // 传入一个id 生成树( cameraInfoTree )的id数组
|
|
|
|
+ createArr(id) {
|
|
|
|
+ let tree = this.cameraInfoTree
|
|
|
|
+ let tmpArr = []
|
|
|
|
+
|
|
|
|
+ recursion(tree)
|
|
|
|
+ function recursion(tree) {
|
|
|
|
+ // debugger
|
|
|
|
+ tree.forEach(item => {
|
|
|
|
+ if(item.id == id) {
|
|
|
|
+ tmpArr.push(item.id)
|
|
|
|
+ return
|
|
|
|
+ } else {
|
|
|
|
+ if(item.childs && item.childs.length>0) {
|
|
|
|
+ tmpArr.push(item.id)
|
|
|
|
+ recursion(item.childs)
|
|
|
|
+ } else {
|
|
|
|
+ tmpArr = []
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ console.log(tmpArr)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -390,5 +407,4 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
</style>
|
|
</style>
|