|
@@ -134,7 +134,7 @@
|
|
|
<el-button
|
|
|
type="text"
|
|
|
v-if="scope.row.runState == '停止'"
|
|
|
- @click="chanheState(scope.row)"
|
|
|
+ @click="stateChangeHandler(scope.row)"
|
|
|
size="small"
|
|
|
class="rmScs"
|
|
|
>启动</el-button
|
|
@@ -142,7 +142,7 @@
|
|
|
<el-button
|
|
|
type="text"
|
|
|
v-if="scope.row.runState == '运行'"
|
|
|
- @click="chanheState(scope.row)"
|
|
|
+ @click="stateChangeHandler(scope.row)"
|
|
|
size="small"
|
|
|
class="rmScs"
|
|
|
>停止</el-button
|
|
@@ -307,6 +307,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import request from '@/utils/request'
|
|
|
import { setTableFilters } from "@/utils/table";
|
|
|
import Dialog from "@/layout/components/Dialog/index.vue";
|
|
|
import NoData from "@/components/nodata";
|
|
@@ -931,10 +932,11 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
// 表格-启动/停止
|
|
|
- async chanheState(row) {
|
|
|
+ async stateChangeHandler(row) {
|
|
|
const runState = row.runState == "运行" ? 0 : 1;
|
|
|
const serviceID = row.serviceID;
|
|
|
- this.changeBtn(runState, serviceID);
|
|
|
+ // this.changeBtn(runState, serviceID);
|
|
|
+ this.changeState(runState, serviceID)
|
|
|
},
|
|
|
// 表格-选中行
|
|
|
selectHandler(selection, row) {
|
|
@@ -963,6 +965,38 @@ export default {
|
|
|
this.$message.error(res.message);
|
|
|
}
|
|
|
},
|
|
|
+ async changeState(runState, serviceID) {
|
|
|
+ try {
|
|
|
+ const operate = runState ? 'start' : 'stop'
|
|
|
+ const { code, returnData: { listValues } } = await Query({
|
|
|
+ id: DATACONTENT_ID.sysServiceNodeListId,
|
|
|
+ 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('操作失败')
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ } else {
|
|
|
+ this.$message.error('查询节点失败')
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log('出错了', error.message || error)
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
};
|
|
|
</script>
|