diff --git a/src/api/index.js b/src/api/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ca320ce9d974c84c4afef6bb1291f320fd9cb444 --- /dev/null +++ b/src/api/index.js @@ -0,0 +1,10 @@ +import request from './config' + +// 获取审计日志列表和系统日志列表 +export function getVersionApi(params) { + return request({ + url: '/version', + method: 'get', + params + }) +} diff --git a/src/api/node_group.js b/src/api/node_group.js index fa192366829912278234710290063d0d611be0d3..7156c3d3b5854e7d1fb6a95b7be86731baf28ca6 100644 --- a/src/api/node_group.js +++ b/src/api/node_group.js @@ -1,85 +1,85 @@ -import axios from './config' - -// 节点分组查询 -export function listGroup(data) { - return axios({ - url: '/nodeGroup/list', - headers: { - 'Content-Type': 'application/json; charset=UTF-8' - }, - method: 'post', - data - }) -} - -// 节点分组新增 -export function addGroup(data) { - return axios({ - url: '/nodeGroup/add', - headers: { - 'Content-Type': 'application/json; charset=UTF-8' - }, - method: 'post', - data - }) -} - -// 节点分组修改 -export function updateGroup(data) { - return axios({ - url: '/nodeGroup/update', - headers: { - 'Content-Type': 'application/json; charset=UTF-8' - }, - method: 'post', - data - }) -} - -// 节点分组删除 -export function deleteGroup(data) { - return axios({ - url: '/nodeGroup/delete', - headers: { - 'Content-Type': 'application/json; charset=UTF-8' - }, - method: 'post', - data - }) -} - -// 查询分组节点列表 -export function nodelist(data) { - return axios({ - url: '/nodegroupinfo/nodelist', - headers: { - 'Content-Type': 'application/json; charset=UTF-8' - }, - method: 'post', - data - }) -} - -// 分组添加节点 -export function addnode(data) { - return axios({ - url: '/nodegroupinfo/addnode', - headers: { - 'Content-Type': 'application/json; charset=UTF-8' - }, - method: 'post', - data - }) -} - -// 分组删除节点 -export function deletenode(data) { - return axios({ - url: '/nodegroupinfo/deletenode', - headers: { - 'Content-Type': 'application/json; charset=UTF-8' - }, - method: 'post', - data - }) -} +import axios from './config' + +// 节点分组查询 +export function listGroup(data) { + return axios({ + url: '/nodeGroup/list', + headers: { + 'Content-Type': 'application/json; charset=UTF-8' + }, + method: 'post', + data + }) +} + +// 节点分组新增 +export function addGroup(data) { + return axios({ + url: '/nodeGroup/add', + headers: { + 'Content-Type': 'application/json; charset=UTF-8' + }, + method: 'post', + data + }) +} + +// 节点分组修改 +export function updateGroup(data) { + return axios({ + url: '/nodeGroup/update', + headers: { + 'Content-Type': 'application/json; charset=UTF-8' + }, + method: 'post', + data + }) +} + +// 节点分组删除 +export function deleteGroup(data) { + return axios({ + url: '/nodeGroup/delete', + headers: { + 'Content-Type': 'application/json; charset=UTF-8' + }, + method: 'post', + data + }) +} + +// 查询分组节点列表 +export function nodelist(data) { + return axios({ + url: '/nodegroupinfo/nodelist', + headers: { + 'Content-Type': 'application/json; charset=UTF-8' + }, + method: 'post', + data + }) +} + +// 分组添加节点 +export function addnode(data) { + return axios({ + url: '/nodegroupinfo/addnode', + headers: { + 'Content-Type': 'application/json; charset=UTF-8' + }, + method: 'post', + data + }) +} + +// 分组删除节点 +export function deletenode(data) { + return axios({ + url: '/nodegroupinfo/deletenode', + headers: { + 'Content-Type': 'application/json; charset=UTF-8' + }, + method: 'post', + data + }) +} diff --git a/src/api/node_package.js b/src/api/node_package.js index cfbb59c68a2e3ddbf0e328be582af2c882344c82..e63b4dc12c7eea782cedee52cdeed3c7450f1951 100644 --- a/src/api/node_package.js +++ b/src/api/node_package.js @@ -1,99 +1,138 @@ -import request from './config' -// import qs from 'qs' - -export function addPackageTask(data) { - return request({ - url: '/node/putToTaskQueue', - headers: { - 'Content-Type': 'application/json; charset=UTF-8' - }, - method: 'post', - data - }) -} - -export function getTaskStatus(data) { - return request({ - url: '/node/getTaskStatus', - method: 'post', - data - }) -} - -export function startThread(data) { - return request({ - url: '/node/threadServiceRunner', - method: 'post', - data - }) -} - -export function getPackageList(data) { - return request({ - url: '/node/getPackageInfo', - method: 'post', - data - }) -} - -export function delTaskById(data) { - return request({ - url: '/node/delTaskById', - method: 'post', - headers: { - 'Content-Type': 'application/json; charset=UTF-8' - }, - data - }) -} - -export function setTaskViewed(data) { - return request({ - url: '/node/setTaskViewed', - method: 'post', - data - }) -} - -export function getInstallablePackage(data) { - return request({ - timeout: 0, - url: '/node/getSourcePackageInfo', - method: 'post', - data: data - }) -} - -export function getInstallablePackageByKeyword(data) { - return request({ - url: '/node/searchSourcePackageInfo', - method: 'post', - data, - headers: { - tip: 'no' - } - }) -} - -export function getUpdateablePackage(nodeId) { - return request({ - headers: { - tip: 'no' - }, - url: '/node/getUpgradeable', - method: 'post', - data: { nodeId } - }) -} - -export function queryDependency(data) { - return request({ - headers: { - tip: 'no', - 'Content-Type': 'application/json; charset=UTF-8' - }, - url: '/pkg/queryDependency?nodeId=' + data.nodeId, - method: 'post', - data: { packageName: data.packageName } - }) -} +import request from './config' +// import qs from 'qs' + +export function addPackageTask(data) { + return request({ + url: '/node/putToTaskQueue', + headers: { + 'Content-Type': 'application/json; charset=UTF-8' + }, + method: 'post', + data + }) +} + +export function getTaskStatus(data) { + return request({ + url: '/node/getTaskStatus', + method: 'post', + data + }) +} + +export function startThread(data) { + return request({ + url: '/node/threadServiceRunner', + method: 'post', + data + }) +} + +// 获取软件包列表数据 +export function getPackageList(data) { + return request({ + url: '/getPackageInfo', + method: 'post', + data, + headers: { + 'Content-Type': 'application/json; charset=UTF-8' + } + }) +} +// 软件包列表刷新 +export function refreshPackageList(data) { + return request({ + url: '/packageRefresh', + method: 'post', + data + }) +} + +// 删除任务记录 +export function delTaskById(data) { + return request({ + url: '/node/delTaskById', + method: 'post', + headers: { + 'Content-Type': 'application/json; charset=UTF-8' + }, + data + }) +} + +// 修改任务为已读状态 +export function setTaskViewed(data) { + return request({ + url: '/node/setTaskViewed', + method: 'post', + data + }) +} + +// 获取当前节点可安装的软件包列表 +export function getInstallablePackage(data) { + return request({ + timeout: 0, + url: '/node/getSourcePackageInfo', + method: 'post', + data: data + }) +} + +// 根据关键字获取节点可安装的软件包 +export function getInstallablePackageByKeyword(data) { + return request({ + url: '/node/searchSourcePackageInfo', + method: 'post', + data, + headers: { + tip: 'no' + } + }) +} + +// 获取可升级软件包列表 +export function getUpdateablePackage(nodeId) { + return request({ + headers: { + tip: 'no' + }, + url: '/node/getUpgradeable', + method: 'post', + data: { nodeId } + }) +} + +// 获取安装软件依赖包 +export function queryDependency(data) { + return request({ + headers: { + tip: 'no', + 'Content-Type': 'application/json; charset=UTF-8' + }, + url: '/pkg/queryDependency?nodeId=' + data.nodeId, + method: 'post', + data: { packageName: data.packageName } + }) +} + +// 查询软件包下服务器 +export function getNodeByPkgName(data) { + return request({ + headers: { + 'Content-Type': 'application/json; charset=UTF-8' + }, + url: '/getNodeByPkgName', + method: 'post', + data + }) +} + +// 查询系统内软件包总数量 +export function getAllPkgCount(data) { + return request({ + url: '/getAllPkgCount', + method: 'get', + data + }) +} diff --git a/src/components/custom-table/index.vue b/src/components/custom-table/index.vue index d4d0282212018e5459dfc5d4e563d78d1e974ae4..baf63809bb2ad3e38f9f129903d37046ee2c7b64 100644 --- a/src/components/custom-table/index.vue +++ b/src/components/custom-table/index.vue @@ -1,136 +1,142 @@ - - - + + + diff --git a/src/components/draggable-table/index.vue b/src/components/draggable-table/index.vue index 83e70f124d915fc7b8763aabb09ee115652615d7..44cc81661c7ccc4a3f6c78b9325b75449d6542be 100644 --- a/src/components/draggable-table/index.vue +++ b/src/components/draggable-table/index.vue @@ -1,66 +1,67 @@ - - - \ No newline at end of file + + + diff --git a/src/pages/install/index.vue b/src/pages/install/index.vue index 569483b3c20b7543c5dc84821072d222d208cb87..33b35fa4f7ebea4926526b73be2bfe431ff37ac6 100644 --- a/src/pages/install/index.vue +++ b/src/pages/install/index.vue @@ -1,146 +1,163 @@ - - - - - + + + + + diff --git a/src/pages/node/nodeGroupManager/components/node_list.vue b/src/pages/node/nodeGroupManager/components/node_list.vue index 9b5df9c99f7b4e5ea029e3df4d199660de13eedf..7dc6f99bc2dd5a97cb5968805480253118a24943 100644 --- a/src/pages/node/nodeGroupManager/components/node_list.vue +++ b/src/pages/node/nodeGroupManager/components/node_list.vue @@ -55,7 +55,7 @@ import NodeLayout from '@/pages/node/list/node-layout' import { nodelist, deletenode } from '@/api/node_group' import { getNodeStatus, setNodeLocalIp, getNodeList } from '@/api/node' import AllNode from './all_node.vue' -import { deepClone, deepCloneV2 } from '@/utils/obj' +import { deepClone } from '@/utils/obj' export default { components: { AllNode, @@ -103,12 +103,13 @@ export default { } }, mounted() { - setTimeout(() => { - this.tableHeight = this.$refs.listSet.clientHeight - 140 - }) + this.calculateTableHeight() this.loadData() }, methods: { + calculateTableHeight() { + this.tableHeight = this.$refs.listSet.clientHeight - 140 + }, nodelist() { this.loading = true nodelist({ groupId: this.parentMsg.id, pageNum: 1, pageSize: 99999 }).then(res => { @@ -204,17 +205,19 @@ export default { }) }, // 加载数据 - loadData() { + async loadData() { this.loading = true - this.nodeMsgs = [] - getNodeList().then((res) => { + try { + const res = await getNodeList() if (res.code === 200) { this.nodeMsgs = res.data || [] - this.nodelist() + this.fetchNodeList() } - }).finally(() => { - - }) + } catch (error) { + console.error('获取节点信息失败:', error) + } finally { + this.loading = false + } }, // 关闭抽屉层 onClose() { @@ -228,7 +231,17 @@ export default { diff --git a/src/utils/validate.js b/src/utils/validate.js index 818ee39a70793add083a604e5066f0d245d51daa..81043c49d7595795f667f27af100e5d0d925d612 100644 --- a/src/utils/validate.js +++ b/src/utils/validate.js @@ -3,3 +3,23 @@ export function isIpAndPort(str) { return /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])(\:([0-9]|[1-9]\d{1,3}|[1-5]\d{4}|6[0-5]{2}[0-3][0-5])){1}$/.test(str) } + +// 校验URL +export function isUrl(str) { + return /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/.test(str) +} + +// 校验日期(格式:YYYY-MM-DD) +export function isDate(str) { + return /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/.test(str) +} + +// 校验时间(格式:HH:mm:ss) +export function isTime(str) { + return /^(2[0-3]|[01]?[0-9]):([0-5]?[0-9]):([0-5]?[0-9])$/.test(str) +} + +// 校验日期时间(格式:YYYY-MM-DD HH:mm:ss) +export function isDateTime(str) { + return /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]) (2[0-3]|[01]?[0-9]):([0-5]?[0-9]):([0-5]?[0-9])$/.test(str) +} \ No newline at end of file