Commit a2cb213b authored by renjintao's avatar renjintao

exception

parent 9d689af0
<template> <template>
<div> <div>
<DataGrid :columns="columns" ref="grid" :action="action"> <DataGrid :columns="columns" ref="grid" :action="action" exportTitle="异常记录">
<template slot="easySearch"> <template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline> <Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys"> <FormItem prop="keys">
<Input placeholder="请输入关键字登录账号/租户编号" v-model="easySearch.keys.value" v-width="300"/> <Input placeholder="请输入关键字登录账号/租户编号" v-model="easySearch.keys.value" v-width="300" />
</FormItem> </FormItem>
<FormItem> <FormItem>
<Button type="primary" @click="search">查询</Button> <Button type="primary" @click="search">查询</Button>
</FormItem> </FormItem>
</Form> </Form>
</template> </template>
<template slot="searchForm"> <template slot="searchForm">
<Search /> <Search />
</template> </template>
<template slot="buttons"> <template slot="buttons">
<DatePicker type="date" v-model="end" placeholder="选择终止日期" style="width: 150px"></DatePicker> <DatePicker type="date" v-model="end" placeholder="选择终止日期" style="width: 150px"></DatePicker>
<Button type="error" @click="clear" :disabled="dis">清理</Button> <Button type="error" @click="clear" :disabled="dis">清理</Button>
</template> </template>
</DataGrid> </DataGrid>
<Modal v-model="modal" :title="title" fullscreen footer-hide> <Modal v-model="modal" :title="title" fullscreen footer-hide>
<component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" /> <component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" />
</Modal> </Modal>
</div> </div>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
import Search from "./search"; import Search from "./search";
export default { export default {
name: "list", name: "list",
components: { components: {
Search, Search,
}, },
head: { head: {
title: "系统异常日志", title: "系统异常日志",
author: "henq", author: "henq",
description: "run_log 7/23/2020 10:55:35 AM", description: "run_log 7/23/2020 10:55:35 AM",
}, },
data() { data() {
return { return {
action: Api.index, action: Api.index,
easySearch: { easySearch: {
keys: { op: "loginName,tanentCode", value: null }, keys: {
}, op: "loginName,tanentCode",
end:null, value: null
modal: false, },
title: "新增", },
detail: null, end: null,
curId: 0, modal: false,
columns: [ title: "新增",
{ detail: null,
key: "id", curId: 0,
title: this.$t("id"), columns: [{
hide: true, key: "id",
align: "left", title: this.$t("id"),
high: true, hide: true,
}, align: "left",
// { key:"creationTime",title:this.l("creationTime") ,align:"left" ,high:true }, high: true,
// { key:"creatorUserId",title:this.l("creatorUserId") ,align:"left" ,high:true }, },
// { key:"lastModificationTime",title:this.l("lastModificationTime") ,align:"left" ,high:true }, // { key:"creationTime",title:this.l("creationTime") ,align:"left" ,high:true },
// { key:"lastModifierUserId",title:this.l("lastModifierUserId") ,align:"left" ,high:true }, // { key:"creatorUserId",title:this.l("creatorUserId") ,align:"left" ,high:true },
// { key:"isDeleted",title:this.l("isDeleted") ,align:"left" ,high:true }, // { key:"lastModificationTime",title:this.l("lastModificationTime") ,align:"left" ,high:true },
// { key:"deletionTime",title:this.l("deletionTime") ,align:"left" ,high:true }, // { key:"lastModifierUserId",title:this.l("lastModifierUserId") ,align:"left" ,high:true },
// { key:"deleterUserId",title:this.l("deleterUserId") ,align:"left" ,high:true }, // { key:"isDeleted",title:this.l("isDeleted") ,align:"left" ,high:true },
// { key:"deletionTime",title:this.l("deletionTime") ,align:"left" ,high:true },
// { key:"deleterUserId",title:this.l("deleterUserId") ,align:"left" ,high:true },
{
key: "level",
title: this.l("level"),
align: "left",
high: true,
width: 100,
},
{
key: "requestUrl",
title: this.l("requestUrl"),
align: "left",
width: 300,
high: true,
tooltip: true,
},
// { key:"messageTemplate",title:this.l("messageTemplate") ,align:"left" ,high:true },
{
key: "renderedMessage",
title: this.l("renderedMessage"),
align: "left",
high: true,
tooltip: true,
},
{
key: "timestamp",
title: this.l("timestamp"),
align: "left",
high: true,
width: 200,
},
{
key: "clientIpAddress",
title: this.l("clientIpAddress"),
align: "left",
width: 150,
high: true,
},
{
key: "loginName",
title: this.l("loginName"),
align: "left",
easy: true,
high: true,
width: 150,
},
{
key: "tanentCode",
title: this.l("tanentCode"),
align: "left",
easy: true,
high: true,
width: 80,
},
{
key: "host",
title: this.l("host"),
align: "left",
hide: true,
high: true,
},
// { key:"status",title:this.l("status") ,align:"left" ,high:true },
{ {
key: "level", key: "requestParam",
title: this.l("level"), title: this.l("requestParam"),
align: "left", hide: true,
high: true, align: "left",
width: 100, high: true,
},
// { key:"exception",title:this.l("exception") ,align:"left" ,high:true },
{
title: "操作",
key: "action",
width: 140,
align: "center",
render: (h, params) => {
return h("div", {
class: "action"
}, [
h(
"op", {
attrs: {
oprate: "detail"
},
on: {
click: () => this.view(params.row.id)
},
},
"查看"
),
//h('op', { attrs: { oprate: 'copy' }, on: { click: () => this.copy(params.row.id) } }, '克隆'),
// h('op', { attrs: { oprate: 'edit'}, on: { click: () => this.edit(params.row.id) } }, '编辑'),
h(
"op", {
attrs: {
oprate: "delete"
},
on: {
click: () => this.remove(params.row.id)
},
},
"删除"
),
]);
},
},
],
};
},
created() {
var date = new Date().getTime() - 24 * 60 * 60 * 1000 * 5;
this.end = new Date(date);
console.log(this);
},
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
ok() {
this.$refs.grid.load();
this.modal = false;
this.curId = 0;
}, },
{ search() {
key: "requestUrl", this.$refs.grid.reload(this.easySearch);
title: this.l("requestUrl"),
align: "left",
width: 300,
high: true,
tooltip: true,
}, },
// { key:"messageTemplate",title:this.l("messageTemplate") ,align:"left" ,high:true }, add() {
{ this.curId = 0;
key: "renderedMessage", this.title = "新增";
title: this.l("renderedMessage"), this.detail = () => import("./add");
align: "left", this.modal = true;
high: true,
tooltip: true,
}, },
{ copy(id) {
key: "timestamp", this.curId = id;
title: this.l("timestamp"), this.title = "克隆";
align: "left", this.detail = () => import("./add");
high: true, this.modal = true;
width: 200,
}, },
{ view(id) {
key: "clientIpAddress", this.curId = id;
title: this.l("clientIpAddress"), this.title = "详情";
align: "left", this.detail = () => import("./detail");
width: 150, this.modal = true;
high: true,
}, },
{ edit(id) {
key: "loginName", this.curId = id;
title: this.l("loginName"), this.title = "编辑";
align: "left", this.detail = () => import("./edit");
easy: true, this.modal = true;
high: true,
width: 150,
}, },
{ remove(id) {
key: "tanentCode", Api.delete(id).then((r) => {
title: this.l("tanentCode"), if (r.success) {
align: "left", this.$refs.grid.load();
easy: true, this.$Message.success("删除成功");
high: true, }
width: 80, });
}, },
{ clear() {
key: "host", this.$Modal.confirm({
title: this.l("host"), title: "确认",
align: "left", content: "确认要删除" + this.$u.toDate(this.end) + "以前的数据吗",
hide: true, onOk: () => {
high: true, Api.deleteAll(this.end).then(r => {
if (r.success) {
this.$Message.success("删除成功")
this.$refs.grid.load();
} else {
this.$Message.error("出现异常")
}
})
}
})
}, },
// { key:"status",title:this.l("status") ,align:"left" ,high:true }, cancel() {
this.curId = 0;
{ this.modal = false;
key: "requestParam",
title: this.l("requestParam"),
hide: true,
align: "left",
high: true,
}, },
// { key:"exception",title:this.l("exception") ,align:"left" ,high:true }, l(key) {
{ /*
title: "操作", run_log:{
key: "action", creationTime:'创建时间',
width: 140, creatorUserId:'创建人',
align: "center", lastModificationTime:'更新时间',
render: (h, params) => { lastModifierUserId:'更新人',
return h("div", { class: "action" }, [ isDeleted:'删除人',
h( deletionTime:'删除时间',
"op", deleterUserId:'删除人',
{ timestamp:'异常发生时间',
attrs: { oprate: "detail" }, level:'日志级别',
on: { click: () => this.view(params.row.id) }, messageTemplate:'消息模板',
}, renderedMessage:'异常信息',
"查看" clientIpAddress:'客户端IP',
), loginName:'登录账号',
//h('op', { attrs: { oprate: 'copy' }, on: { click: () => this.copy(params.row.id) } }, '克隆'), tanentCode:'租户编号',
// h('op', { attrs: { oprate: 'edit'}, on: { click: () => this.edit(params.row.id) } }, '编辑'), host:'主机IP',
h( status:'状态',
"op", requestUrl:'服务地址',
{ requestParam:'参数',
attrs: { oprate: "delete" }, exception:'异常详细信息',
on: { click: () => this.remove(params.row.id) }, }
}, */
"删除" let vkey = "run_log" + "." + key;
), return this.$t(vkey) || key;
]);
},
}, },
],
};
},
created() {
var date=new Date().getTime()-24*60*60*1000*5;
this.end=new Date(date);
console.log(this);
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
ok() {
this.$refs.grid.load();
this.modal = false;
this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
add() {
this.curId = 0;
this.title = "新增";
this.detail = () => import("./add");
this.modal = true;
},
copy(id) {
this.curId = id;
this.title = "克隆";
this.detail = () => import("./add");
this.modal = true;
},
view(id) {
this.curId = id;
this.title = "详情";
this.detail = () => import("./detail");
this.modal = true;
},
edit(id) {
this.curId = id;
this.title = "编辑";
this.detail = () => import("./edit");
this.modal = true;
}, },
remove(id) { computed: {
Api.delete(id).then((r) => { dis() {
if (r.success) { var num = (new Date().getTime() - this.end.getTime()) / (1000 * 60 * 60 * 24);
this.$refs.grid.load(); return num < 1
this.$Message.success("删除成功");
} }
}); }
},
clear(){
this.$Modal.confirm({
title:"确认",
content:"确认要删除"+this.$u.toDate(this.end) +"以前的数据吗",
onOk:()=>{
Api.deleteAll(this.end).then(r=>{
if(r.success){
this.$Message.success("删除成功")
this.$refs.grid.load();
}else{
this.$Message.error("出现异常")
}
})
}
})
},
cancel() {
this.curId = 0;
this.modal = false;
},
l(key) {
/*
run_log:{
creationTime:'创建时间',
creatorUserId:'创建人',
lastModificationTime:'更新时间',
lastModifierUserId:'更新人',
isDeleted:'删除人',
deletionTime:'删除时间',
deleterUserId:'删除人',
timestamp:'异常发生时间',
level:'日志级别',
messageTemplate:'消息模板',
renderedMessage:'异常信息',
clientIpAddress:'客户端IP',
loginName:'登录账号',
tanentCode:'租户编号',
host:'主机IP',
status:'状态',
requestUrl:'服务地址',
requestParam:'参数',
exception:'异常详细信息',
}
*/
let vkey = "run_log" + "." + key;
return this.$t(vkey) || key;
},
},
computed:{
dis(){
var num=(new Date().getTime()-this.end.getTime())/(1000*60*60*24);
return num<1
}
}
}; };
</script> </script>
<style lang="less"> <style lang="less">
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment