Browse Source

1、表单 监控相机选择树 添加场景层级

2、优化树状结构转化方法,只有存在相机的站点才可选
master
Fuyuu 1 year ago
parent
commit
1af0bd6e67
  1. 40
      src/views/military/modules/ai/aiMonitorArea/components/DtAiMonitorAreaForm.vue

40
src/views/military/modules/ai/aiMonitorArea/components/DtAiMonitorAreaForm.vue

@ -112,20 +112,29 @@
const userStore = useUserStore(); const userStore = useUserStore();
// id // 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 areaList: any = [];
// //
const stationList: any = []; const stationList: any = [];
// //
const newCameraList: any = []; const newCameraList: any = [];
// //
function getCurrentSceneArea() { function getCurrentScene() {
return defHttp.get( 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 } { isTransformResponse: false }
); );
} }
//
function getCurrentSceneArea() {
return defHttp.get({ url: '/military/msMapLine/list', params: { pageNo: 1, pageSize: 9999 } }, { isTransformResponse: false });
}
// //
function getCurrentAreaStation() { function getCurrentAreaStation() {
return defHttp.get({ url: '/military/camera/site/list', params: { pageNo: 1, pageSize: 9999 } }, { isTransformResponse: false }); return defHttp.get({ url: '/military/camera/site/list', params: { pageNo: 1, pageSize: 9999 } }, { isTransformResponse: false });
@ -203,22 +212,34 @@
onMounted(() => { onMounted(() => {
// //
getCurrentScene().then((res) => {
sceneList.value = res.result.records;
getCurrentSceneArea().then((res1) => { getCurrentSceneArea().then((res1) => {
areaList.value = res1.result.records; areaList.value = res1.result.records;
getCurrentAreaStation().then((res2) => { getCurrentAreaStation().then((res2) => {
stationList.value = res2.result.records; stationList.value = res2.result.records;
getCurrentStationCamera().then((res3) => { getCurrentStationCamera().then((res3) => {
newCameraList.value = res3.result.records; newCameraList.value = res3.result.records;
// //
const tree: any = []; const tree: any = [];
//
sceneList.value.forEach((row) => {
const node = { title: row.sceneName, value: row.sceneId, children: [] };
tree.push(node);
});
// //
areaList.value.forEach((row) => { areaList.value.forEach((row) => {
const parentNode = tree.find((node) => node.value === row.sceneId);
if (parentNode) {
const node = { title: row.name, value: row.id, children: [] }; const node = { title: row.name, value: row.id, children: [] };
tree.push(node); parentNode.children.push(node);
}
}); });
// //
stationList.value.forEach((row) => { stationList.value.forEach((row) => {
const parentNode = tree.find((node) => node.value === row.lineId); const parentNodes = tree.map((node) => node.children).flat();
const parentNode = parentNodes.find((node) => node.value === row.lineId);
if (parentNode) { if (parentNode) {
const node = { title: row.sitename, value: row.id, children: [] }; const node = { title: row.sitename, value: row.id, children: [] };
parentNode.children.push(node); parentNode.children.push(node);
@ -226,7 +247,8 @@
}); });
// //
newCameraList.value.forEach((row) => { newCameraList.value.forEach((row) => {
const parentNodes = tree.map((node) => node.children).flat(); //
const parentNodes = tree.flatMap((node) => node.children).flatMap((node) => node.children);
const parentNode = parentNodes.find((node) => node.value === row.siteId); const parentNode = parentNodes.find((node) => node.value === row.siteId);
if (parentNode) { if (parentNode) {
const node = { title: row.cameraName, value: row.id, children: null }; const node = { title: row.cameraName, value: row.id, children: null };
@ -238,6 +260,8 @@
}); });
}); });
}); });
});
// //
getCameraList(); getCameraList();
// //
@ -288,7 +312,7 @@
let item = data[i]; let item = data[i];
obj.title = item.title; obj.title = item.title;
obj.value = obj.key = item.value; 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) { if (item.children && item.children.length > 0) {
obj.children = []; obj.children = [];
let indexValue: any = index ? index + '-' + (i + 1) : i + 1; let indexValue: any = index ? index + '-' + (i + 1) : i + 1;

Loading…
Cancel
Save