Procházet zdrojové kódy

!230 style: 语法优化
Merge pull request !230 from a20070322/hotfix/machine-list

蒋小小 před 1 rokem
rodič
revize
f41b83ba0a

+ 20 - 35
web-vue/src/components/upgrade/index.vue

@@ -486,31 +486,23 @@ export default {
         '<li>下载前请阅读更新日志里面的说明和注意事项并且<b>请注意备份数据防止数据丢失!!</b></li>' +
         '<li>如果升级失败需要手动恢复奥</li>' +
         ' </ul>'
-      const that = this
       $confirm({
         title: '系统提示',
         content: h('div', null, [h('p', { innerHTML: html }, null)]),
         okText: '确认',
         zIndex: 1009,
         cancelText: '取消',
-        async onOk() {
-          //
-          return await new Promise((resolve, reject) => {
-            remoteUpgrade({
-              nodeId: that.nodeId,
-              machineId: that.machineId
-            })
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-
-                  that.startCheckUpgradeStatus(res.msg)
-                }
-                resolve()
+        onOk: () => {
+          return remoteUpgrade({
+            nodeId: this.nodeId,
+            machineId: this.machineId
+          }).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.startCheckUpgradeStatus(res.msg)
+            }
           })
         }
       })
@@ -524,30 +516,23 @@ export default {
           '<li>在使用 beta 版过程中遇到问题可以随时反馈给我们,我们会尽快为您解答。</li>' +
           ' </ul>'
         : '确认要关闭 beta 计划吗?'
-      const that = this
       $confirm({
         title: '系统提示',
         content: h('div', {}, [h('p', { innerHTML: html })]),
         okText: '确认',
         zIndex: 1009,
         cancelText: '取消',
-        async onOk() {
-          //
-          return await new Promise((resolve, reject) => {
-            changBetaRelease({
-              beta: beta
-            })
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-
-                  that.loadData()
-                }
-                resolve()
+        onOk: () => {
+          return changBetaRelease({
+            beta: beta
+          }).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+
+              this.loadData()
+            }
           })
         }
       })

+ 13 - 20
web-vue/src/pages/build/details.vue

@@ -292,33 +292,26 @@ export default {
 
     // 回滚
     handleRollback(record) {
-      const that = this
       $confirm({
         title: '系统提示',
         content: '真的要回滚该构建历史记录么?',
         okText: '确认',
         zIndex: 1009,
         cancelText: '取消',
-        async onOk() {
-          // 重新发布
-          return await new Promise((resolve, reject) => {
-            rollback(record.id)
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.refresh()
-                  // 弹窗
-                  that.temp = {
-                    id: record.buildDataId,
-                    buildId: res.data
-                  }
-                  that.buildLogVisible = new Date() * Math.random()
-                }
-                resolve()
+        onOk: () => {
+          return rollback(record.id).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.refresh()
+              // 弹窗
+              this.temp = {
+                id: record.buildDataId,
+                buildId: res.data
+              }
+              this.buildLogVisible = new Date() * Math.random()
+            }
           })
         }
       })

+ 28 - 47
web-vue/src/pages/build/history.vue

@@ -432,60 +432,47 @@ export default {
 
     // 回滚
     handleRollback(record) {
-      const that = this
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: '真的要回滚该构建历史记录么?',
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
+        onOk: () => {
           // 重新发布
-          return await new Promise((resolve, reject) => {
-            rollback(record.id)
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.loadData()
-                  // 弹窗
-                  that.temp = {
-                    id: record.buildDataId,
-                    buildId: res.data
-                  }
-                  that.buildLogVisible = new Date() * Math.random()
-                }
-                resolve()
+          return rollback(record.id).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.loadData()
+              // 弹窗
+              this.temp = {
+                id: record.buildDataId,
+                buildId: res.data
+              }
+              this.buildLogVisible = new Date() * Math.random()
+            }
           })
         }
       })
     },
     // 删除
     handleDelete(record) {
-      const that = this
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: '真的要删除构建历史记录么?',
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          // 删除
-          return await new Promise((resolve, reject) => {
-            deleteBuildHistory(record.id)
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.loadData()
-                }
-                resolve()
+        onOk: () => {
+          return deleteBuildHistory(record.id).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.loadData()
+            }
           })
         }
       })
