账号列表展示账号最后一次登录时间
continuous-integration/drone/push Build is running
Details
continuous-integration/drone/push Build is running
Details
parent
70fcd15ab7
commit
925451ea65
|
@ -2,7 +2,7 @@
|
|||
<el-row>
|
||||
<el-col class="m-b-10" :span="24">
|
||||
<el-table
|
||||
v-adaptive="{bottomOffset}"
|
||||
v-adaptive="{ bottomOffset }"
|
||||
:data="list"
|
||||
:height="tableHeight"
|
||||
v-bind="$attrs"
|
||||
|
@ -15,15 +15,44 @@
|
|||
>
|
||||
<template v-for="(column, index) in columns">
|
||||
<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">
|
||||
<!-- 仅仅显示文字 -->
|
||||
<span v-if="!column.hidden"> <!-- 如果hidden为true的时候 那么当前格可以不显示,可以选择显示自定义的slot-->
|
||||
<span v-if="!column.hidden">
|
||||
<!-- 如果hidden为true的时候 那么当前格可以不显示,可以选择显示自定义的slot-->
|
||||
<!-- 操作按钮 -->
|
||||
<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)">
|
||||
|
@ -31,7 +60,13 @@
|
|||
|
||||
</a> -->
|
||||
<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 v-else>
|
||||
|
@ -52,7 +87,12 @@
|
|||
</el-col>
|
||||
<!-- 分页部分 -->
|
||||
<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-row>
|
||||
</template>
|
||||
|
@ -96,45 +136,44 @@ export default {
|
|||
// 核心数据
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
default: () => [],
|
||||
},
|
||||
|
||||
// columns
|
||||
columns: {
|
||||
type: Array,
|
||||
required: true,
|
||||
default: () => []
|
||||
default: () => [],
|
||||
},
|
||||
// is hidden page for table
|
||||
hiddenPage: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
default: false,
|
||||
},
|
||||
bottomOffset: {
|
||||
type: Number,
|
||||
default: 45
|
||||
default: 45,
|
||||
},
|
||||
searchData: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
default: () => {},
|
||||
},
|
||||
total: {
|
||||
type: Number,
|
||||
default: 0
|
||||
default: 0,
|
||||
},
|
||||
highlightCurrentRow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
tableHeight() {
|
||||
return 100
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 处理点击事件
|
||||
|
@ -157,12 +196,12 @@ export default {
|
|||
},
|
||||
pagination() {
|
||||
this.$emit('getList')
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.page{
|
||||
.page {
|
||||
padding-top: 3px;
|
||||
text-align: right;
|
||||
}
|
||||
|
|
|
@ -24,20 +24,40 @@
|
|||
@sortByColumn="sortByColumn"
|
||||
>
|
||||
<!-- 选择自定义slot -->
|
||||
<template slot="genderSlot" slot-scope="{scope}">
|
||||
{{ scope.row.Sex?'Male':'Female' }}
|
||||
<template slot="tip-slot" slot-scope="{ scope }">
|
||||
<i
|
||||
v-if="diffTime(scope.row.LastLoginTime) >= 6"
|
||||
class="el-icon-warning"
|
||||
style="color: #f56c6c"
|
||||
:title="$t('system:userlist:tip:overTime')"
|
||||
/>
|
||||
</template>
|
||||
<template slot="roleSlot" slot-scope="{scope}">
|
||||
{{ scope.row.RoleNameList.map(role => role.RoleName).join(',') }}
|
||||
<template slot="genderSlot" slot-scope="{ scope }">
|
||||
{{ scope.row.Sex ? 'Male' : 'Female' }}
|
||||
</template>
|
||||
<template slot="isZhiZhunSlot" slot-scope="{scope}">
|
||||
{{scope.row.IsZhiZhun ? $t('system:userlist:table:InternalOrExternal:Internal') : $t('system:userlist:table:InternalOrExternal:External')}}
|
||||
<template slot="roleSlot" slot-scope="{ scope }">
|
||||
{{ scope.row.RoleNameList.map((role) => role.RoleName).join(',') }}
|
||||
</template>
|
||||
<template slot="isTestUserSlot" slot-scope="{scope}">
|
||||
{{scope.row.IsTestUser ? $t('system:userlist:table:IsTestUser:Yes') : $t('system:userlist:table:IsTestUser:No')}}
|
||||
<template slot="isZhiZhunSlot" slot-scope="{ scope }">
|
||||
{{
|
||||
scope.row.IsZhiZhun
|
||||
? $t('system:userlist:table:InternalOrExternal:Internal')
|
||||
: $t('system:userlist:table:InternalOrExternal:External')
|
||||
}}
|
||||
</template>
|
||||
<template slot="statusSlot" slot-scope="{scope}">
|
||||
{{ scope.row.Status? $t('system:userlist:table:Status:Enable') : $t('system:userlist:table:Status:Disable') }}
|
||||
<template slot="isTestUserSlot" slot-scope="{ scope }">
|
||||
{{
|
||||
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>
|
||||
</base-table>
|
||||
</box-content>
|
||||
|
@ -49,8 +69,7 @@ import BoxContent from '@/components/BoxContent'
|
|||
import SearchForm from '@/components/BaseForm/search-form'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import tableMixins from '@/mixins/table'
|
||||
|
||||
|
||||
import moment from 'moment'
|
||||
// 用户列表查询表单配置信息
|
||||
// 用户列表查询表单事件配置信息
|
||||
const searchDataDefault = () => {
|
||||
|
@ -67,7 +86,8 @@ const searchDataDefault = () => {
|
|||
BeginCreateTime: '',
|
||||
EndCreateTime: '',
|
||||
CreateTimeArr: [],
|
||||
SortField: 'CreateTime'
|
||||
LastLoginTimeArr: [],
|
||||
SortField: 'CreateTime',
|
||||
}
|
||||
}
|
||||
export default {
|
||||
|
@ -78,27 +98,28 @@ export default {
|
|||
return {
|
||||
searchData: searchDataDefault(),
|
||||
columns: [
|
||||
{ type: 'tip', slot: 'tip-slot' },
|
||||
{ type: 'index' },
|
||||
{
|
||||
prop: 'UserCode',
|
||||
label: this.$t('system:userlist:table:S/N'),
|
||||
width: 100,
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true
|
||||
showOverflowTooltip: true,
|
||||
},
|
||||
{
|
||||
prop: 'UserName',
|
||||
label: this.$t('system:userlist:table:UserName'),
|
||||
minWidth: 100,
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true
|
||||
showOverflowTooltip: true,
|
||||
},
|
||||
{
|
||||
prop: 'RealName',
|
||||
label: this.$t('system:userlist:table:RealName'),
|
||||
minWidth: 120,
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true
|
||||
showOverflowTooltip: true,
|
||||
},
|
||||
// {
|
||||
// prop: 'Sex',
|
||||
|
@ -114,27 +135,27 @@ export default {
|
|||
label: this.$t('system:userlist:table:Phone'),
|
||||
minWidth: 120,
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true
|
||||
showOverflowTooltip: true,
|
||||
},
|
||||
{
|
||||
prop: 'EMail',
|
||||
label: this.$t('system:userlist:table:Email'),
|
||||
minWidth: 150,
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true
|
||||
showOverflowTooltip: true,
|
||||
},
|
||||
{
|
||||
prop: 'OrganizationName',
|
||||
label: this.$t('system:userlist:table:Organization'),
|
||||
minWidth: 130,
|
||||
showOverflowTooltip: true
|
||||
showOverflowTooltip: true,
|
||||
},
|
||||
{
|
||||
prop: 'UserType',
|
||||
label: this.$t('system:userlist:table:UserType'),
|
||||
minWidth: 100,
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true
|
||||
showOverflowTooltip: true,
|
||||
},
|
||||
{
|
||||
prop: 'IsZhiZhun',
|
||||
|
@ -143,7 +164,8 @@ export default {
|
|||
slot: 'isZhiZhunSlot',
|
||||
minWidth: 140,
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true },
|
||||
showOverflowTooltip: true,
|
||||
},
|
||||
{
|
||||
prop: 'IsTestUser',
|
||||
label: this.$t('system:userlist:table:IsTestUser'),
|
||||
|
@ -151,7 +173,8 @@ export default {
|
|||
slot: 'isTestUserSlot',
|
||||
minWidth: 120,
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true },
|
||||
showOverflowTooltip: true,
|
||||
},
|
||||
{
|
||||
prop: 'Status',
|
||||
label: this.$t('system:userlist:table:Status'),
|
||||
|
@ -159,57 +182,75 @@ export default {
|
|||
slot: 'statusSlot',
|
||||
minWidth: 100,
|
||||
sortable: 'custom',
|
||||
showOverflowTooltip: true },
|
||||
{
|
||||
prop: "CreateTime",
|
||||
label: this.$t("system:userlist:table:createTime"),
|
||||
minWidth: 200,
|
||||
sortable: "custom",
|
||||
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'),
|
||||
minWidth: 200,
|
||||
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: [
|
||||
{
|
||||
type: 'Input',
|
||||
label: this.$t('system:userlist:label:UserName'),
|
||||
label: this.$t('system:userlist:label:UserName'),
|
||||
prop: 'UserName',
|
||||
width: '120px',
|
||||
placeholder: ''
|
||||
placeholder: '',
|
||||
},
|
||||
{
|
||||
type: 'Input',
|
||||
label: this.$t('system:userlist:label:RealName'),
|
||||
prop: 'RealName',
|
||||
width: '120px',
|
||||
placeholder: ''
|
||||
placeholder: '',
|
||||
},
|
||||
{
|
||||
type: 'Input',
|
||||
label: this.$t('system:userlist:label:Phone'),
|
||||
prop: 'Phone',
|
||||
width: '120px',
|
||||
placeholder: ''
|
||||
placeholder: '',
|
||||
},
|
||||
{
|
||||
type: "Input",
|
||||
label: this.$t("system:userlist:label:EMail"),
|
||||
prop: "EMail",
|
||||
width: "120px",
|
||||
placeholder: "",
|
||||
type: 'Input',
|
||||
label: this.$t('system:userlist:label:EMail'),
|
||||
prop: 'EMail',
|
||||
width: '120px',
|
||||
placeholder: '',
|
||||
},
|
||||
{
|
||||
type: 'Input',
|
||||
label: this.$t('system:userlist:label:Organization'),
|
||||
prop: 'OrganizationName',
|
||||
width: '120px',
|
||||
placeholder: ''
|
||||
placeholder: '',
|
||||
},
|
||||
{
|
||||
type: 'Select',
|
||||
|
@ -217,12 +258,22 @@ export default {
|
|||
prop: 'IsZhiZhun',
|
||||
width: '100px',
|
||||
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' },
|
||||
change: scope => '',
|
||||
placeholder: ''
|
||||
change: (scope) => '',
|
||||
placeholder: '',
|
||||
},
|
||||
{
|
||||
type: 'Select',
|
||||
|
@ -230,12 +281,18 @@ export default {
|
|||
prop: 'IsTestUser',
|
||||
width: '100px',
|
||||
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' },
|
||||
change: scope => '',
|
||||
placeholder: ''
|
||||
change: (scope) => '',
|
||||
placeholder: '',
|
||||
},
|
||||
{
|
||||
type: 'Select',
|
||||
|
@ -244,11 +301,14 @@ export default {
|
|||
width: '100px',
|
||||
options: [
|
||||
{ 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' },
|
||||
change: scope => '',
|
||||
placeholder: ''
|
||||
change: (scope) => '',
|
||||
placeholder: '',
|
||||
},
|
||||
{
|
||||
type: 'Select',
|
||||
|
@ -257,25 +317,44 @@ export default {
|
|||
width: '100px',
|
||||
options: [], // 下拉选项
|
||||
props: { label: 'UserType', value: 'Id' }, // 下拉选项配置信息,必填
|
||||
placeholder: ''
|
||||
placeholder: '',
|
||||
},
|
||||
{
|
||||
type: "Daterange",
|
||||
label: this.$t("system:userlist:label:CreateTime"),
|
||||
prop: "CreateTimeArr",
|
||||
width: "400px",
|
||||
placeholder: "",
|
||||
type: 'Daterange',
|
||||
label: this.$t('system:userlist:label:CreateTime'),
|
||||
prop: 'CreateTimeArr',
|
||||
width: '400px',
|
||||
placeholder: '',
|
||||
},
|
||||
{
|
||||
type: 'Daterange',
|
||||
label: this.$t('system:userlist:label:LastLoginTime'),
|
||||
prop: 'LastLoginTimeArr',
|
||||
width: '400px',
|
||||
placeholder: '',
|
||||
},
|
||||
],
|
||||
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:new'), type: 'primary', emitKey: 'new' }
|
||||
{
|
||||
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:new'),
|
||||
type: 'primary',
|
||||
emitKey: 'new',
|
||||
},
|
||||
],
|
||||
userTypeOptions: [],
|
||||
loading: false,
|
||||
total: 0,
|
||||
users: []
|
||||
users: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -283,19 +362,25 @@ export default {
|
|||
this.getInfo()
|
||||
},
|
||||
methods: {
|
||||
diffTime(time) {
|
||||
return moment(new Date()).diff(time, 'months')
|
||||
},
|
||||
// 获取用户信息
|
||||
getList() {
|
||||
this.loading = true
|
||||
getUserList(this.searchData).then(res => {
|
||||
this.loading = false
|
||||
this.users = res.Result.CurrentPageData
|
||||
this.total = res.Result.TotalCount
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
getUserList(this.searchData)
|
||||
.then((res) => {
|
||||
this.loading = false
|
||||
this.users = res.Result.CurrentPageData
|
||||
this.total = res.Result.TotalCount
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
findItemIndex(key) {
|
||||
return this.searchForm.findIndex(value => value.prop && value.prop === key
|
||||
return this.searchForm.findIndex(
|
||||
(value) => value.prop && value.prop === key
|
||||
)
|
||||
},
|
||||
// 获取用户类型下拉选项信息
|
||||
|
@ -309,24 +394,27 @@ export default {
|
|||
},
|
||||
// 编辑用户
|
||||
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) {
|
||||
this.$confirm(this.$t('trials:uploadedDicoms:message:deleteMes'), {
|
||||
type: 'warning',
|
||||
distinguishCancelAndClose: true,
|
||||
|
||||
})
|
||||
.then(() => {
|
||||
deleteSysUser(data.Id)
|
||||
.then(res => {
|
||||
if (res.IsSuccess) {
|
||||
this.users.splice(this.users.findIndex(item => item.Id === data.Id), 1)
|
||||
this.$message.success(this.$t('common:message:deletedSuccessfully'))
|
||||
}
|
||||
})
|
||||
}).then(() => {
|
||||
deleteSysUser(data.Id).then((res) => {
|
||||
if (res.IsSuccess) {
|
||||
this.users.splice(
|
||||
this.users.findIndex((item) => item.Id === data.Id),
|
||||
1
|
||||
)
|
||||
this.$message.success(this.$t('common:message:deletedSuccessfully'))
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
// 重置列表查询
|
||||
handleReset() {
|
||||
|
@ -338,13 +426,17 @@ export default {
|
|||
this.searchData.BeginCreateTime = this.searchData.CreateTimeArr[0]
|
||||
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()
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<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;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue