Commit 5809d778 authored by Kerwin_Cui's avatar Kerwin_Cui

123

parent e17a963c
......@@ -2247,7 +2247,26 @@ def edit_alarm(request):
def del_alarm(request):
try:
id = json.loads(request.body)
a=1
alarm_number = id['alarm_number']
alarm = Error_alarm.objects.filter(alarm_number=alarm_number)
if alarm:
alarm = alarm[0]
alarm.delete()
return render_json(
{"result": True,
"code": 0,
"message": u"预警删除成功!",
"data": ''
})
else:
return render_json(
{
"result": False,
"code": 1,
"message": u"删除失败!",
"data": {}
}
)
except Exception as e:
return render_json(
{
......@@ -2259,6 +2278,18 @@ def del_alarm(request):
)
def create_alarm_by_icube(request):
try:
pass
except Exception as e:
return render_json(
{
"result": False,
"code": 1,
"message": u"未知错误:%s" % e,
"data": {}
}
)
def search_alarm(request):
try:
......
......@@ -245,7 +245,7 @@
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="batchNewVisible = false">取 消</el-button>
<el-button type="primary" @click="batchNewVisible = false" >确 定</el-button>
<el-button type="primary" @click="batchNewVisible = false">确 定</el-button>
</span>
</el-dialog>
</div>
......@@ -392,8 +392,8 @@
this.systemList = res
})
},
<<<<<<< HEAD
searchAlarm(){
searchAlarm() {
if (this.formLine.failure_analysis.alarm_type && this.formLine.failure_analysis.start_time
&& this.formLine.failure_analysis.end_time) {
let vm = this;
......@@ -422,7 +422,7 @@
});
}
},
createNewAlarm(){
createNewAlarm() {
window.location.href = "${SITE_URL}alarm_edit"
},
createNewTask() {
......@@ -430,7 +430,7 @@
// window.location.href = "${SITE_URL}event_edit"
this.batchNewVisible = true
},
delAlarm(){
delAlarm(row) {
this.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
......@@ -443,36 +443,20 @@
type: 'info',
message: '已取消删除'
});
=======
createNewAlarm() {
window.location.href = "${SITE_URL}alarm_edit"
},
delAlarm(row) {
let vm = this
vm.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
cancelButtonText: '取消',
confirmButtonText: '确定',
type: 'warning'
}).then(() => {
let id = row.alarm_number;
this.sureDelete(id)
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
>>>>>>> b9670ad79ebce4d627128543ad1aa9ae0d773d17
});
});
},
//查询
searchList() {
searchList()
{
this.currentPage = 1;
this.count = 0;
this.getAlarmList()
},
}
,
//获取任务列表
getAlarmList(fn) {
getAlarmList(fn)
{
this.loading = true;
let vm = this;
let newdata = {
......@@ -497,33 +481,41 @@
)
},
storage = this.formLine.priority)
},
}
,
setmainuser() {
setmainuser()
{
axios.get('${SITE_URL}getuser/').then(res => {
res = res.data;
this.user = res
})
},
}
,
//编辑模板
readRow(row) {
readRow(row)
{
let data = {event_number: row.event_number};
axios.post("${SITE_URL}event_edit_display/", data).then(res => {
window.localStorage.setItem("event_number", JSON.stringify(res.results));
window.location.href = "${SITE_URL}event_edit"
})
},
}
,
handleSelectionChange(selection) {
handleSelectionChange(selection)
{
this.selectData[this.currentPage] = [];
selection.map((item, index) => {
this.selectData[this.currentPage].push(item.event_number)
})
},
}
,
handleCurPageChange() {
handleCurPageChange()
{
let arr = [];
if (!!this.selectData[this.currentPage]) {
this.selectData[this.currentPage].map(item => {
......@@ -533,9 +525,11 @@
})
}
this.toggleSelection(arr)
},
}
,
toggleSelection(rows) {
toggleSelection(rows)
{
this.$nextTick(() => {
if (rows) {
rows.forEach(row => {
......@@ -545,9 +539,11 @@
this.$refs.table.clearSelection();
}
})
},
}
,
sureDelete(id) {
sureDelete(id)
{
let vm = this;
let data = {alarm_number: id};
axios.post('${SITE_URL}del_alarm/', data).then(res => {
......@@ -571,10 +567,12 @@
});
})
},
}
,
//清除事件搜索条件
emptySearch() {
emptySearch()
{
this.formLine.relate_me = '';
this.formLine.priority = '';
this.formLine.event_first_cat = '';
......@@ -584,10 +582,12 @@
this.formLine.event_number = '';
this.formLine.all_fields = '';
this.formLine.event_label = '';
},
}
,
//选择事件导出文件
async checkedColums() {
async checkedColums()
{
let eventList = [];
let vm = this;
for (let i in this.selectData) {
......@@ -599,7 +599,8 @@
message: '请选择需要导出的事件'
});
} else {
await this.check(eventList);
await
this.check(eventList);
vm.$message({
type: 'success',
message: '下载成功'
......@@ -607,8 +608,10 @@
this.download()
}
},
check(eventList) {
}
,
check(eventList)
{
return new Promise((resolve, reject) => {
axios.post("${SITE_URL}event_out/", {eventList: eventList}).then(res => {
if (res.data == 1) {
......@@ -616,10 +619,12 @@
}
});
})
},
}
,
// 选择日期导出文件
async dateout() {
async dateout()
{
if (this.dateoutinfo == null || this.dateoutinfo.length == 0) {
vm.$message({
type: 'error',
......@@ -627,7 +632,8 @@
});
} else {
console.log('进入按时间导出1')
await this.checkk();
await
this.checkk();
console.log(this.dateoutflag)
if (this.dateoutflag == true) {
vm.$message({
......@@ -643,8 +649,10 @@
}
}
},
checkk() {
}
,
checkk()
{
return new Promise((resolve, reject) => {
axios.post("${SITE_URL}event_out/", this.dateoutinfo).then(res => {
if (res.data == 1) {
......@@ -658,13 +666,17 @@
}
})
})
},
}
,
download() {
download()
{
window.location.href = "${SITE_URL}download";
},
}
,
handleCurrentChange(val) {
handleCurrentChange(val)
{
console.log("当前页" + val);
if (this.currentPage != val) {
this.currentPage = val;
......@@ -672,7 +684,8 @@
this.handleCurPageChange()
})
}
},
}
,
},
......
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