@@ -498,28 +485,22 @@ export default {
         })
         return
       }
-      const that = this
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: '真的要删除这些构建历史记录么?',
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
+        onOk: () => {
           // 删除
-          return await new Promise((resolve, reject) => {
-            deleteBuildHistory(that.tableSelections.join(','))
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.tableSelections = []
-                  that.loadData()
-                }
-                resolve()
+          return deleteBuildHistory(this.tableSelections.join(',')).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.tableSelections = []
+              this.loadData()
+            }
           })
         }
       })

+ 41 - 72
web-vue/src/pages/build/list-info.vue

@@ -997,27 +997,21 @@ export default {
     },
     // 删除
     handleDelete(record) {
-      const that = this
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: '真的要删除构建信息么?删除也将同步删除所有的构建历史记录信息',
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
+        onOk: () => {
           // 删除
-          return await new Promise((resolve, reject) => {
-            deleteBuild(record.id)
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.loadData()
-                }
-                resolve()
+          return deleteBuild(record.id).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.loadData()
+            }
           })
         }
       })
@@ -1030,53 +1024,41 @@ export default {
         })
         return
       }
-      const that = this
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: '真的要批量删除这些构建信息么?删除也将同步删除所有的构建历史记录信息,如果中途删除失败将终止删除操作',
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
+        onOk: () => {
           // 删除
-          return await new Promise((resolve, reject) => {
-            deleteatchBuild({ ids: that.tableSelections.join(',') })
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.loadData()
-                }
-                resolve()
+          return deleteatchBuild({ ids: this.tableSelections.join(',') }).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.loadData()
+            }
           })
         }
       })
     },
     // 清除构建
     handleClear(record) {
-      const that = this
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: '真的要清除构建信息么?',
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          return await new Promise((resolve, reject) => {
-            clearBuid(record.id)
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.loadData()
-                }
-                resolve()
+        onOk: () => {
+          return clearBuid(record.id).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.loadData()
+            }
           })
         }
       })
@@ -1162,27 +1144,21 @@ export default {
     },
     // 停止构建
     handleStopBuild(record) {
-      const that = this
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: '确定要取消构建 【名称:' + record.name + '】 吗?注意:取消/停止构建不一定能正常关闭所有关联进程',
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          return await new Promise((resolve, reject) => {
-            that.temp = Object.assign({}, record)
-            stopBuild(that.temp.id)
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.loadData()
-                }
-                resolve()
+        onOk: () => {
+          this.temp = Object.assign({}, record)
+          return stopBuild(this.temp.id).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.loadData()
+            }
           })
         }
       })
@@ -1213,32 +1189,25 @@ export default {
       }
       // console.log(this.list, index, this.list[method === "top" ? index : method === "up" ? index - 1 : index + 1]);
       const compareId = this.list[method === 'top' ? index : method === 'up' ? index - 1 : index + 1].id
-      const that = this
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: msg,
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          //
-          return await new Promise((resolve, reject) => {
-            sortItem({
-              id: record.id,
-              method: method,
-              compareId: compareId
-            })
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-
-                  that.loadData()
-                }
-                resolve()
+        onOk: () => {
+          return sortItem({
+            id: record.id,
+            method: method,
+            compareId: compareId
+          }).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+
+              this.loadData()
+            }
           })
         }
       })

+ 9 - 17
web-vue/src/pages/certificate/list.vue

@@ -407,30 +407,22 @@ export default {
     },
     // 删除
     handleDelete(record) {
-      const that = this
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: '真的要删除该证书么,删除会将证书文件一并删除奥?',
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          return await new Promise((resolve, reject) => {
-            // 组装参数
-            const params = {
-              id: record.id
-            }
-            deleteCert(params)
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.loadData()
-                }
-                resolve()
+        onOk() {
+          return deleteCert({
+            id: record.id
+          }).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.loadData()
+            }
           })
         }
       })

+ 31 - 60
web-vue/src/pages/dispatch/list.vue

