浏览代码

feat: 回退增加二次确认提示

cuiyalong 10 月之前
父节点
当前提交
c610ca12f1
共有 1 个文件被更改,包括 19 次插入6 次删除
  1. 19 6
      frontend/src/views/CodeList.vue

+ 19 - 6
frontend/src/views/CodeList.vue

@@ -63,7 +63,7 @@
                 <el-table-column prop="claimText" label="认领状态" show-overflow-tooltip></el-table-column>
                 <el-table-column prop="href" label="栏目地址" show-overflow-tooltip></el-table-column>
                 <el-table-column prop="modifyuser" label="维护人" width="80" show-overflow-tooltip></el-table-column>
-                <el-table-column label="操作" width="160">
+                <el-table-column label="操作" width="160" align="center">
                     <template #default="scope">
                   <!-- <el-tooltip content="标注" placement="top">
                             <el-button size="small" :class="{ active: scope.row._action_clicked_mark }" @click="tableEvents.handleDataTag(scope.row)">
@@ -82,7 +82,7 @@
                         </el-tooltip>
                     </template>
                 </el-table-column>
-                <el-table-column label="功能">
+                <el-table-column label="功能" width="160" align="center">
                     <template #default="scope">
                         <el-tooltip content="验证" placement="top">
                             <el-button size="small" :class="{ active: scope.row._action_clicked_verify }" @click="tableEvents.handleVerify(scope.$index, scope.row)">
@@ -95,7 +95,7 @@
                                 <el-icon><Promotion /></el-icon>
                             </el-button>
                         </el-tooltip>
-                        <el-tooltip content="回退" placement="top" v-if="showListRollbackButton">
+                        <el-tooltip content="回退" placement="top">
                             <!-- 爬虫状态是待完成,才可点击回退 -->
                             <el-button size="small" :disabled="scope.row.state !== 0" :class="{ active: scope.row._action_clicked_rollback }" @click="tableEvents.handleRollback(scope.$index, scope.row)">
                                 <el-icon><DArrowLeft /></el-icon>
@@ -596,7 +596,7 @@ const tableEvents = {
             if (r.err === 1) {
                 ElMessage({
                     message: '提交成功',
-                    type: 'error',
+                    type: 'success',
                     duration: 3000,
                 })
                 getTableList()
@@ -609,15 +609,25 @@ const tableEvents = {
             }
         })
     },
-    handleRollback(index, row) {
+    handleRollback(_, row) {
         onlyClickHighlight(row, '_action_clicked_rollback')
+        ElMessageBox.alert('确定回退?', '提示', {
+            confirmButtonText: '确定',
+            callback: (action) => {
+                if (action === 'confirm') {
+                    this.confirmRollback(row)
+                }
+            },
+        })
+    },
+    confirmRollback(row) {
         const lua = getLuaParams(row)
         lua.state = 12
         ServerActionUpdateCodeState({ lua: lua }).then(r => {
             if (r.err === 1) {
                 ElMessage({
                     message: '回退成功',
-                    type: 'error',
+                    type: 'success',
                     duration: 3000,
                 })
                 getTableList()
@@ -683,4 +693,7 @@ EventsOn("spiderConfigChange", data => {
     font-size: 14px;
     white-space: nowrap;
 }
+.action-button-container {
+    display: flex;
+}
 </style>