export function myList (obj, pageNumber, fn, url, query) {
obj.panel.page.pageNumber = pageNumber
let data
if (query) {
//
console.log("------------")
data = query
} else {
//
console.log("------------")
obj.data = {
"page": obj.panel.page,
"row": {
"host_ids": obj.hostIds,
"hostIds": obj.hostIds
}
}
data = obj.data
}
obj.crud.loading(obj, true)
// hostid
if (obj.lastId !== obj.hostIds) {
obj.panel.gridData = []
obj.n = 1
}
obj.getData(obj, url, data, msg => {
// console.log(msg)
obj.isFirst = false
obj.startScroll = true
let len
//
// msg
if (msg) {
//totalRowtotal
if (msg.totalRow >= 0) {
len = msg.totalRow
} else {
len = msg.total
}
if (msg.length >= 0) {
len = msg.length
}
} else {
len = 0
}
//
obj.totalRow = len
obj.total = len
//
if (msg) {
if (msg.size) {
obj.data.size = msg.size
// obj.data.size.beforeId = msg.size.beforeId
// obj.data.size.offset = msg.size.offset
obj.n = parseInt(msg.size.offset) / parseInt(obj.panel.page.pageSize)
}
} else {
// msgundefinedreturn
obj.crud.loading(obj, false, () => {
obj.panel.hasData = false
obj.reloadLock = false
})
return
}
//
function dataHanding (tmp) {
// checkedfalse
tmp.forEach(function (curr) {
curr.checked = false
})
//gridData
obj.crud.loading(obj, false, o => {
// fn
if (fn) fn(msg)
for (let entry of tmp) {
obj.panel.gridData.push(entry)
}
// gridData
obj.panel.gridData.map((val, i) => {
val.myNum = i + 1
})
obj.$store.dispatch({type: "changePanelData", val: obj.panel.gridData})
obj.nowData = obj.panel.gridData
obj.panel.hasData = true
if (obj.panel.gridData.length === 0) obj.panel.hasData = false
})
}
// list
if (msg.length >= 0) dataHanding(msg)
else if (msg.list.length >= 0) dataHanding(msg.list)
//
obj.lastId = obj.hostIds
})
}