|
|
@@ -131,14 +131,16 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var data = {"groupList": getNameFlag(name)};
|
|
|
|
|
|
var v = null;
|
|
|
+
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
v = (v && v.length===1) ? v[0] : v
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- orgActions.listGroup(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var promise = orgActions.listGroup(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
|
|
|
// var v = null;
|
|
|
// orgActions.listGroup(data, function(json){v = json.data;}, null, false);
|
|
|
@@ -151,17 +153,23 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var data = {"groupList": getNameFlag(name)};
|
|
|
|
|
|
var v = null;
|
|
|
+ // var cb = ((async && o2.typeOf(async)=="function") ? (async.isAG ? async : async.ag()) : null) || function(json){
|
|
|
+ // v = json.data;
|
|
|
+ // return v;
|
|
|
+ // }.ag().catch(function(json){ return json; });
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
+ var promise;
|
|
|
if (nested){
|
|
|
- orgActions.listSubGroupNested(data, cb, null, !!async);
|
|
|
+ promise = orgActions.listSubGroupNested(data, cb, null, !!async);
|
|
|
}else{
|
|
|
- orgActions.listSubGroupDirect(data, cb, null, !!async);
|
|
|
+ promise = orgActions.listSubGroupDirect(data, cb, null, !!async);
|
|
|
}
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ return (!!async) ? promise : v;
|
|
|
|
|
|
// var v = null;
|
|
|
// if (nested){
|
|
|
@@ -180,15 +188,17 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
+ var promise
|
|
|
if (nested){
|
|
|
- orgActions.listSupGroupNested(data, cb, null, !!async);
|
|
|
+ var promise = orgActions.listSupGroupNested(data, cb, null, !!async);
|
|
|
}else{
|
|
|
- orgActions.listSupGroupDirect(data, cb, null, !!async);
|
|
|
+ var promise = orgActions.listSupGroupDirect(data, cb, null, !!async);
|
|
|
}
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ return (!!async) ? promise : v;
|
|
|
// var v = null;
|
|
|
// if (nested){
|
|
|
// orgActions.listSupGroupNested(data, function(json){v = json.data;}, null, false);
|
|
|
@@ -205,11 +215,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- orgActions.listGroupWithPerson(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var promise = orgActions.listGroupWithPerson(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
// var v = null;
|
|
|
// orgActions.listGroupWithPerson(data, function(json){v = json.data;}, null, false);
|
|
|
// return v;
|
|
|
@@ -223,11 +234,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = false;
|
|
|
var cb = function(json){
|
|
|
v = json.data.value;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- orgActions.groupHasRole(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var promise = orgActions.groupHasRole(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
|
|
|
// var v = false;
|
|
|
// orgActions.groupHasRole(data, function(json){v = json.data.value;}, null, false);
|
|
|
@@ -244,11 +256,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
v = (v && v.length===1) ? v[0] : v;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- orgActions.listRole(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var promise = orgActions.listRole(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
|
|
|
// var v = null;
|
|
|
// orgActions.listRole(data, function(json){v = json.data;}, null, false);
|
|
|
@@ -262,11 +275,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- orgActions.listRoleWithPerson(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var promise = orgActions.listRoleWithPerson(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
// var v = null;
|
|
|
// orgActions.listRoleWithPerson(data, function(json){v = json.data;}, null, false);
|
|
|
// return v;
|
|
|
@@ -282,11 +296,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = false;
|
|
|
var cb = function(json){
|
|
|
v = json.data.value;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- orgActions.listRoleWithPerson(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var promise = orgActions.listRoleWithPerson(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
|
|
|
// var v = false;
|
|
|
// orgActions.personHasRole(data, function(json){v = json.data.value;}, null, false);
|
|
|
@@ -301,11 +316,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
v = (v && v.length===1) ? v[0] : v;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- orgActions.listPerson(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var promise = orgActions.listPerson(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
// var v = null;
|
|
|
// orgActions.listPerson(data, function(json){v = json.data;}, null, false);
|
|
|
// return (v && v.length===1) ? v[0] : v;
|
|
|
@@ -319,15 +335,17 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
+ var promise;
|
|
|
if (nested){
|
|
|
- orgActions.listPersonSubNested(data, cb, null, !!async);
|
|
|
+ promise = orgActions.listPersonSubNested(data, cb, null, !!async);
|
|
|
}else{
|
|
|
- orgActions.listPersonSubDirect(data, cb, null, !!async);
|
|
|
+ promise = orgActions.listPersonSubDirect(data, cb, null, !!async);
|
|
|
}
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//查询上级人员--返回人员的对象数组
|
|
|
//nested 布尔 true嵌套上级;false直接上级;默认false;
|
|
|
@@ -337,15 +355,17 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
+ var promise;
|
|
|
if (nested){
|
|
|
- orgActions.listPersonSupNested(data, cb, null, !!async);
|
|
|
+ promise = orgActions.listPersonSupNested(data, cb, null, !!async);
|
|
|
}else{
|
|
|
- orgActions.listPersonSupDirect(data, cb, null, !!async);
|
|
|
+ promise = orgActions.listPersonSupDirect(data, cb, null, !!async);
|
|
|
}
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//获取群组的所有人员--返回人员的对象数组
|
|
|
listPersonWithGroup: function(name, async){
|
|
|
@@ -355,11 +375,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- orgActions.listPersonWithGroup(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var promise = orgActions.listPersonWithGroup(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//获取角色的所有人员--返回人员的对象数组
|
|
|
listPersonWithRole: function(name, async){
|
|
|
@@ -368,11 +389,13 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- orgActions.listPersonWithRole(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var promise
|
|
|
+ promise = orgActions.listPersonWithRole(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//获取身份的所有人员--返回人员的对象数组
|
|
|
listPersonWithIdentity: function(name, async){
|
|
|
@@ -381,10 +404,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
- orgActions.listPersonWithIdentity(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ };
|
|
|
+
|
|
|
+ var promise = orgActions.listPersonWithIdentity(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//获取身份的所有人员--返回人员的对象数组或人员对象
|
|
|
getPersonWithIdentity: function(name, async){
|
|
|
@@ -394,10 +419,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
v = (v && v.length===1) ? v[0] : v;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
- orgActions.listPersonWithIdentity(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ };
|
|
|
+
|
|
|
+ var promise = orgActions.listPersonWithIdentity(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//查询组织成员的人员--返回人员的对象数组
|
|
|
//nested 布尔 true嵌套的所有成员;false直接成员;默认false;
|
|
|
@@ -407,15 +434,17 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
+ var promise;
|
|
|
if (nested){
|
|
|
- orgActions.listPersonWithUnitNested(data, cb, null, !!async);
|
|
|
+ promise = orgActions.listPersonWithUnitNested(data, cb, null, !!async);
|
|
|
}else{
|
|
|
- orgActions.listPersonWithUnitDirect(data, cb, null, !!async);
|
|
|
+ promise = orgActions.listPersonWithUnitDirect(data, cb, null, !!async);
|
|
|
}
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//根据属性查询人员--返回人员的对象数组
|
|
|
//name string 属性名
|
|
|
@@ -426,11 +455,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- orgActions.listPersonWithAttribute(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var promise = orgActions.listPersonWithAttribute(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//根据属性查询人员--返回人员的全称数组
|
|
|
//name string 属性名
|
|
|
@@ -441,11 +471,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data.personList;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- orgActions.listPersonWithAttributeValue(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var promise = orgActions.listPersonWithAttributeValue(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
|
|
|
//人员属性************
|
|
|
@@ -485,11 +516,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data.attributeList;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- orgActions.getPersonAttribute(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var promise = orgActions.getPersonAttribute(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//列出人员所有属性的名称
|
|
|
listPersonAttributeName: function(name, async){
|
|
|
@@ -498,11 +530,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data.nameList;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- orgActions.listPersonAttributeName(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var promise = orgActions.listPersonAttributeName(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//列出人员的所有属性
|
|
|
listPersonAllAttribute: function(name, async){
|
|
|
@@ -511,10 +544,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
- orgActions.listPersonAllAttribute(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ };
|
|
|
+
|
|
|
+ var promise = orgActions.listPersonAllAttribute(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
|
|
|
//身份**********
|
|
|
@@ -525,12 +560,13 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
- v = (v && v.length===1) ? v[0] : v
|
|
|
+ v = (v && v.length===1) ? v[0] : v;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- orgActions.listIdentity(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var promise = orgActions.listIdentity(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//列出人员的身份
|
|
|
listIdentityWithPerson: function(name, async){
|
|
|
@@ -539,11 +575,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- orgActions.listIdentityWithPerson(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var promise = orgActions.listIdentityWithPerson(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//查询组织成员身份--返回身份的对象数组
|
|
|
//nested 布尔 true嵌套的所有成员;false直接成员;默认false;
|
|
|
@@ -552,17 +589,29 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var data = {"unitList": getNameFlag(name)};
|
|
|
var v = null;
|
|
|
|
|
|
+ // var cb = function(json){
|
|
|
+ // v = json.data;
|
|
|
+ // if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
+ // return v;
|
|
|
+ // }.ag().catch(function(json){ return json; });
|
|
|
+
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- if (nested){
|
|
|
- orgActions.listIdentityWithUnitNested(data, cb, null, !!async);
|
|
|
- }else{
|
|
|
- orgActions.listIdentityWithUnitDirect(data, cb, null, !!async);
|
|
|
- }
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var method = (nested) ? "listIdentityWithUnitNested" : "listIdentityWithUnitDirect";
|
|
|
+ var promise = orgActions[method](data, cb, null, !!async);
|
|
|
+ promise.name = "org";
|
|
|
+
|
|
|
+ //
|
|
|
+ // if (nested){
|
|
|
+ // orgActions.listIdentityWithUnitNested(data, cb, null, !!async);
|
|
|
+ // }else{
|
|
|
+ // orgActions.listIdentityWithUnitDirect(data, cb, null, !!async);
|
|
|
+ // }
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
|
|
|
//组织**********
|
|
|
@@ -574,11 +623,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
v = (v && v.length===1) ? v[0] : v;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- orgActions.listUnit(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var promise = orgActions.listUnit(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//查询组织的下级--返回组织的对象数组
|
|
|
//nested 布尔 true嵌套下级;false直接下级;默认false;
|
|
|
@@ -586,18 +636,19 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
getOrgActions();
|
|
|
var data = {"unitList": getNameFlag(name)};
|
|
|
var v = null;
|
|
|
-
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
+ var promise;
|
|
|
if (nested){
|
|
|
- orgActions.listUnitSubNested(data, cb, null, !!async);
|
|
|
+ promise = orgActions.listUnitSubNested(data, cb, null, !!async);
|
|
|
}else{
|
|
|
- orgActions.listUnitSubDirect(data, cb, null, !!async);
|
|
|
+ promise = orgActions.listUnitSubDirect(data, cb, null, !!async);
|
|
|
}
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//查询组织的上级--返回组织的对象数组
|
|
|
//nested 布尔 true嵌套上级;false直接上级;默认false;
|
|
|
@@ -609,15 +660,17 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
+ var promise;
|
|
|
if (nested){
|
|
|
- orgActions.listUnitSupNested(data, cb, null, !!async);
|
|
|
+ promise = orgActions.listUnitSupNested(data, cb, null, !!async);
|
|
|
}else{
|
|
|
- orgActions.listUnitSupDirect(data, cb, null, !!async);
|
|
|
+ promise = orgActions.listUnitSupDirect(data, cb, null, !!async);
|
|
|
}
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ return (!!async) ? promise : v;
|
|
|
|
|
|
// if (callback){
|
|
|
// if (nested){
|
|
|
@@ -649,24 +702,57 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
}
|
|
|
|
|
|
var cb;
|
|
|
+ var promise;
|
|
|
switch (getUnitMethod){
|
|
|
case "current":
|
|
|
var data = {"identityList":getNameFlag(name)};
|
|
|
- cb = function(json){ v = json.data; v=(v&&v.length===1) ? v[0] : v; return v; }.ag().catch(function(json){ return v; });
|
|
|
- orgActions.listUnitWithIdentity(data, cb, null, !!async);
|
|
|
+
|
|
|
+ // var cb = ((async && o2.typeOf(async)=="function") ? (async.isAG ? async : async.ag()) : null) || function(json){
|
|
|
+ // v = json.data; v=(v&&v.length===1) ? v[0] : v; return v;
|
|
|
+ // }.ag().catch(function(json){ return json; });
|
|
|
+
|
|
|
+
|
|
|
+ cb = function(json){
|
|
|
+ v = json.data; v=(v&&v.length===1) ? v[0] : v;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
+ return v;
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ promise = orgActions.listUnitWithIdentity(data, cb, null, !!async);
|
|
|
break;
|
|
|
case "type":
|
|
|
var data = {"identity":(typeOf(name)==="object") ? (name.distinguishedName || name.id || name.unique || name.name) : name,"type":flag};
|
|
|
- cb = function(json){ v = json.data; }.ag().catch(function(json){ return v; });
|
|
|
- orgActions.getUnitWithIdentityAndType(data, cb, null, !!async);
|
|
|
+
|
|
|
+ cb = function(json){
|
|
|
+ v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
+ return v;
|
|
|
+ };
|
|
|
+
|
|
|
+ // var cb = ((async && o2.typeOf(async)=="function") ? (async.isAG ? async : async.ag()) : null) || function(json){
|
|
|
+ // v = json.data; return v;
|
|
|
+ // }.ag().catch(function(json){ return json; });
|
|
|
+
|
|
|
+ promise = orgActions.getUnitWithIdentityAndType(data, cb, null, !!async);
|
|
|
break;
|
|
|
case "level":
|
|
|
var data = {"identity":(typeOf(name)==="object") ? (name.distinguishedName || name.id || name.unique || name.name) : name,"level":flag};
|
|
|
- cb = function(json){ v = json.data; }.ag().catch(function(json){ return v; });
|
|
|
- orgActions.getUnitWithIdentityAndLevel(data, cb, null, !!async);
|
|
|
+
|
|
|
+ cb = function(json){
|
|
|
+ v = json.data; v=(v&&v.length===1) ? v[0] : v;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
+ return v;
|
|
|
+ };
|
|
|
+
|
|
|
+ // var cb = ((async && o2.typeOf(async)=="function") ? (async.isAG ? async : async.ag()) : null) || function(json){
|
|
|
+ // v = json.data; return v;
|
|
|
+ // }.ag().catch(function(json){ return json; });
|
|
|
+
|
|
|
+ promise = orgActions.getUnitWithIdentityAndLevel(data, cb, null, !!async);
|
|
|
break;
|
|
|
}
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//列出身份所在组织的所有上级组织
|
|
|
listAllSupUnitWithIdentity: function(name, async){
|
|
|
@@ -675,10 +761,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
- orgActions.listUnitSupNestedWithIdentity(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ };
|
|
|
+
|
|
|
+ var promise = orgActions.listUnitSupNestedWithIdentity(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//获取人员所在的所有组织
|
|
|
listUnitWithPerson: function(name, async){
|
|
|
@@ -687,10 +775,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
- orgActions.listUnitWithPerson(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ };
|
|
|
+
|
|
|
+ var promise = orgActions.listUnitWithPerson(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//列出人员所在组织的所有上级组织
|
|
|
listAllSupUnitWithPerson: function(name, async){
|
|
|
@@ -699,10 +789,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
- orgActions.listUnitSupNestedWithPerson(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ };
|
|
|
+
|
|
|
+ var promise = orgActions.listUnitSupNestedWithPerson(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//根据组织属性,获取所有符合的组织
|
|
|
listUnitWithAttribute: function(name, attribute, async){
|
|
|
@@ -711,10 +803,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
- orgActions.listUnitWithAttribute(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ };
|
|
|
+
|
|
|
+ promise = orgActions.listUnitWithAttribute(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//根据组织职务,获取所有符合的组织
|
|
|
listUnitWithDuty: function(name, id, async){
|
|
|
@@ -723,10 +817,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
- orgActions.listUnitWithDuty(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ };
|
|
|
+
|
|
|
+ var promise = orgActions.listUnitWithDuty(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
|
|
|
//组织职务***********
|
|
|
@@ -735,12 +831,15 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
getOrgActions();
|
|
|
var data = {"name":duty,"unit":(typeOf(id)==="object") ? (id.distinguishedName || id.id || id.unique || id.name) : id};
|
|
|
var v = null;
|
|
|
+
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
- orgActions.getDuty(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ };
|
|
|
+
|
|
|
+ var promise = orgActions.getDuty(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//获取身份的所有职务名称
|
|
|
listDutyNameWithIdentity: function(name, async){
|
|
|
@@ -748,11 +847,13 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var data = {"identityList":getNameFlag(name)};
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
- v = json.data.nameList;
|
|
|
+ v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
- orgActions.listDutyNameWithIdentity(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ };
|
|
|
+
|
|
|
+ var promise = orgActions.listDutyNameWithIdentity(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//获取组织的所有职务名称
|
|
|
listDutyNameWithUnit: function(name, async){
|
|
|
@@ -761,10 +862,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data.nameList;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
- orgActions.listDutyNameWithUnit(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ };
|
|
|
+
|
|
|
+ var promise = orgActions.listDutyNameWithUnit(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//获取组织的所有职务
|
|
|
listUnitAllDuty: function(name, async){
|
|
|
@@ -773,10 +876,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
- orgActions.listUnitAllDuty(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ };
|
|
|
+
|
|
|
+ var promise = orgActions.listUnitAllDuty(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//列出顶层组织
|
|
|
listTopUnit: function(async){
|
|
|
@@ -784,11 +889,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- action.listTopUnit(cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var promise = action.listTopUnit(cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
|
|
|
//组织属性**************
|
|
|
@@ -847,11 +953,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data.attributeList;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- orgActions.getUnitAttribute(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var promise = orgActions.getUnitAttribute(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//列出组织所有属性的名称
|
|
|
listUnitAttributeName: function(name, async){
|
|
|
@@ -860,11 +967,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data.nameList;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- orgActions.listUnitAttributeName(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var promise = orgActions.listUnitAttributeName(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
},
|
|
|
//列出组织的所有属性
|
|
|
listUnitAllAttribute: function(name, async){
|
|
|
@@ -873,11 +981,12 @@ MWF.xScript.PageEnvironment = function (ev) {
|
|
|
var v = null;
|
|
|
var cb = function(json){
|
|
|
v = json.data;
|
|
|
+ if (async && o2.typeOf(async)=="function") return async(v);
|
|
|
return v;
|
|
|
- }.ag().catch(function(json){ return v; });
|
|
|
+ };
|
|
|
|
|
|
- orgActions.listUnitAllAttribute(data, cb, null, !!async);
|
|
|
- return (!!async) ? cb : v;
|
|
|
+ var promise = orgActions.listUnitAllAttribute(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
@@ -1873,21 +1982,29 @@ MWF.xScript.createDict = function(application){
|
|
|
if (success===true) async=true;
|
|
|
if (failure===true) async=true;
|
|
|
|
|
|
+ // var cb = function(json){
|
|
|
+ // value = json.data;
|
|
|
+ // MWF.xScript.addDictToCache(opt, path, value);
|
|
|
+ // if (success && o2.typeOf(success)=="function") value = success(json.data);
|
|
|
+ // return value;
|
|
|
+ // }.ag().catch(function(xhr, text, error){ if (failure && o2.typeOf(failure)=="function") return failure(xhr, text, error); });
|
|
|
+
|
|
|
var cb = function(json){
|
|
|
value = json.data;
|
|
|
MWF.xScript.addDictToCache(opt, path, value);
|
|
|
if (success && o2.typeOf(success)=="function") value = success(json.data);
|
|
|
return value;
|
|
|
- }.ag().catch(function(xhr, text, error){ if (failure && o2.typeOf(failure)=="function") return failure(xhr, text, error); });
|
|
|
+ };
|
|
|
|
|
|
+ var promise;
|
|
|
if (path){
|
|
|
var p = encodePath( path );
|
|
|
//var p = path.replace(/\./g, "/");
|
|
|
- action[ ( (enableAnonymous && type == "cms") ? "getDictDataAnonymous" : "getDictData" ) ](encodeURIComponent(this.name), applicationId, p, cb, null, !!async);
|
|
|
+ promise = action[ ( (enableAnonymous && type == "cms") ? "getDictDataAnonymous" : "getDictData" ) ](encodeURIComponent(this.name), applicationId, p, cb, null, !!async);
|
|
|
}else{
|
|
|
- action[ ( (enableAnonymous && type == "cms") ? "getDictRootAnonymous" : "getDictRoot" ) ](this.name, applicationId, cb, null, !!async);
|
|
|
+ promise = action[ ( (enableAnonymous && type == "cms") ? "getDictRootAnonymous" : "getDictRoot" ) ](this.name, applicationId, cb, null, !!async);
|
|
|
}
|
|
|
- return (!!async) ? cb : value;
|
|
|
+ return (!!async) ? promise : value;
|
|
|
|
|
|
// if (path){
|
|
|
// var p = encodePath( path );
|