Browse Source

重写相机数据树结构

master
Fuyuu 1 year ago
parent
commit
09543cd8e6
  1. 10
      src/views/military/modules/ai/aiMonitorArea/DtAiMonitorArea.data.ts
  2. 72
      src/views/military/modules/ai/aiMonitorArea/components/DtAiMonitorAreaForm.vue
  3. 1
      src/views/military/modules/ai/aiMonitorArea/selectCom/SelectCom.vue

10
src/views/military/modules/ai/aiMonitorArea/DtAiMonitorArea.data.ts

@ -36,11 +36,11 @@ export const columns: BasicColumn[] = [
align: 'center', align: 'center',
dataIndex: 'drawdata', dataIndex: 'drawdata',
}, },
{ // {
title: '所属场景', // title: '所属场景',
align: 'center', // align: 'center',
dataIndex: 'sceneId_dictText', // dataIndex: 'sceneId_dictText',
}, // },
// , // ,
// { // {
// title: '备注', // title: '备注',

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

@ -8,7 +8,7 @@
ref="cameraTree" ref="cameraTree"
v-model:value="formData.cameraId" v-model:value="formData.cameraId"
allow-clear allow-clear
:treeData="cameraList" :treeData="nodeTree"
:disabled="disabled" :disabled="disabled"
placeholder="请选择监控相机" placeholder="请选择监控相机"
> >
@ -60,16 +60,15 @@
<a-textarea v-model:value="formData.drawdata" :rows="4" placeholder="请输入画图数据" :disabled="disabled"></a-textarea> <a-textarea v-model:value="formData.drawdata" :rows="4" placeholder="请输入画图数据" :disabled="disabled"></a-textarea>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <!-- <a-col :span="24">
<a-form-item label="所属场景" v-bind="validateInfos.sceneId" name="sceneId"> <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"> <a-select v-model:value="formData.sceneId" placeholder="请选择所属场景" :disabled="disabled">
<template :key="code.sceneId" v-for="code in sceneCodeList"> <template :key="code.sceneId" v-for="code in sceneCodeList">
<a-select-option :value="code.sceneId">{{ code.sceneName }}</a-select-option> <a-select-option :value="code.sceneId">{{ code.sceneName }}</a-select-option>
</template> </template>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col> -->
<!-- <a-col :span="24"> <!-- <a-col :span="24">
<a-form-item label="备注" v-bind="validateInfos.remark"> <a-form-item label="备注" v-bind="validateInfos.remark">
<a-input v-model:value="formData.remark" placeholder="请输入备注" :disabled="disabled"></a-input> <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 type { Rule } from 'ant-design-vue/es/form';
// //
import SelectCom from '../selectCom/SelectCom.vue'; 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); const cameraTree = ref(null);
@ -169,7 +224,7 @@
const rules: Record<string, Rule[]> = { const rules: Record<string, Rule[]> = {
cameraId: [{ required: true, message: '请选择监控相机!' }], cameraId: [{ required: true, message: '请选择监控相机!' }],
modelCode: [{ required: true, message: '请输入监控模型!' }], modelCode: [{ required: true, message: '请输入监控模型!' }],
sceneId: [{ required: true, message: '请选择所属场景!' }], // sceneId: [{ required: true, message: '' }],
}; };
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true }); const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
@ -212,7 +267,6 @@
if (res.success) { if (res.success) {
// console.log(res.result); // console.log(res.result);
cameraList.value = handleCameraTree(res.result); cameraList.value = handleCameraTree(res.result);
// console.log(cameraList);
} }
}); });
} }
@ -223,9 +277,9 @@
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
let obj: any = {}; let obj: any = {};
let item = data[i]; let item = data[i];
obj.title = item.name; obj.title = item.title;
obj.value = obj.key = item.id; obj.value = obj.key = item.value;
obj.disabled = item.children ? 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 = [];
// obj.key = i + 1; // obj.key = i + 1;

1
src/views/military/modules/ai/aiMonitorArea/selectCom/SelectCom.vue

@ -177,6 +177,7 @@
typeString = ''; typeString = '';
} }
// -
const newShape: any = { const newShape: any = {
type: typeString, type: typeString,
coor: item.coor, coor: item.coor,

Loading…
Cancel
Save