x-php-Admin/src/views/system/log/index.vue

113 lines
2.7 KiB
Vue
Raw Normal View History

2023-06-07 10:48:30 +00:00
<template>
<el-container>
<el-aside width="220px">
2023-08-05 13:43:44 +00:00
<el-tree ref="typeList" class="menu" node-key="label" :data="typeList" :default-expand-all="true" @node-click="nodeClick" :current-node-key="current" :highlight-current="true" :expand-on-click-node="false"> </el-tree>
2023-06-07 10:48:30 +00:00
</el-aside>
<el-container>
<el-main class="nopadding">
<el-container>
<el-header>
<div class="left-panel">
<el-date-picker v-model="date" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</div>
</el-header>
2023-08-05 13:43:44 +00:00
<el-header style="height:120px;" v-if="typeof chartoption === 'object' && Object.keys(chartoption).length > 0">
<xEcharts height="100%" :option="chartoption"></xEcharts>
2023-06-07 10:48:30 +00:00
</el-header>
<el-main class="nopadding">
2023-08-05 13:43:44 +00:00
<xTable ref="table" :api="api" :params="params" :tableColumn="tableColumn" stripe highlightCurrentRow @row-click="rowClick">
<el-table-column type="index" width="55">
2023-06-07 10:48:30 +00:00
<template #default="scope">
2023-08-05 13:43:44 +00:00
<span>{{scope.$index+(currentPage - 1) * limit + 1}}</span>
2023-06-07 10:48:30 +00:00
</template>
</el-table-column>
2023-07-10 16:41:24 +00:00
</xTable>
2023-06-07 10:48:30 +00:00
</el-main>
</el-container>
</el-main>
</el-container>
</el-container>
2023-08-05 13:43:44 +00:00
<el-drawer v-model="infoDrawer" title="日志详情" :size="700" destroy-on-close>
2023-06-07 10:48:30 +00:00
<info ref="info"></info>
</el-drawer>
</template>
<script>
import info from './info'
2023-07-10 16:41:24 +00:00
import xEcharts from '@/components/xEcharts'
2023-06-07 10:48:30 +00:00
export default {
name: 'log',
components: {
info,
2023-07-10 16:41:24 +00:00
xEcharts
2023-06-07 10:48:30 +00:00
},
data() {
return {
infoDrawer: false,
2023-08-05 13:43:44 +00:00
chartoption: {},
typeList: [],
2023-06-07 10:48:30 +00:00
date: [],
2023-08-05 13:43:44 +00:00
data: [],
2023-06-07 10:48:30 +00:00
search: {
keyword: ""
2023-08-05 13:43:44 +00:00
},
api: '',
params: [],
current : '',
config : {},
tableColumn : {},
column : 'default',
currentPage:1,
limit:20,
2023-06-07 10:48:30 +00:00
}
},
2023-07-31 09:59:41 +00:00
mounted() {
this.getType();
},
2023-08-05 13:43:44 +00:00
watch: {
//监听从props里拿到值了
current(){
this.getCurrent();
},
},
2023-06-07 10:48:30 +00:00
methods: {
2023-08-05 13:43:44 +00:00
//树点击
nodeClick(data){
if (data.disabled) {
return false;
}
this.current = data.label;
this.column = data.column || 'column';
},
2023-07-31 09:59:41 +00:00
getType(){
this.$http.get('log/admin/types', {}, { cacheparameters: true }).then((res) => {
if (res.code == 200) {
2023-08-05 13:43:44 +00:00
Object.assign(this.$data, res.data);
2023-07-31 09:59:41 +00:00
}
});
},
2023-08-05 13:43:44 +00:00
getCurrent(){
this.tableColumn = this.config[this.column] || this.config.default;
this.params = { type: this.current }
this.api = 'log/admin/lists'
this.$refs.table.reload(this.params)
},
2023-06-07 10:48:30 +00:00
upsearch(){
},
rowClick(row){
this.infoDrawer = true
this.$nextTick(() => {
this.$refs.info.setData(row)
})
}
}
}
</script>
<style>
</style>