Browse Source

添加场景id限制,获取当前场景(包括子场景)下的所有防区

master
Fuyuu 9 months ago
parent
commit
97a5acecf3
  1. 85
      src/views/military/modules/ai/aiMonitorArea/components/DtAiMonitorAreaForm.vue

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

@ -110,8 +110,9 @@
//
import { useUserStore } from '/@/store/modules/user';
const userStore = useUserStore();
// sys_org_code
const orgCode = 'A01';
// id
const sceneId = userStore.userInfo.sceneId;
//
const areaList: any = [];
//
@ -120,7 +121,10 @@
const newCameraList: any = [];
//
function getCurrentSceneArea() {
return defHttp.get({ url: '/military/msMapLine/list', params: { sysOrgCode: orgCode } }, { isTransformResponse: false });
return defHttp.get(
{ url: '/military/msMapLine/list', params: { sceneId: sceneId + '*', pageNo: 1, pageSize: 9999 } },
{ isTransformResponse: false }
);
}
//
function getCurrentAreaStation() {
@ -130,40 +134,9 @@
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);
//
@ -229,6 +202,42 @@
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
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);
}
});
// ant tree-select
nodeTree.value = handleCameraTree(tree);
});
});
});
//
getCameraList();
//
@ -282,15 +291,9 @@
obj.disabled = item.children?.length > 0 ? true : false;
if (item.children && item.children.length > 0) {
obj.children = [];
// obj.key = i + 1;
let indexValue: any = index ? index + '-' + (i + 1) : i + 1;
obj.children = handleCameraTree(item.children, indexValue);
} else {
// obj.key = index !== undefined ? index + '-' + (i + 1) : (i + 1) + '';
// let tmp = (obj.key + '').split('-').length;
// obj.selectable = tmp >= 3;
}
// obj.key = index !== undefined ? index + '-' + (i + 1) : (i + 1) + '';
arr.push(obj);
}
return arr;

Loading…
Cancel
Save