账号列表展示账号最后一次登录时间
continuous-integration/drone/push Build is running Details

uat_us
wangxiaoshuang 2024-10-25 13:42:49 +08:00
parent 70fcd15ab7
commit 925451ea65
2 changed files with 236 additions and 105 deletions

View File

@ -2,7 +2,7 @@
<el-row> <el-row>
<el-col class="m-b-10" :span="24"> <el-col class="m-b-10" :span="24">
<el-table <el-table
v-adaptive="{bottomOffset}" v-adaptive="{ bottomOffset }"
:data="list" :data="list"
:height="tableHeight" :height="tableHeight"
v-bind="$attrs" v-bind="$attrs"
@ -15,15 +15,44 @@
> >
<template v-for="(column, index) in columns"> <template v-for="(column, index) in columns">
<slot name="front-slot" /> <slot name="front-slot" />
<el-table-column v-if="column.type === 'tip'" :key="index" width="35">
<template slot-scope="scope">
<span v-if="column.slot">
<!-- 具名slot -->
<slot v-if="column.slot" :name="column.slot" :scope="scope" />
</span>
</template>
</el-table-column>
<!-- 序号 --> <!-- 序号 -->
<el-table-column v-if="column.type === 'selection'" :key="index" type="selection" width="55" /> <el-table-column
v-else-if="column.type === 'selection'"
:key="index"
type="selection"
width="55"
/>
<!-- 复选框 --> <!-- 复选框 -->
<el-table-column v-else-if="column.type === 'index'" :key="index" type="index" width="50" /> <el-table-column
v-else-if="column.type === 'index'"
:key="index"
type="index"
width="50"
/>
<!-- 具体内容 --> <!-- 具体内容 -->
<el-table-column v-else :key="index" align="left" :label="column.label" :width="column.width" :min-width="column.minWidth" :show-overflow-tooltip="column.showOverflowTooltip || false" :sortable="column.sortable || false" :prop="column.prop"> <el-table-column
v-else
:key="index"
align="left"
:label="column.label"
:width="column.width"
:min-width="column.minWidth"
:show-overflow-tooltip="column.showOverflowTooltip || false"
:sortable="column.sortable || false"
:prop="column.prop"
>
<template slot-scope="scope"> <template slot-scope="scope">
<!-- 仅仅显示文字 --> <!-- 仅仅显示文字 -->
<span v-if="!column.hidden"> <!-- hiddentrue slot--> <span v-if="!column.hidden">
<!-- 如果hidden为true的时候 那么当前格可以不显示可以选择显示自定义的slot-->
<!-- 操作按钮 --> <!-- 操作按钮 -->
<span v-if="column.type === 'operate'"> <span v-if="column.type === 'operate'">
<!-- <a v-for="(operate, i) in column.operates" :key="i" href="javascript:void(0)" class="operate-button" @click="handleClick(operate, scope.row)"> <!-- <a v-for="(operate, i) in column.operates" :key="i" href="javascript:void(0)" class="operate-button" @click="handleClick(operate, scope.row)">
@ -31,7 +60,13 @@
&nbsp;&nbsp; &nbsp;&nbsp;
</a> --> </a> -->
<span v-for="(operate, i) in column.operates" :key="i"> <span v-for="(operate, i) in column.operates" :key="i">
<el-button :size="operate.size || 'mini'" :type="operate.type || 'primary'" style="margin-right:5px;" @click="handleClick(operate, scope.row)">{{ operate.name }}</el-button> <el-button
:size="operate.size || 'mini'"
:type="operate.type || 'primary'"
style="margin-right: 5px"
@click="handleClick(operate, scope.row)"
>{{ operate.name }}</el-button
>
</span> </span>
</span> </span>
<span v-else> <span v-else>
@ -52,7 +87,12 @@
</el-col> </el-col>
<!-- 分页部分 --> <!-- 分页部分 -->
<el-col v-if="!hiddenPage" :span="24" class="page"> <el-col v-if="!hiddenPage" :span="24" class="page">
<pagination :total="total" :page.sync="searchData.PageIndex" :limit.sync="searchData.PageSize" @pagination="pagination" /> <pagination
:total="total"
:page.sync="searchData.PageIndex"
:limit.sync="searchData.PageSize"
@pagination="pagination"
/>
</el-col> </el-col>
</el-row> </el-row>
</template> </template>
@ -96,45 +136,44 @@ export default {
// //
list: { list: {
type: Array, type: Array,
default: () => [] default: () => [],
}, },
// columns // columns
columns: { columns: {
type: Array, type: Array,
required: true, required: true,
default: () => [] default: () => [],
}, },
// is hidden page for table // is hidden page for table
hiddenPage: { hiddenPage: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
bottomOffset: { bottomOffset: {
type: Number, type: Number,
default: 45 default: 45,
}, },
searchData: { searchData: {
type: Object, type: Object,
default: () => {} default: () => {},
}, },
total: { total: {
type: Number, type: Number,
default: 0 default: 0,
}, },
highlightCurrentRow: { highlightCurrentRow: {
type: Boolean, type: Boolean,
default: false default: false,
} },
}, },
data() { data() {
return { return {}
}
}, },
computed: { computed: {
tableHeight() { tableHeight() {
return 100 return 100
} },
}, },
methods: { methods: {
// //
@ -157,12 +196,12 @@ export default {
}, },
pagination() { pagination() {
this.$emit('getList') this.$emit('getList')
} },
} },
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.page{ .page {
padding-top: 3px; padding-top: 3px;
text-align: right; text-align: right;
} }

