提交 fd29439d 编写于 作者: U unknown

添加表单组件的isEmpty 方法

上级 df9fc999
......@@ -216,6 +216,9 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input = new Class({
var text = (this.node.getFirst()) ? this.node.getFirst().get("text") : this.node.get("text");
return {"value": [value || ""] , "text": [text || value || ""]};
},
isEmpty : function(){
return !!this.getData();
},
getData: function(when){
if (this.json.compute == "save") this._setValue(this._computeValue());
return this.getInputData();
......
......@@ -1104,6 +1104,14 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
}.bind(this));
},
isEmpty : function(){
var data = this.getData();
if( typeOf(data) === "array" ){
return data.length !== 0
}else{
return !!data;
}
},
getData: function () {
return (this.attachmentController) ? this.attachmentController.getAttachmentNames() : null;
},
......
......@@ -179,6 +179,14 @@ MWF.xApplication.process.Xform.Combox = MWF.APPCombox = new Class({
this.combox.setOptions({"list": list});
}
},
isEmpty : function(){
var data = this.getData();
if( typeOf(data) === "array" ){
return data.length !== 0;
}else{
return !!data;
}
},
getInputData: function(){
if (this.combox) return this.combox.getData();
return this._getBusinessData();
......
......@@ -1133,6 +1133,15 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
getTotal: function(){
this._loadTotal();
return this.totalResaults;
},
isEmpty: function(){
var data = this.getData();
if( !data )return true;
if( typeOf( data ) === "object" ){
if( typeOf( data.data ) !== "array" )return true;
if( data.data.length === 0 )return true;
}
return false;
},
getData: function(){
if (this.editable!=false){
......
......@@ -984,6 +984,15 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
this._loadTotal();
return this.totalResaults;
},
isEmpty: function(){
var data = this.getData();
if( !data )return true;
if( typeOf( data ) === "object" ){
if( typeOf( data.data ) !== "array" )return true;
if( data.data.length === 0 )return true;
}
return false;
},
getData: function(){
if (this.editable!=false){
if (this.isEdit) this._completeLineEdit();
......
......@@ -1796,6 +1796,11 @@ debugger;
this._repage();
}.bind(this));
},
isEmpty: function(){
var data = this.getData();
if( typeOf(data) !== "object" )return true;
return !!data.filetext;
},
getData: function(){
//if (this.editMode){
if (this.layout_copies) this.data.copies = this.layout_copies.get("text");
......
......@@ -1082,7 +1082,7 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
// this.setModifedData(data[i], pathList.push(i));
// }
//}
} else if (typeOf(data) !== "null") {
} else if (typeOf(data) !== "null") { //后台对null是忽略处理的,认为值没有变化
var od = this.getOrigianlPathData(pathList);
if (typeOf(data) !== typeOf(od) || data !== od) {
this.setModifedDataByPathList(data, pathList);
......
......@@ -1203,6 +1203,10 @@ MWF.xApplication.process.Xform.Office = MWF.APPOffice = new Class({
this.fileUploadNode = this.uploadFileAreaNode.getFirst();
this.uploadFileAreaNode.inject(this.officeForm);
},
isEmpty : function(){
var data = this.getData();
return !!data;
},
getData: function(){
if (this.officeOCX && (this.officeOCX.DocType==1 || this.officeOCX.DocType==6)){
this.officeOCX.ActiveDocument.Application.Selection.WholeStory();
......
......@@ -323,6 +323,12 @@ MWF.xApplication.process.Xform.Org = MWF.APPOrg = new Class({
//this.setData((v) ? v.join(", ") : "");
this.setData(v);
},
isEmpty: function(){
var data = this.getData();
if( typeOf(data) !== "array" )return true;
if( data.length === 0 )return true;
return false;
},
getInputData: function(){
if (this.json.isInput){
if (this.combox)return this.combox.getData();
......
......@@ -276,6 +276,12 @@ MWF.xApplication.process.Xform.Orgfield = MWF.APPOrgfield = new Class({
value = this._computeValue();
}
return value || "";
},
isEmpty: function(){
var data = this.getData();
if( typeOf(data) !== "array" )return true;
if( data.length === 0 )return true;
return false;
},
getData: function(when){
if (this.json.compute == "save") this._setValue(this._computeValue());
......
......@@ -394,6 +394,12 @@ MWF.xApplication.process.Xform.Personfield = MWF.APPPersonfield = new Class({
//this.setData((v) ? v.join(", ") : "");
this.setData(v);
},
isEmpty: function(){
var data = this.getData();
if( typeOf(data) !== "array" )return true;
if( data.length === 0 )return true;
return false;
},
getInputData: function(){
if (this.json.isInput){
if (this.combox) return this.combox.getData();
......
......@@ -37,6 +37,13 @@ MWF.xApplication.process.Xform.Stat = MWF.APPStat = new Class({
});
}.bind(this));
},
isEmpty: function(){
var data = this.getData();
debugger;
if( typeOf(data) !== "array" )return true;
if( data.length === 0 )return true;
return false;
},
getData: function(){
if (!this.stat) return null;
if (!this.stat.stat) return null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册