1
lzhe
2024-06-03 a786409d7f6769f43c107159dd84faf4a2927a9a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<template>
    <el-container>
        <el-aside width="220px">
            <el-tree ref="category" class="menu" node-key="label" :data="category" :default-expanded-keys="['系统日志']" current-node-key="系统日志" :highlight-current="true" :expand-on-click-node="false">
            </el-tree>
        </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>
                        <div class="right-panel">
 
                        </div>
                    </el-header>
                    <el-header style="height:150px;">
                        <scEcharts height="100%" :option="logsChartOption"></scEcharts>
                    </el-header>
                    <el-main class="nopadding">
                        <scTable ref="table" :apiObj="apiObj" stripe highlightCurrentRow @row-click="rowClick">
                            <el-table-column label="级别" prop="level" width="60">
                                <template #default="scope">
                                    <el-icon v-if="scope.row.level=='error'" style="color: #F56C6C;"><el-icon-circle-close-filled /></el-icon>
                                    <el-icon v-if="scope.row.level=='warn'" style="color: #E6A23C;"><el-icon-warning-filled /></el-icon>
                                    <el-icon v-if="scope.row.level=='info'" style="color: #409EFF;"><el-icon-info-filled /></el-icon>
                                </template>
                            </el-table-column>
                            <el-table-column label="ID" prop="id" width="180"></el-table-column>
                            <el-table-column label="日志名" prop="name" width="150"></el-table-column>
                            <el-table-column label="请求接口" prop="url" width="150"></el-table-column>
                            <el-table-column label="请求方法" prop="type" width="150"></el-table-column>
                            <el-table-column label="用户" prop="user" width="150"></el-table-column>
                            <el-table-column label="客户端IP" prop="cip" width="150"></el-table-column>
                            <el-table-column label="日志时间" prop="time" width="170"></el-table-column>
                        </scTable>
                    </el-main>
                </el-container>
            </el-main>
        </el-container>
    </el-container>
 
    <el-drawer v-model="infoDrawer" title="日志详情" :size="600" destroy-on-close>
        <info ref="info"></info>
    </el-drawer>
</template>
 
<script>
    import info from './info'
    import scEcharts from '@/components/scEcharts'
 
    export default {
        name: 'log',
        components: {
            info,
            scEcharts
        },
        data() {
            return {
                infoDrawer: false,
                logsChartOption: {
                    color: ['#409eff','#e6a23c','#f56c6c'],
                    grid: {
                        top: '0px',
                        left: '10px',
                        right: '10px',
                        bottom: '0px'
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    xAxis: {
                        type: 'category',
                        boundaryGap: false,
                        data: ['2021-07-01', '2021-07-02', '2021-07-03', '2021-07-04', '2021-07-05', '2021-07-06', '2021-07-07', '2021-07-08', '2021-07-09', '2021-07-10', '2021-07-11', '2021-07-12', '2021-07-13', '2021-07-14', '2021-07-15']
                    },
                    yAxis: {
                        show: false,
                        type: 'value'
                    },
                    series: [{
                        data: [120, 200, 150, 80, 70, 110, 130, 120, 200, 150, 80, 70, 110, 130, 70, 110],
                        type: 'bar',
                        stack: 'log',
                        barWidth: '15px'
                    },
                    {
                        data: [15, 26, 7, 12, 13, 9, 21, 15, 26, 7, 12, 13, 9, 21, 12, 3],
                        type: 'bar',
                        stack: 'log',
                        barWidth: '15px'
                    },
                    {
                        data: [0, 0, 0, 120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                        type: 'bar',
                        stack: 'log',
                        barWidth: '15px'
                    }]
                },
                category: [
                    {
                        label: '系统日志',
                        children: [
                            {label: 'debug'},
                            {label: 'info'},
                            {label: 'warn'},
                            {label: 'error'},
                            {label: 'fatal'}
                        ]
                    },
                    {
                        label: '应用日志',
                        children: [
                            {label: 'selfHelp'},
                            {label: 'WechatApp'}
                        ]
                    }
                ],
                date: [],
                apiObj: this.$API.system.log.list,
                search: {
                    keyword: ""
                }
            }
        },
        methods: {
            upsearch(){
 
            },
            rowClick(row){
                this.infoDrawer = true
                this.$nextTick(() => {
                    this.$refs.info.setData(row)
                })
            }
        }
    }
</script>
 
<style>
</style>