一、两个下拉框联动功能
二、实现输入框模糊 查询 下拉选择样例
1、前端脚本调用接口
var data = "{}";
var res=[];
new Request({
method:"post",
async:false,
url: o2.Actions.getHost("x_program_center") + "/x_program_center/jaxrs/invoke/getData/execute",
headers:{'Content-Type':'application/json;charset=utf-8'},
data:JSON.stringify(data),
onRequest:function(){
},
onSuccess:function(responseText){
var responsejson = JSON.parse(responseText);
var val = responsejson.data.value;
res = val.split(",");
},
onFailure:function(){
alert("error");
}
}).send();
return res;
2、接口获取自表数据
print("this.requestText="+this.requestText);
var data = {};
data["type"] = "select";
data["data"] = "select o from newTable o where 1>0";
data["maxResults"] = "20";
data["firstResult"] = "0";
var flag = "newTable";
var res = "";
var string = JSON.stringify(data);
var applications = this.applications;
var serviceRoot = "x_query_assemble_designer";
var path = "table/"+flag+"/execute";
var resp = applications.postQuery( serviceRoot, path , string);
var json = JSON.parse( resp.toString() );
var arr = json.data;
for(var i =0 ;i< arr.length;i++){
if(res == ""){
res = arr[i].name;
}else{
res =res + "," + arr[i].name;
}
}
res
三、自建表相联查询
四、自建表排序
五、表单元素显示隐藏
var tt = this.form.get("personType");
var selData = tt.getData();
var element = this.form.get("table_table$Td_16");
var element17 = this.form.get("table_table$Td_17");
if("合作方"== selData){
debugger;
element.node.style.display="none";
element17.node.style.display="none";
}else{
debugger;
element.node.style.display="";
element17.node.style.display="";
}
六、通过群组获取人员身份
var groupList = this.org.getGroup( "test" );
var personList =groupList.personList;
var ipersonList = [];
for(var i=0;i var personList2 = this.org.listIdentityWithPerson(personList[i] );
if( personList2.length > 0){
ipersonList.push(personList2[0].distinguishedName);
}
}
return ipersonList;
七、通过职务获取人员身份
var dutyName = "班组长";
var unit = "xxhb";
var identityList = this.org.getDuty( dutyName, unit );
return [identityList[0].distinguishedName];
八、通过角色获了人员身份
var roleList = this.org.getRole( "test" );
debugger;
var personList = roleList.personList;
var iperson = [];
debugger;
for(var i=0;i < personList.length;i++){
var personList2 = this.org.listIdentityWithPerson( personList[i] );
iperson[i] = personList2[0].distinguishedName;
}
return iperson;
九、获取发起人部门
var task = this.workContext.getTask();
return task.creatorUnit;
十、获起发起人
return this.workContext.getTask().creatorPerson;
十一、获取手机号
var person = this.org.getPerson( this.workContext.getTask().creatorPerson );
return person.mobile;
十二、表单域取值与赋值
var tt = this.form.get("org");
var selData = tt.getData();
var selName = selData[0].personDn;
debugger;
this.form.get("dep").setData(selData[0].unitName);
this.form.get("textfield").setData(selData[0].personEmployee);
var person = this.org.getPerson( selName );
this.form.get("mobile").setData(person.mobile);
十三、创建待阅
var data = {};
data["identityList"] = ['办公室员工@a48222f1-8d15-497b-b79c-a11544505809@I'];
data["notify"] = "请阅";
//var work = this.workContext.getWork();
//var workId = work.id;
var workId = "ae3268d3-88b5-4d62-acc4-5a258e2f34d5";
print("workId=" + workId);
var string = JSON.stringify(data);
var applications = this.applications;
var serviceRoot = "x_processplatform_service_processing";
var path = "read/work/"+workId;
var resp = applications.postQuery( serviceRoot, path , string);
print(resp.toString() );
十四、获取编号
var work = this.workContext.getWork();
return work.serial;