用户评审功能
continuous-integration/drone/push Build is passing Details

main
wangxiaoshuang 2025-08-25 14:17:22 +08:00
parent 64581a3e07
commit f101478135
3 changed files with 434 additions and 343 deletions

View File

@ -0,0 +1,111 @@
<template>
<base-model v-if="config.visible" :config="config">
<template slot="dialog-body">
<el-table :data="curData" border style="width: 100%" size="small">
<el-table-column
prop="key"
:label="$t('system:loginLog:table:cfgItem')"
show-overflow-tooltip
/>
<el-table-column
prop="value"
:label="$t('system:loginLog:table:cfgVal')"
show-overflow-tooltip
>
<template slot-scope="scope">
<span v-if="scope.row.prop !== 'UserRoleList'">{{
scope.row.value
}}</span>
<template v-else>
<div
v-for="item in scope.row.value"
:key="item.UserTypeEnum"
style="margin: 0"
>
{{ item.UserTypeShortName
}}{{ $t('system:loginLog:form:symbol')
}}{{ $fd('IsEnable', !item.IsUserRoleDisabled) }}
</div>
</template>
</template>
</el-table-column>
</el-table>
</template>
<template slot="dialog-footer">
<el-button type="primary" @click="config.visible = false">
{{ $t('common:button:confirm') }}
</el-button>
</template>
</base-model>
</template>
<script>
import BaseModel from '@/components/BaseModel'
export default {
components: { BaseModel },
props: {
JsonObj: {
type: String,
default: '',
},
config: {
type: Object,
default: () => {
return {
visible: false,
title: this.$t('system:loginLog:dialog:title'),
width: '500px',
top: '10vh',
appendToBody: true,
bodyStyle: `min-height: 100px; max-height: 650px;overflow-y: auto;padding: 10px;border: 1px solid #e0e0e0;`,
}
},
},
},
data() {
return {
curKeys: [
'UserName',
'FirstName',
'LastName',
'EMail',
'Phone',
'Status',
'OrganizationName',
'PositionName',
'DepartmentName',
'UserRoleList',
],
}
},
computed: {
curDataArr() {
if (!this.curData) return []
return Object.keys(this.curData)
},
curData() {
if (!this.JsonObj) return []
let obj = JSON.parse(this.JsonObj)
let curData = []
Object.keys(obj).forEach((key) => {
if (this.curKeys.includes(key)) {
let o = {
key: this.$t(`system:loginLog:form:${key}`),
value: obj[key],
prop: key,
}
if (key === 'Status') {
o.value = this.$fd('IsUserEnable', obj[key])
}
curData.push(o)
}
})
return curData
},
},
}
</script>
<style lang="scss" scoped>
::v-deep .el-form-item__label {
font-weight: bold;
}
</style>

View File

