Browse Source

修改服务管理启动停止

zhaoke 2 years ago
parent
commit
699c7b7f3a
1 changed files with 20 additions and 18 deletions
  1. 20 18
      src/components/Table/index.vue

+ 20 - 18
src/components/Table/index.vue

@@ -59,7 +59,7 @@
                   <div class="hd-tr">
                     <template v-if="isStatus">
                       <el-button type="text" @click="handleLook(scope.row)" size="small" class="rmScs">查看</el-button>
-                      <template v-if="scope.row.serviceTypeCode == 1 || scope.row.serviceTypeCode == 3">
+                      <template v-if="scope.row.serviceTypeCode == 2 || scope.row.serviceTypeCode == 4">
                         <el-button type="text" v-if="scope.row.runState == '停止'" @click="stateChangeHandler(scope.row)" size="small" class="rmScs">启动</el-button>
                         <el-button type="text" v-if="scope.row.runState == '运行'" @click="stateChangeHandler(scope.row)" size="small" class="rmScs">停止</el-button>
                       </template>
@@ -808,23 +808,25 @@ export default {
           dataContent: [serviceID]
         })
         if (Number(code) === 0) {
-          console.log(listValues)
-          // if (listValues.length) {
-          //   Promise.all(
-          //     listValues.map(node =>
-          //       request({
-          //         url: `${node.serviceURL}/${operate}`,
-          //         method: 'post'
-          //       })
-          //     )
-          //   ).then(results => {
-          //     if (results.every(result => Number(result.code) === 0)) {
-          //       this.$message.success('操作成功')
-          //     } else {
-          //       this.$message.error('操作失败')
-          //     }
-          //   })
-          // }
+          if (listValues.length) {
+            Promise.all(
+              listValues.map(node =>
+                request({
+                  url: `${node.serviceURL}${operate}`,
+                  method: 'post',
+                  data: {
+                    serviceId: serviceID
+                  }
+                })
+              )
+            ).then(results => {
+              if (results.every(result => Number(result.code) === 0)) {
+                this.$message.success('操作成功')
+              } else {
+                this.$message.error('操作失败')
+              }
+            })
+          }
         } else {
           this.$message.error('查询节点失败')
         }