2525 <el-tag type =" danger" size =" large" style =" margin-left : 5px " >
2626 {{ $t('commons.status.failed') }}: {{ faliedCount }}
2727 </el-tag >
28+ <el-button plain @click =" onDeny" :disabled =" selects.length === 0" style =" margin-left : 5px " >
29+ {{ $t('firewall.deny') }}
30+ </el-button >
2831 </el-col >
2932 <el-col :xs =" 24" :sm =" 8" :md =" 8" :lg =" 8" :xl =" 8" >
3033 <TableSetting @search =" search()" />
4447 </template >
4548
4649 <template #main >
47- <ComplexTable :pagination-config =" paginationConfig" :data =" data" @search =" search" >
50+ <ComplexTable
51+ :pagination-config =" paginationConfig"
52+ v-model:selects =" selects"
53+ :data =" data"
54+ @search =" search"
55+ >
56+ <el-table-column type =" selection" :selectable =" selectable" fix />
4857 <el-table-column min-width =" 80" :label =" $t('logs.loginIP')" prop =" address" />
4958 <el-table-column min-width =" 60" :label =" $t('ssh.belong')" prop =" area" />
5059 <el-table-column min-width =" 60" :label =" $t('firewall.port')" prop =" port" />
@@ -83,6 +92,9 @@ import TableSetting from '@/components/table-setting/index.vue';
8392import { dateFormat } from ' @/utils/util' ;
8493import { onMounted , reactive , ref } from ' @vue/runtime-core' ;
8594import { loadSSHLogs } from ' @/api/modules/host' ;
95+ import { operateIPRule } from ' @/api/modules/host' ;
96+ import { MsgSuccess } from ' @/utils/message' ;
97+ import i18n from ' @/lang' ;
8698
8799const loading = ref ();
88100const data = ref ();
@@ -95,6 +107,28 @@ const searchInfo = ref();
95107const searchStatus = ref (' All' );
96108const successfulCount = ref (0 );
97109const faliedCount = ref (0 );
110+ const selects = ref <any >([]);
111+
112+ function selectable(row : any ): boolean {
113+ return row .address !== ' 127.0.0.1' && row .address !== ' ::1' ;
114+ }
115+
116+ function select2address(): string {
117+ let res = [];
118+ selects .value .forEach ((item : any ) => {
119+ if (! res .includes (item .address )) res .push (item .address );
120+ });
121+ return res .join (' ,' );
122+ }
123+
124+ const onDeny = async () => {
125+ let address = select2address ();
126+ if (! address ) return ;
127+ await operateIPRule ({ operation: ' add' , address: address , strategy: ' drop' }).then (() => {
128+ MsgSuccess (i18n .global .t (' commons.msg.operationSuccess' ));
129+ search ();
130+ });
131+ };
98132
99133const search = async () => {
100134 let params = {
0 commit comments