|
楼主 |
发表于 2016-5-18 17:16:17
|
显示全部楼层
继续补充源码:
参考主页面路由的实例,建立了index.js文件
define(function(require) {
var $ = require("jquery");
var justep = require("$UI/system/lib/justep");
var ShellImpl = require('$UI/system/lib/portal/shellImpl');
var Model = function() {
this.callParent();
var shellImpl = new ShellImpl(this, {
"contentsXid" : "pages",
"pageMappings" : {
"main" : {
url : require.toUrl('./main.w')
}
}
})
};
Model.prototype.modelLoad = function(event){
justep.Shell.showPage("main");
};
return Model;
});
main.js文件如下
define(function(require) {
var $ = require("jquery");
var justep = require("$UI/system/lib/justep");
var Model = function() {
this.callParent();
this.cust_name = justep.Bind.observable("");
};
Model.prototype.button2Click = function(event) {
};
Model.prototype.buttonQueryInfoClick = function(event) {
this.comp("hldrlistdata").clear();
var params = {
"hldr_name" : this.comp("searchInput").val()
};
var me = this;
$.ajax({
type : "GET",
url : 'http://127.0.0.1/restler/queryaccount/phrlist',
dataType : 'json',
"data" : {
"params" : JSON.stringify(params)
},
async : false,
success : function(ret)
{
if (ret['requestdata']['success'])
{
me.comp("hldrlistdata").clear();
me.comp("hldrlistdata").loadData(ret, true);
} else {
return;
}
},
error : function(ret) {
justep.Util.hint("没有找到客户信息!" , {
"type" : "danger",
"position" : "bottom"
});
return;
}
});
};
Model.prototype.baasDataMainBeforeRefresh = function(event) {
};
Model.prototype.button3Click = function(event) {
var row = event.bindingContext.$object; // 得到meetingdata.row对象,再读取数据
var v_cntr_no = row.val("cntr_no");
justep.Shell.showPage("$UI/accountquery/detail.w?cntr_no=" + v_cntr_no);
};
Model.prototype.baasDataMainCreate = function(event) {
};
Model.prototype.hldrlistdataCustomRefresh = function(event) {
};
return Model;
}); |
|