Commit 3cd50e1b authored by Kerwin_Cui's avatar Kerwin_Cui

导出

parent 5db307fd
...@@ -41,4 +41,5 @@ urlpatterns = [ ...@@ -41,4 +41,5 @@ urlpatterns = [
url(r'^alarm_count_info/$', alarm_count_info), url(r'^alarm_count_info/$', alarm_count_info),
url(r'^monitor_excel/$', monitor_excel), url(r'^monitor_excel/$', monitor_excel),
url(r'^system_cmdb/$', system_cmdb), url(r'^system_cmdb/$', system_cmdb),
url(r'^download_monitor/$', download_monitor),
] ]
...@@ -2481,25 +2481,27 @@ def search_alarm(request): ...@@ -2481,25 +2481,27 @@ def search_alarm(request):
try: try:
req = json.loads(request.body) req = json.loads(request.body)
alarm_list = Error_alarm.objects.all().order_by('-alarm_happen_time') alarm_list = Error_alarm.objects.all().order_by('-alarm_happen_time')
if req['data']['alarm_system']:
alarm_list = alarm_list.filter(alarm_system__contains=req['data']['alarm_system'])
if req['data']['priority']: if req['data']['priority']:
alarm_list = alarm_list.filter(alarm_level=req['data']['priority']) alarm_list = alarm_list.filter(alarm_level=req['data']['priority'])
if req['data']['dateoutinfo']:
if req['dateoutinfo']: hptime_choose = req['data']['dateoutinfo']
hptime_choose = req['dateoutinfo']
startTime = hptime_choose[0] startTime = hptime_choose[0]
startTime = datetime.datetime.strptime(startTime, "%Y-%m-%d") startTime = datetime.datetime.strptime(startTime, "%Y-%m-%d")
startTime = (startTime + datetime.timedelta(days=1)).strftime("%Y-%m-%d") # startTime = (startTime + datetime.timedelta(days=1)).strftime("%Y-%m-%d")
# endTime = hptime_choose[1] endTime = hptime_choose[1]
# endTime = datetime.datetime.strptime(endTime[0:10], "%Y-%m-%d") endTime = datetime.datetime.strptime(endTime[0:10], "%Y-%m-%d")
# endTime = (endTime + datetime timedelta(days=1)).strftime("%Y-%m-%d") # endTime = (endTime + datetime.timedelta(days=1)).strftime("%Y-%m-%d")
# eventList = eventList.filter(event_happened_time__gte=startTime).filter( alarm_list = alarm_list.filter(alarm_happen_time__gte=startTime).filter(
# event_happened_time__lte=endTime) alarm_happen_time__lte=endTime)
if req['data']['alarm_number']: if req['data']['alarm_number']:
alarm_list = alarm_list.filter(alarm_number__contains=req['data']['alarm_number']) alarm_list = alarm_list.filter(alarm_number__contains=req['data']['alarm_number'])
if req['data']['alarm_system']:
new_list = []
for i in alarm_list:
if req['data']['alarm_system'] in eval(i.alarm_system):
new_list.append(i)
alarm_list = new_list
if request.body == "": if request.body == "":
current_page = 1 current_page = 1
page_size = 10 page_size = 10
...@@ -2543,7 +2545,17 @@ def alarm_count_info(request): ...@@ -2543,7 +2545,17 @@ def alarm_count_info(request):
try: try:
req = json.loads(request.body) req = json.loads(request.body)
sysList = req.get('syslist') sysList = req.get('syslist')
alarm_list = Error_alarm.objects.all() alarm_list_all = Error_alarm.objects.all()
alarm_list = []
if sysList:
new_list = []
for sys in sysList:
for i in alarm_list_all:
if sys in eval(i.alarm_system):
new_list.append(i)
alarm_list = new_list
else:
alarm_list = alarm_list_all
result = {} result = {}
for alarm in alarm_list: for alarm in alarm_list:
sys_list = eval(alarm.alarm_system) sys_list = eval(alarm.alarm_system)
...@@ -2667,6 +2679,14 @@ def monitor_excel(request): ...@@ -2667,6 +2679,14 @@ def monitor_excel(request):
) )
def download_monitor(request):
file_name = u'统计报表.xls'
file = open(file_name, 'rb')
response = FileResponse(file)
response['Content-Type'] = 'application/octet-stream'
response['Content-Disposition'] = 'attachment;filename="统计报表.xls"'
return response
def system_cmdb(request): def system_cmdb(request):
try: try:
sys_data = requests.get('http://192.168.1.246:8001/webapi/moduleInstances/108?pageNum=1&pageSize=500') sys_data = requests.get('http://192.168.1.246:8001/webapi/moduleInstances/108?pageNum=1&pageSize=500')
...@@ -2695,6 +2715,7 @@ def system_cmdb(request): ...@@ -2695,6 +2715,7 @@ def system_cmdb(request):
} }
) )
# 同步事件 # 同步事件
def sync(request): def sync(request):
now_time = int(time.time()) now_time = int(time.time())
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<div class="panel-body"> <div class="panel-body">
<div class="king-wrapper clearfix"> <div class="king-wrapper clearfix">
选择用户组: 选择用户组:
<el-select style="width:300px;margin-right: 100px" clearable <el-select style="width:300px;margin-right: 100px" clearable filterable
v-model="Group"> v-model="Group">
<el-option v-for="item in GroupOp" <el-option v-for="item in GroupOp"
:key="item.value" :key="item.value"
...@@ -18,14 +18,6 @@ ...@@ -18,14 +18,6 @@
:value="item.label"> :value="item.label">
</el-option> </el-option>
</el-select> </el-select>
查询时间:
<el-date-picker
v-model="time"
type="daterange"
style="width:250px;"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
<el-button size="medium" id="search" type="primary" <el-button size="medium" id="search" type="primary"
@click="searchList()" @click="searchList()"
style="float: right;margin-right:12px">查询 style="float: right;margin-right:12px">查询
...@@ -92,15 +84,15 @@ ...@@ -92,15 +84,15 @@
methods: { methods: {
searchList() { searchList() {
console.log(this.Group)
console.log(this.sysGroup)
console.log(this.sysGroup[this.Group])
let finallist = [] let finallist = []
for (let temp of this.sysGroup) { if(this.sysGroup && this.Group){
for (let temp of this.sysGroup) {
if (temp.group_name == this.Group) { if (temp.group_name == this.Group) {
finallist = temp.group_system finallist = temp.group_system
} }
} }
}
let newdata = { let newdata = {
currentPage: this.currentPage, currentPage: this.currentPage,
pageSize: this.pageSize, pageSize: this.pageSize,
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
style="display:inline-block;"> style="display:inline-block;">
<el-select v-model="formLine.alarm_system" clearable multiple filterable style="width:200px;" <el-select v-model="formLine.alarm_system" clearable multiple filterable style="width:200px;"
:disabled="editStatus"> :disabled="editStatus">
<el-option v-for="item in systemList" <el-option v-for="item in systemListCmdb"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.label"> :value="item.label">
...@@ -233,6 +233,7 @@ ...@@ -233,6 +233,7 @@
options: [], options: [],
tabelshowData: [] tabelshowData: []
}, },
systemListCmdb:[],
errorMachine: [], errorMachine: [],
machineBiz: "", machineBiz: "",
machineListFlag: 1, machineListFlag: 1,
...@@ -335,8 +336,9 @@ ...@@ -335,8 +336,9 @@
this.getuser(); this.getuser();
this.getAutoList(); this.getAutoList();
this.getPrimaryList(); this.getPrimaryList();
this.getSystem(); //this.getSystem();
this.getAlarmTitle(); this.getAlarmTitle();
this.system_cmdb()
if (data.if_auto == '5') { if (data.if_auto == '5') {
this.autochange = true; this.autochange = true;
this.notbkauto = false; this.notbkauto = false;
...@@ -393,6 +395,12 @@ ...@@ -393,6 +395,12 @@
} }
return result; return result;
}, },
system_cmdb(){
axios.get('${SITE_URL}system_cmdb/').then(res => {
res = res.data;
this.systemListCmdb = res
})
},
dellabeldialog(e, label) { dellabeldialog(e, label) {
e = e || window.event e = e || window.event
e.stopPropagation() e.stopPropagation()
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
style="display:inline-block;width:100%;"> style="display:inline-block;width:100%;">
<el-select style="min-width:150px;width:80%;" clearable filterable <el-select style="min-width:150px;width:80%;" clearable filterable
v-model="formLine.alarm_system"> v-model="formLine.alarm_system">
<el-option v-for="item in systemList" <el-option v-for="item in systemListCmdb"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.label"></el-option> :value="item.label"></el-option>
...@@ -330,7 +330,7 @@ ...@@ -330,7 +330,7 @@
data() { data() {
return { return {
dateoutflag: false, dateoutflag: false,
systemListCmdb:[],
user: '', user: '',
gridData: [], gridData: [],
priorityOp: keyArray.priority, priorityOp: keyArray.priority,
...@@ -382,7 +382,8 @@ ...@@ -382,7 +382,8 @@
mounted() { mounted() {
this.setmainuser(); this.setmainuser();
this.getAlarmList(); this.getAlarmList();
this.getSystem() this.getSystem();
this.system_cmdb()
}, },
...@@ -393,6 +394,12 @@ ...@@ -393,6 +394,12 @@
this.systemList = res this.systemList = res
}) })
}, },
system_cmdb(){
axios.get('${SITE_URL}system_cmdb/').then(res => {
res = res.data;
this.systemListCmdb = res
})
},
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.selectData =selection this.selectData =selection
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
</el-col> </el-col>
<el-col :span="20"> <el-col :span="20">
<el-form-item label="行政组" style="display:inline-block;" label-width="130px"> <el-form-item label="行政组" style="display:inline-block;" label-width="130px">
<el-select style="width:200px;" clearable v-model="formLine.xzz" > <el-select style="width:200px;" clearable v-model="group" >
<el-option v-for="item in GroupOp" <el-option v-for="item in GroupOp"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-button type="primary" size="medium" style="float:right" <el-button type="primary" size="medium" style="float:right"
@click="dateout()">导出 @click="monitorOut()">导出
</el-button> </el-button>
</el-col> </el-col>
</el-row> </el-row>
...@@ -344,8 +344,10 @@ ...@@ -344,8 +344,10 @@
data() { data() {
return { return {
labelList: [], labelList: [],
group:'',
dateoutflag: false, dateoutflag: false,
dateoutinfo: "", dateoutinfo: "",
userGroup:{},
user: '', user: '',
sysGroup:{}, sysGroup:{},
GroupOp:[], GroupOp:[],
...@@ -387,6 +389,9 @@ ...@@ -387,6 +389,9 @@
methods: { methods: {
async monitorOut(){
if ()
},
//查询 //查询
searchList() { searchList() {
this.currentPage = 1; this.currentPage = 1;
...@@ -396,7 +401,7 @@ ...@@ -396,7 +401,7 @@
getUserGroup() { getUserGroup() {
axios.get('${SITE_URL}search_user_group/').then(res => { axios.get('${SITE_URL}search_user_group/').then(res => {
this.GroupOp = res.data['group_list']; this.GroupOp = res.data['group_list'];
this.sysGroup = res.data['group_system_list'] this.userGroup = res.data['group_user_list']
}) })
}, },
......
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