|
|
@ -112,20 +112,29 @@ |
|
|
|
const userStore = useUserStore(); |
|
|
|
|
|
|
|
// 获取当前权限下的场景id |
|
|
|
const sceneId = userStore.userInfo.sceneId; |
|
|
|
// const sceneId = userStore.userInfo.sceneId; |
|
|
|
// 三级场景 00001-00001-00001 二级场景 00001-00002 一级场景 00001 |
|
|
|
const sceneId = '00001-00002'; |
|
|
|
|
|
|
|
// 场景列表 |
|
|
|
const sceneList: any = []; |
|
|
|
// 防区列表 |
|
|
|
const areaList: any = []; |
|
|
|
// 站点列表 |
|
|
|
const stationList: any = []; |
|
|
|
// 相机列表 |
|
|
|
const newCameraList: any = []; |
|
|
|
// 获取当前场景下所有防区 |
|
|
|
function getCurrentSceneArea() { |
|
|
|
// 获取当前场景及子场景信息 |
|
|
|
function getCurrentScene() { |
|
|
|
return defHttp.get( |
|
|
|
{ url: '/military/msMapLine/list', params: { sceneId: sceneId + '*', pageNo: 1, pageSize: 9999 } }, |
|
|
|
{ url: '/military/msMapScene/list', params: { sceneId: sceneId + '*', pageNo: 1, pageSize: 9999 } }, |
|
|
|
{ isTransformResponse: false } |
|
|
|
); |
|
|
|
} |
|
|
|
// 获取当前场景(包括其子场景)下的所有防区 |
|
|
|
function getCurrentSceneArea() { |
|
|
|
return defHttp.get({ url: '/military/msMapLine/list', params: { pageNo: 1, pageSize: 9999 } }, { isTransformResponse: false }); |
|
|
|
} |
|
|
|
// 获取当前防区下的所有站点 |
|
|
|
function getCurrentAreaStation() { |
|
|
|
return defHttp.get({ url: '/military/camera/site/list', params: { pageNo: 1, pageSize: 9999 } }, { isTransformResponse: false }); |
|
|
@ -203,41 +212,56 @@ |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
// 将数据转化为树状结构 |
|
|
|
getCurrentSceneArea().then((res1) => { |
|
|
|
areaList.value = res1.result.records; |
|
|
|
getCurrentAreaStation().then((res2) => { |
|
|
|
stationList.value = res2.result.records; |
|
|
|
getCurrentStationCamera().then((res3) => { |
|
|
|
newCameraList.value = res3.result.records; |
|
|
|
// 定义一个空数组作为树状数组的根节点 |
|
|
|
const tree: any = []; |
|
|
|
// 遍历防区列表,查找对应场景下的数据 |
|
|
|
areaList.value.forEach((row) => { |
|
|
|
const node = { title: row.name, value: row.id, children: [] }; |
|
|
|
tree.push(node); |
|
|
|
}); |
|
|
|
// 遍历站点列表,查找对应防区下的数据 |
|
|
|
stationList.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); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 遍历相机列表,查找对应站点下的数据 |
|
|
|
newCameraList.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); |
|
|
|
} |
|
|
|
getCurrentScene().then((res) => { |
|
|
|
sceneList.value = res.result.records; |
|
|
|
getCurrentSceneArea().then((res1) => { |
|
|
|
areaList.value = res1.result.records; |
|
|
|
getCurrentAreaStation().then((res2) => { |
|
|
|
stationList.value = res2.result.records; |
|
|
|
getCurrentStationCamera().then((res3) => { |
|
|
|
newCameraList.value = res3.result.records; |
|
|
|
|
|
|
|
// 定义一个空数组作为树状数组的根节点 |
|
|
|
const tree: any = []; |
|
|
|
//遍历场景列表,查找当前场景(及子场景)数据 |
|
|
|
sceneList.value.forEach((row) => { |
|
|
|
const node = { title: row.sceneName, value: row.sceneId, children: [] }; |
|
|
|
tree.push(node); |
|
|
|
}); |
|
|
|
// 遍历防区列表,查找对应场景下的数据 |
|
|
|
areaList.value.forEach((row) => { |
|
|
|
const parentNode = tree.find((node) => node.value === row.sceneId); |
|
|
|
if (parentNode) { |
|
|
|
const node = { title: row.name, value: row.id, children: [] }; |
|
|
|
parentNode.children.push(node); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 遍历站点列表,查找对应防区下的数据 |
|
|
|
stationList.value.forEach((row) => { |
|
|
|
const parentNodes = tree.map((node) => node.children).flat(); |
|
|
|
const parentNode = parentNodes.find((node) => node.value === row.lineId); |
|
|
|
if (parentNode) { |
|
|
|
const node = { title: row.sitename, value: row.id, children: [] }; |
|
|
|
parentNode.children.push(node); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 遍历相机列表,查找对应站点下的数据 |
|
|
|
newCameraList.value.forEach((row) => { |
|
|
|
// 筛选孙子节点 |
|
|
|
const parentNodes = tree.flatMap((node) => node.children).flatMap((node) => node.children); |
|
|
|
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); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 转化为ant tree-select结构 |
|
|
|
nodeTree.value = handleCameraTree(tree); |
|
|
|
}); |
|
|
|
// 转化为ant tree-select结构 |
|
|
|
nodeTree.value = handleCameraTree(tree); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
// 获取相机数据 |
|
|
|
getCameraList(); |
|
|
|
// 获取场景编码 |
|
|
@ -288,7 +312,7 @@ |
|
|
|
let item = data[i]; |
|
|
|
obj.title = item.title; |
|
|
|
obj.value = obj.key = item.value; |
|
|
|
obj.disabled = item.children?.length > 0 ? true : false; |
|
|
|
obj.disabled = item.children?.length >= 0 ? true : false; |
|
|
|
if (item.children && item.children.length > 0) { |
|
|
|
obj.children = []; |
|
|
|
let indexValue: any = index ? index + '-' + (i + 1) : i + 1; |
|
|
|