diff --git a/frontend/src/request/cluster.ts b/frontend/src/request/cluster.ts
index 19b9bc2733df37cc7608292343f5f761dc3aa843..e21b60668e46bd9679aa52df70ac62c66a985278 100644
--- a/frontend/src/request/cluster.ts
+++ b/frontend/src/request/cluster.ts
@@ -7,7 +7,7 @@
*/
import request from "./request";
-// 分页获取部门机器信息
+// 分页获取部门机器信息 || 模糊搜索机器列表
export function getPagedDepartMachines(data: any) {
return request({
url: "macList/machineinfo",
diff --git a/frontend/src/views/Audit/AuditDetail.vue b/frontend/src/views/Audit/AuditDetail.vue
index a7c12000d51595f381782ef9280ef3473ab30d68..ab1b1073ba1dcea090595e1bd527e417b54b593f 100644
--- a/frontend/src/views/Audit/AuditDetail.vue
+++ b/frontend/src/views/Audit/AuditDetail.vue
@@ -10,27 +10,29 @@
{{ audit.action }}
- {{ audit.message }}
+
+ {{ audit.message }}
+
\ No newline at end of file
+
diff --git a/frontend/src/views/Cluster/Cluster.vue b/frontend/src/views/Cluster/Cluster.vue
index 075bbbc3b5bc753fad013af2883e4e9ce04f11a2..77ad59815f9a77fe78af0259a8c40681861d443d 100644
--- a/frontend/src/views/Cluster/Cluster.vue
+++ b/frontend/src/views/Cluster/Cluster.vue
@@ -24,34 +24,45 @@
v-model:selectedData="selectedMachines"
>
-
-
- 操作
-
-
-
-
-
-
-
-
- 变更部门
-
-
-
-
- 删除
-
-
-
-
- {{ item.name }}
-
-
-
-
+ {{ item.name }}
+
+
+
+
+
@@ -86,7 +97,7 @@
@@ -116,13 +127,14 @@ const showSelect = ref(true);
const machines = ref([]);
const total = ref(0);
const page = ref({ pageSize: 10, currentPage: 1 });
+const searchInput = ref("");
const showChangeDepartDialog = ref(false);
let pluginBtns = ref([] as any);
onMounted(() => {
updatePlugins();
- updateDepartmentMachines(departmentID.value);
+ updateDepartmentMachines({ DepartId: departmentID.value });
pluginBtns.value = usePluginStore().extention;
});
@@ -139,11 +151,11 @@ watch(
{ immediate: true, deep: true }
);
-function updateDepartmentMachines(departID: number) {
+function updateDepartmentMachines(params: any) {
getPagedDepartMachines({
page: page.value.currentPage,
size: page.value.pageSize,
- DepartId: departID,
+ ...params,
})
.then((resp: any) => {
if (resp.code === RespCodeOK) {
@@ -187,7 +199,7 @@ watch(
() => page.value,
(newV) => {
if (newV) {
- updateDepartmentMachines(departmentID.value);
+ searchInput.value ? onSearchHost() : updateDepartmentMachines({ DepartId: departmentID.value });
}
},
{ deep: true }
@@ -198,7 +210,7 @@ function machineDetail(info: any) {
function onDepartmentClicked(depart: any) {
departmentID.value = depart.id;
- updateDepartmentMachines(depart.id);
+ updateDepartmentMachines({ DepartId: depart.id });
}
// 发送插件的请求
@@ -210,13 +222,50 @@ const handlePluginAPI = (url: string) => {
axios.post(window.location.origin + url, { uuids: uuidArr }).then((response: any) => {
if (response.data.data.code === 200) {
setTimeout(() => {
- updateDepartmentMachines(departmentID.value);
+ updateDepartmentMachines({ DepartId: departmentID.value });
ElMessage.success(response.data.data.msg);
}, 2000);
}
});
};
+/**
+ * 模糊搜索
+ * @params search:string 模糊关键字
+ * 其中状态一栏对应关系:
+ * 在线-online
+ * | 离线-offline
+ * | normal-正常使用
+ * | maintenance-维护中
+ */
+const onSearchHost = () => {
+ let searchKey: string = "";
+ let stateDict = [
+ {
+ label: "在线",
+ value: "online",
+ },
+ {
+ label: "离线",
+ value: "offline",
+ },
+ {
+ label: "正常使用",
+ value: "normal",
+ },
+ {
+ label: "维护中",
+ value: "maintenance",
+ },
+ ];
+
+ if (searchInput.value) {
+ let filterStates = stateDict.filter((item) => item.label.match(searchInput.value));
+ searchKey = filterStates.length > 0 ? filterStates[0].value : searchInput.value;
+ }
+ updateDepartmentMachines({ search: searchKey });
+};
+
/*
* 删除机器
* @params deluuid[] 机器的uuid列表
@@ -236,7 +285,7 @@ const handleDeleteMachine = () => {
if (res.code === RespCodeOK) {
page.value.currentPage = 1;
page.value.pageSize = 10;
- updateDepartmentMachines(1);
+ updateDepartmentMachines({ DepartId: 1 });
ElMessage.success(res.msg);
} else {
ElMessage.success(res.msg);
@@ -275,6 +324,15 @@ const handleTerminal = (ip: string) => {
.cluster {
width: 80%;
height: 100%;
+ .search {
+ height: 100%;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ &_input {
+ width: 300px;
+ }
+ }
}
}
diff --git a/frontend/src/views/Plugin/PluginFrame.vue b/frontend/src/views/Plugin/PluginFrame.vue
index 8b90c5006d52714a42ba0c97a2de8632bd59e2d2..8a0b089c4921bea47ead3e039b59a1c101c61d25 100644
--- a/frontend/src/views/Plugin/PluginFrame.vue
+++ b/frontend/src/views/Plugin/PluginFrame.vue
@@ -7,13 +7,13 @@
-->
-