|
|
@@ -5,6 +5,7 @@
|
|
|
</template>
|
|
|
<template v-slot:extra>
|
|
|
<lay-button class="card-button" v-if="apiList?.includes('/serverAuth/getPage')" @click="handlePem()">PEM管理</lay-button>
|
|
|
+ <lay-button class="card-button" v-if="apiList?.includes('/serverAuth/getPage')" @click="handleCommand()">批量执行指令</lay-button>
|
|
|
<lay-button class="card-button" v-if="apiList?.includes('/userServer/save')" @click="handleBatch()">批量添加服务器</lay-button>
|
|
|
<lay-button class="card-button" v-if="apiList?.includes('/userServer/save')" @click="handleUpdate(0)">添加服务器</lay-button>
|
|
|
</template>
|
|
|
@@ -21,13 +22,23 @@
|
|
|
</lay-form>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <lay-table :page="tablePage" :columns="columns" resize :data-source="dataSource" :loading="pageConfig.loading" @change="handleCurrentChange">
|
|
|
+ <lay-table
|
|
|
+ :page="tablePage"
|
|
|
+ :columns="columns"
|
|
|
+ resize
|
|
|
+ id="userServerId"
|
|
|
+ :data-source="dataSource"
|
|
|
+ v-model:selected-keys="selectedKeys"
|
|
|
+ :loading="pageConfig.loading"
|
|
|
+ @change="handleCurrentChange"
|
|
|
+ >
|
|
|
<template v-slot:status="{ row }">
|
|
|
{{ row.status ? "启用" : "禁用" }}
|
|
|
</template>
|
|
|
<template v-slot:operator="{ row }">
|
|
|
<lay-space>
|
|
|
<TableButton v-if="apiList?.includes('/userServer/testConnect')" text="测试连接" @click="handleTest(row)" />
|
|
|
+ <TableButton v-if="apiList?.includes('/userServer/delete')" text="指令" @click="handleCommand(row)" />
|
|
|
<TableButton v-if="apiList?.includes('/userServer/update')" text="编辑" @click="handleUpdate(1, row)" />
|
|
|
<TableButton v-if="apiList?.includes('/userServer/save')" text="复制" @click="handleUpdate(2, row)" />
|
|
|
<TableButton v-if="apiList?.includes('/userServer/delete')" type="danger" text="删除" @click="handleDelete(row)" />
|
|
|
@@ -40,6 +51,7 @@
|
|
|
<Update ref="updateRef" />
|
|
|
<Batch ref="batchRef" />
|
|
|
<Pem ref="pemRef" />
|
|
|
+ <Command ref="commandRef" />
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup name="ServerManage">
|
|
|
@@ -47,6 +59,7 @@ import { ref, reactive, getCurrentInstance } from "vue";
|
|
|
import Pem from "./components/Pem.vue";
|
|
|
import Update from "./components/Update.vue";
|
|
|
import Batch from "./components/Batch.vue";
|
|
|
+import Command from "./components/Command.vue";
|
|
|
import TableButton from "@/components/TableButton.vue";
|
|
|
import { get_server_list, delete_server, test_connect_server } from "@/api";
|
|
|
|
|
|
@@ -54,6 +67,7 @@ const { proxy }: any = getCurrentInstance();
|
|
|
const updateRef = ref();
|
|
|
const batchRef = ref();
|
|
|
const pemRef = ref();
|
|
|
+const commandRef = ref();
|
|
|
|
|
|
const apiList = ref(window.sessionStorage.getItem("_4L_API_LIST"));
|
|
|
|
|
|
@@ -79,12 +93,13 @@ interface TablePage {
|
|
|
}
|
|
|
const tablePage: TablePage = reactive({ current: 1, limit: 10, total: 0 });
|
|
|
const columns = ref([
|
|
|
+ { title: "选项", width: "44px", type: "checkbox" },
|
|
|
{ title: "名称", key: "name" },
|
|
|
- { title: "IP", key: "ipAddrComplex" },
|
|
|
+ { title: "IP", width: "120px", key: "ipAddrComplex" },
|
|
|
{ title: "端口号", width: "80px", key: "portComplex" },
|
|
|
{ title: "状态", width: "80px", key: "status", customSlot: "status" },
|
|
|
{ title: "备注", key: "remark", ellipsisTooltip: true },
|
|
|
- { title: "更新时间", key: "updateTime" },
|
|
|
+ { title: "更新时间", width: "160px", key: "updateTime" },
|
|
|
{
|
|
|
title: "操作",
|
|
|
customSlot: "operator",
|
|
|
@@ -93,6 +108,7 @@ const columns = ref([
|
|
|
},
|
|
|
]);
|
|
|
let dataSource = ref([]);
|
|
|
+let selectedKeys = ref([]);
|
|
|
|
|
|
// 请求交易所列表
|
|
|
const getPageInfo = (isSearch?: boolean) => {
|
|
|
@@ -123,10 +139,22 @@ const handleUpdate = async (type: number, value?: any) => {
|
|
|
if (result) getPageInfo();
|
|
|
};
|
|
|
|
|
|
+const handleCommand = async (value?: any) => {
|
|
|
+ let userServerId;
|
|
|
+ if (value) {
|
|
|
+ userServerId = [value.userServerId];
|
|
|
+ } else {
|
|
|
+ userServerId = selectedKeys.value
|
|
|
+ }
|
|
|
+ await commandRef.value.show(userServerId);
|
|
|
+};
|
|
|
+
|
|
|
// 测试连接
|
|
|
const handleTest = async (value: any) => {
|
|
|
let params = { ...value };
|
|
|
+ pageConfig.loading = true;
|
|
|
test_connect_server(params, (data: any) => {
|
|
|
+ pageConfig.loading = false;
|
|
|
if (data.code == 200) {
|
|
|
proxy.$message(`连接成功!`);
|
|
|
}
|