|
@@ -2,7 +2,7 @@
|
|
|
<div class="data-table" :style="{ marginTop: marginTop }">
|
|
|
<div :style="dataTableContentStyle" v-loading="loading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)" class="data-table-content">
|
|
|
<div class="flex">
|
|
|
- <div :class="dataId ? 'bcTitle': 'manageTitle'">{{ pageTitle }}</div>
|
|
|
+ <div :class="dataId ? 'bcTitle': 'manageTitle'">{{ dataTitle }}</div>
|
|
|
</div>
|
|
|
<template v-if="tableData.length">
|
|
|
<div style="height:100%">
|
|
@@ -37,9 +37,13 @@
|
|
|
<el-table-column fixed="right" label="操作" :width="fixedWidth">
|
|
|
<template slot-scope="scope">
|
|
|
<div class="hd-td">
|
|
|
- <el-button type="text" size="small" class="rmScs">启用</el-button>
|
|
|
- <el-button type="text" @click="handleEdit(scope.row)" size="small" class="rmScs">停用</el-button>
|
|
|
- <el-button class="rmSc" type="text" @click="handleRemove(scope.row)" size="small">重置</el-button>
|
|
|
+ <template v-if="scope.row.serviceType == 4">
|
|
|
+ <el-button v-if="!scope.row.runState" @click="handleStart(scope.row)" type="text" size="small" class="rmScs">启用</el-button>
|
|
|
+ <el-button v-else type="text" @click="handleEdit(scope.row)" size="small" class="rmScs">停用</el-button>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <el-button class="rmSc" type="text" @click="handleRemove(scope.row)" size="small">重置</el-button>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -58,7 +62,7 @@ import { setTableFilters } from "@/utils/table";
|
|
|
import Dialog from "@/layout/components/Dialog/index.vue";
|
|
|
import NoData from "@/components/nodata";
|
|
|
import { translateDataToTreeAllTreeMsg } from "@/utils/validate";
|
|
|
-import { Query, newData, modifyData, moveData } from "@/api/webApi";
|
|
|
+import { Query, newData, modifyData, moveData, start, stop } from "@/api/webApi";
|
|
|
export default {
|
|
|
name: "DataTable",
|
|
|
props: {
|
|
@@ -176,6 +180,7 @@ export default {
|
|
|
dataContent: {
|
|
|
handler (obj) {
|
|
|
if (obj.deployNodeID) {
|
|
|
+ this.queryId = obj.deployNodeID
|
|
|
this.resetTable();
|
|
|
this.getColumnData(obj.deployNodeID)
|
|
|
} else {
|
|
@@ -254,7 +259,7 @@ export default {
|
|
|
"left": "(",
|
|
|
"column": "serviceOutPutId",
|
|
|
"comparator": "=",
|
|
|
- "value": `${id}`,
|
|
|
+ "value": `185`,
|
|
|
"right": ")",
|
|
|
"connector": ""
|
|
|
}
|
|
@@ -270,7 +275,7 @@ export default {
|
|
|
this.rowTitle = titleColumn.columnName;
|
|
|
}
|
|
|
this.tableCols = returnData;
|
|
|
- this.getQuery(this.queryId);
|
|
|
+ this.getQuery(id);
|
|
|
}
|
|
|
} else {
|
|
|
this.$message.error("获取表头数据失败");
|
|
@@ -368,13 +373,13 @@ export default {
|
|
|
try {
|
|
|
this.loading = true;
|
|
|
const { code, returnData, columnset } = await Query({
|
|
|
- serviceId: id,
|
|
|
+ serviceId: 3,
|
|
|
page: ++this.page,
|
|
|
pageSize: this.pageSize,
|
|
|
dataContent: [
|
|
|
{
|
|
|
"left": "(",
|
|
|
- "column": "deployNodeID",
|
|
|
+ "column": "workId",
|
|
|
"comparator": "=",
|
|
|
"value": `${id}`,
|
|
|
"right": ")",
|
|
@@ -406,11 +411,11 @@ export default {
|
|
|
this.loading = false;
|
|
|
}
|
|
|
},
|
|
|
- //表格-增/删/改
|
|
|
+ //服务列表-增/删/改
|
|
|
async generalDataReception (event, data) {
|
|
|
try {
|
|
|
const params = {
|
|
|
- serviceId: this.dataId,
|
|
|
+ serviceId: this.queryId,
|
|
|
dataContent: data,
|
|
|
event: `${event}`,
|
|
|
};
|
|
@@ -424,23 +429,34 @@ export default {
|
|
|
this.$message.success("操作成功");
|
|
|
this.resetTable();
|
|
|
this.getQuery(this.queryId);
|
|
|
- this.flag = false;
|
|
|
- this.rmFlag = false;
|
|
|
- this.tableObj = {};
|
|
|
- this.form = {};
|
|
|
- // this.$router.go(0);
|
|
|
} else {
|
|
|
this.$message.error("操作失败");
|
|
|
- this.flag = false;
|
|
|
- this.rmFlag = false;
|
|
|
- this.tableObj = {};
|
|
|
- this.form = {};
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- this.flag = false;
|
|
|
- this.rmFlag = false;
|
|
|
- this.tableObj = {};
|
|
|
- this.form = {};
|
|
|
+ this.$message.error("操作失败");
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ //服务启停
|
|
|
+ async controlService (event, data) {
|
|
|
+ try {
|
|
|
+ const params = {
|
|
|
+ serviceId: data.serviceID
|
|
|
+ };
|
|
|
+ const { code } =
|
|
|
+ event == 1
|
|
|
+ ? await start(params)
|
|
|
+ : await stop(params);
|
|
|
+ if (code == 0) {
|
|
|
+ this.$message.success('操作成功')
|
|
|
+ this.resetTable();
|
|
|
+ this.getColumnData(this.queryId)
|
|
|
+ } else {
|
|
|
+ this.$message.error("操作失败");
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ this.$message.error("操作失败");
|
|
|
}
|
|
|
},
|
|
|
// 表格勾选
|
|
@@ -676,10 +692,13 @@ export default {
|
|
|
},
|
|
|
//表格-编辑
|
|
|
handleEdit (row) {
|
|
|
- this.flag = true;
|
|
|
- this.tableType = "edit";
|
|
|
- this.tableTitle = "编辑算法配置";
|
|
|
- this.form = JSON.parse(JSON.stringify(row));
|
|
|
+ row.runState = 0
|
|
|
+ this.controlService(0, row)
|
|
|
+ },
|
|
|
+
|
|
|
+ handleStart (row) {
|
|
|
+ row.runState = 1
|
|
|
+ this.controlService(1, row)
|
|
|
},
|
|
|
|
|
|
// 新增/编辑-确认
|
|
@@ -699,10 +718,7 @@ export default {
|
|
|
},
|
|
|
//表格-删除
|
|
|
handleRemove (row) {
|
|
|
- this.rmFlag = true;
|
|
|
- // this.rmTitle = row.className || row.username || row.serviceName || row.queryTemplateName;
|
|
|
- this.rmTitle = row[this.rowTitle];
|
|
|
- this.tableObj = row;
|
|
|
+ this.controlService(0, row)
|
|
|
},
|
|
|
//表格-删除-确认
|
|
|
tableRemove () {
|
|
@@ -717,25 +733,6 @@ export default {
|
|
|
handlePreview (row) {
|
|
|
this.$emit("preview", row);
|
|
|
},
|
|
|
- //服务启停
|
|
|
- async controlService (event, data) {
|
|
|
- try {
|
|
|
- const params = {
|
|
|
- serviceId: data.deployNodeID
|
|
|
- };
|
|
|
- const { code } =
|
|
|
- event == 1
|
|
|
- ? await start(params)
|
|
|
- : await stop(params);
|
|
|
- if (code == 0) {
|
|
|
- this.generalDataReception(2, data)
|
|
|
- } else {
|
|
|
- this.$message.error("操作失败");
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- this.$message.error("操作失败");
|
|
|
- }
|
|
|
- },
|
|
|
},
|
|
|
};
|
|
|
</script>
|