瀏覽代碼

feat(setting): 添加操作步骤复制功能

- 在操作列中增加复制按钮,仅对非系统步骤显示
- 实现copyRow函数,支持复制指定行的配置并新增
- 复制时自动生成带"副本"后缀的步骤名称
- 复制时保留原步骤的所有配置参数
- 排序模式下禁用复制功能
- 复制后打开新增步骤对话框
panqiuyao 1 周之前
父節點
當前提交
2c13737a8b
共有 1 個文件被更改,包括 30 次插入0 次删除
  1. 30 0
      frontend/src/views/Setting/components/action_config.vue

+ 30 - 0
frontend/src/views/Setting/components/action_config.vue

@@ -73,6 +73,7 @@
       <el-table-column prop="value" label="操作" >
         <template #default="{row, $index}">
           <a class="mar-right-10 cursor-pointer" @click="editRow(row, $index)" v-log="{ describe: { action: '点击编辑步骤', id: row.id, action_name: row.action_name } }">编辑</a>
+          <a class="mar-right-10 cursor-pointer" v-if="!row.is_system" @click="copyRow(row, $index)" v-log="{ describe: { action: '点击复制步骤', id: row.id, action_name: row.action_name } }">复制</a>
           <a class="cursor-pointer" v-if="!row.is_system" @click="deleteRow(row, $index)" v-log="{ describe: { action: '点击删除步骤', id: row.id, action_name: row.action_name } }">删除</a>
         </template>
       </el-table-column>
@@ -281,6 +282,35 @@ const editRow = (row, index) => {
 };
 
 /**
+ * 复制指定行的配置并新增。
+ * @param {Object} row - 当前行的数据
+ * @param {number} index - 当前行的索引
+ */
+const copyRow = (row, index) => {
+  if (isSortMode.value) return; // 排序模式下禁用
+
+  editId.value = -1
+  let length = Number(tableData.value.length) + 1
+  addRowData.value = {
+    mode_type: topsTab.value === 'left' ? '执行左脚程序' : '执行右脚程序',
+    tab_id: activeTab.value.id,
+    action_name: row.action_name + '_副本',
+    take_picture: row.take_picture,
+    camera_height: row.camera_height,
+    camera_angle: row.camera_angle,
+    turntable_position: row.turntable_position,
+    turntable_angle: row.turntable_angle,
+    shoe_upturn: row.shoe_upturn,
+    led_switch: row.led_switch,
+    number_focus: row.number_focus,
+    pre_delay: row.pre_delay,
+    after_delay: row.after_delay,
+  }
+  dialogVisible.value = true;
+  editTitle.value = '新增步骤';
+};
+
+/**
  * 删除指定行的配置。
  * @param {Object} row - 当前行的数据
  * @param {number} index - 当前行的索引