@@ -4,7 +4,7 @@
       is-show-tools
       default-auto-refresh
       :auto-refresh-time="5"
-      :activePage="activePage"
+      :active-page="activePage"
       table-name="dispatch"
       :columns="columns"
       size="middle"
@@ -1448,7 +1448,6 @@ export default {
 
     // 删除
     handleDelete(record, thorough) {
-      const that = this
       if (record.outGivingProject) {
         $confirm({
           title: '系统提示',
@@ -1458,21 +1457,14 @@ export default {
             : '真的要删除分发信息么?删除后节点下面的项目也都将删除',
           okText: '确认',
           cancelText: '取消',
-          async onOk() {
-            return await new Promise((resolve, reject) => {
-              // 删除
-              delDisPatchProject({ id: record.id, thorough: thorough })
-                .then((res) => {
-                  if (res.code === 200) {
-                    $notification.success({
-                      message: res.msg
-                    })
-
-                    that.loadData()
-                  }
-                  resolve()
+          onOk: () => {
+            return delDisPatchProject({ id: record.id, thorough: thorough }).then((res) => {
+              if (res.code === 200) {
+                $notification.success({
+                  message: res.msg
                 })
-                .catch(reject)
+                this.loadData()
+              }
             })
           }
         })
@@ -1484,21 +1476,14 @@ export default {
         content: '真的要释放分发信息么?释放之后节点下面的项目信息还会保留,如需删除项目还需要到节点管理中操作',
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          return await new Promise((resolve, reject) => {
-            // 删除
-            releaseDelDisPatch(record.id)
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-
-                  that.loadData()
-                }
-                resolve()
+        onOk: () => {
+          return releaseDelDisPatch(record.id).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.loadData()
+            }
           })
         }
       })
@@ -1512,7 +1497,6 @@ export default {
         '<li>一般用于服务器无法连接且已经确定不再使用</li>' +
         '<li>如果误操作会产生冗余数据!!!</li>' +
         ' </ul>'
-      const that = this
       $confirm({
         title: '危险操作!!!',
         zIndex: 1009,
@@ -1521,21 +1505,15 @@ export default {
         cancelButtonProps: { type: 'primary' },
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          return await new Promise((resolve, reject) => {
-            // 删除
-            unbindOutgiving(record.id)
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-
-                  that.loadData()
-                }
-                resolve()
+        onOk: () => {
+          return unbindOutgiving(record.id).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+
+              this.loadData()
+            }
           })
         }
       })
@@ -1606,28 +1584,21 @@ export default {
 
     // 取消
     handleCancel(record) {
-      const that = this
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: '真的取消当前分发吗?',
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          return await new Promise((resolve, reject) => {
-            // 删除
-            cancelOutgiving({ id: record.id })
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.loadData()
-                  // that.silenceLoadData()
-                }
-                resolve()
+        onOk: () => {
+          return cancelOutgiving({ id: record.id }).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.loadData()
+              // this.silenceLoadData()
+            }
           })
         }
       })

+ 7 - 14
web-vue/src/pages/dispatch/logRead.vue

@@ -339,27 +339,20 @@ export default {
     },
     // 删除
     handleDelete(record) {
-      const that = this
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: '真的要删除日志搜索么?',
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          return await new Promise((resolve, reject) => {
-            // 删除
-            deleteLogRead(record.id)
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.loadData()
-                }
-                resolve()
+        onOk: () => {
+          return deleteLogRead(record.id).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.loadData()
+            }
           })
         }
       })

+ 11 - 17
web-vue/src/pages/dispatch/status.vue

@@ -616,7 +616,6 @@ export default {
         '<li>一般用于服务器无法连接且已经确定不再使用</li>' +
         '<li>如果误操作会产生冗余数据!!!</li>' +
         ' </ul>'
-      const that = this
       $confirm({
         title: '危险操作!!!',
         zIndex: 1009,
@@ -625,23 +624,18 @@ export default {
         cancelButtonProps: { type: 'primary' },
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          return await new Promise((resolve, reject) => {
-            removeProject({
-              nodeId: item.nodeId,
-              projectId: item.projectId,
-              id: that.id
-            })
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.loadData()
-                }
-                resolve()
+        onOk: () => {
+          return removeProject({
+            nodeId: item.nodeId,
+            projectId: item.projectId,
+            id: this.id
+          }).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.loadData()
+            }
           })
         }
       })

+ 13 - 20
web-vue/src/pages/docker/container.vue

@@ -924,33 +924,26 @@ export default {
       if (!action) {
         return
       }
-      const that = this
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: action.msg,
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          return await new Promise((resolve, reject) => {
-            // 组装参数
-            const params = {
-              id: that.reqDataId,
+        onOk: () => {
+          return action
+            .api(this.urlPrefix, {
+              id: this.reqDataId,
               containerId: record.id
-            }
-            action
-              .api(that.urlPrefix, params)
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.loadData()
-                }
-                resolve()
-              })
-              .catch(reject)
-          })
+            })
+            .then((res) => {
+              if (res.code === 200) {
+                $notification.success({
+                  message: res.msg
+                })
+                this.loadData()
+              }
+            })
         }
       })
     },

