Browse Source

feat(photography): 添加设备配置编辑页面刷新功能

- 在编辑页面添加刷新按钮,支持重新加载当前配置数据
- 实现 refreshData 方法,通过 API 获取最新配置详情
- 添加多相机模式下的默认值处理逻辑
- 集成操作日志记录功能
- 优化按钮布局结构
- 添加刷新成功或失败的用户提示消息
panqiuyao 1 tuần trước cách đây
mục cha
commit
17d6e1b51e
1 tập tin đã thay đổi với 37 bổ sung1 xóa
  1. 37 1
      frontend/src/views/Photography/components/editRow.vue

+ 37 - 1
frontend/src/views/Photography/components/editRow.vue

@@ -107,10 +107,11 @@
       </el-form-item>
     </el-form>
     <div class="btn-row mar-top-20">
+      <div class="normal-btn" @click="refreshData" v-if="id" v-log="{ describe: { action: '点击刷新配置' } }">刷新</div>
       <div class="normal-btn" @click="close" v-if="id" v-log="{ describe: { action: '点击关闭编辑行' } }">取消</div>
       <div class="normal-btn"  v-loading="captureLoading"  v-if="!id && editRowData.is_system" @click="testShoesFlip" v-log="{ describe: { action: '点击运行测试拍照' } }">运行</div>
       <div class="primary-btn"  v-loading="captureLoading" @click="saveRow" v-log="{ describe: { action: '点击保存设备配置' } }">{{ id ? '保存并关闭' : '保存' }}</div>
-      </div>
+    </div>
   </div>
 
 </template>
@@ -431,6 +432,41 @@ const close = ()=>{
 }
 
 /**
+ * 刷新当前编辑的配置数据。
+ */
+const refreshData = async () => {
+  if (captureLoading.value) {
+    return
+  }
+  if (!props.id) {
+    return
+  }
+
+  captureLoading.value = true
+  try {
+    const result = await getDeviceConfigDetail({ id: props.id })
+    if (result.code == 0 && result.data) {
+      editRowData.value = result.data
+      // 多相机模式默认值处理
+      if (isMultiCameraMode.value) {
+        if (!availablePoints.value.includes(editRowData.value.point_name)) {
+          editRowData.value.point_name = availablePoints.value[0] || 'A'
+        }
+        editRowData.value.is_move_device = editRowData.value.is_move_device ?? 1
+      }
+      ElMessage.success('刷新成功')
+    } else {
+      ElMessage.error('刷新失败')
+    }
+  } catch (err) {
+    console.error('刷新配置失败:', err)
+    ElMessage.error('刷新失败')
+  } finally {
+    captureLoading.value = false
+  }
+}
+
+/**
  * 保存当前编辑的配置。
  */
 const saveRow = async () => {