You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.2 KiB
66 lines
2.2 KiB
!(function () { |
|
var Store = BI.inherit(Fix.Model, { |
|
state: function () { |
|
return { |
|
tableData:[], |
|
headerData:[], |
|
currentPage: 1, |
|
totalCount: 0, |
|
perCount: 20 |
|
}; |
|
}, |
|
|
|
context:["selectedLink"], |
|
|
|
watch: { |
|
selectedLink: function () { |
|
this.model.currentPage = 1; |
|
this.initData(); |
|
} |
|
}, |
|
|
|
computed: { |
|
header: function () { |
|
var self = this; |
|
var head = []; |
|
var con = BI.Constants.getConstant("dec.hw.col.type") ; |
|
BI.map( self.model.headerData,function (i, val) { |
|
var text = BI.filter(con, function (index, v) { |
|
return BI.isEqual(val.colType, parseInt(v.value)) |
|
})[0].text; |
|
head.push({"text":val.colName + "(" + text + ")"}) |
|
}); |
|
return head; |
|
}, |
|
columnSize: function () { |
|
var self = this; |
|
var len = self.model.header.length; |
|
return new Array(len).fill((1/len).toFixed(2)); |
|
}, |
|
items: function () { |
|
var startNum = this.model.perCount * (this.model.currentPage - 1); |
|
return this.model.tableData.slice(startNum, startNum + this.model.perCount) |
|
}, |
|
totalCount: function () { |
|
return BI.size(this.model.tableData) |
|
} |
|
}, |
|
|
|
actions:{ |
|
initData: function (callback) { |
|
var self = this; |
|
Dec.HW.queryData({ |
|
name: self.model.selectedLink |
|
}, function (res) { |
|
self.model.tableData = res.data.tableData; |
|
self.model.headerData = BI.hwColTypeDeal(res.data.colAttr); |
|
BI.isFunction(callback) && callback(); |
|
}); |
|
}, |
|
setPage: function(val) { |
|
this.model.currentPage = val |
|
} |
|
} |
|
}); |
|
BI.model("dec.model.excelexport.right.table", Store); |
|
})(); |