提交 7995e5c1 编写于 作者: NoSubject's avatar NoSubject

修改Org组件,兼容同步模式

上级 29c32c44
......@@ -48,6 +48,13 @@
<input type="radio" name="storeRange" value="simple" text{($.section!=='full')?'checked':''}/>{{$.lp.simple}}
</td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.asyncMode}}:</td>
<td class="editTableValue">
<input type="radio" name="asyncMode" value="yes" text{($.asyncMode=='yes')?'checked':''}/>{{$.lp.yes}}
<input type="radio" name="asyncMode" value="no" text{($.asyncMode!=='yes')?'checked':''}/>{{$.lp.no}}
</td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.separator}}:</td>
<td class="editTableValue">
......
......@@ -430,6 +430,7 @@ MWF.xApplication.process.FormDesigner.LP = {
"complete": "Complete",
"simple": "Simple",
"separator": "Separator",
"asyncMode": "Async Mode",
"identity": "Identity",
"unit": "Unit",
......
......@@ -428,6 +428,7 @@ MWF.xApplication.process.FormDesigner.LP = {
"complete": "完整",
"simple": "精简",
"separator": "分隔符",
"asyncMode": "异步模式",
"identity": "身份",
"unit": "组织",
......
......@@ -223,11 +223,6 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input = new Class(
this.__setValue(v);
}.bind(this), function(){});
this.moduleValueAG = p;
p.then(function(){
this.moduleValueAG = null;
}.bind(this), function(){
this.moduleValueAG = null;
}.bind(this));
}else{
this.moduleValueAG = null;
this.__setValue(value);
......@@ -238,6 +233,7 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input = new Class(
},
__setValue: function(value){
this.moduleValueAG = null;
this._setBusinessData(value);
if (this.node.getFirst()) this.node.getFirst().set("value", value || "");
if (this.readonly || this.json.isReadonly) this.node.set("text", value);
......
......@@ -102,6 +102,8 @@ MWF.xApplication.process.Xform.$Module = MWF.APP$Module = new Class(
this._afterLoaded();
this.fireEvent("postLoad");
this.fireEvent("load");
this.moduleLoaded = true;
}
},
_loadUserInterface: function(){
......
......@@ -1178,47 +1178,65 @@ MWF.xApplication.process.Xform.Org = MWF.APPOrg = new Class(
if (typeOf(value)!=="array") value = (!!value) ? [value] : [];
//value = (value.flat) ? value.flat() : value.flatten();
var p = o2.promiseAll(value).then(function(d){
if (typeOf(d)!=="array") d = (!!d) ? [d] : [];
d.each(function(da){
if (typeOf(da)!=="array") da = (!!da) ? [da] : [];
da.each(function(dd){
if (dd){
if (typeOf(dd)==="string"){
var pp = this.getOrgAction()[this.getValueMethod(dd)](function(json){
return MWF.org.parseOrgData(json.data, true, simple);
}.bind(this), null, dd, true).catch(function(e){
console.log("error:" + e);
console.log(e);
});
ags.push(pp);
}else{
values.push(dd);
if (value.some(function(e){ return (e && o2.typeOf(e.then)=="function") }) || this.json.asyncMode==="yes"){
var p = Promise.all(value).then(function(d){
if (typeOf(d)!=="array") d = (!!d) ? [d] : [];
d.each(function(da){
if (typeOf(da)!=="array") da = (!!da) ? [da] : [];
da.each(function(dd){
if (dd){
if (typeOf(dd)==="string"){
var pp = this.getOrgAction()[this.getValueMethod(dd)](function(json){
return MWF.org.parseOrgData(json.data, true, simple);
}.bind(this), null, dd, true).catch(function(e){
console.log("error:" + e);
console.log(e);
});
ags.push(pp);
}else{
values.push(dd);
}
}
}
}.bind(this));
}.bind(this));
}.bind(this));
if (ags.length){
return o2.promiseAll(ags).then(function(data){
values = values.concat(data);
if (ags.length){
return Promise.all(ags).then(function(data){
values = values.concat(data);
flag = true;
this.__setValue(values);
return values;
}.bind(this), function(){});
}else{
flag = true;
this.__setValue(values);
return values;
}.bind(this), function(){});
}else{
flag = true;
this.__setValue(values);
return values
}
}.bind(this), function(){});
return values
}
}.bind(this), function(){});
this.moduleValueAG = p;
if (p && p.then) p.then(function(){
this.moduleValueAG = null;
}.bind(this), function(){
this.moduleValueAG = null;
}.bind(this));
return p;
}else{
value.each(function(dd){
if (dd){
if (typeOf(dd)==="string"){
this.getOrgAction()[this.getValueMethod(dd)](function(json){
values.push(MWF.org.parseOrgData(json.data, true, simple));
}.bind(this), null, dd, false);
}else{
values.push(dd);
}
}
}.bind(this));
this.__setValue(values);
return values
}
this.moduleValueAG = p;
if (p && p.then) p.then(function(){
this.moduleValueAG = null;
}.bind(this), function(){
this.moduleValueAG = null;
}.bind(this));
return p;
// var ag = o2.AG.all(value).then(function(d) {
// if (typeOf(d)!=="array") d = (d) ? [d.toString()] : [];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册