Commit b9ac0c1a by 周海峰

日志

parent df79cc93
import request from '@/utils/request'
export function queryDesensitizationStrategyLog(data) {
return request({
url: '/aop/DesensitizationStrategyLog/queryDesensitizationStrategyLog',
method: 'post',
data: data
})
}
export function getDesensitizationLogExcel(data) {
return request({
url: '/aop/DesensitizationStrategyLog/getdesensitizationStrategyLog',
method: 'post',
data: data,
responseType: 'blob' //
})
}
......@@ -15,4 +15,13 @@ export function allProject(data) {
method: 'post',
data: data
})
}
export function getEncryptionLogExcel(data) {
return request({
url: '/aop/encryptlog/getEncryptionLogExcel',
method: 'post',
data: data,
responseType: 'blob' //
})
}
\ No newline at end of file
......@@ -27,10 +27,13 @@ export function queryMenuTreeAndUserlist(data) {
data: data
})
}
export function getOpeExcel(data) {
return request({
url: '/aop/getOpeExcel',
method: 'post',
data: data
data: data,
responseType: 'blob' //
})
}
\ No newline at end of file
// timeRangeOptions.js
const timeRangeOptions = [
{ value: '0', label: '今天' },
{ value: '3', label: '近三天' },
{ value: '7', label: '近一周' },
{ value: '30', label: '近一个月' },
{ value: '90', label: '近三个月' },
{ value: '180', label: '近半年' },
{ value: '全部', label: '全部' }
]
export default timeRangeOptions;
......@@ -16,7 +16,7 @@
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.realname"
:label="item.user"
:value="item.id"
/>
</el-select>
......@@ -26,7 +26,6 @@
v-model="queryParams.range"
placeholder="请选择时间"
style="width: 200px"
@change="handleTimeRangeChange"
>
<el-option
v-for="item in timeRangeOptions"
......@@ -54,7 +53,7 @@
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button type="primary" icon="Download" @click="handleExport">导出</el-button>
<el-button type="primary" @click="handleCheck">数据完整性校验</el-button>
<!-- <el-button type="primary" @click="handleCheck">数据完整性校验</el-button> -->
</el-form-item>
</el-form>
</div>
......@@ -65,18 +64,18 @@
border
style="width: 100%"
>
<el-table-column prop="user" label="用户" align="left" />
<el-table-column prop="time" label="时间" align="left" width="180" />
<el-table-column prop="moduleId" label="模块编号" align="left" width="120" />
<el-table-column prop="moduleName" label="操作模块" align="left" width="150" />
<el-table-column prop="operation" label="操作信息" align="left" show-overflow-tooltip />
<el-table-column prop="createuser" label="用户" width="200" align="left" />
<el-table-column prop="createtime" label="时间" align="left" width="180" />
<el-table-column prop="code" label="模块编号" align="left" width="120" />
<el-table-column prop="operModule" label="操作模块" align="left" width="150" />
<el-table-column prop="operationMassage" label="操作信息" align="left" show-overflow-tooltip />
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
v-model:page="queryParams.page"
v-model:limit="queryParams.rows"
@pagination="getList"
/>
</div>
......@@ -84,127 +83,121 @@
<script setup>
import { ref, reactive, computed, onMounted } from 'vue'
import { ElMessageBox, ElMessage } from 'element-plus'
import { Coin } from '@element-plus/icons-vue'
import { queryMenuTreeAndUserlist } from '@/api/logSet/operationLog.js'
import { queryDesensitizationStrategyLog, getDesensitizationLogExcel } from '@/api/logSet/desensitizationLog.js'
import { allProject } from '@/api/logSet/encryptedLog.js'
import useAppStore from '@/store/modules/app'
import timeRangeOptions from '@/constants/timeRangeOptions.js'
const appStore = useAppStore()
console.log('当前用户信息',appStore.userInfo)
const loading = ref(true)
const total = ref(0)
const logList = ref([])
const queryParams = reactive({
pageNum: 1,
pageSize: 10,
page: 1,
rows: 10,
user: undefined,
range: '0',
startTime: '',
endTime: '',
module: undefined,
projectId: undefined
})
const userOptions = ref([
{ id: 'admin', realname: 'admin' },
{ id: 'system', realname: 'system' },
{ id: 'test', realname: 'test' }
])
const timeRangeOptions = ref([
{ value: '0', label: '今天' },
{ value: '3', label: '近三天' },
{ value: '7', label: '近一周' },
{ value: '30', label: '近一个月' },
{ value: '90', label: '近三个月' },
{ value: '180', label: '近半年' },
{ value: '全部', label: '全部' }
// { id: 'admin', realname: 'admin' },
// { id: 'system', realname: 'system' },
// { id: 'test', realname: 'test' }
])
const projectLevelOptions = ref([
{ id: '1', project: '一级' },
{ id: '2', project: '二级' },
{ id: '3', project: '三级' }
// { id: '1', project: '一级' },
// { id: '2', project: '二级' },
// { id: '3', project: '三级' }
])
const pageCount = computed(() => {
const t = Number(total.value) || 0
const ps = Number(queryParams.pageSize) || 1
return Math.ceil(t / ps)
})
const getList = () => {
const getList = async () => {
loading.value = true
setTimeout(() => {
logList.value = [
{
user: 'admin',
time: '2025-08-19 19:36:25',
moduleId: 'DDM_00000',
moduleName: '系统模块',
operation: '用户登录'
},
{
user: 'admin',
time: '2025-08-19 19:01:36',
moduleId: 'DDM_00001',
moduleName: '用户管理-用户',
operation: '用户[admin]登录到系统平台。'
}
]
total.value = 53
try {
const response = await queryDesensitizationStrategyLog(queryParams)
logList.value = response.data.list || []
total.value = response.data.total || 0
} catch (error) {
console.error('Failed to fetch desensitization log list:', error)
} finally {
loading.value = false
}, 200)
}
}
const handleQuery = () => {
queryParams.pageNum = 1
queryParams.page = 1
getList()
}
const handleExport = () => {
window.$modal.confirm('是否确认导出所有操作日志数据?').then(() => {
// 实际导出逻辑
window.$modal.msgSuccess('导出成功')
}).catch(() => {})
const handleExport = async () => {
ElMessageBox.confirm('是否确认导出日志数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(async () => {
try {
const response = await getDesensitizationLogExcel(queryParams)
const blob = new Blob([response], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
const link = document.createElement('a')
link.href = URL.createObjectURL(blob)
link.download = '脱敏日志.xls'
link.click()
URL.revokeObjectURL(link.href)
ElMessage.success('导出成功')
} catch (error) {
console.error('Failed to export operation logs:', error)
ElMessage.error('导出出错')
}
})
.catch(() => {
ElMessage.info('导出已取消')
})
}
const handleCheck = () => {
window.$modal.msgSuccess('数据完整性校验完成')
}
const handleTimeRangeChange = (value) => {
const now = new Date()
let startTime = new Date()
switch (value) {
case 'last3days':
startTime.setDate(now.getDate() - 3)
break
case 'lastWeek':
startTime.setDate(now.getDate() - 7)
break
case 'lastMonth':
startTime.setMonth(now.getMonth() - 1)
break
case 'last3Months':
startTime.setMonth(now.getMonth() - 3)
break
case 'lastHalfYear':
startTime.setMonth(now.getMonth() - 6)
break
case 'all':
startTime = null
break
onMounted(async () => {
try {
const response = await queryMenuTreeAndUserlist({ type: 'global' })
console.log('queryMenuTreeAndUserlist', response)
userOptions.value = response.data.userlist.map(user => ({
id: user.id,
user: user.realname
}))
} catch (error) {
console.error('Failed to fetch user and module data:', error)
}
if (startTime) {
queryParams.startTime = startTime.toISOString().split('T')[0] + ' 00:00:00'
queryParams.endTime = now.toISOString().split('T')[0] + ' 23:59:59'
} else {
queryParams.startTime = ''
queryParams.endTime = ''
try {
const params = {
loginUser: {
tsysUser: {
id: appStore.userInfo.user.id,
username: appStore.userInfo.user.username
}
},
proName: '',
note: ''
}
const projectResponse = await allProject(params)
projectLevelOptions.value = projectResponse.data.map(project => ({
id: project.id,
project: project.project
}))
} catch (error) {
console.error('Failed to fetch project level data:', error)
}
handleQuery()
}
onMounted(() => {
getList()
})
</script>
......
......@@ -85,9 +85,10 @@
import { ref, reactive, computed, onMounted } from 'vue'
import { Lock } from '@element-plus/icons-vue'
import { queryMenuTreeAndUserlist } from '@/api/logSet/operationLog.js'
import { query , allProject} from '@/api/logSet/encryptedLog.js'
import { query , allProject, getEncryptionLogExcel} from '@/api/logSet/encryptedLog.js'
import { ElMessageBox, ElMessage } from 'element-plus'
import useAppStore from '@/store/modules/app'
import timeRangeOptions from '@/constants/timeRangeOptions.js'
const appStore = useAppStore()
console.log('当前用户信息',appStore.userInfo)
const loading = ref(true)
......@@ -108,16 +109,6 @@ const userOptions = ref([
// { id: 'test', user: 'test' }
])
const timeRangeOptions = ref([
{ value: '0', label: '今天' },
{ value: '3', label: '近三天' },
{ value: '7', label: '近一周' },
{ value: '30', label: '近一个月' },
{ value: '90', label: '近三个月' },
{ value: '180', label: '近半年' },
{ value: '全部', label: '全部' }
])
const projectLevelOptions = ref([
// { id: '1', project: '一级' },
// { id: '2', project: '二级' },
......@@ -144,10 +135,29 @@ const handleQuery = () => {
}
const handleExport = () => {
window.$modal.confirm('是否确认导出所有操作日志数据?').then(() => {
// 实际导出逻辑
window.$modal.msgSuccess('导出成功')
}).catch(() => {})
ElMessageBox.confirm('是否确认导出所有加密日志数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(async () => {
try {
const response = await getEncryptionLogExcel(queryParams)
const blob = new Blob([response], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
const link = document.createElement('a')
link.href = URL.createObjectURL(blob)
link.download = '加密日志.xls'
link.click()
URL.revokeObjectURL(link.href)
ElMessage.success('导出成功')
} catch (error) {
console.error('Failed to export operation logs:', error)
ElMessage.error('导出出错')
}
})
.catch(() => {
ElMessage.info('导出已取消')
})
}
const handleCheck = () => {
......
......@@ -87,7 +87,7 @@ import { ref, reactive, computed, onMounted } from 'vue'
import { Document } from '@element-plus/icons-vue'
import { query, checkEnc, queryMenuTreeAndUserlist, getOpeExcel} from '@/api/logSet/operationLog.js'
import { ElMessageBox, ElMessage } from 'element-plus'
import timeRangeOptions from '@/constants/timeRangeOptions.js'
const loading = ref(true)
const total = ref(0)
const logList = ref([])
......@@ -105,15 +105,6 @@ const userOptions = ref([
// { id: 'test', realname: 'test' }
])
const timeRangeOptions = ref([
{ value: '0', label: '今天' },
{ value: '3', label: '近三天' },
{ value: '7', label: '近一周' },
{ value: '30', label: '近一个月' },
{ value: '90', label: '近三个月' },
{ value: '180', label: '近半年' },
{ value: '全部', label: '全部' }
])
const moduleTreeOptions = ref([])
......@@ -144,11 +135,10 @@ const handleExport = async () => {
.then(async () => {
try {
const response = await getOpeExcel(queryParams)
//const blob = new Blob([response], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
const blob = new Blob([response], { type: 'application/vnd.ms-excel'})
const blob = new Blob([response], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
const link = document.createElement('a')
link.href = URL.createObjectURL(blob)
link.download = '操作日志.xlsx'
link.download = '操作日志.xls'
link.click()
URL.revokeObjectURL(link.href)
ElMessage.success('导出成功')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论