|
|
@@ -130,8 +130,6 @@ const isMultiCameraMode = computed(() => userInfoStore.isMultiCameraMode)
|
|
|
// 当前选中的点位
|
|
|
const activePoint = ref('A')
|
|
|
|
|
|
-const iso_options = ref(['auto', 100, 200, 400, 800, 1600, 3200, 6400, 12800])
|
|
|
-
|
|
|
// 相机列表(通过 IPC 获取,不再依赖 store)
|
|
|
const cameraList = ref([])
|
|
|
|
|
|
@@ -148,20 +146,28 @@ const multiConfig = reactive({
|
|
|
A: {
|
|
|
iso: { low: '100', high: '6400' },
|
|
|
CameraKey: '',
|
|
|
- CameraName: ''
|
|
|
+ CameraName: '',
|
|
|
+ iso_options: ['auto', 100, 200, 400, 800, 1600, 3200, 6400, 12800]
|
|
|
},
|
|
|
B: {
|
|
|
iso: { low: '100', high: '6400' },
|
|
|
CameraKey: '',
|
|
|
- CameraName: ''
|
|
|
+ CameraName: '',
|
|
|
+ iso_options: ['auto', 100, 200, 400, 800, 1600, 3200, 6400, 12800]
|
|
|
},
|
|
|
C: {
|
|
|
iso: { low: '100', high: '6400' },
|
|
|
CameraKey: '',
|
|
|
- CameraName: ''
|
|
|
+ CameraName: '',
|
|
|
+ iso_options: ['auto', 100, 200, 400, 800, 1600, 3200, 6400, 12800]
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+// 当前点位可用的 ISO 选项(模板中使用)
|
|
|
+const iso_options = computed(() => {
|
|
|
+ return multiConfig[activePoint.value]?.iso_options || ['auto', 100, 200, 400, 800, 1600, 3200, 6400, 12800]
|
|
|
+})
|
|
|
+
|
|
|
// 根据模式显示不同的点位列表
|
|
|
const displayPointList = computed(() => {
|
|
|
if (isMultiCameraMode.value) {
|
|
|
@@ -202,6 +208,24 @@ const availableCameras = computed(() => {
|
|
|
// 切换点位
|
|
|
const switchPoint = (pointKey) => {
|
|
|
activePoint.value = pointKey
|
|
|
+ // 切换到点位时,检查该点位相机的 ISO 是否需要更新
|
|
|
+ const cameraKey = multiConfig[pointKey].CameraKey
|
|
|
+ if (cameraKey) {
|
|
|
+ const camera = cameraList.value.find(c => c.CameraKey === cameraKey)
|
|
|
+ if (camera && camera.CameraISO && Array.isArray(camera.CameraISO)) {
|
|
|
+ // 更新 ISO 选项(确保包含最新相机的 ISO)
|
|
|
+ multiConfig[pointKey].iso_options = camera.CameraISO
|
|
|
+ // 检查当前选中的 ISO 是否还在新列表中
|
|
|
+ const currentLow = multiConfig[pointKey].iso.low
|
|
|
+ const currentHigh = multiConfig[pointKey].iso.high
|
|
|
+ if (!camera.CameraISO.includes(currentLow)) {
|
|
|
+ multiConfig[pointKey].iso.low = camera.CameraISO[0]
|
|
|
+ }
|
|
|
+ if (!camera.CameraISO.includes(currentHigh)) {
|
|
|
+ multiConfig[pointKey].iso.high = camera.CameraISO[0]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 更新点位连接状态
|
|
|
@@ -218,18 +242,54 @@ const updatePointConnectionStatus = () => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-// 通过 IPC 获取相机列表
|
|
|
-const fetchCameraList = () => {
|
|
|
- clientStore.ipc.invoke(icpList.camera.getCameraList).then(result => {
|
|
|
- if (result && result.CameraLists && Array.isArray(result.CameraLists)) {
|
|
|
- cameraList.value = result.CameraLists
|
|
|
- // 不再自动分配相机,让用户手动选择
|
|
|
- updatePointConnectionStatus()
|
|
|
- }
|
|
|
- }).catch(err => {
|
|
|
- console.error('获取相机列表失败:', err)
|
|
|
- })
|
|
|
-}
|
|
|
+ // 通过 IPC 获取相机列表
|
|
|
+ const fetchCameraList = () => {
|
|
|
+ clientStore.ipc.invoke(icpList.camera.getCameraList).then(result => {
|
|
|
+
|
|
|
+ console.log('icpList.camera.getCameraList');
|
|
|
+ console.log(result);
|
|
|
+ if (result && result.CameraLists && Array.isArray(result.CameraLists)) {
|
|
|
+ cameraList.value = result.CameraLists
|
|
|
+ // 更新各点位对应相机的 ISO 选项
|
|
|
+ updateIsoOptionsForAllPoints()
|
|
|
+ updatePointConnectionStatus()
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ console.error('获取相机列表失败:', err)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新所有点位的 ISO 选项
|
|
|
+ const updateIsoOptionsForAllPoints = () => {
|
|
|
+ const cameras = cameraList.value || []
|
|
|
+ Object.keys(multiConfig).forEach(pointKey => {
|
|
|
+ const cameraKey = multiConfig[pointKey].CameraKey
|
|
|
+ if (cameraKey) {
|
|
|
+ const camera = cameras.find(c => c.CameraKey === cameraKey)
|
|
|
+ if (camera && camera.CameraISO) {
|
|
|
+ multiConfig[pointKey].iso_options = camera.CameraISO
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 从 smart_shooter_getinfo 获取 ISO 配置(保留作为备用)
|
|
|
+ const fetchIsoConfig = () => {
|
|
|
+ clientStore.ipc.removeAllListeners(icpList.socket.message + '_smart_shooter_getinfo');
|
|
|
+ socketStore.sendMessage({
|
|
|
+ type: 'smart_shooter_getinfo'
|
|
|
+ });
|
|
|
+
|
|
|
+ clientStore.ipc.on(icpList.socket.message + '_smart_shooter_getinfo', async (event, result) => {
|
|
|
+ if (result.code == 0 && result.data) {
|
|
|
+ // 从 CameraISO 字段获取 ISO 选项
|
|
|
+ if (result.data.CameraISO && Array.isArray(result.data.CameraISO)) {
|
|
|
+ iso_options.value = result.data.CameraISO
|
|
|
+ }
|
|
|
+ }
|
|
|
+ clientStore.ipc.removeAllListeners(icpList.socket.message + '_smart_shooter_getinfo');
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
// 相机选择变更
|
|
|
const onCameraChange = (pointKey) => {
|
|
|
@@ -238,10 +298,24 @@ const onCameraChange = (pointKey) => {
|
|
|
const camera = cameraList.value.find(c => c.CameraKey === cameraKey)
|
|
|
if (camera) {
|
|
|
multiConfig[pointKey].CameraName = camera.CameraName
|
|
|
+ // 更新当前点位的 ISO 选项
|
|
|
+ if (camera.CameraISO && Array.isArray(camera.CameraISO)) {
|
|
|
+ multiConfig[pointKey].iso_options = camera.CameraISO
|
|
|
+ // 如果当前选中的 ISO 不在新列表中,重置为默认值
|
|
|
+ const currentLow = multiConfig[pointKey].iso.low
|
|
|
+ const currentHigh = multiConfig[pointKey].iso.high
|
|
|
+ if (!camera.CameraISO.includes(currentLow)) {
|
|
|
+ multiConfig[pointKey].iso.low = camera.CameraISO[0]
|
|
|
+ }
|
|
|
+ if (!camera.CameraISO.includes(currentHigh)) {
|
|
|
+ multiConfig[pointKey].iso.high = camera.CameraISO[0]
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
- // 清除绑定时也清空 CameraName
|
|
|
+ // 清除绑定时也清空 CameraName,重置 ISO 选项
|
|
|
multiConfig[pointKey].CameraName = ''
|
|
|
+ multiConfig[pointKey].iso_options = ['auto', 100, 200, 400, 800, 1600, 3200, 6400, 12800]
|
|
|
}
|
|
|
updatePointConnectionStatus()
|
|
|
}
|
|
|
@@ -265,8 +339,17 @@ const ensureCurrentCameraInList = () => {
|
|
|
|
|
|
// 监听multiConfig变化并更新父组件
|
|
|
watch(multiConfig, (newVal) => {
|
|
|
+ // 过滤掉 iso_options 字段,只保留配置数据
|
|
|
+ const isoConfig = {}
|
|
|
+ Object.keys(newVal).forEach(key => {
|
|
|
+ isoConfig[key] = {
|
|
|
+ iso: newVal[key].iso,
|
|
|
+ CameraKey: newVal[key].CameraKey,
|
|
|
+ CameraName: newVal[key].CameraName
|
|
|
+ }
|
|
|
+ })
|
|
|
emit('update:camera_configs', {
|
|
|
- iso_config: multiConfig,
|
|
|
+ iso_config: isoConfig,
|
|
|
})
|
|
|
}, { deep: true })
|
|
|
|
|
|
@@ -301,24 +384,8 @@ onMounted(() => {
|
|
|
// 单相机模式默认选中点位A
|
|
|
activePoint.value = 'A'
|
|
|
|
|
|
- // 通过 IPC 获取相机列表
|
|
|
+ // 通过 IPC 获取相机列表(同时获取 ISO 配置)
|
|
|
fetchCameraList()
|
|
|
-
|
|
|
- // 读取设备当前可用的 ISO 档位
|
|
|
- clientStore.ipc.removeAllListeners(icpList.socket.message + '_smart_shooter_get_camera_property');
|
|
|
- socketStore.sendMessage({
|
|
|
- type: 'smart_shooter_get_camera_property'
|
|
|
- });
|
|
|
-
|
|
|
- clientStore.ipc.on(icpList.socket.message + '_smart_shooter_get_camera_property', async (event, result) => {
|
|
|
- if (result.code == 0 && result.data) {
|
|
|
- const ISO = result.data.filter(item => item.CameraPropertyType == 'ISO')
|
|
|
- if (ISO.length > 0) {
|
|
|
- iso_options.value = ISO[0].CameraPropertyRange
|
|
|
- }
|
|
|
- }
|
|
|
- clientStore.ipc.removeAllListeners(icpList.socket.message + '_smart_shooter_get_camera_property');
|
|
|
- })
|
|
|
})
|
|
|
|
|
|
// 暴露保存方法,给父组件调用
|