FileManage/web/src/views/appmanage/loginlog.vue

269 lines
9.6 KiB
Vue
Raw Normal View History

2025-01-10 14:16:18 +08:00
<script lang="ts">
export default {
name: 'loginlog' // 登录日志
};
</script>
<script setup lang="ts">
import { onMounted,ref } from "vue";
import Page from '@/components/Pagination/page.vue';
import {queryAppUserLogsPage,queryAppUserHistoryLogsPage,exportUserLogData} from '@/api/appmanage'
import { downloadFile } from '@/utils/index'
const queryInfo :any = ref({
current:1,
size:10,
total:0
})
//搜索内容
const mobile = ref('')
const logintime = ref('')
const loading = ref(false)
const tableData:any = ref([])
onMounted(() => {
getData();
});
// 搜索
function getData(){
const params = {
current: queryInfo.value.current,
size:queryInfo.value.size,
mobile:mobile.value,
startVisionLeft:queryInfo.value.startVisionLeft,
endVisionLeft:queryInfo.value.endVisionLeft,
startVisionRight:queryInfo.value.startVisionRight,
endVisionRight:queryInfo.value.endVisionRight,
startDate:'',
endDate:''
}
loading.value = true
if( logintime.value !== null && logintime.value !== ''){
params.startDate =logintime.value[0]
params.endDate = logintime.value[1]
}
queryAppUserLogsPage(params).then((res:any) => {
tableData.value = res.data.records
queryInfo.value.total = res.data.total
loading.value = false
}).catch(()=>{
loading.value = false
})
}
// 重置
function reset(){
logintime.value = ''
mobile.value = ''
const params = {
current: queryInfo.value.current,
size:queryInfo.value.size,
}
loading.value = true
queryAppUserLogsPage(params).then((res:any) => {
tableData.value = res.data.records
queryInfo.value.total = res.data.total
loading.value = false
})
}
function dateFormat(row: any) { // 时间方法
const daterc = row;
if (daterc != null) {
var date = new Date(daterc);
var year = date.getFullYear();
var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
// 拼接
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
}
}
const dialogLogVisible = ref(false)
const loginInfo:any =ref({
total:0,
size:10,
current:1,
mobile:""
})
function viewLoding(row:any){
loginInfo.value = {
total:0,
size:20,
current:1,
mobile:row.mobile
}
dialogLogVisible.value = true
getLoding()
}
const historyData:any = ref([])
function getLoding(){
const params = {
current: loginInfo.value.current,
size:loginInfo.value.size,
mobile:loginInfo.value.mobile
}
queryAppUserHistoryLogsPage(params).then((res:any) => {
historyData.value = res.data.records
loginInfo.value.total = res.data.total
}).catch(()=>{
})
}
function handleClose(){
dialogLogVisible.value =false
}
function exportOut(){
let params = {
mobile:mobile.value,
startVisionLeft:queryInfo.value.startVisionLeft,
endVisionLeft:queryInfo.value.endVisionLeft,
startVisionRight:queryInfo.value.startVisionRight,
endVisionRight:queryInfo.value.endVisionRight,
startDate:'',
endDate:''
};
if( logintime.value !== null && logintime.value !== ''){
params.startDate =logintime.value[0]
params.endDate = logintime.value[1]
}
exportUserLogData(params).then((response: any) => {
downloadFile(response, 'APP程序-学生信息查询记录', 'xlsx')
});
}
</script>
<template>
<div class="activitymanage-box">
<div class="activitymanage-box-top">
<div class="flex">
<el-input v-model="mobile" placeholder="请输入手机号" style="width:240px" clearable />
<el-date-picker v-model="logintime" style="margin-left: 10px;height: 34px;" type="daterange" start-placeholder="开始时间" end-placeholder="结束时间" value-format="YYYY-MM-DD"/>
<div style="display:flex;align-items: center;padding-left: 10px;">
<div style="color:#909399;font-size: 14px;padding-right: 10px;">左眼裸眼视力:</div>
<el-input v-model="queryInfo.startVisionLeft" placeholder="起始值" style="width: 90px;" clearable />
<span>&nbsp;-&nbsp;</span>
<el-input v-model="queryInfo.endVisionLeft" placeholder="结束值" style="width: 90px;" clearable />
</div>
<div style="display:flex;align-items: center;padding-left: 10px;">
<div style="color:#909399;font-size: 14px;padding-right: 10px;">右眼裸眼视力:</div>
<el-input v-model="queryInfo.startVisionRight" placeholder="起始值" style="width: 90px;" clearable />
<span>&nbsp;-&nbsp;</span>
<el-input v-model="queryInfo.endVisionRight" placeholder="结束值" style="width: 90px;" clearable />
</div>
<el-button type="primary" class="ml-[10px]" @click="getData">搜索</el-button>
<el-button @click="reset">重置</el-button>
<el-button type="primary" @click="exportOut">
<img src="@/assets/visionscreening/exports.png" style="padding-right: 5px;" alt="">导出
</el-button>
</div>
</div>
<div v-loading="loading" class="visionscreening-box-bottom">
<el-table :data="tableData" border style="width: 100%; height:calc(100vh - 280px)" :header-cell-style="{background:'rgb(250 250 250)',height:'50px'}">
<el-table-column prop="mobile" label="手机号" min-width="200" />
<el-table-column prop="student_name" label="学生姓名" min-width="100" />
<el-table-column prop="log_time" label="操作时间" width="200">
<template #default="scope">
{{ dateFormat(scope.row.log_time) }}
</template>
</el-table-column>
<el-table-column label="操作" width="80" fixed="right" align="center">
<template #default="scope">
<div style="display: -webkit-flex;display: flex; justify-content: space-around;-webkit-justify-content: space-around; ">
<img src="@/assets/tableicon/u886.png" alt="" title="查看" @click="viewLoding(scope.row)" style="cursor: pointer;">
</div>
</template>
</el-table-column>
</el-table>
<Page class="mt-[20px]" :total="queryInfo.total" v-model:size="queryInfo.size" v-model:current="queryInfo.current"
@pagination="getData" />
</div>
<el-dialog v-model="dialogLogVisible" :close-on-click-modal="false" title="查看记录" :before-close="handleClose" width="1280px" draggable append-to-body>
<el-table :data="historyData" border style="width: 100%; height:calc(100vh - 280px)" :header-cell-style="{background:'rgb(250 250 250)',height:'50px'}">
<el-table-column prop="mobile" label="手机号" width="200" />
<el-table-column prop="student_name" label="学生姓名" width="100" />
<el-table-column label="裸眼视力" width="120" >
<template #default="scope">
<span>{{scope.row.vision_left}},{{scope.row.vision_right}}</span>
</template>
</el-table-column>
<el-table-column label="操作类型" width="100" >
<template #default="scope">
<span v-if="scope.row.opttype === '01'">登录</span>
<span v-else-if="scope.row.opttype === '02'">关联学生</span>
<span v-else-if="scope.row.opttype === '03'">查询视力</span>
</template>
</el-table-column>
<el-table-column prop="description" label="操作描述" />
<el-table-column prop="log_time" label="操作时间" width="200">
<template #default="scope">
{{ dateFormat(scope.row.log_time) }}
</template>
</el-table-column>
</el-table>
<Page class="mt-[20px]" :total="loginInfo.total" v-model:size="loginInfo.size" v-model:current="loginInfo.current"
@pagination="getLoding" />
</el-dialog>
</div>
</template>
<style scoped lang="scss">
.activitymanage-box {
height: calc(100vh - 130px);
background-color: #fff;
border-radius: 5px;
box-shadow: 0px 0px 10px rgba(219, 225, 236, 1);
padding: 20px;
.activitymanage-box-top{
width:100%;
display: flex;
justify-content: space-between;
margin-bottom: 20px;
}
}
.dialog-footer {
display: flex;
display: -webkit-flex;
justify-content: flex-end;
-webkit-justify-content: flex-end;
}
:deep(.el-tree-node__content){
height: 30px;
}
:deep(.el-input__inner){
height: 32px;
font-size:14px;
}
.lefttitle {
min-width: 150px;
display: flex;
align-items: center;
padding: 10px 15px;
font-family: 'Arial Negreta', 'Arial Normal', 'Arial';
font-weight: 700;
font-style: normal;
font-size: 16px;
color: #1B1B1B;
background: rgba(246, 247, 250, 1);
border-bottom: 1px var(--el-border-color) var(--el-border-style);
margin-bottom: 10px;
.line{
border-width: 0px;
width: 5px;
height: 14px;
margin-right: 7px;
background: inherit;
background-color: rgba(64, 158, 255, 1);
border: none;
border-radius: 0px;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
}
.leftbox{
width: 250px;
height: calc(100vh - 200px);
border: 1px solid #e1e1e1;
border-radius: 4px;
}
</style>