|
|
@ -11,10 +11,11 @@ |
|
|
|
<a-icon type="sync" @click="reNew" ref="reNewBtn" /> |
|
|
|
</p> |
|
|
|
<div class="cameraBox"> |
|
|
|
<!-- 树形控件界面--> |
|
|
|
<!--树形控件界面--> |
|
|
|
<div class="treeBox"> |
|
|
|
<a-input-search style="margin-bottom: 8px" placeholder="搜索" @change="onChange" /> |
|
|
|
<a-tree |
|
|
|
v-model:selectedKeys="selectedKeys" |
|
|
|
:defaultExpandAll="true" |
|
|
|
v-if="gData.length != 0" |
|
|
|
:expanded-keys="expandedKeys" |
|
|
@ -28,7 +29,7 @@ |
|
|
|
> |
|
|
|
</a-tree> |
|
|
|
</div> |
|
|
|
<!-- 菜单界面--> |
|
|
|
<!--菜单界面--> |
|
|
|
<div class="menuBox"> |
|
|
|
<div class="menuTop"> |
|
|
|
<a-button type="primary" @click="add"> 新增 </a-button> |
|
|
@ -48,16 +49,15 @@ |
|
|
|
<a-form-item label="监控点位" class="mustInput" name="siteName"> |
|
|
|
<a-col :span="11"> |
|
|
|
<a-select name="lineNameTemp" v-model:value="lineNameTemp" @change="handleLineChange" :disabled="!changeTag"> |
|
|
|
<a-select-option v-for="(line, i) in lineArr" :key="line.id"> |
|
|
|
<a-select-option v-for="line in lineArr" :key="line.id"> |
|
|
|
{{ line.name }} |
|
|
|
</a-select-option> |
|
|
|
</a-select> |
|
|
|
</a-col> |
|
|
|
|
|
|
|
<a-col :offset="1" :span="12"> |
|
|
|
<a-form-item style="margin-bottom: 0px"> |
|
|
|
<a-select name="siteNameTemp" v-model:value="siteNameTemp" @change="handleSiteChange" :disabled="!changeTag"> |
|
|
|
<a-select-option v-for="(site, i) in siteArr" :key="site.id"> |
|
|
|
<a-select-option v-for="site in siteArr" :key="site.id"> |
|
|
|
{{ site.name }} |
|
|
|
</a-select-option> |
|
|
|
</a-select> |
|
|
@ -70,12 +70,10 @@ |
|
|
|
<a-form-item label="相机IP" class="mustInput" name="ip"> |
|
|
|
<a-input v-model:value="cameraForm.ip" :disabled="!changeTag" /> |
|
|
|
</a-form-item> |
|
|
|
|
|
|
|
<a-form-item label="相机备用IP" class="mustInput" name="ip2"> |
|
|
|
<a-input v-model:value="cameraForm.ip2" :disabled="!changeTag" /> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="相机端口" class="mustInput" name="port"> |
|
|
|
<!-- <a-input v-model="cameraForm.port" type="number" :disabled="!changeTag" /> --> |
|
|
|
<a-input-number v-model:value="cameraForm.port" :disabled="!changeTag" style="width: 100%" /> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="相机认证用户名" class="mustInput" name="user"> |
|
|
@ -85,8 +83,6 @@ |
|
|
|
<a-input-password v-model:value="cameraForm.password" :disabled="!changeTag" /> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="厂家" class="mustInput" name="factory" v-if="cameraFactorys.length > 0"> |
|
|
|
<!-- <j-dict-select-tag v-model:value="cameraForm.factory" placeholder="选择" |
|
|
|
dictCode="ms_camera_factory" :disabled="!changeTag" /> --> |
|
|
|
<!-- 使用antd原生下拉框 --> |
|
|
|
<a-select v-model:value="cameraForm.factory" :disabled="!changeTag"> |
|
|
|
<template :key="Number(cameraFactory.value)" v-for="cameraFactory in cameraFactorys"> |
|
|
@ -94,10 +90,8 @@ |
|
|
|
</template> |
|
|
|
</a-select> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="类型" class="mustInput" name="type"> |
|
|
|
<a-form-item label="相机类型" class="mustInput" name="type"> |
|
|
|
<a-col :span="11"> |
|
|
|
<!-- <j-dict-select-tag name="type" v-model:value="cameraForm.type" placeholder="选择" |
|
|
|
dictCode="ms_camera_type" @change="typeChange" :disabled="!changeTag" /> --> |
|
|
|
<!-- 使用antd原生下拉框 --> |
|
|
|
<a-select name="type" v-model:value="cameraForm.type" :disabled="!changeTag" @change="typeChange"> |
|
|
|
<template :key="Number(cameraType.value)" v-for="cameraType in cameraTypes"> |
|
|
@ -106,10 +100,6 @@ |
|
|
|
</a-select> |
|
|
|
</a-col> |
|
|
|
<a-col :offset="1" :span="12"> |
|
|
|
<!-- <a-form-item style="margin-bottom: 0px;"> |
|
|
|
<j-dict-select-tag name="style" v-model:value="cameraForm.style" placeholder="选择" |
|
|
|
dictCode="ms_camera_style" :disabled="!flag || !changeTag" /> |
|
|
|
</a-form-item> --> |
|
|
|
<!-- 使用antd原生下拉框 --> |
|
|
|
<a-select name="style" v-model:value="cameraForm.style" :disabled="!flag || !changeTag"> |
|
|
|
<template :key="Number(cameraStyle.value)" v-for="cameraStyle in cameraStyles"> |
|
|
@ -118,14 +108,12 @@ |
|
|
|
</a-select> |
|
|
|
</a-col> |
|
|
|
</a-form-item> |
|
|
|
|
|
|
|
<a-form-item label="安装高度" class="mustInput" name="height"> |
|
|
|
<!-- <a-input v-model="cameraForm.height" type="number" :disabled="!changeTag" /> --> |
|
|
|
<a-input-number v-model:value="cameraForm.height" :disabled="!changeTag" style="width: 100%" /> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="录像机" name="videoRecorder"> |
|
|
|
<a-select v-model:value="cameraForm.videoRecorderId" :disabled="!changeTag"> |
|
|
|
<a-select-option v-for="(vr, i) in videoRecorderArr" :value="vr.id" :key="vr.id"> |
|
|
|
<a-select-option v-for="vr in videoRecorderArr" :value="vr.id" :key="vr.id"> |
|
|
|
{{ vr.name }} |
|
|
|
</a-select-option> |
|
|
|
</a-select> |
|
|
@ -160,27 +148,19 @@ |
|
|
|
<a-form-item label="地理纬度" name="latitude"> |
|
|
|
<a-input v-model:value="cameraForm.latitude" disabled /> |
|
|
|
</a-form-item> |
|
|
|
<!-- <a-form-model-item :wrapper-col="{offset:8,span:14}" name="style"> |
|
|
|
<j-dict-select-tag v-model="cameraForm.style" placeholder="选择" dictCode="ms_camera_style"/> |
|
|
|
</a-form-model-item>--> |
|
|
|
<a-form-item label="视线水平左夹角" name="leftAngle"> |
|
|
|
<!-- <a-input v-model="cameraForm.leftAngle" type="number" :disabled="!changeTag" /> --> |
|
|
|
<a-input-number v-model:value="cameraForm.leftAngle" :disabled="!changeTag" style="width: 100%" /> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="视线水平右夹角" name="rightAngle"> |
|
|
|
<!-- <a-input v-model="cameraForm.rightAngle" type="number" :disabled="!changeTag" /> --> |
|
|
|
<a-input-number v-model:value="cameraForm.rightAngle" :disabled="!changeTag" style="width: 100%" /> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="视野中央有效视距" name="viewDistance"> |
|
|
|
<!-- <a-input v-model="cameraForm.viewDistance" type="number" :disabled="!changeTag" /> --> |
|
|
|
<a-input-number v-model:value="cameraForm.viewDistance" :disabled="!changeTag" style="width: 100%" /> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="采样帧率" name="frameRate"> |
|
|
|
<!-- <a-input v-model="cameraForm.frameRate" type="number" :disabled="!changeTag" /> --> |
|
|
|
<a-input-number v-model:value="cameraForm.frameRate" :disabled="!changeTag" style="width: 100%" /> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="最大跟踪范围" name="maxRange"> |
|
|
|
<!-- <a-input v-model="cameraForm.maxRange" type="number" :disabled="!changeTag" /> --> |
|
|
|
<a-input-number v-model:value="cameraForm.maxRange" :disabled="!changeTag" style="width: 100%" /> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="云台控制IP" name="cloudCtrlIp"> |
|
|
@ -190,23 +170,18 @@ |
|
|
|
<a-input v-model:value="cameraForm.cloudCtrlPort" :disabled="!changeTag" /> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="零方位角" name="zeroAzimuth"> |
|
|
|
<!-- <a-input v-model="cameraForm.zeroAzimuth" type="number" :disabled="!changeTag" /> --> |
|
|
|
<a-input-number v-model:value="cameraForm.zeroAzimuth" :disabled="!changeTag" style="width: 100%" /> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="最大仰角" name="maxElevation"> |
|
|
|
<!-- <a-input v-model="cameraForm.maxElevation" type="number" :disabled="!changeTag" /> --> |
|
|
|
<a-input-number v-model:value="cameraForm.maxElevation" :disabled="!changeTag" style="width: 100%" /> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="安装垂直角" name="fixedAngle"> |
|
|
|
<!-- <a-input v-model="cameraForm.fixedAngle" type="number" :disabled="!changeTag" /> --> |
|
|
|
<a-input-number v-model:value="cameraForm.fixedAngle" :disabled="!changeTag" style="width: 100%" /> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="最大可视距离" name="maxVisibleDistance"> |
|
|
|
<!-- <a-input v-model="cameraForm.maxVisibleDistance" type="number" :disabled="!changeTag" /> --> |
|
|
|
<a-input-number v-model:value="cameraForm.maxVisibleDistance" :disabled="!changeTag" style="width: 100%" /> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="变倍因子" name="zoomFactor"> |
|
|
|
<!-- <a-input v-model="cameraForm.zoomFactor" type="number" :disabled="!changeTag" /> --> |
|
|
|
<a-input-number v-model:value="cameraForm.zoomFactor" :disabled="!changeTag" style="width: 100%" /> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="报警持续时间(秒)" name="alarmNum"> |
|
|
@ -250,137 +225,187 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script lang="ts" setup> |
|
|
|
import { ref, reactive, onMounted } from 'vue'; |
|
|
|
import { ref, onMounted } from 'vue'; |
|
|
|
import { useUserStore } from '/@/store/modules/user'; |
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'; |
|
|
|
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue'; |
|
|
|
import axios from 'axios'; |
|
|
|
import { defHttp } from '/@/utils/http/axios'; |
|
|
|
import { Modal } from 'ant-design-vue'; |
|
|
|
|
|
|
|
// 厂家 |
|
|
|
const cameraFactorys: any = ref([]); |
|
|
|
// 类型 |
|
|
|
// 相机类型 |
|
|
|
const cameraTypes: any = ref([]); |
|
|
|
// 相机光照颜色 |
|
|
|
const cameraStyles: any = ref([]); |
|
|
|
|
|
|
|
// 获取场景类型字典 |
|
|
|
// 获取相机厂家 |
|
|
|
const getCameraFactory = () => { |
|
|
|
return defHttp.get({ url: '/sys/dict/getDictItems/ms_camera_factory' }, { isTransformResponse: false }); |
|
|
|
}; |
|
|
|
//获取场景类型字典 |
|
|
|
//获取相机类型 |
|
|
|
const getCameraType = () => { |
|
|
|
return defHttp.get({ url: '/sys/dict/getDictItems/ms_camera_type' }, { isTransformResponse: false }); |
|
|
|
}; |
|
|
|
//获取场景类型字典 |
|
|
|
//获取相机光色 |
|
|
|
const getCameraStyle = () => { |
|
|
|
return defHttp.get({ url: '/sys/dict/getDictItems/ms_camera_style' }, { isTransformResponse: false }); |
|
|
|
}; |
|
|
|
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 6 } }); |
|
|
|
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 18 } }); |
|
|
|
|
|
|
|
// 刷新按钮 |
|
|
|
const reNewBtn = ref(); |
|
|
|
// 当前登录用户信息 |
|
|
|
const userStore = useUserStore(); |
|
|
|
// 消息弹窗 |
|
|
|
const { createMessage } = useMessage(); |
|
|
|
const x = 3; |
|
|
|
const y = 2; |
|
|
|
const z = 1; |
|
|
|
// const gData = [] |
|
|
|
// const dataList = [] |
|
|
|
|
|
|
|
const getParentKey = (key, tree) => { |
|
|
|
let parentKey; |
|
|
|
for (let i = 0; i < tree.length; i++) { |
|
|
|
const node = tree[i]; |
|
|
|
if (node.children) { |
|
|
|
if (node.children.some((item) => item.id === key)) { |
|
|
|
parentKey = node.id; |
|
|
|
} else if (getParentKey(key, node.children)) { |
|
|
|
parentKey = getParentKey(key, node.children); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return parentKey; |
|
|
|
}; |
|
|
|
|
|
|
|
// 展开指定的树节点 |
|
|
|
const expandedKeys: any = ref([]); |
|
|
|
const searchValue = ref(''); |
|
|
|
// 是否自动关闭父节点 |
|
|
|
const autoExpandParent = ref(true); |
|
|
|
// 相机数据 |
|
|
|
const gData: any = ref([]); |
|
|
|
// 相机树结构数据 |
|
|
|
const treeData: any = ref([]); |
|
|
|
// 每一条数据,包括防区、站点、相机 |
|
|
|
const dataList: any = ref([]); |
|
|
|
// 用于替换对应字段名 |
|
|
|
const replaceFields = ref({ |
|
|
|
key: 'id', |
|
|
|
title: 'name', |
|
|
|
children: 'children', |
|
|
|
}); |
|
|
|
const url = ref({ |
|
|
|
// 获取所有相机信息 |
|
|
|
getSiteCameraInfo: '/military/camera/site/getSiteCameraInfo', |
|
|
|
// 根据id获取相机信息 |
|
|
|
getCameraInfoById: '/military/camera/setting/queryById', |
|
|
|
// 添加相机 |
|
|
|
add: '/military/camera/setting/add', |
|
|
|
// 编辑相机 |
|
|
|
edit: '/military/camera/setting/edit', |
|
|
|
// 删除相机 |
|
|
|
delete: '/military/camera/setting/delete', |
|
|
|
// 获取录像机列表 |
|
|
|
getVideoRecorderInfo: '/military/videoRecorder/qryCameraList', |
|
|
|
// 第三方平台接口 |
|
|
|
getVMCameraInfo: '/third/api/getVMCameraInfo', |
|
|
|
}); |
|
|
|
// 监控点位-防区 |
|
|
|
const lineNameTemp = ref(''); |
|
|
|
// 监控点位-站点 |
|
|
|
const siteNameTemp = ref(''); |
|
|
|
// 录像机 |
|
|
|
const vrNameTemp = ref(''); |
|
|
|
// 选择的相机id |
|
|
|
const dataId = ref(''); |
|
|
|
// 取消 |
|
|
|
const cancelFlag = ref(false); |
|
|
|
// 不知道 |
|
|
|
const flag = ref(false); |
|
|
|
// 表单修改状态 |
|
|
|
const changeTag = ref(false); |
|
|
|
// 按钮修改状态 |
|
|
|
const getTag = ref(false); |
|
|
|
// 区分添加/修改 |
|
|
|
const addOrEdit = ref(false); |
|
|
|
// 相机信息表单 |
|
|
|
const cameraForm: any = ref({ |
|
|
|
// 相机id |
|
|
|
id: '', |
|
|
|
// 相机ip |
|
|
|
ip: '', |
|
|
|
// 备用ip |
|
|
|
ip2: '', |
|
|
|
// 相机端口 |
|
|
|
port: '', |
|
|
|
// 厂家 |
|
|
|
factory: '', |
|
|
|
// 相机名称 |
|
|
|
cameraName: '', |
|
|
|
// 相机类型 |
|
|
|
cameraType: '', |
|
|
|
//相机光色 |
|
|
|
style: '', |
|
|
|
// 相机类型 |
|
|
|
type: '', |
|
|
|
// 相机认证用户名 |
|
|
|
user: '', |
|
|
|
siteId: '', |
|
|
|
// 相机认证密码 |
|
|
|
password: '', |
|
|
|
// 相机认证通道号 |
|
|
|
channel: '', |
|
|
|
// 预览rtsp地址 |
|
|
|
preRtsp: '', |
|
|
|
// 分析rtsp地址 |
|
|
|
analysisRtsp: '', |
|
|
|
// 录像rtsp地址 |
|
|
|
recordRtsp: '', |
|
|
|
// 防区名称 |
|
|
|
lineName: '', |
|
|
|
// 站点id |
|
|
|
siteId: '', |
|
|
|
// 站点名称 |
|
|
|
siteName: '', |
|
|
|
// 云台控制ip |
|
|
|
cloudCtrlIp: '', |
|
|
|
// 云台控制端口 |
|
|
|
cloudCtrlPort: '', |
|
|
|
cameraName: '', |
|
|
|
latitude: '', |
|
|
|
// 地理经度 |
|
|
|
longitude: '', |
|
|
|
// 地理纬度 |
|
|
|
latitude: '', |
|
|
|
// 安装高度 |
|
|
|
height: '', |
|
|
|
// 录像机id |
|
|
|
videoRecorderId: '', |
|
|
|
// 录像机名称 |
|
|
|
videoRecorder: '', |
|
|
|
cameraType: '', |
|
|
|
// 相机颜色?? |
|
|
|
cameraColor: '', |
|
|
|
// 视线水平左夹角 |
|
|
|
leftAngle: '', |
|
|
|
// 视线水平右夹角 |
|
|
|
rightAngle: '', |
|
|
|
// 视野中央有效视距 |
|
|
|
viewDistance: '', |
|
|
|
// 采样帧率 |
|
|
|
frameRate: '', |
|
|
|
// 最大跟踪范围 |
|
|
|
maxRange: '', |
|
|
|
// 零方位角 |
|
|
|
zeroAzimuth: '', |
|
|
|
// 最大仰角 |
|
|
|
maxElevation: '', |
|
|
|
// 安装垂直角 |
|
|
|
fixedAngle: '', |
|
|
|
// 最大可视距离 |
|
|
|
maxVisibleDistance: '', |
|
|
|
// 变倍因子 |
|
|
|
zoomFactor: '', |
|
|
|
videoRecorderId: '', |
|
|
|
// 白光开始时间 |
|
|
|
dayBeginTime: '', |
|
|
|
// 白光结束时间 |
|
|
|
dayEndTime: '', |
|
|
|
// 报警持续时间 |
|
|
|
alarmNum: undefined, |
|
|
|
// Web播放地址 |
|
|
|
webcastAddress: '', |
|
|
|
}); |
|
|
|
const lineArr: any = ref([]); //线路数据 |
|
|
|
const siteData: any = ref({}); //线路站点对应关系 |
|
|
|
const siteArr: any = ref([]); //站点数据 |
|
|
|
const videoRecorderArr: any = ref([]); //录像机数据 |
|
|
|
// 防区数据 |
|
|
|
const lineArr: any = ref([]); |
|
|
|
// 防区站点对应关系 |
|
|
|
const siteData: any = ref({}); |
|
|
|
// 站点数据 |
|
|
|
const siteArr: any = ref([]); |
|
|
|
// 录像机数据 |
|
|
|
const videoRecorderArr: any = ref([]); |
|
|
|
// 选中的相机节点 |
|
|
|
const selectedKeys: any = ref([]); |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
dataList.value.length = 0; |
|
|
|
// 获取相机数据 |
|
|
|
getTreeInfo(); |
|
|
|
// 厂家 |
|
|
|
getCameraFactory().then((response) => { |
|
|
@ -388,28 +413,29 @@ |
|
|
|
cameraFactorys.value = response.result; |
|
|
|
} |
|
|
|
}); |
|
|
|
// 类型 |
|
|
|
// 相机类型 |
|
|
|
getCameraType().then((response) => { |
|
|
|
if (response.success) { |
|
|
|
cameraTypes.value = response.result; |
|
|
|
} |
|
|
|
}), |
|
|
|
getCameraStyle().then((response) => { |
|
|
|
if (response.success) { |
|
|
|
cameraStyles.value = response.result; |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
// 相机光色 |
|
|
|
getCameraStyle().then((response) => { |
|
|
|
if (response.success) { |
|
|
|
cameraStyles.value = response.result; |
|
|
|
} |
|
|
|
}); |
|
|
|
// 录像机列表 |
|
|
|
getVideoRecorderArr(); |
|
|
|
}); |
|
|
|
|
|
|
|
// 选择防区 |
|
|
|
function handleLineChange(id) { |
|
|
|
changeSiteArr(id); |
|
|
|
} |
|
|
|
|
|
|
|
// 选择站点 |
|
|
|
function handleSiteChange(id) { |
|
|
|
cameraForm.value.siteId = id; |
|
|
|
} |
|
|
|
|
|
|
|
function changeSiteArr(id) { |
|
|
|
let lineLen = gData.value.length; |
|
|
|
siteArr.value = []; |
|
|
@ -431,17 +457,20 @@ |
|
|
|
cameraForm.value.siteName = siteArr.value[0].name; |
|
|
|
siteNameTemp.value = cameraForm.value.siteName; //改变线路,默认回显该线路的第一个站点 |
|
|
|
} |
|
|
|
|
|
|
|
// 新增相机 |
|
|
|
function add() { |
|
|
|
addOrEdit.value = true; |
|
|
|
cancelFlag.value = true; |
|
|
|
changeTag.value = true; |
|
|
|
getTag.value = false; |
|
|
|
dataId.value = ''; |
|
|
|
// 清空树选中节点 |
|
|
|
selectedKeys.value = []; |
|
|
|
fromClear(); |
|
|
|
} |
|
|
|
|
|
|
|
// 编辑相机 |
|
|
|
function edit() { |
|
|
|
// 只有光电追踪仪和枪机有不同色光 |
|
|
|
if (cameraForm.value.type == '1' || cameraForm.value.type == '3') { |
|
|
|
flag.value = true; |
|
|
|
} else { |
|
|
@ -450,7 +479,6 @@ |
|
|
|
} |
|
|
|
|
|
|
|
if (cameraForm.value.id == '') { |
|
|
|
// this.$message.info("请先选择需要修改的数据!"); |
|
|
|
createMessage.info('请先选择需要修改的数据!'); |
|
|
|
return false; |
|
|
|
} |
|
|
@ -458,7 +486,7 @@ |
|
|
|
addOrEdit.value = true; |
|
|
|
changeTag.value = true; |
|
|
|
} |
|
|
|
|
|
|
|
// 删除相机 |
|
|
|
function del() { |
|
|
|
Modal.confirm({ |
|
|
|
title: '确认删除', |
|
|
@ -472,11 +500,12 @@ |
|
|
|
}, |
|
|
|
{ joinParamsToUrl: true, isTransformResponse: false } |
|
|
|
) |
|
|
|
// deleteAction(that.url.delete, {id: that.cameraForm.id}) |
|
|
|
.then((res) => { |
|
|
|
if (res.success) { |
|
|
|
createMessage.success(res.message); |
|
|
|
// 置空表单 |
|
|
|
fromClear(); |
|
|
|
// 重新获取相机数据 |
|
|
|
getTreeInfo(); |
|
|
|
getTag.value = false; |
|
|
|
} else { |
|
|
@ -489,11 +518,11 @@ |
|
|
|
}, |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// 提交表单数据 |
|
|
|
function submitForm() { |
|
|
|
// ip校验规则 |
|
|
|
const pattern = |
|
|
|
/(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)/; |
|
|
|
let settingId = cameraForm.value.id; |
|
|
|
let cloudCtrlIp = cameraForm.value.cloudCtrlIp; |
|
|
|
let cloudCtrlPort = cameraForm.value.cloudCtrlPort; |
|
|
|
let cameraName = cameraForm.value.cameraName; |
|
|
@ -563,6 +592,7 @@ |
|
|
|
}, |
|
|
|
]; |
|
|
|
let errorMessage = ''; |
|
|
|
// 错误信息拼接 |
|
|
|
if (!cameraName || !siteName || !port || !user || !password || !height || !type || !factory || !ip || !ip2) { |
|
|
|
for (const flag of flagList) { |
|
|
|
if (!flag.code) { |
|
|
@ -576,10 +606,7 @@ |
|
|
|
createMessage.warning('请检查IP格式并正确填写!'); |
|
|
|
return; |
|
|
|
} |
|
|
|
// else if (!pattern.test(this.cameraForm.cloudCtrlIp)){ |
|
|
|
// this.$message.warning("请正确填写云台IP!"); |
|
|
|
// return |
|
|
|
// } |
|
|
|
// 未输入时将赋值为0 |
|
|
|
cameraForm.value.channel = channel ? channel : '0'; |
|
|
|
cameraForm.value.leftAngle = leftAngle ? leftAngle : '0'; |
|
|
|
cameraForm.value.rightAngle = rightAngle ? rightAngle : '0'; |
|
|
@ -593,17 +620,15 @@ |
|
|
|
cameraForm.value.zoomFactor = zoomFactor ? zoomFactor : '0'; |
|
|
|
cameraForm.value.cloudCtrlIp = cloudCtrlIp ? cloudCtrlIp : ip; |
|
|
|
cameraForm.value.cloudCtrlPort = cloudCtrlPort ? cloudCtrlPort : port; |
|
|
|
console.log(cameraForm.value.style); |
|
|
|
cameraForm.value.style = style ? style : ''; |
|
|
|
console.log(cameraForm.value.style); |
|
|
|
let http; |
|
|
|
if (addOrEdit.value) { |
|
|
|
let httpurl = ''; |
|
|
|
let method = ''; |
|
|
|
// 无选中相机,则添加相机 |
|
|
|
if (!cameraForm.value.id) { |
|
|
|
httpurl += url.value.add; |
|
|
|
method = 'post'; |
|
|
|
console.log(cameraForm.value.style); |
|
|
|
http = defHttp.post( |
|
|
|
{ |
|
|
|
url: httpurl, |
|
|
@ -612,9 +637,9 @@ |
|
|
|
{ isTransformResponse: false } |
|
|
|
); |
|
|
|
} else { |
|
|
|
// 有选中相机,则编辑相机 |
|
|
|
httpurl += url.value.edit; |
|
|
|
method = 'put'; |
|
|
|
console.log(cameraForm.value.style); |
|
|
|
http = defHttp.put( |
|
|
|
{ |
|
|
|
url: httpurl, |
|
|
@ -623,21 +648,21 @@ |
|
|
|
{ isTransformResponse: false } |
|
|
|
); |
|
|
|
} |
|
|
|
http |
|
|
|
// httpAction(httpurl, cameraForm.value, method) |
|
|
|
.then((res) => { |
|
|
|
let success_message = cameraForm.value.id ? '修改成功' : '添加成功'; |
|
|
|
let error_message = cameraForm.value.id ? '修改失败' : '添加失败'; |
|
|
|
if (res.success) { |
|
|
|
createMessage.success(success_message); |
|
|
|
cameraForm.value = res.result; |
|
|
|
getTreeInfo(); |
|
|
|
// fromClear(); |
|
|
|
} else { |
|
|
|
console.log(res); |
|
|
|
createMessage.warning(error_message); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 添加或编辑相机 |
|
|
|
http.then((res) => { |
|
|
|
let success_message = cameraForm.value.id ? '修改成功' : '添加成功'; |
|
|
|
let error_message = cameraForm.value.id ? '修改失败' : '添加失败'; |
|
|
|
// 添加或编辑完成 |
|
|
|
if (res.success) { |
|
|
|
createMessage.success(success_message); |
|
|
|
// 重新赋值表单 |
|
|
|
cameraForm.value = res.result; |
|
|
|
// 重新获取相机 |
|
|
|
getTreeInfo(); |
|
|
|
} else { |
|
|
|
createMessage.warning(error_message); |
|
|
|
} |
|
|
|
}); |
|
|
|
cancelFlag.value = false; |
|
|
|
addOrEdit.value = false; |
|
|
|
changeTag.value = false; |
|
|
@ -645,14 +670,8 @@ |
|
|
|
flag.value = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function selectSite(item, option) { |
|
|
|
let siteId = option.key; |
|
|
|
cameraForm.value.siteId = siteId; |
|
|
|
} |
|
|
|
|
|
|
|
// 选择相机类型 |
|
|
|
function typeChange(item) { |
|
|
|
console.log(item); |
|
|
|
if (item == '1' || item == '3') { |
|
|
|
flag.value = true; |
|
|
|
} else { |
|
|
@ -660,17 +679,15 @@ |
|
|
|
flag.value = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function onSelect(selectedKeys, info) { |
|
|
|
console.log(selectedKeys); |
|
|
|
// 选择相机 |
|
|
|
function onSelect(selectedKeys, _info) { |
|
|
|
fromClear(); |
|
|
|
addOrEdit.value = false; |
|
|
|
cancelFlag.value = false; |
|
|
|
changeTag.value = false; |
|
|
|
// 选中相机 |
|
|
|
dataId.value = selectedKeys[0]; |
|
|
|
// console.log(selectedKeys,info); |
|
|
|
|
|
|
|
selectedKeys = selectedKeys; |
|
|
|
let gDataLen = gData.value.length; |
|
|
|
getTag.value = false; |
|
|
|
for (let i = 0; i < gDataLen; i++) { |
|
|
@ -679,8 +696,6 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
//请求相机数据 |
|
|
|
console.log('dataId.value', dataId.value); |
|
|
|
|
|
|
|
defHttp |
|
|
|
.get( |
|
|
|
{ |
|
|
@ -689,9 +704,7 @@ |
|
|
|
}, |
|
|
|
{ isTransformResponse: false } |
|
|
|
) |
|
|
|
// getAction(this.url.getCameraInfoById + "?id=" + this.dataId) |
|
|
|
.then((res) => { |
|
|
|
console.log(res); |
|
|
|
if (res.success) { |
|
|
|
getTag.value = true; |
|
|
|
cameraForm.value = res.result; |
|
|
@ -701,67 +714,68 @@ |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取相机数据 |
|
|
|
function getTreeInfo() { |
|
|
|
defHttp |
|
|
|
.get( |
|
|
|
{ |
|
|
|
url: url.value.getSiteCameraInfo, |
|
|
|
// params: model.value |
|
|
|
}, |
|
|
|
{ isTransformResponse: false } |
|
|
|
) |
|
|
|
// httpAction(this.url.getSiteCameraInfo, this.model, 'get') |
|
|
|
.then((res) => { |
|
|
|
if (res.success) { |
|
|
|
gData.value = res.result; |
|
|
|
treeData.value = gData.value; |
|
|
|
// console.log("treeData",treeData.value); |
|
|
|
|
|
|
|
treeData.value = handleCameraTree(res.result); |
|
|
|
generateList(gData.value); |
|
|
|
lineArr.value = []; |
|
|
|
initLineArr(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// 处理相机数据 |
|
|
|
function handleCameraTree(data, _index = undefined) { |
|
|
|
let arr: any = []; |
|
|
|
for (let i = 0; i < data.length; i++) { |
|
|
|
let obj: any = {}; |
|
|
|
let item = data[i]; |
|
|
|
obj.name = item.name; |
|
|
|
obj.id = item.id; |
|
|
|
obj.disabled = item.children?.length > 0 ? true : false; |
|
|
|
if (item.children && item.children.length > 0) { |
|
|
|
obj.children = handleCameraTree(item.children); |
|
|
|
} |
|
|
|
arr.push(obj); |
|
|
|
} |
|
|
|
return arr; |
|
|
|
} |
|
|
|
// 展开/收起节点时触发 |
|
|
|
function onExpand(onExpandedKeys) { |
|
|
|
expandedKeys.value = onExpandedKeys; |
|
|
|
autoExpandParent.value = false; |
|
|
|
} |
|
|
|
|
|
|
|
// 搜索相机 |
|
|
|
function onChange(e) { |
|
|
|
let time = null; |
|
|
|
const value = e.target.value; |
|
|
|
treeData.value = []; |
|
|
|
// console.log(time) |
|
|
|
const expandedKeys = dataList.value.map((item) => { |
|
|
|
dataList.value.map((item) => { |
|
|
|
if (value) { |
|
|
|
if (item.title.indexOf(value) > -1) { |
|
|
|
console.log(item); |
|
|
|
|
|
|
|
treeData.value.push({ |
|
|
|
children: [], |
|
|
|
id: item.key, |
|
|
|
name: item.title, |
|
|
|
disabled: item.children?.length > 0 ? true : false, |
|
|
|
}); |
|
|
|
// treeData.value = gData.value |
|
|
|
} |
|
|
|
} else { |
|
|
|
treeData.value = gData.value; |
|
|
|
treeData.value = handleCameraTree(gData.value); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
// Object.assign(this, { |
|
|
|
// expandedKeys, |
|
|
|
// searchValue: value, |
|
|
|
// autoExpandParent: true |
|
|
|
// }) |
|
|
|
} |
|
|
|
|
|
|
|
// 将树结构展开,每个节点都变成同级 |
|
|
|
function generateList(data) { |
|
|
|
// dataList.length=0 |
|
|
|
// console.log(dataList) |
|
|
|
for (let i = 0; i < data.length; i++) { |
|
|
|
const node: any = data[i]; |
|
|
|
const key = node.name; |
|
|
@ -771,7 +785,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 防区列表 |
|
|
|
function initLineArr() { |
|
|
|
let lineLen = gData.value.length; |
|
|
|
for (let i = 0; i < lineLen; i++) { |
|
|
@ -779,12 +793,9 @@ |
|
|
|
lineArr.value.push({ id: lineData.id, name: lineData.name }); |
|
|
|
} |
|
|
|
} |
|
|
|
// 取消编辑/新增 |
|
|
|
function cancel() { |
|
|
|
// fromClear() |
|
|
|
|
|
|
|
let mycameraForm = cameraForm.value; |
|
|
|
if (!getTag.value) { |
|
|
|
// this.getTag = false; |
|
|
|
cameraForm.value.id = ''; |
|
|
|
cameraForm.value.ip = ''; |
|
|
|
cameraForm.value.ip2 = ''; |
|
|
@ -839,7 +850,6 @@ |
|
|
|
}, |
|
|
|
{ isTransformResponse: false } |
|
|
|
) |
|
|
|
// getAction(this.url.getCameraInfoById + "?id=" + that.dataId) |
|
|
|
.then((res) => { |
|
|
|
if (res.success) { |
|
|
|
getTag.value = true; |
|
|
@ -854,6 +864,7 @@ |
|
|
|
cancelFlag.value = false; |
|
|
|
addOrEdit.value = false; |
|
|
|
} |
|
|
|
// 重置表单 |
|
|
|
function fromReset() { |
|
|
|
if (dataId.value) { |
|
|
|
defHttp |
|
|
@ -864,7 +875,6 @@ |
|
|
|
}, |
|
|
|
{ isTransformResponse: false } |
|
|
|
) |
|
|
|
// getAction(this.url.getCameraInfoById + "?id=" + that.dataId) |
|
|
|
.then((res) => { |
|
|
|
if (res.success) { |
|
|
|
getTag.value = true; |
|
|
@ -878,8 +888,8 @@ |
|
|
|
fromClear(); |
|
|
|
} |
|
|
|
} |
|
|
|
// 清空表单 |
|
|
|
function fromClear() { |
|
|
|
// let cameraForm = cameraForm.value; |
|
|
|
dataId.value = ''; |
|
|
|
cameraForm.value.id = ''; |
|
|
|
cameraForm.value.ip = ''; |
|
|
@ -927,6 +937,7 @@ |
|
|
|
siteNameTemp.value = ''; |
|
|
|
vrNameTemp.value = ''; |
|
|
|
} |
|
|
|
// 获取录像机列表 |
|
|
|
function getVideoRecorderArr() { |
|
|
|
defHttp |
|
|
|
.get( |
|
|
@ -935,18 +946,15 @@ |
|
|
|
}, |
|
|
|
{ isTransformResponse: false } |
|
|
|
) |
|
|
|
// getAction(this.url.getVideoRecorderInfo) |
|
|
|
.then((res) => { |
|
|
|
if (res.success) { |
|
|
|
res.result.forEach((data, index) => { |
|
|
|
res.result.forEach((data, _index) => { |
|
|
|
videoRecorderArr.value.push({ id: data.id, name: data.deviceName }); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
function videoRecorderChange(id) { |
|
|
|
cameraForm.value.videoRecorderId = id; |
|
|
|
} |
|
|
|
// 刷新列表 |
|
|
|
function reNew() { |
|
|
|
reNewBtn.value.spin = true; |
|
|
|
defHttp |
|
|
@ -956,7 +964,6 @@ |
|
|
|
}, |
|
|
|
{ isTransformResponse: false } |
|
|
|
) |
|
|
|
// getAction(this.url.getVMCameraInfo) |
|
|
|
.then((res) => { |
|
|
|
if (res.success) { |
|
|
|
createMessage.success('相机列表更新成功!'); |
|
|
@ -1030,7 +1037,7 @@ |
|
|
|
color: red; |
|
|
|
position: absolute; |
|
|
|
top: 6px; |
|
|
|
left: -8px; |
|
|
|
left: 4px; |
|
|
|
} |
|
|
|
|
|
|
|
.timePeriodDelimiter { |
|
|
|