优化:ROI 编辑页删除边缘设备选择器
device_id 现在由后端从摄像头配置自动继承,前端不再需要手动选择。
This commit is contained in:
@@ -68,17 +68,6 @@ const snapOk = ref(false);
|
|||||||
const panelVisible = ref(false);
|
const panelVisible = ref(false);
|
||||||
const roiCanvasRef = ref<InstanceType<typeof RoiCanvas> | null>(null);
|
const roiCanvasRef = ref<InstanceType<typeof RoiCanvas> | null>(null);
|
||||||
|
|
||||||
const edgeDevices = ref<Array<{ deviceId: string }>>([]);
|
|
||||||
|
|
||||||
async function loadEdgeDevices() {
|
|
||||||
try {
|
|
||||||
const list = await wvpRequestClient.get<Array<{ deviceId: string }>>('/aiot/device/device/list');
|
|
||||||
edgeDevices.value = (list as any) || [];
|
|
||||||
} catch {
|
|
||||||
edgeDevices.value = [{ deviceId: 'edge' }];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectedRoi = computed(() => {
|
const selectedRoi = computed(() => {
|
||||||
if (!selectedRoiId.value) return null;
|
if (!selectedRoiId.value) return null;
|
||||||
return roiList.value.find((r) => r.roiId === selectedRoiId.value) || null;
|
return roiList.value.find((r) => r.roiId === selectedRoiId.value) || null;
|
||||||
@@ -93,7 +82,6 @@ const polygonPointCount = computed(() => {
|
|||||||
// ==================== 初始化 ====================
|
// ==================== 初始化 ====================
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
loadEdgeDevices();
|
|
||||||
const q = route.query;
|
const q = route.query;
|
||||||
if (q.cameraCode) {
|
if (q.cameraCode) {
|
||||||
cameraCode.value = String(q.cameraCode);
|
cameraCode.value = String(q.cameraCode);
|
||||||
@@ -230,7 +218,7 @@ function addFullscreen() {
|
|||||||
priority: 0,
|
priority: 0,
|
||||||
enabled: 1,
|
enabled: 1,
|
||||||
description: '',
|
description: '',
|
||||||
deviceId: edgeDevices.value[0]?.deviceId || 'edge',
|
deviceId: '',
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
await saveRoi(newRoi);
|
await saveRoi(newRoi);
|
||||||
@@ -283,7 +271,7 @@ async function onRoiDrawn(data: { coordinates: string; roi_type: string }) {
|
|||||||
priority: 0,
|
priority: 0,
|
||||||
enabled: 1,
|
enabled: 1,
|
||||||
description: '',
|
description: '',
|
||||||
deviceId: edgeDevices.value[0]?.deviceId || 'edge',
|
deviceId: '',
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
await saveRoi(newRoi);
|
await saveRoi(newRoi);
|
||||||
@@ -532,17 +520,6 @@ function handlePush() {
|
|||||||
@blur="updateRoiData(selectedRoi!)"
|
@blur="updateRoiData(selectedRoi!)"
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="边缘设备">
|
|
||||||
<Select
|
|
||||||
v-model:value="selectedRoi.deviceId"
|
|
||||||
placeholder="选择边缘设备"
|
|
||||||
@change="updateRoiData(selectedRoi!)"
|
|
||||||
>
|
|
||||||
<Select.Option v-for="dev in edgeDevices" :key="dev.deviceId" :value="dev.deviceId">
|
|
||||||
{{ dev.deviceId }}
|
|
||||||
</Select.Option>
|
|
||||||
</Select>
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item label="颜色">
|
<Form.Item label="颜色">
|
||||||
<Input
|
<Input
|
||||||
v-model:value="selectedRoi.color"
|
v-model:value="selectedRoi.color"
|
||||||
|
|||||||
Reference in New Issue
Block a user