CN-34 feat:添加操作日志列表页面

This commit is contained in:
zhangyu
2021-06-17 16:56:50 +08:00
parent 19090ceae6
commit 50e1d8f04b
18 changed files with 332 additions and 38 deletions

View File

@@ -104,7 +104,7 @@
</template>
<script>
import {defaultPageSize} from '@/utils/constants'
import { defaultPageSize } from '@/utils/constants'
export default {
name: 'pagination',
@@ -234,7 +234,7 @@ export default {
immediate: true,
deep: true,
handler (n, o) {
// console.log(n)
// console.log(n)
}
}
}

View File

@@ -24,7 +24,7 @@
<button type="button" class="nz-btn nz-btn-size-small-new nz-btn-style-light-new option-btn" @click="selectAllOrNone" :class="{'btn-active':selectAllFlag}"><span ><i class="nz-icon nz-icon-delete"></i></span></button>
</div>-->
<el-tree :data="menus" :default-expand-all="expandAllFlag" :props="{label:labelFormatter}" @check-change="selectChange" class="tree-border" node-key="id" ref="menuTree" show-checkbox id="role-box-input-menus">
<template #default="{ node, data }">
<template #default="{ data }">
<span>
<i v-if="data.type == '1'" class="el-icon-menu"></i>
<i v-if="data.type == '2'" class="el-icon-edit"></i>
@@ -48,8 +48,8 @@
</template>
<script>
import rightBoxMixin from '@/mixins/rightBox'
import { get, post, put } from '@/utils/http'
import rightBoxMixin from '@/mixins/rightBox'
import { get, post, put } from '@/utils/http'
export default {
name: 'userBox',
mixins: [rightBoxMixin],

View File

@@ -86,7 +86,6 @@
<script>
import rightBoxMixin from '@/mixins/rightBox'
import { onMounted } from "vue";
import { get, post, put } from '@/utils/http'
export default {
name: 'UserBox',
@@ -144,7 +143,7 @@ export default {
},
setup () {
},
mounted() {
mounted () {
this.getRoleData()
},
methods: {
@@ -190,8 +189,8 @@ export default {
}
})
},
getRoleData (){
get('sys/role?pageSize=-1').then(response => {
getRoleData () {
get('sys/role?pageSize=-1').then(response => {
if (response.code === 200) {
this.roleData = response.data.list
}
@@ -204,7 +203,7 @@ export default {
immediate: true,
handler (n) {
this.editObject = JSON.parse(JSON.stringify(n))
if ( !this.editObject.roleIds && this.editObject.roles ) {
if (!this.editObject.roleIds && this.editObject.roles) {
this.editObject.roleIds = this.editObject.roles[0].id
}
}

View File

@@ -0,0 +1,130 @@
<template>
<el-table
id="roleTable"
ref="dataTable"
:data="tableData"
:height="height"
border
class="no-operation"
@header-dragend="dragend"
@sort-change="tableDataSort"
@selection-change="selectionChange"
>
<el-table-column
:resizable="false"
align="center"
type="selection"
width="55">
</el-table-column>
<el-table-column
v-for="(item, index) in customTableTitle"
:key="`col-${index}`"
:fixed="item.fixed"
:label="item.label"
:min-width="`${item.minWidth}`"
:prop="item.prop"
:resizable="true"
:sort-orders="['ascending', 'descending']"
:width="`${item.width}`"
class="data-column"
>
<template #header>
<span class="data-column__span">{{item.label}}</span>
<div class="col-resize-area"></div>
</template>
<template #default="scope">
<span v-if="item.prop === 'time'">
{{scope.row[item.prop]}} ms
</span>
<span v-else-if="item.prop === 'username'">{{formatUsername(scope.row)}}</span>
<span v-else-if="item.prop === 'ctime'">{{utcTimeToSysTime(scope.row[item.prop])}}</span>
<span v-else>{{scope.row[item.prop]}}</span>
</template>
</el-table-column>
</el-table>
</template>
<script>
import table from '@/mixins/table'
export default {
name: 'roleTable',
mixins: [table],
data () {
return {
tableTitle: [
{
label: this.$t('config.operationlog.id'),
prop: 'id',
show: true,
width: 80
}, {
label: this.$t('config.operationlog.username'),
prop: 'username',
show: true
},
{
label: this.$t('config.operationlog.ip'),
prop: 'ip',
show: true
},
{
label: this.$t('config.operationlog.operation'),
prop: 'operation',
show: true
},
{
label: this.$t('config.operationlog.type'),
prop: 'type',
show: true
},
{
label: this.$t('config.operationlog.state'),
prop: 'state',
show: true
},
// {
// label: this.$t('config.operationlog.userId'),
// prop: 'userId',
// show: false,
// },
{
label: this.$t('config.operationlog.operaId'),
prop: 'operaId',
show: false
},
{
label: this.$t('config.operationlog.createDate'),
prop: 'ctime',
show: true
},
{
label: this.$t('config.operationlog.time'),
prop: 'time',
show: false
},
{
label: this.$t('config.operationlog.params'),
prop: 'params',
show: false
},
{
label: this.$t('config.operationlog.response'),
prop: 'response',
show: false
}
]
}
},
methods: {
formatUsername (row) {
if (row.username) {
return row.username
} else if (row.operation === 'login' && !row.username) { // 如果是登录 且登录失败
return JSON.parse(row.params).username
} else {
return '-'
}
}
}
}
</script>

View File

@@ -75,8 +75,7 @@
</template>
<script>
import table from '@/mixins/table'
import { put } from '@/utils/http'
import table from '@/mixins/table'
export default {
name: 'roleTable',
mixins: [table],
@@ -88,12 +87,12 @@ export default {
prop: 'id',
show: true,
width: 80,
sortable:'custom'
sortable: 'custom'
}, {
label: this.$t('config.roles.name'),
prop: 'name',
show: true,
sortable:'custom'
sortable: 'custom'
}, {
label: this.$t('overall.remark'),
prop: 'remark',

View File

@@ -42,6 +42,7 @@
</template>
<template v-else-if="item.prop === 'status'">
<el-switch
v-if="scope.row.id"
v-model="scope.row.status"
:active-color="theme.themeColor"
active-value="1"