+ 24 - 38
web-vue/src/pages/docker/images.vue

@@ -293,33 +293,26 @@ export default {
       if (!action) {
         return
       }
-      const that = this
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: action.msg,
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          return await new Promise((resolve, reject) => {
-            // 组装参数
-            const params = {
-              id: that.reqDataId,
+        onOk: () => {
+          return action
+            .api(this.urlPrefix, {
+              id: this.reqDataId,
               imageId: record.id
-            }
-            action
-              .api(that.urlPrefix, params)
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.loadData()
-                }
-                resolve()
-              })
-              .catch(reject)
-          })
+            })
+            .then((res) => {
+              if (res.code === 200) {
+                $notification.success({
+                  message: res.msg
+                })
+                this.loadData()
+              }
+            })
         }
       })
     },
@@ -430,31 +423,24 @@ export default {
     // 分配
     batchDelete() {
       let ids = this.tableSelections
-      const that = this
+
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: '真的要批量删除选择的镜像吗?已经被容器使用的镜像无法删除!',
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          return await new Promise((resolve, reject) => {
-            // 组装参数
-            const params = {
-              id: that.reqDataId,
-              imagesIds: ids.join(',')
-            }
-            dockerImageBatchRemove(that.urlPrefix, params)
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.loadData()
-                }
-                resolve()
+        onOk: () => {
+          return dockerImageBatchRemove(this.urlPrefix, {
+            id: this.reqDataId,
+            imagesIds: ids.join(',')
+          }).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.loadData()
+            }
           })
         }
       })

+ 9 - 17
web-vue/src/pages/docker/list.vue

@@ -441,30 +441,22 @@ export default {
     },
     // 删除
     handleDelete(record) {
-      const that = this
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: '真的要删除该记录么?删除后构建关联的容器标签将无法使用',
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          return await new Promise((resolve, reject) => {
-            // 组装参数
-            const params = {
-              id: record.id
-            }
-            deleteDcoker(params)
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.loadData()
-                }
-                resolve()
+        onOk: () => {
+          return deleteDcoker({
+            id: record.id
+          }).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.loadData()
+            }
           })
         }
       })

+ 13 - 20
web-vue/src/pages/docker/networks.vue

@@ -188,33 +188,26 @@ export default {
       if (!action) {
         return
       }
-      const that = this
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: action.msg,
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          return await new Promise((resolve, reject) => {
-            // 组装参数
-            const params = {
-              id: that.reqDataId,
+        onOk: () => {
+          return action
+            .api(this.urlPrefix, {
+              id: this.reqDataId,
               volumeName: record.name
-            }
-            action
-              .api(that.urlPrefix, params)
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.loadData()
-                }
-                resolve()
-              })
-              .catch(reject)
-          })
+            })
+            .then((res) => {
+              if (res.code === 200) {
+                $notification.success({
+                  message: res.msg
+                })
+                this.loadData()
+              }
+            })
         }
       })
     }

+ 9 - 17
web-vue/src/pages/docker/swarm/list.vue

@@ -320,30 +320,22 @@ export default {
 
     // 删除
     handleDelete(record) {
-      const that = this
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: '真的要删除该记录么?删除后构建关联的容器标签将无法使用',
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          return await new Promise((resolve, reject) => {
-            // 组装参数
-            const params = {
-              id: record.id
-            }
-            delSwarm(params)
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.loadData()
-                }
-                resolve()
+        onOk: () => {
+          return delSwarm({
+            id: record.id
+          }).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.loadData()
+            }
           })
         }
       })

+ 10 - 18
web-vue/src/pages/docker/swarm/node.vue

@@ -343,31 +343,23 @@ export default {
     },
     //
     handleLeava(record) {
-      const that = this
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: '真的要在该集群剔除此节点么?',
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          return await new Promise((resolve, reject) => {
-            // 组装参数
-            const params = {
-              nodeId: record.id,
-              id: that.id
-            }
-            dockerSwarmNodeLeave(params)
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.loadData()
-                }
-                resolve()
+        onOk: () => {
+          return dockerSwarmNodeLeave({
+            nodeId: record.id,
+            id: this.id
+          }).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.loadData()
+            }
           })
         }
       })

+ 10 - 18
web-vue/src/pages/docker/swarm/service.vue

@@ -841,31 +841,23 @@ export default {
     },
     // 删除
     handleDel(record) {
-      const that = this
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: '真的要删除此服务么?',
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          return await new Promise((resolve, reject) => {
-            // 组装参数
-            const params = {
-              serviceId: record.id,
-              id: that.id
-            }
-            dockerSwarmServicesDel(that.urlPrefix, params)
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.loadData()
-                }
-                resolve()
+        onOk: () => {
+          return dockerSwarmServicesDel(this.urlPrefix, {
+            serviceId: record.id,
+            id: this.id
+          }).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.loadData()
+            }
           })
         }
       })

+ 13 - 20
web-vue/src/pages/docker/volumes.vue

@@ -171,33 +171,26 @@ export default {
       if (!action) {
         return
       }
-      const that = this
       $confirm({
         title: '系统提示',
         content: action.msg,
         zIndex: 1009,
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          return await new Promise((resolve, reject) => {
-            // 组装参数
-            const params = {
-              id: that.reqDataId,
+        onOk: () => {
+          return action
+            .api(this.urlPrefix, {
+              id: this.reqDataId,
               volumeName: record.name
-            }
-            action
-              .api(that.urlPrefix, params)
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.loadData()
-                }
-                resolve()
-              })
-              .catch(reject)
-          })
+            })
+            .then((res) => {
+              if (res.code === 200) {
+                $notification.success({
+                  message: res.msg
+                })
+                this.loadData()
+              }
+            })
         }
       })
     }

+ 17 - 32
web-vue/src/pages/file-manager/fileStorage/list.vue

@@ -755,30 +755,22 @@ export default {
     },
     // 删除文件
     handleDelete(record) {
-      const that = this
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: '真的要删除当前文件么?' + record.name,
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          return await new Promise((resolve, reject) => {
-            // 删除
-            delFile({
-              id: record.id
-            })
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-
-                  that.loadData()
-                }
-                resolve()
+        onOk: () => {
+          return delFile({
+            id: record.id
+          }).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.loadData()
+            }
           })
         }
       })
@@ -791,28 +783,21 @@ export default {
         })
         return
       }
-      const that = this
       $confirm({
         title: '系统提示',
         zIndex: 1009,
         content: '真的要删除这些文件么?',
         okText: '确认',
         cancelText: '取消',
-        async onOk() {
-          return await new Promise((resolve, reject) => {
-            // 删除
-            delFile({ ids: that.tableSelections.join(',') })
-              .then((res) => {
-                if (res.code === 200) {
-                  $notification.success({
-                    message: res.msg
-                  })
-                  that.tableSelections = []
-                  that.loadData()
-                }
-                resolve()
+        onOk: () => {
+          return delFile({ ids: this.tableSelections.join(',') }).then((res) => {
+            if (res.code === 200) {
+              $notification.success({
+                message: res.msg
               })
-              .catch(reject)
+              this.tableSelections = []
+              this.loadData()
+            }
           })
         }
       })