View File

@ -24,20 +24,40 @@
@sortByColumn="sortByColumn" @sortByColumn="sortByColumn"
> >
<!-- 选择自定义slot --> <!-- 选择自定义slot -->
<template slot="genderSlot" slot-scope="{scope}"> <template slot="tip-slot" slot-scope="{ scope }">
{{ scope.row.Sex?'Male':'Female' }} <i
v-if="diffTime(scope.row.LastLoginTime) >= 6"
class="el-icon-warning"
style="color: #f56c6c"
:title="$t('system:userlist:tip:overTime')"
/>
</template> </template>
<template slot="roleSlot" slot-scope="{scope}"> <template slot="genderSlot" slot-scope="{ scope }">
{{ scope.row.RoleNameList.map(role => role.RoleName).join(',') }} {{ scope.row.Sex ? 'Male' : 'Female' }}
</template> </template>
<template slot="isZhiZhunSlot" slot-scope="{scope}"> <template slot="roleSlot" slot-scope="{ scope }">
{{scope.row.IsZhiZhun ? $t('system:userlist:table:InternalOrExternal:Internal') : $t('system:userlist:table:InternalOrExternal:External')}} {{ scope.row.RoleNameList.map((role) => role.RoleName).join(',') }}
</template> </template>
<template slot="isTestUserSlot" slot-scope="{scope}"> <template slot="isZhiZhunSlot" slot-scope="{ scope }">
{{scope.row.IsTestUser ? $t('system:userlist:table:IsTestUser:Yes') : $t('system:userlist:table:IsTestUser:No')}} {{
scope.row.IsZhiZhun
? $t('system:userlist:table:InternalOrExternal:Internal')
: $t('system:userlist:table:InternalOrExternal:External')
}}
</template> </template>
<template slot="statusSlot" slot-scope="{scope}"> <template slot="isTestUserSlot" slot-scope="{ scope }">
{{ scope.row.Status? $t('system:userlist:table:Status:Enable') : $t('system:userlist:table:Status:Disable') }} {{
scope.row.IsTestUser
? $t('system:userlist:table:IsTestUser:Yes')
: $t('system:userlist:table:IsTestUser:No')
}}
</template>
<template slot="statusSlot" slot-scope="{ scope }">
{{
scope.row.Status
? $t('system:userlist:table:Status:Enable')
: $t('system:userlist:table:Status:Disable')
}}
</template> </template>
</base-table> </base-table>
</box-content> </box-content>
@ -49,8 +69,7 @@ import BoxContent from '@/components/BoxContent'
import SearchForm from '@/components/BaseForm/search-form' import SearchForm from '@/components/BaseForm/search-form'
import BaseTable from '@/components/BaseTable' import BaseTable from '@/components/BaseTable'
import tableMixins from '@/mixins/table' import tableMixins from '@/mixins/table'
import moment from 'moment'
// //
// //
const searchDataDefault = () => { const searchDataDefault = () => {
@ -67,7 +86,8 @@ const searchDataDefault = () => {
BeginCreateTime: '', BeginCreateTime: '',
EndCreateTime: '', EndCreateTime: '',
CreateTimeArr: [], CreateTimeArr: [],
SortField: 'CreateTime' LastLoginTimeArr: [],
SortField: 'CreateTime',
} }
} }
export default { export default {
@ -78,27 +98,28 @@ export default {
return { return {
searchData: searchDataDefault(), searchData: searchDataDefault(),
columns: [ columns: [
{ type: 'tip', slot: 'tip-slot' },
{ type: 'index' }, { type: 'index' },
{ {
prop: 'UserCode', prop: 'UserCode',
label: this.$t('system:userlist:table:S/N'), label: this.$t('system:userlist:table:S/N'),
width: 100, width: 100,
sortable: 'custom', sortable: 'custom',
showOverflowTooltip: true showOverflowTooltip: true,
}, },
{ {
prop: 'UserName', prop: 'UserName',
label: this.$t('system:userlist:table:UserName'), label: this.$t('system:userlist:table:UserName'),
minWidth: 100, minWidth: 100,
sortable: 'custom', sortable: 'custom',
showOverflowTooltip: true showOverflowTooltip: true,
}, },
{ {
prop: 'RealName', prop: 'RealName',
label: this.$t('system:userlist:table:RealName'), label: this.$t('system:userlist:table:RealName'),
minWidth: 120, minWidth: 120,
sortable: 'custom', sortable: 'custom',
showOverflowTooltip: true showOverflowTooltip: true,
}, },
// { // {
// prop: 'Sex', // prop: 'Sex',
@ -114,27 +135,27 @@ export default {
label: this.$t('system:userlist:table:Phone'), label: this.$t('system:userlist:table:Phone'),
minWidth: 120, minWidth: 120,
sortable: 'custom', sortable: 'custom',
showOverflowTooltip: true showOverflowTooltip: true,
}, },
{ {
prop: 'EMail', prop: 'EMail',
label: this.$t('system:userlist:table:Email'), label: this.$t('system:userlist:table:Email'),
minWidth: 150, minWidth: 150,
sortable: 'custom', sortable: 'custom',
showOverflowTooltip: true showOverflowTooltip: true,
}, },
{ {
prop: 'OrganizationName', prop: 'OrganizationName',
label: this.$t('system:userlist:table:Organization'), label: this.$t('system:userlist:table:Organization'),
minWidth: 130, minWidth: 130,
showOverflowTooltip: true showOverflowTooltip: true,
}, },
{ {
prop: 'UserType', prop: 'UserType',
label: this.$t('system:userlist:table:UserType'), label: this.$t('system:userlist:table:UserType'),
minWidth: 100, minWidth: 100,
sortable: 'custom', sortable: 'custom',
showOverflowTooltip: true showOverflowTooltip: true,
}, },
{ {
prop: 'IsZhiZhun', prop: 'IsZhiZhun',
@ -143,7 +164,8 @@ export default {
slot: 'isZhiZhunSlot', slot: 'isZhiZhunSlot',
minWidth: 140, minWidth: 140,
sortable: 'custom', sortable: 'custom',
showOverflowTooltip: true }, showOverflowTooltip: true,
},
{ {
prop: 'IsTestUser', prop: 'IsTestUser',
label: this.$t('system:userlist:table:IsTestUser'), label: this.$t('system:userlist:table:IsTestUser'),
@ -151,7 +173,8 @@ export default {
slot: 'isTestUserSlot', slot: 'isTestUserSlot',
minWidth: 120, minWidth: 120,
sortable: 'custom', sortable: 'custom',
showOverflowTooltip: true }, showOverflowTooltip: true,
},
{ {
prop: 'Status', prop: 'Status',
label: this.$t('system:userlist:table:Status'), label: this.$t('system:userlist:table:Status'),
@ -159,21 +182,39 @@ export default {
slot: 'statusSlot', slot: 'statusSlot',
minWidth: 100, minWidth: 100,
sortable: 'custom', sortable: 'custom',
showOverflowTooltip: true },
{
prop: "CreateTime",
label: this.$t("system:userlist:table:createTime"),
minWidth: 200,
sortable: "custom",
showOverflowTooltip: true, showOverflowTooltip: true,
}, },
{ type: 'operate', {
prop: 'CreateTime',
label: this.$t('system:userlist:table:createTime'),
minWidth: 200,
sortable: 'custom',
showOverflowTooltip: true,
},
{
prop: 'LastLoginTime',
label: this.$t('system:userlist:table:LastLoginTime'),
minWidth: 200,
sortable: 'custom',
showOverflowTooltip: true,
},
{
type: 'operate',
label: this.$t('common:action:action'), label: this.$t('common:action:action'),
minWidth: 200, minWidth: 200,
operates: [ operates: [
{ name: this.$t('common:button:edit'), type: 'primary', emitKey: 'editCb' }, {
{ name: this.$t('common:button:delete'), type: 'danger', emitKey: 'deleteCb' } name: this.$t('common:button:edit'),
] } type: 'primary',
emitKey: 'editCb',
},
{
name: this.$t('common:button:delete'),
type: 'danger',
emitKey: 'deleteCb',
},
],
},
], ],
searchForm: [ searchForm: [
{ {
@ -181,35 +222,35 @@ export default {
label: this.$t('system:userlist:label:UserName'), label: this.$t('system:userlist:label:UserName'),
prop: 'UserName', prop: 'UserName',
width: '120px', width: '120px',
placeholder: '' placeholder: '',
}, },
{ {
type: 'Input', type: 'Input',
label: this.$t('system:userlist:label:RealName'), label: this.$t('system:userlist:label:RealName'),
prop: 'RealName', prop: 'RealName',
width: '120px', width: '120px',
placeholder: '' placeholder: '',
}, },
{ {
type: 'Input', type: 'Input',
label: this.$t('system:userlist:label:Phone'), label: this.$t('system:userlist:label:Phone'),
prop: 'Phone', prop: 'Phone',
width: '120px', width: '120px',
placeholder: '' placeholder: '',
}, },
{ {
type: "Input", type: 'Input',
label: this.$t("system:userlist:label:EMail"), label: this.$t('system:userlist:label:EMail'),
prop: "EMail", prop: 'EMail',
width: "120px", width: '120px',
placeholder: "", placeholder: '',
}, },
{ {
type: 'Input', type: 'Input',
label: this.$t('system:userlist:label:Organization'), label: this.$t('system:userlist:label:Organization'),
prop: 'OrganizationName', prop: 'OrganizationName',
width: '120px', width: '120px',
placeholder: '' placeholder: '',
}, },
{ {
type: 'Select', type: 'Select',
@ -217,12 +258,22 @@ export default {
prop: 'IsZhiZhun', prop: 'IsZhiZhun',
width: '100px', width: '100px',
options: [ options: [
{ label: this.$t('system:userlist:label:InternalOrExternal:Internal'), value: true }, {
{ label: this.$t('system:userlist:label:InternalOrExternal:External'), value: false } label: this.$t(
'system:userlist:label:InternalOrExternal:Internal'
),
value: true,
},
{
label: this.$t(
'system:userlist:label:InternalOrExternal:External'
),
value: false,
},
], ],
props: { label: 'label', value: 'value' }, props: { label: 'label', value: 'value' },
change: scope => '', change: (scope) => '',
placeholder: '' placeholder: '',
}, },
{ {
type: 'Select', type: 'Select',
@ -230,12 +281,18 @@ export default {
prop: 'IsTestUser', prop: 'IsTestUser',
width: '100px', width: '100px',
options: [ options: [
{ label: this.$t('system:userlist:label:IsTestUser:Yes'), value: true }, {
{ label: this.$t('system:userlist:label:IsTestUser:No'), value: false } label: this.$t('system:userlist:label:IsTestUser:Yes'),
value: true,
},
{
label: this.$t('system:userlist:label:IsTestUser:No'),
value: false,
},
], ],
props: { label: 'label', value: 'value' }, props: { label: 'label', value: 'value' },
change: scope => '', change: (scope) => '',
placeholder: '' placeholder: '',
}, },
{ {
type: 'Select', type: 'Select',
@ -244,11 +301,14 @@ export default {
width: '100px', width: '100px',
options: [ options: [
{ label: this.$t('system:userlist:label:Status:Enable'), value: 1 }, { label: this.$t('system:userlist:label:Status:Enable'), value: 1 },
{ label: this.$t('system:userlist:label:Status:Disable'), value: 0 } {
label: this.$t('system:userlist:label:Status:Disable'),
value: 0,
},
], ],
props: { label: 'label', value: 'value' }, props: { label: 'label', value: 'value' },
change: scope => '', change: (scope) => '',
placeholder: '' placeholder: '',
}, },
{ {
type: 'Select', type: 'Select',
@ -257,25 +317,44 @@ export default {
width: '100px', width: '100px',
options: [], // options: [], //
props: { label: 'UserType', value: 'Id' }, // props: { label: 'UserType', value: 'Id' }, //
placeholder: '' placeholder: '',
}, },
{ {
type: "Daterange", type: 'Daterange',
label: this.$t("system:userlist:label:CreateTime"), label: this.$t('system:userlist:label:CreateTime'),
prop: "CreateTimeArr", prop: 'CreateTimeArr',
width: "400px", width: '400px',
placeholder: "", placeholder: '',
},
{
type: 'Daterange',
label: this.$t('system:userlist:label:LastLoginTime'),
prop: 'LastLoginTimeArr',
width: '400px',
placeholder: '',
}, },
], ],
searchHandle: [ searchHandle: [
{ label: this.$t('common:button:reset'), type: 'primary', emitKey: 'reset' }, {
{ label: this.$t('common:button:search'), type: 'primary', emitKey: 'search' }, label: this.$t('common:button:reset'),
{ label: this.$t('common:button:new'), type: 'primary', emitKey: 'new' } type: 'primary',
emitKey: 'reset',
},
{
label: this.$t('common:button:search'),
type: 'primary',
emitKey: 'search',
},
{
label: this.$t('common:button:new'),
type: 'primary',
emitKey: 'new',
},
], ],
userTypeOptions: [], userTypeOptions: [],
loading: false, loading: false,
total: 0, total: 0,
users: [] users: [],
} }
}, },
created() { created() {
@ -283,19 +362,25 @@ export default {
this.getInfo() this.getInfo()
}, },
methods: { methods: {
diffTime(time) {
return moment(new Date()).diff(time, 'months')
},
// //
getList() { getList() {
this.loading = true this.loading = true
getUserList(this.searchData).then(res => { getUserList(this.searchData)
.then((res) => {
this.loading = false this.loading = false
this.users = res.Result.CurrentPageData this.users = res.Result.CurrentPageData
this.total = res.Result.TotalCount this.total = res.Result.TotalCount
}).catch(() => { })
.catch(() => {
this.loading = false this.loading = false
}) })
}, },
findItemIndex(key) { findItemIndex(key) {
return this.searchForm.findIndex(value => value.prop && value.prop === key return this.searchForm.findIndex(
(value) => value.prop && value.prop === key
) )
}, },
// //
@ -309,20 +394,23 @@ export default {
}, },
// //
handleEditUser(data) { handleEditUser(data) {
this.$router.push({ path: '/system/user/edit', query: { Id: data.Id, userName: data.UserName, email: data.EMail }}) this.$router.push({
path: '/system/user/edit',
query: { Id: data.Id, userName: data.UserName, email: data.EMail },
})
}, },
// //
handleDeleteUser(data) { handleDeleteUser(data) {
this.$confirm(this.$t('trials:uploadedDicoms:message:deleteMes'), { this.$confirm(this.$t('trials:uploadedDicoms:message:deleteMes'), {
type: 'warning', type: 'warning',
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
}).then(() => {
}) deleteSysUser(data.Id).then((res) => {
.then(() => {
deleteSysUser(data.Id)
.then(res => {
if (res.IsSuccess) { if (res.IsSuccess) {
this.users.splice(this.users.findIndex(item => item.Id === data.Id), 1) this.users.splice(
this.users.findIndex((item) => item.Id === data.Id),
1
)
this.$message.success(this.$t('common:message:deletedSuccessfully')) this.$message.success(this.$t('common:message:deletedSuccessfully'))
} }
}) })
@ -338,13 +426,17 @@ export default {
this.searchData.BeginCreateTime = this.searchData.CreateTimeArr[0] this.searchData.BeginCreateTime = this.searchData.CreateTimeArr[0]
this.searchData.EndCreateTime = this.searchData.CreateTimeArr[1] this.searchData.EndCreateTime = this.searchData.CreateTimeArr[1]
} }
if (this.searchData.LastLoginTimeArr.length > 0) {
this.searchData.BeginLastLoginTime = this.searchData.LastLoginTimeArr[0]
this.searchData.EndLastLoginTime = this.searchData.LastLoginTimeArr[1]
}
this.getList() this.getList()
}, },
} },
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
/deep/ .box-body .search .base-search-form .el-form-item{ /deep/ .box-body .search .base-search-form .el-form-item {
margin-bottom: 15px; margin-bottom: 15px;
} }
</style> </style>