|
define(function(require){
var $ = require("jquery");
var justep = require("$UI/system/lib/justep");
var Model = function(){
this.callParent();
};
Model.prototype.getDefaultClass = function(type){
var rows =this.comp("classData").classData.find(["fType"],[type]);
return rows.length > 0 ? rows[0].val("fClass") : "";
};
Model.prototype.okBtnClick = function(event){
this.owner.send(this.comp("accountData").getCurrentRow());
this.comp("window").close();
};
Model.prototype.accountDataValueChanged = function(event){
if(event.col=="fType"){
event.row.val("fClass",this.getDefaultClass(event.value));
}
};
Model.prototype.modelParamsReceive = function(event){
var data =this.comp("accountData");
data.clear();
if(event.params.data.operator =="new"){
data.newData({
"defaultValues" : [ {
"fID" : justep.UUID.createUUID(),
"fCreateTime" : new Date(),
"fDate" : new Date(),
"fType" : "支出",
"fClass": this.getDefaultClass("支出")
} ]
});
}
else if (event.params.data.operator=="edit"){
data.loadData([event.params.data.rowData]);
data.first();
}
};
return Model;
});
|
|