Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4bb09a0fb1 | ||
|
|
90bbed91f0 | ||
|
|
6b8e8ab5d8 | ||
|
|
f86e4b5b9a | ||
|
|
b52d832986 |
25
src/api/system/ipBlack.js
Normal file
25
src/api/system/ipBlack.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function getList(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/system/blacklist/ip/list',
|
||||||
|
method: 'get',
|
||||||
|
params: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function doAdd(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/system/blacklist/ip',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function doRemove(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/system/blacklist/ip/remove',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
25
src/api/system/userBlack.js
Normal file
25
src/api/system/userBlack.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function getList(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/system/blacklist/user/list',
|
||||||
|
method: 'get',
|
||||||
|
params: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function doAdd(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/system/blacklist/user',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function doRemove(data) {
|
||||||
|
return request({
|
||||||
|
url: 'management/api/system/blacklist/user/remove',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -308,8 +308,8 @@ export const asyncRoutes = [
|
|||||||
meta: { title: '用户签到记录' },
|
meta: { title: '用户签到记录' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'userChat',
|
path: 'userDevice',
|
||||||
name: 'UserChat',
|
name: 'UserDevice',
|
||||||
component: () => import('@/views/spring/user/device/index'),
|
component: () => import('@/views/spring/user/device/index'),
|
||||||
meta: { title: '设备' },
|
meta: { title: '设备' },
|
||||||
},
|
},
|
||||||
@@ -378,6 +378,18 @@ export const asyncRoutes = [
|
|||||||
component: () => import('@/views/personnelManagement/suspiciousRequest/index'),
|
component: () => import('@/views/personnelManagement/suspiciousRequest/index'),
|
||||||
meta: { title: '异常请求' },
|
meta: { title: '异常请求' },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'ipBlacklist',
|
||||||
|
name: 'IPBlacklist',
|
||||||
|
component: () => import('@/views/systemManagement/ipBlack/index'),
|
||||||
|
meta: { title: 'IP 黑名单' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'userBlacklist',
|
||||||
|
name: 'UserBlacklist',
|
||||||
|
component: () => import('@/views/systemManagement/userBlack/index'),
|
||||||
|
meta: { title: '用户 黑名单' },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'uploadedFileManagement',
|
path: 'uploadedFileManagement',
|
||||||
name: 'UploadedFileManagement',
|
name: 'UploadedFileManagement',
|
||||||
@@ -452,8 +464,8 @@ export const asyncRoutes = [
|
|||||||
// meta: { title: '用户' },
|
// meta: { title: '用户' },
|
||||||
// },
|
// },
|
||||||
// {
|
// {
|
||||||
// path: 'userChat',
|
// path: 'userDevice',
|
||||||
// name: 'UserChat',
|
// name: 'userDevice',
|
||||||
// component: () => import('@/views/maomao/user/chat/index'),
|
// component: () => import('@/views/maomao/user/chat/index'),
|
||||||
// meta: { title: '聊天' },
|
// meta: { title: '聊天' },
|
||||||
// },
|
// },
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ instance.interceptors.request.use(
|
|||||||
}
|
}
|
||||||
if (store.getters['user/appId']) {
|
if (store.getters['user/appId']) {
|
||||||
config.headers['x-app-id'] = store.getters['user/appId']
|
config.headers['x-app-id'] = store.getters['user/appId']
|
||||||
|
} else {
|
||||||
|
config.headers['x-app-id'] = '69665538a49b8ae3be50fe5d'
|
||||||
}
|
}
|
||||||
if (config.method === 'get' && config.params) {
|
if (config.method === 'get' && config.params) {
|
||||||
config.params = Vue.prototype.$baseLodash.pickBy(config.params, Vue.prototype.$baseLodash.identity)
|
config.params = Vue.prototype.$baseLodash.pickBy(config.params, Vue.prototype.$baseLodash.identity)
|
||||||
|
|||||||
@@ -63,6 +63,9 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button icon="el-icon-search" type="primary" @click="handleQuery">查询</el-button>
|
<el-button icon="el-icon-search" type="primary" @click="handleQuery">查询</el-button>
|
||||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||||
|
<el-button :type="excludeAcquaintance ? 'primary' : 'default'" @click="toggleExcludeAcquaintance">去掉熟人</el-button>
|
||||||
|
<el-button :type="onlyUserId === true ? 'primary' : 'default'" @click="toggleOnlyUserId(true)">只显示有用户请求</el-button>
|
||||||
|
<el-button :type="onlyNoUserId === true ? 'primary' : 'default'" @click="toggleOnlyNoUserId()">只显示无用户请求</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
@@ -136,6 +139,14 @@
|
|||||||
<el-link type="primary" :underline="false" @click="goToUser(row.userId)">{{ row.userId }}</el-link>
|
<el-link type="primary" :underline="false" @click="goToUser(row.userId)">{{ row.userId }}</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="Device ID" prop="deviceId" show-overflow-tooltip>
|
||||||
|
<template slot-scope="{ row }">
|
||||||
|
<el-link v-if="row.deviceId" type="primary" :underline="false" @click="goToDevice(row.deviceId)">
|
||||||
|
{{ row.deviceId }}
|
||||||
|
</el-link>
|
||||||
|
<span v-else>-</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<el-pagination
|
<el-pagination
|
||||||
background
|
background
|
||||||
@@ -175,6 +186,9 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
excludeAcquaintance: false,
|
||||||
|
onlyUserId: null, // null: all, true: only with user
|
||||||
|
onlyNoUserId: null, // null: all, true: only without user
|
||||||
eventNameMap,
|
eventNameMap,
|
||||||
eventTypeMap,
|
eventTypeMap,
|
||||||
appMap,
|
appMap,
|
||||||
@@ -273,6 +287,16 @@
|
|||||||
pageSize: 10000, // 获取足够多的数据进行前端统计,或者应该依赖后端聚合接口
|
pageSize: 10000, // 获取足够多的数据进行前端统计,或者应该依赖后端聚合接口
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.excludeAcquaintance) {
|
||||||
|
params.excludeAcquaintance = true
|
||||||
|
}
|
||||||
|
if (this.onlyUserId !== null) {
|
||||||
|
params.onlyUserId = this.onlyUserId
|
||||||
|
}
|
||||||
|
if (this.onlyNoUserId !== null) {
|
||||||
|
params.onlyNoUserId = this.onlyNoUserId
|
||||||
|
}
|
||||||
|
|
||||||
const { data } = await getTrackingLogsList(params)
|
const { data } = await getTrackingLogsList(params)
|
||||||
this.list = data.list || []
|
this.list = data.list || []
|
||||||
|
|
||||||
@@ -314,6 +338,28 @@
|
|||||||
this.pageSize = val
|
this.pageSize = val
|
||||||
this.currentPage = 1
|
this.currentPage = 1
|
||||||
},
|
},
|
||||||
|
toggleExcludeAcquaintance() {
|
||||||
|
this.excludeAcquaintance = !this.excludeAcquaintance
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
toggleOnlyUserId(value) {
|
||||||
|
if (this.onlyUserId === value) {
|
||||||
|
this.onlyUserId = null // Toggle off if already selected
|
||||||
|
} else {
|
||||||
|
this.onlyUserId = value
|
||||||
|
this.onlyNoUserId = null // 互斥
|
||||||
|
}
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
toggleOnlyNoUserId() {
|
||||||
|
if (this.onlyNoUserId === true) {
|
||||||
|
this.onlyNoUserId = null // Toggle off if already selected
|
||||||
|
} else {
|
||||||
|
this.onlyNoUserId = true
|
||||||
|
this.onlyUserId = null // 互斥
|
||||||
|
}
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
handleCurrentChange(val) {
|
handleCurrentChange(val) {
|
||||||
this.currentPage = val
|
this.currentPage = val
|
||||||
},
|
},
|
||||||
@@ -330,6 +376,10 @@
|
|||||||
query: { userId },
|
query: { userId },
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
goToDevice(deviceId) {
|
||||||
|
if (!deviceId) return
|
||||||
|
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
|
||||||
|
},
|
||||||
handleEventNameClick(params) {
|
handleEventNameClick(params) {
|
||||||
const name = params.name
|
const name = params.name
|
||||||
// name 可能是中文映射名,需要反向查找 key,或者在 processData 时把 key 存入
|
// name 可能是中文映射名,需要反向查找 key,或者在 processData 时把 key 存入
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="accessLogManagement-container">
|
<div class="accessLogManagement-container">
|
||||||
|
<el-tabs v-model="queryForm.appId" type="card" @tab-click="handleTabClick">
|
||||||
|
<el-tab-pane v-for="item in applicationList" :key="item.id" :label="item.name" :name="item.id" />
|
||||||
|
</el-tabs>
|
||||||
|
|
||||||
<vab-query-form>
|
<vab-query-form>
|
||||||
<vab-query-form-right-panel :span="12">
|
<vab-query-form-right-panel :span="12">
|
||||||
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
|
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
|
||||||
@@ -24,7 +28,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="类型" show-overflow-tooltip>
|
<el-table-column align="center" label="类型" show-overflow-tooltip>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tag v-if="row.url.includes('api/v')" type="success">应用</el-tag>
|
<el-tag v-if="row.platform.includes('weixin')" type="success">微信小程序</el-tag>
|
||||||
<el-tag v-else type="info">后台</el-tag>
|
<el-tag v-else type="info">后台</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -39,8 +43,13 @@
|
|||||||
{{ row.userName || row.userId }}
|
{{ row.userName || row.userId }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="method" prop="method" show-overflow-tooltip width="80" />
|
||||||
|
<el-table-column align="center" label="statusCode" prop="statusCode" show-overflow-tooltip width="100" />
|
||||||
|
<el-table-column align="center" label="耗时(ms)" prop="duration" show-overflow-tooltip width="100" />
|
||||||
|
<el-table-column align="center" label="平台" prop="platform" show-overflow-tooltip width="100" />
|
||||||
<el-table-column align="center" label="userAgent" prop="userAgent" show-overflow-tooltip />
|
<el-table-column align="center" label="userAgent" prop="userAgent" show-overflow-tooltip />
|
||||||
<el-table-column align="center" label="referrer" prop="referrer" show-overflow-tooltip />
|
<el-table-column align="center" label="referrer" prop="referrer" show-overflow-tooltip />
|
||||||
|
<el-table-column align="center" label="body" prop="body" show-overflow-tooltip />
|
||||||
</el-table>
|
</el-table>
|
||||||
<el-pagination
|
<el-pagination
|
||||||
background
|
background
|
||||||
@@ -56,6 +65,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getList } from '@/api/accessLogManagement'
|
import { getList } from '@/api/accessLogManagement'
|
||||||
|
import { getList as getApplicationList } from '@/api/appManagement'
|
||||||
import { formatTime } from '@/utils'
|
import { formatTime } from '@/utils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -69,14 +79,17 @@
|
|||||||
selectRows: '',
|
selectRows: '',
|
||||||
elementLoadingText: '正在加载...',
|
elementLoadingText: '正在加载...',
|
||||||
queryForm: {
|
queryForm: {
|
||||||
|
appId: '',
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
permission: '',
|
permission: '',
|
||||||
},
|
},
|
||||||
|
applicationList: [],
|
||||||
timeOutID: null,
|
timeOutID: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.fetchApplicationList()
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -84,6 +97,13 @@
|
|||||||
clearTimeout(this.timeOutID)
|
clearTimeout(this.timeOutID)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
async fetchApplicationList() {
|
||||||
|
const { data } = await getApplicationList({ pageNo: 1, pageSize: 100 })
|
||||||
|
this.applicationList = data.list
|
||||||
|
},
|
||||||
|
handleTabClick() {
|
||||||
|
this.queryData()
|
||||||
|
},
|
||||||
formatTime,
|
formatTime,
|
||||||
setSelectRows(val) {
|
setSelectRows(val) {
|
||||||
this.selectRows = val
|
this.selectRows = val
|
||||||
|
|||||||
@@ -32,9 +32,12 @@
|
|||||||
</vab-query-form>
|
</vab-query-form>
|
||||||
|
|
||||||
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
||||||
|
<el-table-column align="center" label="IP" prop="ip" show-overflow-tooltip />
|
||||||
|
<el-table-column align="center" label="地址" prop="address" show-overflow-tooltip />
|
||||||
|
|
||||||
<el-table-column align="center" label="用户" show-overflow-tooltip>
|
<el-table-column align="center" label="用户" show-overflow-tooltip>
|
||||||
<template slot-scope="{ row }">
|
<template slot-scope="{ row }">
|
||||||
{{ row.userName || row.userId }}
|
{{ row.userId }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="应用" show-overflow-tooltip>
|
<el-table-column align="center" label="应用" show-overflow-tooltip>
|
||||||
@@ -42,7 +45,6 @@
|
|||||||
{{ row.appName || row.appId }}
|
{{ row.appName || row.appId }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="IP" prop="ip" show-overflow-tooltip />
|
|
||||||
<el-table-column align="center" label="路径" prop="path" show-overflow-tooltip />
|
<el-table-column align="center" label="路径" prop="path" show-overflow-tooltip />
|
||||||
<el-table-column align="center" label="原因" prop="reason" show-overflow-tooltip />
|
<el-table-column align="center" label="原因" prop="reason" show-overflow-tooltip />
|
||||||
<el-table-column align="center" label="UserAgent" prop="userAgent" show-overflow-tooltip />
|
<el-table-column align="center" label="UserAgent" prop="userAgent" show-overflow-tooltip />
|
||||||
|
|||||||
@@ -122,7 +122,7 @@
|
|||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
goToDevice(deviceId) {
|
goToDevice(deviceId) {
|
||||||
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
|
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
|
||||||
},
|
},
|
||||||
async fetchData() {
|
async fetchData() {
|
||||||
this.listLoading = true
|
this.listLoading = true
|
||||||
|
|||||||
@@ -186,7 +186,7 @@
|
|||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
goToDevice(deviceId) {
|
goToDevice(deviceId) {
|
||||||
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
|
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
|
||||||
},
|
},
|
||||||
goToTemplate(templateId) {
|
goToTemplate(templateId) {
|
||||||
this.$router.push({ path: '/spring/blessing/template', query: { templateId } })
|
this.$router.push({ path: '/spring/blessing/template', query: { templateId } })
|
||||||
|
|||||||
@@ -136,7 +136,7 @@
|
|||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
goToDevice(deviceId) {
|
goToDevice(deviceId) {
|
||||||
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
|
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
|
||||||
},
|
},
|
||||||
goToCard(cardId) {
|
goToCard(cardId) {
|
||||||
// Assuming there is a card detail or list page, but for now just placeholder or link to card list
|
// Assuming there is a card detail or list page, but for now just placeholder or link to card list
|
||||||
|
|||||||
@@ -139,7 +139,7 @@
|
|||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
goToDevice(deviceId) {
|
goToDevice(deviceId) {
|
||||||
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
|
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
|
||||||
},
|
},
|
||||||
async fetchData() {
|
async fetchData() {
|
||||||
this.listLoading = true
|
this.listLoading = true
|
||||||
|
|||||||
@@ -199,7 +199,7 @@
|
|||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
goToDevice(deviceId) {
|
goToDevice(deviceId) {
|
||||||
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
|
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
|
||||||
},
|
},
|
||||||
goToContent(row) {
|
goToContent(row) {
|
||||||
if (row.scene === 'card_generate') {
|
if (row.scene === 'card_generate') {
|
||||||
|
|||||||
@@ -202,7 +202,7 @@
|
|||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
goToDevice(deviceId) {
|
goToDevice(deviceId) {
|
||||||
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
|
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
|
||||||
},
|
},
|
||||||
goToContent(row) {
|
goToContent(row) {
|
||||||
if (row.type === 1) {
|
if (row.type === 1) {
|
||||||
|
|||||||
@@ -165,7 +165,7 @@
|
|||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
goToDevice(deviceId) {
|
goToDevice(deviceId) {
|
||||||
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
|
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
|
||||||
},
|
},
|
||||||
goToShareRecord(userId) {
|
goToShareRecord(userId) {
|
||||||
this.$router.push({ path: '/spring/user/shareRecord', query: { userId } })
|
this.$router.push({ path: '/spring/user/shareRecord', query: { userId } })
|
||||||
|
|||||||
@@ -200,7 +200,7 @@
|
|||||||
this.$router.push({ path: '/spring/user/shareRecord', query: { keyword: shareToken } })
|
this.$router.push({ path: '/spring/user/shareRecord', query: { keyword: shareToken } })
|
||||||
},
|
},
|
||||||
goToDevice(deviceId) {
|
goToDevice(deviceId) {
|
||||||
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
|
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
|
||||||
},
|
},
|
||||||
goToTemplate(templateId) {
|
goToTemplate(templateId) {
|
||||||
this.$router.push({ path: '/spring/blessing/template', query: { templateId } })
|
this.$router.push({ path: '/spring/blessing/template', query: { templateId } })
|
||||||
|
|||||||
@@ -214,7 +214,7 @@
|
|||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
goToDevice(deviceId) {
|
goToDevice(deviceId) {
|
||||||
this.$router.push({ path: '/spring/user/userChat', query: { deviceId } })
|
this.$router.push({ path: '/spring/user/userDevice', query: { deviceId } })
|
||||||
},
|
},
|
||||||
goToShareRecord(userId) {
|
goToShareRecord(userId) {
|
||||||
this.$router.push({ path: '/spring/user/shareRecord', query: { userId } })
|
this.$router.push({ path: '/spring/user/shareRecord', query: { userId } })
|
||||||
|
|||||||
@@ -69,6 +69,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
const { permission } = this.$route.query
|
||||||
|
if (permission) {
|
||||||
|
this.queryForm.permission = permission
|
||||||
|
}
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px" @close="close">
|
||||||
|
<el-form ref="form" label-width="80px" :model="form" :rules="rules">
|
||||||
|
<el-form-item label="IP地址" prop="ip">
|
||||||
|
<el-input v-model.trim="form.ip" autocomplete="off" placeholder="请输入需要拉黑的IP地址" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="close">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="save">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { doAdd } from '@/api/system/ipBlack'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'IPBlacklistEdit',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
form: {
|
||||||
|
ip: '',
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
ip: [{ required: true, trigger: 'blur', message: '请输入IP地址' }],
|
||||||
|
},
|
||||||
|
title: '新增',
|
||||||
|
dialogFormVisible: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
showEdit() {
|
||||||
|
this.title = '新增'
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
this.dialogFormVisible = true
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$refs['form'].resetFields()
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
this.dialogFormVisible = false
|
||||||
|
},
|
||||||
|
save() {
|
||||||
|
this.$refs['form'].validate(async (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
try {
|
||||||
|
const { msg } = await doAdd(this.form)
|
||||||
|
this.$baseMessage(msg, 'success')
|
||||||
|
this.$refs['form'].resetFields()
|
||||||
|
this.dialogFormVisible = false
|
||||||
|
this.$emit('fetch-data')
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
130
src/views/systemManagement/ipBlack/index.vue
Normal file
130
src/views/systemManagement/ipBlack/index.vue
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
<template>
|
||||||
|
<div class="ip-blacklist-container">
|
||||||
|
<vab-query-form>
|
||||||
|
<vab-query-form-left-panel :span="12">
|
||||||
|
<el-button icon="el-icon-plus" type="primary" @click="handleAdd">新增</el-button>
|
||||||
|
<el-button icon="el-icon-delete" type="danger" @click="handleDelete">移除选中</el-button>
|
||||||
|
</vab-query-form-left-panel>
|
||||||
|
<vab-query-form-right-panel :span="12">
|
||||||
|
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
|
||||||
|
<el-form-item>
|
||||||
|
<el-input v-model.trim="queryForm.ip" clearable placeholder="请输入查询的IP" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</vab-query-form-right-panel>
|
||||||
|
</vab-query-form>
|
||||||
|
|
||||||
|
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText" @selection-change="setSelectRows">
|
||||||
|
<el-table-column align="center" show-overflow-tooltip type="selection" width="55" />
|
||||||
|
<el-table-column align="center" label="IP" prop="ip" show-overflow-tooltip />
|
||||||
|
<el-table-column align="center" label="地址" prop="address" show-overflow-tooltip />
|
||||||
|
<el-table-column align="center" fixed="right" label="操作" show-overflow-tooltip width="200">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button type="text" @click="handleDelete(row)">移除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<el-pagination
|
||||||
|
background
|
||||||
|
:current-page="queryForm.pageNo"
|
||||||
|
:layout="layout"
|
||||||
|
:page-size="queryForm.pageSize"
|
||||||
|
:total="total"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<edit ref="edit" @fetch-data="fetchData" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getList, doRemove } from '@/api/system/ipBlack'
|
||||||
|
import Edit from './components/IPBlacklistEdit'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'IPBlacklist',
|
||||||
|
components: { Edit },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: [],
|
||||||
|
listLoading: true,
|
||||||
|
layout: 'total, sizes, prev, pager, next, jumper',
|
||||||
|
total: 0,
|
||||||
|
selectRows: [],
|
||||||
|
elementLoadingText: '正在加载...',
|
||||||
|
queryForm: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
ip: '',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
setSelectRows(val) {
|
||||||
|
this.selectRows = val
|
||||||
|
},
|
||||||
|
handleAdd() {
|
||||||
|
this.$refs['edit'].showEdit()
|
||||||
|
},
|
||||||
|
handleDelete(row) {
|
||||||
|
if (row.ip) {
|
||||||
|
this.$baseConfirm('你确定要将当前IP从黑名单中移除吗?', null, async () => {
|
||||||
|
const { msg } = await doRemove({ ips: [row.ip] })
|
||||||
|
this.$baseMessage(msg, 'success')
|
||||||
|
this.fetchData()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
if (this.selectRows.length > 0) {
|
||||||
|
const ips = this.selectRows.map((item) => item.ip)
|
||||||
|
this.$baseConfirm('你确定要将选中的IP从黑名单中移除吗?', null, async () => {
|
||||||
|
const { msg } = await doRemove({ ips })
|
||||||
|
this.$baseMessage(msg, 'success')
|
||||||
|
this.fetchData()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$baseMessage('未选中任何行', 'error')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleSizeChange(val) {
|
||||||
|
this.queryForm.pageSize = val
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
handleCurrentChange(val) {
|
||||||
|
this.queryForm.pageNo = val
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
queryData() {
|
||||||
|
this.queryForm.pageNo = 1
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
async fetchData() {
|
||||||
|
this.listLoading = true
|
||||||
|
try {
|
||||||
|
const { data } = await getList(this.queryForm)
|
||||||
|
this.list = data.list
|
||||||
|
this.total = data.totalCount
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.listLoading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.ip-blacklist-container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px" @close="close">
|
||||||
|
<el-form ref="form" label-width="80px" :model="form" :rules="rules">
|
||||||
|
<el-form-item label="用户ID" prop="userId">
|
||||||
|
<el-input v-model.trim="form.userId" autocomplete="off" placeholder="请输入需要拉黑的用户ID" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="close">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="save">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { doAdd } from '@/api/system/userBlack'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'UserBlacklistEdit',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
form: {
|
||||||
|
userId: '',
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
userId: [{ required: true, trigger: 'blur', message: '请输入用户ID' }],
|
||||||
|
},
|
||||||
|
title: '新增',
|
||||||
|
dialogFormVisible: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
showEdit() {
|
||||||
|
this.title = '新增'
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
this.dialogFormVisible = true
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$refs['form'].resetFields()
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
this.dialogFormVisible = false
|
||||||
|
},
|
||||||
|
save() {
|
||||||
|
this.$refs['form'].validate(async (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
try {
|
||||||
|
const { msg } = await doAdd(this.form)
|
||||||
|
this.$baseMessage(msg, 'success')
|
||||||
|
this.$refs['form'].resetFields()
|
||||||
|
this.dialogFormVisible = false
|
||||||
|
this.$emit('fetch-data')
|
||||||
|
this.form = this.$options.data().form
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
129
src/views/systemManagement/userBlack/index.vue
Normal file
129
src/views/systemManagement/userBlack/index.vue
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
<template>
|
||||||
|
<div class="user-blacklist-container">
|
||||||
|
<vab-query-form>
|
||||||
|
<vab-query-form-left-panel :span="12">
|
||||||
|
<el-button icon="el-icon-plus" type="primary" @click="handleAdd">新增</el-button>
|
||||||
|
<el-button icon="el-icon-delete" type="danger" @click="handleDelete">移除选中</el-button>
|
||||||
|
</vab-query-form-left-panel>
|
||||||
|
<vab-query-form-right-panel :span="12">
|
||||||
|
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
|
||||||
|
<el-form-item>
|
||||||
|
<el-input v-model.trim="queryForm.userId" clearable placeholder="请输入查询的用户ID" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</vab-query-form-right-panel>
|
||||||
|
</vab-query-form>
|
||||||
|
|
||||||
|
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText" @selection-change="setSelectRows">
|
||||||
|
<el-table-column align="center" show-overflow-tooltip type="selection" width="55" />
|
||||||
|
<el-table-column align="center" label="用户ID" prop="userId" show-overflow-tooltip />
|
||||||
|
<el-table-column align="center" fixed="right" label="操作" show-overflow-tooltip width="200">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button type="text" @click="handleDelete(row)">移除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<el-pagination
|
||||||
|
background
|
||||||
|
:current-page="queryForm.pageNo"
|
||||||
|
:layout="layout"
|
||||||
|
:page-size="queryForm.pageSize"
|
||||||
|
:total="total"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<edit ref="edit" @fetch-data="fetchData" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getList, doRemove } from '@/api/system/userBlack'
|
||||||
|
import Edit from './components/UserBlacklistEdit'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'UserBlacklist',
|
||||||
|
components: { Edit },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: [],
|
||||||
|
listLoading: true,
|
||||||
|
layout: 'total, sizes, prev, pager, next, jumper',
|
||||||
|
total: 0,
|
||||||
|
selectRows: [],
|
||||||
|
elementLoadingText: '正在加载...',
|
||||||
|
queryForm: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
userId: '',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
setSelectRows(val) {
|
||||||
|
this.selectRows = val
|
||||||
|
},
|
||||||
|
handleAdd() {
|
||||||
|
this.$refs['edit'].showEdit()
|
||||||
|
},
|
||||||
|
handleDelete(row) {
|
||||||
|
if (row.userId) {
|
||||||
|
this.$baseConfirm('你确定要将当前用户从黑名单中移除吗?', null, async () => {
|
||||||
|
const { msg } = await doRemove({ userIds: [row.userId] })
|
||||||
|
this.$baseMessage(msg, 'success')
|
||||||
|
this.fetchData()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
if (this.selectRows.length > 0) {
|
||||||
|
const userIds = this.selectRows.map((item) => item.userId)
|
||||||
|
this.$baseConfirm('你确定要将选中的用户从黑名单中移除吗?', null, async () => {
|
||||||
|
const { msg } = await doRemove({ userIds })
|
||||||
|
this.$baseMessage(msg, 'success')
|
||||||
|
this.fetchData()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$baseMessage('未选中任何行', 'error')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleSizeChange(val) {
|
||||||
|
this.queryForm.pageSize = val
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
handleCurrentChange(val) {
|
||||||
|
this.queryForm.pageNo = val
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
queryData() {
|
||||||
|
this.queryForm.pageNo = 1
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
async fetchData() {
|
||||||
|
this.listLoading = true
|
||||||
|
try {
|
||||||
|
const { data } = await getList(this.queryForm)
|
||||||
|
this.list = data.list
|
||||||
|
this.total = data.totalCount
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.listLoading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.user-blacklist-container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user