|
|
@ -8,7 +8,7 @@ |
|
|
|
ref="cameraTree" |
|
|
|
v-model:value="formData.cameraId" |
|
|
|
allow-clear |
|
|
|
:treeData="cameraList" |
|
|
|
:treeData="nodeTree" |
|
|
|
:disabled="disabled" |
|
|
|
placeholder="请选择监控相机" |
|
|
|
> |
|
|
@ -60,16 +60,15 @@ |
|
|
|
<a-textarea v-model:value="formData.drawdata" :rows="4" placeholder="请输入画图数据" :disabled="disabled"></a-textarea> |
|
|
|
</a-form-item> |
|
|
|
</a-col> |
|
|
|
<a-col :span="24"> |
|
|
|
<!-- <a-col :span="24"> |
|
|
|
<a-form-item label="所属场景" v-bind="validateInfos.sceneId" name="sceneId"> |
|
|
|
<!-- <a-input v-model:value="formData.sceneId" placeholder="请输入所属场景" :disabled="disabled"></a-input> --> |
|
|
|
<a-select v-model:value="formData.sceneId" placeholder="请选择所属场景" :disabled="disabled"> |
|
|
|
<template :key="code.sceneId" v-for="code in sceneCodeList"> |
|
|
|
<a-select-option :value="code.sceneId">{{ code.sceneName }}</a-select-option> |
|
|
|
</template> |
|
|
|
</a-select> |
|
|
|
</a-form-item> |
|
|
|
</a-col> |
|
|
|
</a-col> --> |
|
|
|
<!-- <a-col :span="24"> |
|
|
|
<a-form-item label="备注" v-bind="validateInfos.remark"> |
|
|
|
<a-input v-model:value="formData.remark" placeholder="请输入备注" :disabled="disabled"></a-input> |
|
|
@ -108,6 +107,62 @@ |
|
|
|
import type { Rule } from 'ant-design-vue/es/form'; |
|
|
|
// 引入视频标注组件 |
|
|
|
import SelectCom from '../selectCom/SelectCom.vue'; |
|
|
|
// 登录用户信息 |
|
|
|
import { useUserStore } from '/@/store/modules/user'; |
|
|
|
const userStore = useUserStore(); |
|
|
|
// 获取当前权限下的sys_org_code |
|
|
|
const orgCode = 'A01'; |
|
|
|
// 防区列表 |
|
|
|
const areaList: any = []; |
|
|
|
// 站点列表 |
|
|
|
const stationList: any = []; |
|
|
|
// 相机列表 |
|
|
|
const newCameraList: any = []; |
|
|
|
// 获取当前场景下所有防区 |
|
|
|
function getCurrentSceneArea() { |
|
|
|
return defHttp.get({ url: '/military/msMapLine/list', params: { sysOrgCode: orgCode } }, { isTransformResponse: false }); |
|
|
|
} |
|
|
|
// 获取当前防区下的所有站点 |
|
|
|
function getCurrentAreaStation() { |
|
|
|
return defHttp.get({ url: '/military/camera/site/list', params: { pageNo: 1, pageSize: 9999 } }, { isTransformResponse: false }); |
|
|
|
} |
|
|
|
// 获取当前站点下的所有相机 |
|
|
|
function getCurrentStationCamera() { |
|
|
|
return defHttp.get({ url: '/military/camera/setting/list', params: { pageNo: 1, pageSize: 9999 } }, { isTransformResponse: false }); |
|
|
|
} |
|
|
|
const nodeTree: any = ref([]); |
|
|
|
|
|
|
|
getCurrentSceneArea().then((res1) => { |
|
|
|
getCurrentAreaStation().then((res2) => { |
|
|
|
getCurrentStationCamera().then((res3) => { |
|
|
|
// 定义一个空数组作为树状数组的根节点 |
|
|
|
const tree: any = []; |
|
|
|
// 遍历防区列表,查找对应场景下的数据 |
|
|
|
res1.result.records.value.forEach((row) => { |
|
|
|
const node = { title: row.name, value: row.id, children: [] }; |
|
|
|
tree.push(node); |
|
|
|
}); |
|
|
|
// 遍历站点列表,查找对应防区下的数据 |
|
|
|
res2.result.records.value.forEach((row) => { |
|
|
|
const parentNode = tree.find((node) => node.value === row.lineId); |
|
|
|
if (parentNode) { |
|
|
|
const node = { title: row.sitename, value: row.id, children: [] }; |
|
|
|
parentNode.children.push(node); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 遍历相机列表,查找对应站点下的数据 |
|
|
|
res3.result.records.value.forEach((row) => { |
|
|
|
const parentNodes = tree.map((node) => node.children).flat(); |
|
|
|
const parentNode = parentNodes.find((node) => node.value === row.siteId); |
|
|
|
if (parentNode) { |
|
|
|
const node = { title: row.cameraName, value: row.id, children: null }; |
|
|
|
parentNode.children.push(node); |
|
|
|
} |
|
|
|
}); |
|
|
|
nodeTree.value = handleCameraTree(tree); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
// 相机选择树 |
|
|
|
const cameraTree = ref(null); |
|
|
@ -169,7 +224,7 @@ |
|
|
|
const rules: Record<string, Rule[]> = { |
|
|
|
cameraId: [{ required: true, message: '请选择监控相机!' }], |
|
|
|
modelCode: [{ required: true, message: '请输入监控模型!' }], |
|
|
|
sceneId: [{ required: true, message: '请选择所属场景!' }], |
|
|
|
// sceneId: [{ required: true, message: '请选择所属场景!' }], |
|
|
|
}; |
|
|
|
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true }); |
|
|
|
|
|
|
@ -212,7 +267,6 @@ |
|
|
|
if (res.success) { |
|
|
|
// console.log(res.result); |
|
|
|
cameraList.value = handleCameraTree(res.result); |
|
|
|
// console.log(cameraList); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
@ -223,9 +277,9 @@ |
|
|
|
for (let i = 0; i < data.length; i++) { |
|
|
|
let obj: any = {}; |
|
|
|
let item = data[i]; |
|
|
|
obj.title = item.name; |
|
|
|
obj.value = obj.key = item.id; |
|
|
|
obj.disabled = item.children ? true : false; |
|
|
|
obj.title = item.title; |
|
|
|
obj.value = obj.key = item.value; |
|
|
|
obj.disabled = item.children?.length > 0 ? true : false; |
|
|
|
if (item.children && item.children.length > 0) { |
|
|
|
obj.children = []; |
|
|
|
// obj.key = i + 1; |
|
|
|