From d3c658fa4deeac2e3672e55ddba5bb7f6b7622c1 Mon Sep 17 00:00:00 2001 From: aoshiguchen <1052045476@qq.com> Date: Sun, 10 Dec 2023 22:43:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E5=85=A8=E7=BB=84=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- neutrino-proxy-admin/src/api/securityGroup.js | 25 ++-- .../src/views/system/securityGroup.vue | 33 +++-- .../src/views/system/securityRule.vue | 130 +++++++++++++----- .../server/constant/ExceptionConstant.java | 2 + .../constant/SecurityRulePassTypeEnum.java | 2 +- .../server/controller/SecurityController.java | 35 +++-- .../req/system/SecurityGroupCreateReq.java | 2 +- .../req/system/SecurityGroupListReq.java | 2 +- .../req/system/SecurityRuleCreateReq.java | 2 +- .../req/system/SecurityRuleListReq.java | 16 +++ .../SecurityRuleUpdateEnableStatueReq.java | 19 +++ .../req/system/SecurityRuleUpdateReq.java | 2 +- .../res/system/SecurityGroupDetailRes.java | 2 +- .../res/system/SecurityGroupListRes.java | 8 +- ...yRuleRes.java => SecurityRuleListRes.java} | 9 +- .../SecurityRuleUpdateEnableStatueRes.java | 8 ++ .../server/dal/SecurityRuleMapper.java | 18 +++ .../server/dal/entity/SecurityGroupDO.java | 8 +- .../server/dal/entity/SecurityRuleDO.java | 22 ++- .../server/service/SecurityGroupService.java | 53 ++++--- .../resources/mapper/SecurityRuleMapper.xml | 26 ++++ .../main/resources/sql/h2/init-structure.sql | 4 +- .../sql/h2/update/UPDATE-20231207.SQL | 4 +- .../resources/sql/mariadb/init-structure.sql | 4 +- .../resources/sql/mysql/init-structure.sql | 4 +- .../sql/mysql/update/UPDATE-20231207.SQL | 4 +- 26 files changed, 308 insertions(+), 136 deletions(-) create mode 100644 neutrino-proxy-server/src/main/java/org/dromara/neutrinoproxy/server/controller/req/system/SecurityRuleListReq.java create mode 100644 neutrino-proxy-server/src/main/java/org/dromara/neutrinoproxy/server/controller/req/system/SecurityRuleUpdateEnableStatueReq.java rename neutrino-proxy-server/src/main/java/org/dromara/neutrinoproxy/server/controller/res/system/{SecurityRuleRes.java => SecurityRuleListRes.java} (85%) create mode 100644 neutrino-proxy-server/src/main/java/org/dromara/neutrinoproxy/server/controller/res/system/SecurityRuleUpdateEnableStatueRes.java create mode 100644 neutrino-proxy-server/src/main/resources/mapper/SecurityRuleMapper.xml diff --git a/neutrino-proxy-admin/src/api/securityGroup.js b/neutrino-proxy-admin/src/api/securityGroup.js index f6987719..451539f1 100644 --- a/neutrino-proxy-admin/src/api/securityGroup.js +++ b/neutrino-proxy-admin/src/api/securityGroup.js @@ -58,6 +58,14 @@ export function updateGroupEnableStatus(id, enable) { }) } +export function fetchRulePage(query) { + return request({ + url: '/security/rule/page', + method: 'get', + params: query + }) +} + export function fetchRuleList(query) { return request({ url: '/security/rule/list', @@ -89,16 +97,13 @@ export function deleteRule(query) { }) } -export function enableRule(ruleId) { +export function updateRuleEnableStatus(id, enable) { return request({ - url: `/security/rule/enable?ruleId=${ruleId}`, - method: 'post' - }) -} - -export function disableRule(ruleId) { - return request({ - url: `/security/rule/disable?ruleId=${ruleId}`, - method: 'post' + url: '/security/rule/update/enable-status', + method: 'post', + data: { + id: id, + enable: enable + } }) } diff --git a/neutrino-proxy-admin/src/views/system/securityGroup.vue b/neutrino-proxy-admin/src/views/system/securityGroup.vue index 5afcfed3..0430080c 100644 --- a/neutrino-proxy-admin/src/views/system/securityGroup.vue +++ b/neutrino-proxy-admin/src/views/system/securityGroup.vue @@ -3,11 +3,15 @@
+ + + {{ - $t('table.search') }} + $t('table.search') }} + {{$t('table.add')}}
@@ -31,18 +35,17 @@ @@ -186,6 +189,7 @@ import {fetchGroupPage, createGroup, updateGroup, deleteGroup, updateGroupEnableStatus} from '@/api/securityGroup' import { fetchList as fetchPortMappingList, portMappingBindSecurityGroup, portMappingUnbindSecurityGroup} from '@/api/portMapping' import waves from '@/directive/waves' // 水波纹指令 +import { parseTime } from '@/utils' import LinkPopover from '../../components/Link/linkPopover' export default { @@ -206,6 +210,7 @@ import LinkPopover from '../../components/Link/linkPopover' size: 10, name: undefined, description: undefined, + defaultPassType: undefined, enable: undefined }, listLoading: true, @@ -217,7 +222,9 @@ import LinkPopover from '../../components/Link/linkPopover' }, selectObj: { statusOptions: [{ label: '启用', value: 1 }, { label: '禁用', value: 2 }], - onlineOptions: [{ label: '在线', value: 1 }, { label: '离线', value: 2 }] + onlineOptions: [{ label: '在线', value: 1 }, { label: '离线', value: 2 }], + passType: [{ label: '允许', value: 1 }, { label: '拒绝', value: 2 }] + }, dialogFormVisible: false, dialogStatus: '', @@ -255,6 +262,13 @@ import LinkPopover from '../../components/Link/linkPopover' } }, filters: { + passTypeName(type) { + const statusMap = { + 1: '允许', + 2: '拒绝' + } + return statusMap[type] + }, statusName(status) { const statusMap = { 1: '启用', @@ -355,8 +369,7 @@ import LinkPopover from '../../components/Link/linkPopover' }, handleUpdate(row) { this.temp = Object.assign({}, row) // copy obj - this.temp.defaultPassType = row.defaultPassType == 'allow' ? 1 : 0 - this.temp.timestamp = new Date(this.temp.timestamp) + // this.temp.timestamp = new Date(this.temp.timestamp) this.dialogStatus = 'update' this.dialogFormVisible = true this.$nextTick(() => { @@ -396,7 +409,9 @@ import LinkPopover from '../../components/Link/linkPopover' }) }, handleGoRulePage (row) { - this.$router.push(`/system/securityRule?groupId=${row.id}`) + this.$router.push({ path: '/system/securityRule', query: { groupId: row.id }}) + + // this.$router.push(`/system/securityRule?groupId=${row.id}`) }, handlePortMapping(row) { this.dialogBindPortMappingVisible = true diff --git a/neutrino-proxy-admin/src/views/system/securityRule.vue b/neutrino-proxy-admin/src/views/system/securityRule.vue index cf700692..02e14026 100644 --- a/neutrino-proxy-admin/src/views/system/securityRule.vue +++ b/neutrino-proxy-admin/src/views/system/securityRule.vue @@ -6,7 +6,18 @@
{{group.description}}
-
+
+ + + + + + + + + {{ + $t('table.search') }} + {{$t('table.add')}}
@@ -35,8 +46,7 @@ @@ -46,12 +56,12 @@ @@ -62,13 +72,20 @@ +
+ + +
+ @@ -131,7 +148,7 @@