|
|
@ -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; |
|
|
|