Commit b9ca163b authored by Kerwin_Cui's avatar Kerwin_Cui

翻页bug

parent 8cc061e9
......@@ -2817,22 +2817,14 @@ def alarm_count_out(request):
data_list = []
for i in req:
new_list = []
# new_list.append(i.get(u'system'))
# new_list.append(i.get(u'total'))
# new_list.append(i.get(u'bad_work'))
# new_list.append(i.get(u'main_work'))
# new_list.append(i.get(u'normal_work'))
# new_list.append(i.get(u'bad_weekend'))
# new_list.append(i.get(u'main_weekend'))
# new_list.append(i.get(u'normal_weekend'))
new_list.append(i[0])
new_list.append(i[1])
new_list.append(i[2])
new_list.append(i[3])
new_list.append(i[4])
new_list.append(i[5])
new_list.append(i[6])
new_list.append(i[7])
new_list.append(i.get(u'system'))
new_list.append(i.get(u'total'))
new_list.append(i.get(u'bad_work'))
new_list.append(i.get(u'main_work'))
new_list.append(i.get(u'normal_work'))
new_list.append(i.get(u'bad_weekend'))
new_list.append(i.get(u'main_weekend'))
new_list.append(i.get(u'normal_weekend'))
data_list.append(new_list)
workbook = xlwt.Workbook(encoding='utf-8')
......
......@@ -40,7 +40,7 @@
ref="table"
stripe.2
:header-cell-style="{background:'#409EFF',color:'white'}">
<el-table-column type="selection" width="35"></el-table-column>
<el-table-column type="selection" width="50"></el-table-column>
<el-table-column width="200" prop="system" label="系统" align="center"></el-table-column>
<el-table-column prop="total" label="有效故障预警数" align="center"></el-table-column>
<el-table-column prop="bad_work" label="严重故障预警数(交易日)" align="center"></el-table-column>
......@@ -90,7 +90,7 @@
methods: {
searchList() {
searchList(fn) {
let finallist = []
if(this.sysGroup && this.Group){
for (let temp of this.sysGroup) {
......@@ -107,13 +107,21 @@
axios.post('${SITE_URL}alarm_count_info/', newdata).then(res => {
this.AlarmCountData = res.data.results;
this.total = res.data.count
if (!!fn) {
fn()
}
});
console.log(this.AlarmCountData)
},
async listOut(){
let eventList = [];
let vm = this;
for (let i in this.selectData) {
eventList = eventList.concat(this.selectData[i])
}
//console.log(!this.AlarmCountData.length)
if (!this.selectData.length){
if (!eventList.length){
vm.$message(
{
type: 'error',
......@@ -131,8 +139,13 @@
},
out_data(){
return new Promise((resolve,reject)=>{
axios.post('${SITE_URL}alarm_count_out/', this.selectData).then(res => {
let eventList = [];
for (let i in this.selectData) {
eventList = eventList.concat(this.selectData[i])
}
axios.post('${SITE_URL}alarm_count_out/', eventList).then(res => {
if (res.data == 1) {resolve('ok')}
})
})
......@@ -150,13 +163,39 @@
console.log("当前页" + val);
if (this.currentPage != val) {
this.currentPage = val
this.searchList()
this.searchList(() => {
this.handleCurPageChange()
})
}
},
handleCurPageChange() {
let arr = [];
if (!!this.selectData[this.currentPage]) {
this.selectData[this.currentPage].map(item => {
arr = arr.concat(this.AlarmCountData.filter(item2 => {
return item2.system == item.system
}))
})
}
console.log(arr)
this.toggleSelection(arr)
},
toggleSelection(rows) {
this.$nextTick(() => {
if (rows) {
rows.forEach(row => {
this.$refs.table.toggleRowSelection(row)
})
} else {
this.$refs.table.clearSelection();
}
})
},
handleSelectionChange(selection) {
this.selectData = [];
this.selectData[this.currentPage] = [];
selection.map((item, index) => {
this.selectData.push([item.system,item.total,item.bad_work,item.main_work,item.normal_work,item.bad_weekend,item.main_weekend,item.normal_weekend])
this.selectData[this.currentPage].push(item)
});
console.log(this.selectData)
},
......
......@@ -176,7 +176,7 @@
:header-cell-style="{background:'#409EFF',color:'white'}"
>
<el-table-column type="selection" width="35"></el-table-column>
<el-table-column type="selection" width="50"></el-table-column>
<el-table-column width="300" prop="event_number" label="事件编号" header-align="center" align="left"></el-table-column>
<el-table-column prop="summary" label="摘要" header-align="center" align="left" show-overflow-tooltip></el-table-column>
<el-table-column width="130" prop="priority" label="优先级" align="center"></el-table-column>
......
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