You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.9 KiB

6 years ago
<template>
<div v-loading="config.loading">
<abstract-table :data="tableData" :highlight-current-row="false">
6 years ago
<el-table-column align="center" label="#" type="index" width="60">
<el-button icon="el-icon-refresh-right" slot="header" style="padding: 0" type="text" @click="search"/>
</el-table-column>
<el-table-column align="center" label="ip" prop="ip" show-overflow-tooltip/>
<el-table-column align="center" label="操作" prop="action" show-overflow-tooltip/>
<el-table-column align="center" label="时间" show-overflow-tooltip>
<template v-slot="{row}">{{row.time | timestamp2Date}}</template>
</el-table-column>
<el-table-column align="center" label="状态" width="80">
<template v-slot="{row}">
<el-tooltip :disabled="row.type!==0" placement="left">
<div slot="content" style="max-width: 60vw">
<el-scrollbar wrap-class="el-select-dropdown__wrap">
<p>{{row.error}}</p>
</el-scrollbar>
</div>
<el-tag :type="row.type===1?'success':'danger'" size="small" effect="dark">
6 years ago
{{getInfo(row.type)}}
</el-tag>
</el-tooltip>
</template>
</el-table-column>
</abstract-table>
6 years ago
<el-pagination
background
:current-page="searchForm.page"
:page-size="searchForm.pageSize"
:total="searchForm.total"
layout="total, prev, pager, next, jumper"
@current-change="pageChange"
/>
</div>
</template>
<script>
import tablePageMixin from '@/mixins/tablePageMixin'
6 years ago
import {getUserAction} from "@/api/system/user"
export default {
name: "UserAction",
mixins: [tablePageMixin],
6 years ago
data() {
return {
searchForm: {
pageSize: 10,
}
6 years ago
}
},
computed: {
uid() {
return this.$store.state.user.id
}
},
methods: {
search() {
if (this.config.loading) return
this.config.loading = true
6 years ago
getUserAction({...this.searchForm, uid: this.uid})
.then(({list, total}) => {
this.searchForm.total = total
this.tableData = list
})
.finally(() => this.config.loading = false)
6 years ago
},
getInfo(type) {
switch (type) {
case 0:
return '失败'
case 1:
return '成功'
}
return null
}
}
}
</script>