add user operate monitor component

This commit is contained in:
idiotalex@163.com 2021-04-02 18:16:17 +08:00
parent 3e5632f684
commit 862a8bf83a
4 changed files with 103 additions and 5 deletions

View File

@ -72,4 +72,14 @@ export function getMonitorLogList(params) {
method: 'post',
data: params
})
}
/**
* 操作监控日志列表
*/
export function getMonitorOperateLogList() {
return axios({
url: '/monitor_user_opt/list_data',
method: 'post'
})
}

View File

@ -0,0 +1,82 @@
<template>
<div>
<div ref="filter" class="filter">
<a-button type="primary" @click="handleAdd">新增</a-button>
<a-button type="primary" @click="loadData">刷新</a-button>
</div>
<!-- 数据表格 -->
<a-table :data-source="list" :loading="loading" :columns="columns" :scroll="{x: '80vw'}" :pagination="false" bordered :rowKey="(record, index) => index">
<a-tooltip slot="name" slot-scope="text" placement="topLeft" :title="text">
<span>{{ text }}</span>
</a-tooltip>
<a-switch slot="status" slot-scope="text" :checked="text" checked-children="开启" un-checked-children="关闭"/>
<a-switch slot="autoRestart" slot-scope="text" :checked="text" checked-children="" un-checked-children=""/>
<a-switch slot="alarm" slot-scope="text" :checked="text" disabled checked-children="报警中" un-checked-children="未报警"/>
<a-tooltip slot="parent" slot-scope="text" placement="topLeft" :title="text">
<span>{{ text }}</span>
</a-tooltip>
<template slot="operation" slot-scope="text, record">
<a-button type="primary" @click="handleEdit(record)">编辑</a-button>
<a-button type="danger" @click="handleDelete(record)">删除</a-button>
</template>
</a-table>
</div>
</template>
<script>
import { getMonitorOperateLogList } from '../../api/monitor';
import { parseTime } from '../../utils/time';
export default {
data() {
return {
loading: false,
list: [],
temp: {},
editOperateMonitorVisible: false,
columns: [
{title: '名称', dataIndex: 'name', scopedSlots: {customRender: 'name'}, width: 150},
{title: '开启状态', dataIndex: 'status', scopedSlots: {customRender: 'status'}, width: 150},
{title: '创建人', dataIndex: 'parent', scopedSlots: {customRender: 'parent'}, width: 120},
{title: '修改时间', dataIndex: 'modifyTime', customRender: (text) => {
if (!text || text === '0') {
return '';
}
return parseTime(text);
}, width: 180},
{title: '操作', dataIndex: 'operation', scopedSlots: {customRender: 'operation'}, width: 200}
],
rules: {
name: [
{ required: true, message: 'Please input monitor name', trigger: 'blur' }
],
}
}
},
created() {
this.loadData();
},
methods: {
//
loadData() {
this.loading = true;
getMonitorOperateLogList().then(res => {
if (res.code === 200) {
this.list = res.data;
}
this.loading = false;
})
},
//
handleAdd() {
this.editOperateMonitorVisible = true;
},
}
}
</script>
<style scoped>
.filter {
margin-bottom: 10px;
}
.ant-btn {
margin-right: 10px;
}
</style>

View File

@ -19,11 +19,6 @@ const children = [
name: 'node-ssh',
component: () => import('../pages/node/ssh')
},
{
path: '/monitor/list',
name: 'monitor-list',
component: () => import('../pages/monitor/list')
},
{
path: '/dispatch/list',
name: 'dispatch-list',
@ -39,11 +34,21 @@ const children = [
name: 'dispatch-white-list',
component: () => import('../pages/dispatch/white-list')
},
{
path: '/monitor/list',
name: 'monitor-list',
component: () => import('../pages/monitor/list')
},
{
path: '/monitor/log',
name: 'monitor-log',
component: () => import('../pages/monitor/log')
},
{
path: '/monitor/operate-log',
name: 'monitor-operate-log',
component: () => import('../pages/monitor/operate-log')
},
{
path: '/build/list',
name: 'build-list',

View File

@ -11,6 +11,7 @@ const routeMenuMap = {
'outgivingWhitelistDirectory': '/dispatch/white-list',
'monitor': '/monitor/list',
'monitorLog': '/monitor/log',
'userOptLog': '/monitor/operate-log',
'buildList': '/build/list',
'buildHistory': '/build/history',
'user': '/user/list',