|
define(function(require) {
var $ = require("jquery");
var justep = require("$UI/system/lib/justep");
var Model = function() {
this.callParent();
};
// 点击图片分类,展示相关分类信息
Model.prototype.imageClick = function(event) {
var className = event.currentTarget.getAttribute('classname');
$(this.getElementByXid("span1")).html(className);
this.comp("list2").set({
"filter" : "js: $row.val('parentName') == '" + className + "'"
});
this.comp("list2").refresh(true);
};
// 数据组件自定义刷新
Model.prototype.data1CustomRefresh = function(event) {
// 获取列表
var self = this;
var user = JSON.parse(localStorage.getItem("user"));
$.ajax({
type : "POST",
url : "http://220.249.20.134:1820/msservices/msinfo/retrieve",
headers : {
'Content-Type' : 'application/json',
"Authorization" : user.token
},
dataType : "json",
data : JSON.stringify({
"parentId" : "2"
}),
success : function(result) {
if (result.result == "FAILED") {
justep.Util.hint("加载失败!:" + JSON.stringify(result.data));
} else {
console.log(JSON.stringify(result.data));
// justep.Util.hint("加载成功!:" + JSON.stringify(result.data));
self.comp("data1").loadData(result.data);
}
},
error : function(message) {
justep.Util.hint("请求失败!");
}
});
};
// 点击列表,打开详情页
Model.prototype.openDetailPage = function(event) {
var row = event.bindingContext.$object;
justep.Shell.showPage(require.toUrl("./detail.w"), {
rowId : row.val("id")
});
};
// 搜索按钮
Model.prototype.button1Click = function(event) {
var search = this.comp("input1").val();
this.comp("list2").set({
"filter" : "js: $row.val('title').indexOf(" + "'"+search +"'"+ ")!=-1"
});
this.comp("list2").refresh(true);
this.comp("input1").val("");
};
return Model;
}); |
|