Commit 4ac598de authored by Kerwin_Cui's avatar Kerwin_Cui

1112

parent 43fa3d45
......@@ -39,4 +39,5 @@ urlpatterns = [
url(r'^create_alarm_by_icube/$', create_alarm_by_icube),
url(r'^search_user_group/$', search_user_group),
url(r'^alarm_count_info/$', alarm_count_info),
url(r'^monitor_excel/$', monitor_excel),
]
......@@ -2512,7 +2512,7 @@ def search_alarm(request):
event_list = event_page.page(current_page).object_list
result_list = []
for i in alarm_list:
for i in event_list:
# alarm_system = i.alarm_system
data = {
"alarm_number": i.alarm_number,
......@@ -2544,6 +2544,7 @@ def search_alarm(request):
def alarm_count_info(request):
try:
req = json.loads(request.body)
sysList = req.get('syslist')
alarm_list = Error_alarm.objects.all()
result = {}
for alarm in alarm_list:
......@@ -2609,6 +2610,50 @@ def alarm_count_info(request):
}
)
def monitor_excel(request):
try:
user_list = []
event_list = EventInfo.objects.all()
# for i in sys_list:
# event_list.filter(processing_person=i)
# 创建工作簿
workbook = xlwt.Workbook(encoding='utf-8')
# 创建sheet
data_sheet = workbook.add_sheet('demo')
# 填写表头信息
row0 = ['行政组名','事件总数','监控有效性','故障处理自动化率']
for i in range(4):
data_sheet.write(0, i, row0[i], set_style(u'宋体', 220, True))
data_list = [u'组',u'100',u'50',u'30']
for i in range(4):
data_sheet.write(1, i, data_list[i], set_style(u'宋体', 220, False))
workbook.save(u'统计报表.xls')
return render_json(
{
"result": True,
"message": u"查询数据成功",
"code": 0,
"results": {},
}
)
except Exception as e:
return render_json(
{
"result": False,
"code": 1,
"message": u"未知错误:%s" % e,
"data": {}
}
)
# 同步事件
def sync(request):
now_time = int(time.time())
......
......@@ -79,7 +79,8 @@
currentPage: 1,
pageSize: 10,
time: '',
total:0
total:0,
sysGroup:{}
}
},
mounted() {
......@@ -90,20 +91,23 @@
methods: {
searchList(){
console.log(this.userGroup)
console.log(this.sysGroup)
console.log(this.sysGroup[this.userGroup])
let newdata = {
currentPage: this.currentPage,
pageSize: this.pageSize,
syslist: this.sysGroup[this.userGroup]
};
axios.post('${SITE_URL}alarm_count_info/',newdata).then(res => {
console.log(res.data.results)
this.AlarmCountData = res.data.results;
this.total = res.data.count
})
},
getUserGroup() {
axios.get('${SITE_URL}search_user_group/').then(res => {
res = res.data['group_list'];
this.userGroupOp = res
this.userGroupOp = res.data['group_list'];
this.sysGroup = res.data['group_system_list']
})
},
handleCurrentChange(val) {
......
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