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.

89 lines
2.2 KiB

4 years ago
define(function(require, exports, module){
var Page = require('views/pages/basicReport');
var vk = require('adapter/vkeybordAdapter.js');
var page = null;
var dataManager = null;
//设置dataManager
function setDataManager() {
}
function makeDataManager(data) {
var key = Object.keys(data)[0];
return new DataManager(data[key]);
}
function getkey(Obj) {
var key = null,
keys = Object.keys(Obj)
if (keys[0] === 'Message') {
key = keys[1];
} else {
key = keys[0];
}
return key;
}
function getrptfunc() {
var token = getParameterByName('token');
var rptId = getParameterByName('rptId');
var showVitalKeybord = getParameterByName('showVitalKeybord');
ER.Cache.token = token;
ER.Cache.showVitalKeybord = showVitalKeybord;
ER.VK = new vk();
ER.services.getrptfunc({
token: token,
rptId: rptId
}, function(isok, data) {
if (isok) {
ER.Cache.logon = data.logOn;
// dataManager = makeDataManager(data.rptSchema);
// dataManager.rptKey = getkey(data.rptSchema);
// dataManager.rptFormats = data.rptFormats;
// dataManager.addRptResultCol(data.rptSchema[dataManager.rptKey].columns);
// var options = {
// rptId: rptId,
// rptFormatId: dataManager.rptFormats[0].rptformatid,
// userCode: '111',
// searchId: '',
// isSearch: '1',
// pageIndex: 0
// };
// dataManager.makeDataParams(options);
page = new Page();
ER.pages = {};
ER.pages[page.id] = page;
page.makeDataFromSchema(data.rptSchema, data.rptFormats, data.rptFormatAlarm);
page.init();
// ER.services.searchSchema({
// rptId: rptId,
// rptFormatId: dataManager.rptFormats[0].rptformatid
// }, function (isok, data) {
// debugger;
// });
}
});
}
function makeDataFromSchema(data, dataManager) {
dataManager = makeDataManager(data);
dataManager.rptKey = getkey(data);
dataManager.rptFormats = data.rptFormats;
dataManager.addRptResultCol(data[dataManager.rptKey].columns);
var options = {
rptId: rptId,
rptFormatId: dataManager.rptFormats[0].rptformatid,
userCode: '111',
searchId: '',
isSearch: '1',
pageIndex: 0
};
dataManager.makeDataParams(options);
}
return {
getrptfunc: getrptfunc
};
});