|
|
@@ -1,131 +1,146 @@
|
|
|
<template>
|
|
|
- <lay-card class="custom-card">
|
|
|
- <template v-slot:title>
|
|
|
- <span class="card-title">服务器管理</span>
|
|
|
- </template>
|
|
|
- <template v-slot:extra>
|
|
|
- <lay-button class="card-button" v-if="apiList?.includes('/user/save')" @click="handleUpdate()">PEM管理</lay-button>
|
|
|
- <lay-button class="card-button" v-if="apiList?.includes('/user/save')" @click="handleUpdate()">批量添加服务器</lay-button>
|
|
|
- <lay-button class="card-button" v-if="apiList?.includes('/user/save')" @click="handleUpdate()">添加服务器</lay-button>
|
|
|
- </template>
|
|
|
-
|
|
|
- <template v-slot:body>
|
|
|
- <div class="custom-form-layout">
|
|
|
- <lay-form class="form-wp" :model="pageParams" mode="inline">
|
|
|
- <lay-form-item label="名称" prop="name">
|
|
|
- <lay-input v-model="pageParams.name" />
|
|
|
- </lay-form-item>
|
|
|
- <div class="form-button-wp">
|
|
|
- <lay-button @click="getPageInfo(true)">搜索</lay-button>
|
|
|
- </div>
|
|
|
- </lay-form>
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <lay-table :page="tablePage" :columns="columns" resize :data-source="dataSource" :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('/user/setStatus')" text="测试连接" @click="handleStatus(row)" />
|
|
|
- <TableButton v-if="apiList?.includes('/user/update')" text="编辑" @click="handleUpdate(row)" />
|
|
|
- <TableButton v-if="apiList?.includes('/user/update')" text="复制" @click="handleUpdate(row)" />
|
|
|
- <TableButton v-if="apiList?.includes('/user/delete')" type="danger" text="删除" @click="handleDelete(row)" />
|
|
|
- </lay-space>
|
|
|
- </template>
|
|
|
- </lay-table>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </lay-card>
|
|
|
- <Update ref="updateRef" />
|
|
|
- </template>
|
|
|
-
|
|
|
- <script lang="ts" setup name="ServerManage">
|
|
|
- import { ref, reactive, getCurrentInstance } from "vue";
|
|
|
- import Update from "./components/Update.vue";
|
|
|
- import TableButton from "@/components/TableButton.vue";
|
|
|
- import { get_server_list, delete_server } from "@/api";
|
|
|
-
|
|
|
- const { proxy }: any = getCurrentInstance();
|
|
|
- const updateRef = ref();
|
|
|
-
|
|
|
- const apiList = ref(window.sessionStorage.getItem("_4L_API_LIST"));
|
|
|
-
|
|
|
- interface PageConfig {
|
|
|
- loading: boolean;
|
|
|
- }
|
|
|
-
|
|
|
- let pageConfig: PageConfig = reactive({
|
|
|
- loading: false,
|
|
|
+ <lay-card class="custom-card">
|
|
|
+ <template v-slot:title>
|
|
|
+ <span class="card-title">服务器管理</span>
|
|
|
+ </template>
|
|
|
+ <template v-slot:extra>
|
|
|
+ <lay-button class="card-button" v-if="apiList?.includes('/user/save')" @click="handlePem()">PEM管理</lay-button>
|
|
|
+ <lay-button class="card-button" v-if="apiList?.includes('/user/save')" @click="handleBatch()">批量添加服务器</lay-button>
|
|
|
+ <lay-button class="card-button" v-if="apiList?.includes('/user/save')" @click="handleUpdate()">添加服务器</lay-button>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:body>
|
|
|
+ <div class="custom-form-layout">
|
|
|
+ <lay-form class="form-wp" :model="pageParams" mode="inline">
|
|
|
+ <lay-form-item label="名称" prop="name">
|
|
|
+ <lay-input v-model="pageParams.name" />
|
|
|
+ </lay-form-item>
|
|
|
+ <div class="form-button-wp">
|
|
|
+ <lay-button @click="getPageInfo(true)">搜索</lay-button>
|
|
|
+ </div>
|
|
|
+ </lay-form>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <lay-table :page="tablePage" :columns="columns" resize :data-source="dataSource" :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('/user/setStatus')" text="测试连接" @click="handleStatus(row)" />
|
|
|
+ <TableButton v-if="apiList?.includes('/user/update')" text="编辑" @click="handleUpdate(row)" />
|
|
|
+ <TableButton v-if="apiList?.includes('/user/update')" text="复制" @click="handleUpdate(row)" />
|
|
|
+ <TableButton v-if="apiList?.includes('/user/delete')" type="danger" text="删除" @click="handleDelete(row)" />
|
|
|
+ </lay-space>
|
|
|
+ </template>
|
|
|
+ </lay-table>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </lay-card>
|
|
|
+ <Update ref="updateRef" />
|
|
|
+ <Batch ref="batchRef" />
|
|
|
+ <Pem ref="pemRef" />
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup name="ServerManage">
|
|
|
+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 TableButton from "@/components/TableButton.vue";
|
|
|
+import { get_server_list, delete_server } from "@/api";
|
|
|
+
|
|
|
+const { proxy }: any = getCurrentInstance();
|
|
|
+const updateRef = ref();
|
|
|
+const batchRef = ref();
|
|
|
+const pemRef = ref();
|
|
|
+
|
|
|
+const apiList = ref(window.sessionStorage.getItem("_4L_API_LIST"));
|
|
|
+
|
|
|
+interface PageConfig {
|
|
|
+ loading: boolean;
|
|
|
+}
|
|
|
+
|
|
|
+let pageConfig: PageConfig = reactive({
|
|
|
+ loading: false,
|
|
|
+});
|
|
|
+
|
|
|
+interface FormItem {
|
|
|
+ pageNum?: Number;
|
|
|
+ pageSize?: Number;
|
|
|
+ name?: String;
|
|
|
+}
|
|
|
+const pageParams: FormItem = reactive({ pageNum: 1, pageSize: 10 });
|
|
|
+
|
|
|
+interface TablePage {
|
|
|
+ current: number;
|
|
|
+ limit: number;
|
|
|
+ total: number;
|
|
|
+}
|
|
|
+const tablePage: TablePage = reactive({ current: 1, limit: 10, total: 0 });
|
|
|
+const columns = ref([
|
|
|
+ { title: "名称", width: "80px", key: "name", sort: "desc" },
|
|
|
+ { title: "IP", width: "80px", key: "account", sort: "desc" },
|
|
|
+ { title: "端口号", width: "80px", key: "account", sort: "desc" },
|
|
|
+ { title: "状态", width: "80px", key: "status", customSlot: "status" },
|
|
|
+ { title: "备注", width: "80px", key: "remark", ellipsisTooltip: true },
|
|
|
+ { title: "更新时间", width: "80px", key: "account", sort: "desc" },
|
|
|
+ {
|
|
|
+ title: "操作",
|
|
|
+ width: "150px",
|
|
|
+ customSlot: "operator",
|
|
|
+ key: "operator",
|
|
|
+ ignoreExport: true,
|
|
|
+ },
|
|
|
+]);
|
|
|
+let dataSource = ref([]);
|
|
|
+
|
|
|
+// 请求交易所列表
|
|
|
+const getPageInfo = (isSearch?: boolean) => {
|
|
|
+ if (isSearch) pageParams.pageNum = 1;
|
|
|
+ pageConfig.loading = true;
|
|
|
+ get_server_list(pageParams, (data: any) => {
|
|
|
+ pageConfig.loading = false;
|
|
|
+ if (data.code == 200) {
|
|
|
+ dataSource.value = data.data.list;
|
|
|
+ tablePage.total = data.data.total;
|
|
|
+ }
|
|
|
});
|
|
|
-
|
|
|
- interface FormItem {
|
|
|
- pageNum?: Number;
|
|
|
- pageSize?: Number;
|
|
|
- name?: String;
|
|
|
- }
|
|
|
- const pageParams: FormItem = reactive({ pageNum: 1, pageSize: 10 });
|
|
|
-
|
|
|
- interface TablePage {
|
|
|
- current: number;
|
|
|
- limit: number;
|
|
|
- total: number;
|
|
|
- }
|
|
|
- const tablePage: TablePage = reactive({ current: 1, limit: 10, total: 0 });
|
|
|
- const columns = ref([
|
|
|
- { title: "名称", width: "80px", key: "name", sort: "desc" },
|
|
|
- { title: "IP", width: "80px", key: "account", sort: "desc" },
|
|
|
- { title: "端口号", width: "80px", key: "account", sort: "desc" },
|
|
|
- { title: "状态", width: "80px", key: "status", customSlot: "status" },
|
|
|
- { title: "备注", width: "80px", key: "remark", ellipsisTooltip: true },
|
|
|
- { title: "更新时间", width: "80px", key: "account", sort: "desc" },
|
|
|
- {
|
|
|
- title: "操作",
|
|
|
- width: "150px",
|
|
|
- customSlot: "operator",
|
|
|
- key: "operator",
|
|
|
- ignoreExport: true,
|
|
|
- },
|
|
|
- ]);
|
|
|
- let dataSource = ref([]);
|
|
|
-
|
|
|
- // 请求交易所列表
|
|
|
- const getPageInfo = (isSearch?: boolean) => {
|
|
|
- if (isSearch) pageParams.pageNum = 1;
|
|
|
- pageConfig.loading = true;
|
|
|
- get_server_list(pageParams, (data: any) => {
|
|
|
- pageConfig.loading = false;
|
|
|
- if (data.code == 200) {
|
|
|
- dataSource.value = data.data.list;
|
|
|
- tablePage.total = data.data.total;
|
|
|
- }
|
|
|
- });
|
|
|
- };
|
|
|
+};
|
|
|
+getPageInfo();
|
|
|
+
|
|
|
+const handlePem = async () => {
|
|
|
+ const result = await pemRef.value.show();
|
|
|
+ if (result) getPageInfo();
|
|
|
+};
|
|
|
+
|
|
|
+const handleBatch = async () => {
|
|
|
+ const result = await batchRef.value.show();
|
|
|
+ if (result) getPageInfo();
|
|
|
+};
|
|
|
+
|
|
|
+const handleUpdate = async (value?: any) => {
|
|
|
+ const result = await updateRef.value.show(value);
|
|
|
+ if (result) getPageInfo();
|
|
|
+};
|
|
|
+
|
|
|
+// 删除交易所
|
|
|
+const handleDelete = async (value: any) => {
|
|
|
+ let result = await proxy.$waitingConfirm("是否确认删除该用户?");
|
|
|
+ if (!result) return;
|
|
|
+ let params = [value.userId];
|
|
|
+ pageConfig.loading = true;
|
|
|
+ delete_server(params, (data: any) => {
|
|
|
+ pageConfig.loading = false;
|
|
|
+ if (data.code == 200) {
|
|
|
+ proxy.$message(`删除成功!`);
|
|
|
+ getPageInfo();
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+// 分页设置
|
|
|
+const handleCurrentChange = (val: any) => {
|
|
|
+ pageParams.pageNum = val.current;
|
|
|
getPageInfo();
|
|
|
-
|
|
|
- const handleUpdate = async (value?: any) => {
|
|
|
- const result = await updateRef.value.show(value);
|
|
|
- if (result) getPageInfo();
|
|
|
- };
|
|
|
-
|
|
|
- // 删除交易所
|
|
|
- const handleDelete = async (value: any) => {
|
|
|
- let result = await proxy.$waitingConfirm("是否确认删除该用户?");
|
|
|
- if (!result) return;
|
|
|
- let params = [value.userId];
|
|
|
- pageConfig.loading = true;
|
|
|
- delete_server(params, (data: any) => {
|
|
|
- pageConfig.loading = false;
|
|
|
- if (data.code == 200) {
|
|
|
- proxy.$message(`删除成功!`);
|
|
|
- getPageInfo();
|
|
|
- }
|
|
|
- });
|
|
|
- };
|
|
|
- // 分页设置
|
|
|
- const handleCurrentChange = (val: any) => {
|
|
|
- pageParams.pageNum = val.current;
|
|
|
- getPageInfo();
|
|
|
- };
|
|
|
- </script>
|
|
|
-
|
|
|
+};
|
|
|
+</script>
|