log.js
1.39 KB
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
import api from './index';
import baseurl from './baseUrl';
import moment from "moment";
import {config} from '../../public/js/config'
let oplogurl = `${baseurl}/api/v1/log_serv/user_oper_logs`
let userlogurl = `${baseurl}/api/v1/log_serv/system_logs/`
let servicename = {
serv_task:"任务设置",
serv_scene:"场景设置",
serv_store:"存储配置",
serv_auth:"用户管理",
serv_system:"系统管理",
serv_serch:"数据查询"
}
const oplogs = function(data,service,action) {
//开启日志模式才进行日志收集
if(config.logstatus) {
let username = localStorage.getItem('uname');
let baseData = {
"dt": moment().locale('zh-cn'),
"username": username,
"api_type": "http",
"verb": "1",
"path": "***" ,
"params": {"*":'*'},
"ecode": 0,
"enote": "ok",
"remark":action,
"serv_type":service
}
api.post(oplogurl,baseData).then(res =>{
});
}
}
export const syslogs =function(){
if(config.logstatus) {
api.post(oplogurl,data).then(res =>{
});
}
}
const loglist = {oplogs,syslogs}
const install = function(Vue) {
if (install.installed) {
return;
}
install.installed = true;
Object.defineProperties(Vue.prototype, {
$logs: {
get() {
return loglist;
}
}
});
};
export default {
install
};