@ -2,179 +2,153 @@
<div class="log"> <div class="log">
<div ref="leftContainer" class="left"> <div ref="leftContainer" class="left">
<el-form :inline="true"> <el-form :inline="true">
<el-form-item <el-form-item :label="$t('system:loginLog:label:OptType')" prop="OptType">
label="操作类型" <el-select v-model="searchData.OptTypeList" clearable style="width: 200px" multiple :collapse-tags="true">
prop="OptType" <el-option v-for="item of $d.UserOptType" :key="'UserOptType' + item.label" :value="item.value"
> :label="item.label" />
<el-select v-model="searchData.OptType" clearable style="width:120px;">
<el-option
v-for="item of $d.UserOptType"
:key="'UserOptType' + item.label"
:value="item.value"
:label="item.label"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="IP" prop="IP">
label="IP" <el-input v-model="searchData.IP" size="small" clearable style="width: 120px" />
prop="IP"
>
<el-input
v-model="searchData.IP"
size="small"
clearable
style="width:120px;"
/>
</el-form-item> </el-form-item>
<el-form-item <el-form-item :label="$t('system:loginLog:label:LoginFaildName')" prop="LoginFaildName">
label="错误用户名" <el-input v-model="searchData.LoginFaildName" size="small" clearable style="width: 120px" />
prop="LoginFaildName"
>
<el-input
v-model="searchData.LoginFaildName"
size="small"
clearable
style="width:120px;"
/>
</el-form-item> </el-form-item>
<el-form-item <el-form-item :label="$t('system:loginLog:table:LoginUserName')" prop="LoginFaildName">
label="创建时间" <el-input v-model="searchData.LoginUserName" size="small" clearable style="width: 120px" />
> </el-form-item>
<el-date-picker <!-- <el-form-item :label="$t('system:loginLog:table:LoginUserType')" prop="LoginUserTypeEnum">
v-model="datetimerange" <el-select v-model="searchData.LoginUserTypeEnum" clearable style="width: 120px">
type="datetimerange" <el-option v-for="item of $d.UserType" :key="'UserType' + item.label" :value="item.value"
range-separator="-" :label="item.label" />
:start-placeholder="$t('trials:uploadClinicalData:table:beginDate')" </el-select>
:end-placeholder="$t('trials:uploadClinicalData:table:endDate')" </el-form-item> -->
value-format="yyyy-MM-dd HH:mm:ss" <el-form-item :label="$t('system:loginLog:label:IsLoginUncommonly')" prop="IsLoginUncommonly ">
:default-time="['00:00:00', '23:59:59']" <el-select v-model="searchData.IsLoginUncommonly" clearable style="width: 120px">
@change="handleDatetimeChange" <el-option v-for="item of $d.YesOrNo" :key="item.id" :value="item.value" :label="item.label" />
/> </el-select>
</el-form-item>
<el-form-item :label="$t('system:loginLog:label:CreateTime')">
<el-date-picker v-model="datetimerange" type="datetimerange" value-format="yyyy-MM-dd HH:mm:ss"
:default-time="['00:00:00', '23:59:59']" @change="handleDatetimeChange" style="width: 380px" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button <el-button type="primary" icon="el-icon-search" @click="getList">
type="primary" {{ $t('common:button:search') }}
icon="el-icon-search" </el-button>
size="mini" <el-button type="primary" icon="el-icon-refresh-left" @click="handleReset">
@click="getList" {{ $t('common:button:reset') }}
>
查询
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table <el-table v-loading="loading" v-adaptive="{ bottomOffset: 45 }" height="100" :data="list" class="table"
v-loading="loading" @sort-change="handleSortByColumn">
v-adaptive="{bottomOffset:45}" <el-table-column type="index" width="50">
height="100" <template slot-scope="scope">
:data="list" <span style="
class="table" display: flex;
@sort-change="handleSortByColumn" align-items: center;
:default-sort="{ prop: 'CreateTime', order: 'descending' }" justify-content: flex-end;
> ">
<el-table-column <el-tooltip class="item" effect="dark" :content="$t('system:loginLog:label:IsLoginUncommonly')"
type="index" placement="top" style="margin-right: 3px" v-if="scope.row.IsIgnoreUncommonly">
width="50" <i v-if="scope.row.IsLoginUncommonly" class="el-icon-warning icon-i icon-success"></i>
/> </el-tooltip>
<el-table-column <el-tooltip class="item" effect="dark" :content="$t('system:loginLog:label:IsLoginUncommonly')"
label="操作类型" placement="top" style="margin-right: 3px" v-else-if="scope.row.IsLoginUncommonly">
prop="OptType" <i v-if="scope.row.IsLoginUncommonly" class="el-icon-warning icon-i"
min-width="90" @click.stop="setIsIgnoreUncommonly(scope.row)"></i>
show-overflow-tooltip </el-tooltip>
sortable="custom" <span>{{ scope.$index + 1 }}</span>
> </span>
</template>
</el-table-column>
<el-table-column :label="$t('system:loginLog:table:OptType')" prop="OptType" min-width="150"
show-overflow-tooltip sortable="custom">
<template slot-scope="scope"> <template slot-scope="scope">
{{ $fd('UserOptType', scope.row.OptType) }} {{ $fd('UserOptType', scope.row.OptType) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="IP" prop="IP" min-width="150" sortable="custom" show-overflow-tooltip />
label="IP" <el-table-column :label="$t('trials:loginLog:table:IPRegion')" prop="IPRegion" min-width="120"
prop="IP" show-overflow-tooltip sortable="custom" />
min-width="90" <!-- <el-table-column
sortable="custom" :label="$t('system:loginLog:table:LoginFaildName')"
show-overflow-tooltip
/>
<el-table-column
label="错误用户名"
prop="LoginFaildName" prop="LoginFaildName"
min-width="90" min-width="180"
show-overflow-tooltip show-overflow-tooltip
sortable="custom" sortable="custom"
/> /> -->
<el-table-column <el-table-column :label="$t('system:loginLog:table:LoginUserName')" prop="ActionUserName" min-width="140"
label="用户名" show-overflow-tooltip sortable="custom" />
prop="LoginUserName" <el-table-column :label="$t('system:loginLog:table:Aetionlserlype')" prop="ActionUserType" min-width="100"
min-width="90" show-overflow-tooltip sortable="custom" />
show-overflow-tooltip <!-- <el-table-column
sortable="custom" :label="$t('system:loginLog:table:LoginUserType')"
/>
<el-table-column
label="用户类型"
prop="LoginUserTypeEnum" prop="LoginUserTypeEnum"
min-width="90" min-width="120"
sortable="custom" sortable="custom"
show-overflow-tooltip show-overflow-tooltip
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ $fd('UserType',scope.row.LoginUserTypeEnum) }} {{ $fd("UserType", scope.row.LoginUserTypeEnum) }}
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column <el-table-column :label="$t('system:loginLog:table:OptUserName')" prop="TargetIdentityUserName" min-width="200"
label="操作用户名" sortable="custom" show-overflow-tooltip />
prop="OptUserName" <!-- <el-table-column
min-width="90" :label="$t('system:loginLog:table:OptUserType')"
sortable="custom"
show-overflow-tooltip
/>
<el-table-column
label="操作用户类型"
prop="OptUserTypeEnum" prop="OptUserTypeEnum"
min-width="90" min-width="200"
sortable="custom" sortable="custom"
show-overflow-tooltip show-overflow-tooltip
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ $fd('UserType',scope.row.OptUserTypeEnum) }} {{ $fd("UserType", scope.row.OptUserTypeEnum) }}
</template>
</el-table-column> -->
<el-table-column :label="$t('system:loginLog:table:detail')" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<el-button v-if="scope.row.JsonObj" type="text" @click="handleOpenDialog(scope.row)">
<span>{{ $t('system:loginLog:message:detail') }}</span>
</el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column :label="$t('system:loginLog:table:CreateTime')" prop="CreateTime" min-width="180"
label="创建时间" sortable="custom" show-overflow-tooltip />
prop="CreateTime"
min-width="90"
sortable="custom"
show-overflow-tooltip
/>
</el-table> </el-table>
<div class="pagination" style="text-align: right;margin-top:5px;"> <div class="pagination" style="text-align: right; margin-top: 5px">
<pagination <pagination :total="total" :page.sync="searchData.PageIndex" :limit.sync="searchData.PageSize"
:total="total" @pagination="getList" />
:page.sync="searchData.PageIndex"
:limit.sync="searchData.PageSize"
@pagination="getList"
/>
</div> </div>
</div> </div>
<detail :config="config" :JsonObj="JsonObj" />
</div> </div>
</template> </template>
<script> <script>
import { getUserLogList } from '@/api/user' import { getUserLogList, setIsIgnoreUncommonly } from '@/api/user'
import Pagination from '@/components/Pagination' import Pagination from '@/components/Pagination'
import detail from './detail.vue'
import moment from 'moment' import moment from 'moment'
const searchDataDefault = () => { const searchDataDefault = () => {
return { return {
OptType: null, OptType: null,
OptTypeList: [],
Ip: '', Ip: '',
LoginFaildName: '', LoginFaildName: '',
IsLoginUncommonly: null,
LoginUserName: '',
LoginUserTypeEnum: null,
BeginDate: '', BeginDate: '',
EndDate: '', EndDate: '',
Asc: false, Asc: false,
SortField: 'CreateTime', SortField: 'CreateTime',
PageIndex: 1, PageIndex: 1,
PageSize: 20 PageSize: 20,
} }
} }
export default { export default {
components: { Pagination }, components: { Pagination, detail },
data() { data() {
return { return {
moment, moment,
@ -182,20 +156,59 @@ export default {
list: [], list: [],
total: 0, total: 0,
loading: false, loading: false,
datetimerange: [] datetimerange: [],
config: {
visible: false,
title: this.$t('system:loginLog:dialog:title'),
width: '500px',
top: '10vh',
},
JsonObj: null,
} }
}, },
mounted() { mounted() {
this.getList() this.getList()
}, },
methods: { methods: {
//
async setIsIgnoreUncommonly(row) {
try {
let confirm = await this.$confirm(this.$t("system:loginLog:confirmMessage:setIsIgnoreUncommonly"))
if (!confirm) return false
let data = {
IsIgnoreUncommonly: true,
Id: row.Id
}
this.loading = true
let res = await setIsIgnoreUncommonly(data)
this.loading = false
if (res.IsSuccess) {
this.getList()
}
} catch (err) {
this.loading = false
console.log(err)
}
},
handleOpenDialog(row) {
if (!row.JsonObj)
return this.$message.warning(this.$t('system:loginLog:message:noJSON'))
this.config.title = this.$t('system:loginLog:dialog:title').replace(
'xxx',
this.$fd('UserOptType', row.OptType)
)
this.JsonObj = row.JsonObj
this.config.visible = true
},
getList() { getList() {
this.loading = true this.loading = true
getUserLogList(this.searchData).then((res) => { getUserLogList(this.searchData)
.then((res) => {
this.loading = false this.loading = false
this.list = res.Result.CurrentPageData this.list = res.Result.CurrentPageData
this.total = res.Result.TotalCount this.total = res.Result.TotalCount
}).catch(() => { })
.catch(() => {
this.loading = false this.loading = false
}) })
}, },
@ -210,6 +223,7 @@ export default {
}, },
// //
handleReset() { handleReset() {
this.datetimerange = []
this.searchData = searchDataDefault() this.searchData = searchDataDefault()
this.getList() this.getList()
}, },
@ -223,8 +237,8 @@ export default {
this.searchData.SortField = column.prop this.searchData.SortField = column.prop
this.searchData.PageIndex = 1 this.searchData.PageIndex = 1
this.getList() this.getList()
} },
} },
} }
</script> </script>
<style lang="scss"> <style lang="scss">
@ -234,24 +248,37 @@ export default {
display: flex; display: flex;
padding: 10px; padding: 10px;
border-radius: 5px; border-radius: 5px;
.left { .left {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 0; width: 0;
flex-grow: 4; flex-grow: 4;
// border-right: 1px solid #ccc; // border-right: 1px solid #ccc;
.filter-container { .filter-container {
display: flex; display: flex;
align-items: center; align-items: center;
margin: 5px; margin: 5px;
} }
.data-table { .data-table {
flex: 1; flex: 1;
padding: 5px 0px; padding: 5px 0px;
} }
.pagination-container { .pagination-container {
text-align: right; text-align: right;
} }
} }
.icon-i {
color: #f56c6c;
cursor: pointer;
}
.icon-success {
color: #67C23A
}
} }
</style> </style>

View File

@ -2,34 +2,16 @@
<BaseContainer> <BaseContainer>
<template slot="search-container"> <template slot="search-container">
<el-form :inline="true"> <el-form :inline="true">
<el-form-item <el-form-item :label="$t('trials:loginLog:table:optType')" prop="OptType">
:label="$t('trials:loginLog:table:optType')" <el-select v-model="searchData.OptTypeList" clearable multiple :collapse-tags="true" style="width: 200px">
prop="OptType" <el-option v-for="item of $d.UserOptType" v-show="item.value !== 3 && item.value !== 10 && item.value !== 9"
> :key="'UserOptType' + item.label" :value="item.value" :label="item.label" />
<el-select
v-model="searchData.OptType"
clearable
style="width: 120px"
>
<template v-for="item of $d.UserOptType">
<el-option
:key="'UserOptType' + item.label"
:value="item.value"
:label="item.label"
v-if="item.value !== 9 && item.value !== 10"
/>
</template>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="IP" prop="IP"> <el-form-item label="IP" prop="IP">
<el-input <el-input v-model="searchData.IP" size="small" clearable style="width: 120px" />
v-model="searchData.IP"
size="small"
clearable
style="width: 120px"
/>
</el-form-item> </el-form-item>
<el-form-item <!-- <el-form-item
:label="$t('trials:loginLog:table:incorrectUserName')" :label="$t('trials:loginLog:table:incorrectUserName')"
prop="LoginFaildName" prop="LoginFaildName"
v-if="!isMine" v-if="!isMine"
@ -40,109 +22,73 @@
clearable clearable
style="width: 120px" style="width: 120px"
/> />
</el-form-item> -->
<el-form-item :label="$t('trials:loginLog:table:userName')" prop="LoginUserName" v-if="!isMine">
<el-select v-model="searchData.IdentityUserId" clearable style="width: 120px">
<el-option v-for="item of trialUserList" :key="item.IdentityUserId" :value="item.IdentityUserId"
:label="item.UserName" />
</el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item :label="$t('trials:loginLog:table:optUserName')" prop="TargetIdentityUserId" v-if="!isMine">
:label="$t('trials:loginLog:table:userName')" <el-select v-model="searchData.TargetIdentityUserId" clearable style="width: 120px">
prop="LoginUserName" <el-option v-for="item of trialUserList" :key="item.IdentityUserId" :value="item.IdentityUserId"
v-if="!isMine" :label="item.UserName" />
> </el-select>
<el-input
v-model="searchData.LoginUserName"
size="small"
clearable
style="width: 120px"
/>
</el-form-item> </el-form-item>
<el-form-item <el-form-item :label="$t('trials:loginLog:table:userType')" prop="OptType" v-if="!isMine">
:label="$t('trials:loginLog:table:userType')" <el-select v-model="searchData.LoginUserType" clearable style="width: 120px">
prop="OptType" <el-option v-for="item of $d.UserType" v-show="item.value !== 7 && item.value !== 8"
v-if="!isMine" :key="'UserType' + item.label" :value="item.label" :label="item.label" />
>
<el-select
v-model="searchData.UserTypeId"
clearable
style="width: 120px"
>
<el-option
v-for="item of userTypeOptions"
:key="item.Id"
:label="item.UserType"
:value="item.Id"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('trials:loginLog:table:createTime')"> <el-form-item :label="$t('trials:loginLog:table:createTime')">
<el-date-picker <el-date-picker v-model="datetimerange" type="datetimerange" :default-time="['00:00:00', '23:59:59']"
clearable
v-model="datetimerange"
type="datetimerange"
:default-time="['00:00:00', '23:59:59']"
:start-placeholder="$t('trials:loginLog:table:beginTime')" :start-placeholder="$t('trials:loginLog:table:beginTime')"
:end-placeholder="$t('trials:loginLog:table:endTime')" :end-placeholder="$t('trials:loginLog:table:endTime')" value-format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss" @change="handleDatetimeChange" />
@change="handleDatetimeChange"
/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleSearch"> <el-button type="primary" icon="el-icon-search" @click="handleSearch">
{{ $t("common:button:search") }} {{ $t('common:button:search') }}
</el-button> </el-button>
<!-- 重置 --> <!-- 重置 -->
<el-button <el-button type="primary" icon="el-icon-refresh-left" @click="handleReset">
type="primary" {{ $t('common:button:reset') }}
icon="el-icon-refresh-left"
@click="handleReset"
>
{{ $t("common:button:reset") }}
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</template> </template>
<template slot="main-container"> <template slot="main-container">
<el-table <el-table v-loading="loading" v-adaptive="{ bottomOffset: isMine ? 80 : 60 }" height="100" :data="list"
v-loading="loading" class="table" @sort-change="handleSortByColumn" :default-sort="{ prop: 'CreateTime', order: 'descending' }">
v-adaptive="{ bottomOffset: isMine ? 80 : 60 }"
height="100"
:data="list"
class="table"
@sort-change="handleSortByColumn"
:default-sort="{ prop: 'CreateTime', order: 'descending' }"
>
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column <el-table-column :label="$t('trials:loginLog:table:optType')" prop="OptType" min-width="90"
:label="$t('trials:loginLog:table:optType')" show-overflow-tooltip sortable="custom">
prop="OptType"
min-width="90"
show-overflow-tooltip
sortable="custom"
>
<template slot-scope="scope"> <template slot-scope="scope">
{{ $fd("UserOptType", scope.row.OptType) }} {{ $fd('UserOptType', scope.row.OptType) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="IP" prop="IP" min-width="90" show-overflow-tooltip sortable="custom" />
label="IP" <!-- <el-table-column
prop="IP" :label="$t('trials:loginLog:table:IPRegion')"
prop="IPRegion"
min-width="90" min-width="90"
show-overflow-tooltip show-overflow-tooltip
sortable="custom" sortable="custom"
/> /> -->
<el-table-column <!-- <el-table-column
v-if="!isMine" v-if="!isMine"
:label="$t('trials:loginLog:table:incorrectUserName')" :label="$t('trials:loginLog:table:incorrectUserName')"
prop="LoginFaildName" prop="LoginFaildName"
min-width="90" min-width="90"
show-overflow-tooltip show-overflow-tooltip
sortable="custom" sortable="custom"
/> /> -->
<el-table-column <el-table-column :label="$t('trials:loginLog:table:userName')" prop="ActionUserName" min-width="90"
:label="$t('trials:loginLog:table:userName')" show-overflow-tooltip sortable="custom" />
prop="LoginUserName" <el-table-column :label="$t('trials:loginLog:table:Aetionlserlype')" prop="ActionUserType" min-width="100"
min-width="90" show-overflow-tooltip sortable="custom" />
show-overflow-tooltip <!-- <el-table-column
sortable="custom"
/>
<el-table-column
:label="$t('trials:loginLog:table:userType')" :label="$t('trials:loginLog:table:userType')"
prop="LoginUserTypeEnum" prop="LoginUserTypeEnum"
min-width="90" min-width="90"
@ -150,73 +96,67 @@
sortable="custom" sortable="custom"
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ $fd("UserType", scope.row.LoginUserTypeEnum) }} {{ $fd('UserType', scope.row.LoginUserTypeEnum) }}
</template> </template>
</el-table-column> </el-table-column> -->
<!-- <el-table-column <el-table-column v-if="!isMine" :label="$t('trials:loginLog:table:optUserName')" prop="TargetIdentityUserName"
v-if="!isMine" min-width="120" show-overflow-tooltip sortable="custom" />
:label="$t('trials:loginLog:table:optUserName')"
prop="optUserName"
min-width="90"
show-overflow-tooltip
sortable="custom"
/> -->
<!-- <el-table-column <!-- <el-table-column
v-if="!isMine" v-if="!isMine"
:label="$t('trials:loginLog:table:optUserType')" :label="$t('trials:loginLog:table:optUserType')"
prop="OptUserTypeEnum" prop="OptUserTypeEnum"
min-width="90" min-width="160"
show-overflow-tooltip show-overflow-tooltip
sortable="custom" sortable="custom"
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ $fd("UserType", scope.row.OptUserTypeEnum) }} {{ $fd('UserType', scope.row.OptUserTypeEnum) }}
</template> </template>
</el-table-column> --> </el-table-column> -->
<el-table-column <el-table-column :label="$t('trials:loginLog:table:detail')" min-width="80" show-overflow-tooltip>
:label="$t('trials:loginLog:table:createTime')" <template slot-scope="scope">
prop="CreateTime" <el-button v-if="scope.row.JsonObj" type="text" @click="handleOpenDialog(scope.row)">
min-width="90" <span>{{ $t('trials:loginLog:message:detail') }}</span>
show-overflow-tooltip </el-button>
sortable="custom" </template>
/> </el-table-column>
<el-table-column :label="$t('trials:loginLog:table:createTime')" prop="CreateTime" min-width="90"
show-overflow-tooltip sortable="custom" />
</el-table> </el-table>
<!-- 分页组件 --> <!-- 分页组件 -->
<pagination <pagination class="page" :total="total" :page.sync="searchData.PageIndex" :limit.sync="searchData.PageSize"
class="page" @pagination="getList" />
:total="total"
:page.sync="searchData.PageIndex"
:limit.sync="searchData.PageSize"
@pagination="getList"
/>
</template> </template>
<detail :config="config" :JsonObj="JsonObj" />
</BaseContainer> </BaseContainer>
</template> </template>
<script> <script>
import { getUserLogList } from "@/api/user"; import { getUserLogList, getTrialUserList } from '@/api/user'
import { getUserTypeListByUserType } from "@/api/admin"; import BaseContainer from '@/components/BaseContainer'
import BaseContainer from "@/components/BaseContainer"; import Pagination from '@/components/Pagination'
import Pagination from "@/components/Pagination"; import moment from 'moment'
import moment from "moment"; import detail from '@/views/system/login-log/detail.vue'
const searchDataDefault = () => { const searchDataDefault = () => {
return { return {
TrialId: "", TrialId: '',
OptType: null, OptType: null,
Ip: "", OptTypeList: [],
LoginFaildName: "", Ip: '',
BeginDate: "", LoginFaildName: '',
EndDate: "", LoginUserName: '',
LoginUserType: null,
BeginDate: '',
EndDate: '',
Asc: false, Asc: false,
SortField: "CreateTime", SortField: 'CreateTime',
UserTypeId: null,
LoginUserName: null,
PageIndex: 1, PageIndex: 1,
PageSize: 20, PageSize: 20,
UserId: "", UserId: '',
}; TargetIdentityUserId: ''
}; }
}
export default { export default {
components: { BaseContainer, Pagination }, components: { BaseContainer, Pagination, detail },
props: { props: {
isMine: { isMine: {
type: Boolean, type: Boolean,
@ -224,91 +164,104 @@ export default {
}, },
id: { id: {
type: String, type: String,
default: "", default: '',
}, },
}, },
data() { data() {
return { return {
userTypeOptions: [],
moment, moment,
searchData: searchDataDefault(), searchData: searchDataDefault(),
list: [], list: [],
total: 0, total: 0,
loading: false, loading: false,
datetimerange: [], datetimerange: [],
}; trialUserList: [],
config: {
visible: false,
title: this.$t('trials:loginLog:dialog:title'),
width: '500px',
top: '10vh',
},
JsonObj: null,
}
}, },
mounted() { mounted() {
this.getList(); if (!this.isMine) {
this.getUserType(); this.getTrialUserList()
}
this.getList()
}, },
methods: { methods: {
// handleOpenDialog(row) {
getUserType() { if (!row.JsonObj)
getUserTypeListByUserType(0).then((res) => { return this.$message.warning(this.$t('trials:loginLog:message:noJSON'))
let arr = []; this.config.title = this.$t('trials:loginLog:dialog:title').replace(
if (this.hasPermi(["role:admin"])) { 'xxx',
arr = [1]; this.$fd('UserOptType', row.OptType)
)
this.JsonObj = row.JsonObj
this.config.visible = true
},
//
async getTrialUserList() {
try {
let params = {
TrialId: this.$route.query.trialId,
} }
if (this.hasPermi(["role:oa"])) { let res = await getTrialUserList(params)
arr = [1, 2]; if (res.IsSuccess) {
this.trialUserList = res.Result
} }
if (this.hasPermi(["role:pm"])) { } catch (err) {
arr = [1, 2, 14]; console.log(err)
} }
this.userTypeOptions = res.Result.map((item) => {
if (!arr.includes(item.UserTypeEnum)) {
return item;
}
}).filter((item) => item);
});
}, },
getList() { getList() {
this.loading = true; this.loading = true
this.searchData.TrialId = this.$route.query.trialId; this.searchData.TrialId = this.$route.query.trialId
if (this.isMine) { if (this.isMine) {
this.searchData.UserId = this.id; this.searchData.IdentityUserId = this.id
} }
getUserLogList(this.searchData) getUserLogList(this.searchData)
.then((res) => { .then((res) => {
this.loading = false; this.loading = false
this.list = res.Result.CurrentPageData; this.list = res.Result.CurrentPageData
this.total = res.Result.TotalCount; this.total = res.Result.TotalCount
}) })
.catch(() => { .catch(() => {
this.loading = false; this.loading = false
}); })
}, },
handleDatetimeChange(val) { handleDatetimeChange(val) {
if (val) { if (val) {
this.searchData.BeginDate = val[0]; this.searchData.BeginDate = val[0]
this.searchData.EndDate = val[1]; this.searchData.EndDate = val[1]
} else { } else {
this.searchData.BeginDate = ""; this.searchData.BeginDate = ''
this.searchData.EndDate = ""; this.searchData.EndDate = ''
} }
}, },
handleSearch() { handleSearch() {
this.searchData.PageIndex = 1; this.searchData.PageIndex = 1
this.getList(); this.getList()
}, },
// //
handleReset() { handleReset() {
this.searchData = searchDataDefault(); this.datetimerange = null
this.datetimerange = []; this.searchData = searchDataDefault()
this.getList(); this.getList()
}, },
// //
handleSortByColumn(column) { handleSortByColumn(column) {
if (column.order === "ascending") { if (column.order === 'ascending') {
this.searchData.Asc = true; this.searchData.Asc = true
} else { } else {
this.searchData.Asc = false; this.searchData.Asc = false
} }
this.searchData.SortField = column.prop; this.searchData.SortField = column.prop
this.searchData.PageIndex = 1; this.searchData.PageIndex = 1
this.getList(); this.getList()
}, },
}, },
}; }
</script> </script>