调用osf函数

EAS 移动bos_前端

EAS 移动bos_vue.js_02

EAS 移动bos_javascript_03

var  personEducationInfos=null; //教育信息
var personRewardPunishInfos=null; //奖惩信息
var personTechPostInfos=null; //职称信息




_self.pageinit=function(){

//获取我的档案
//_private.fillMyArchiveEvent(); //单据头信息渲染
var success = function(data){
var obj = eval('(' + data.resultPersonInfo + ')');
var personInfo=obj.personInfo;

$("#name").text( personInfo.name);
$("#position").text( personInfo.position.name);
var sexValue= obj.personInfo.gender.value;

mbos('sex').value({
alias: obj.personInfo.gender.alias,
enumclass: "com.kingdee.eas.basedata.person.Genders",
isenum: true,
value:sexValue
});

var imgsrc= ['data:image/png;base64,'+obj.personInfo.photo+''].join('');
$("#photo").attr("src", imgsrc);
if(obj.personInfo.photo==""){
_private.showDefaultImg();
}

$("#name").text( obj.personInfo.name);
$("#position").text( obj.personInfo.position.name);

mbos('person').value({
"bosType":"80EF7DED",
"id":obj.personInfo.number.id,
"number":obj.personInfo.number.number,
"orgRange":[],
"orgRangeIncludeSubOrg":[]
});

mbos('dept').value({
"bosType":"6A6435BE",
"id":obj.personInfo.adminOrg.id,
"name":obj.personInfo.adminOrg.name,
"orgRange":[],
"orgRangeIncludeSubOrg":[]
});

mbos('zhiwei').value({
"bosType":"74AE612E",
"id":obj.personInfo.position.id,
"name":obj.personInfo.position.name,
"orgRange":[],
"orgRangeIncludeSubOrg":[]
});

mbos('JobGradeF7').value({
"bosType":"67F02330",
"id":obj.personInfo.jobGrade.id,
"name":obj.personInfo.jobGrade.name,
"orgRange":[],
"orgRangeIncludeSubOrg":[]
});

mbos('maritalStatus').value({
"bosType":"7A9AFC47",
"id":obj.personInfo.wed.id,
"name":obj.personInfo.wed.name,
"orgRange":[],
"orgRangeIncludeSubOrg":[]
});


mbos('political').value({
"bosType":"791DBAAB",
"id":obj.personInfo.political.id,
"name":obj.personInfo.political.name,
"orgRange":[],
"orgRangeIncludeSubOrg":[]
});


mbos('nation').value({
"bosType":"D8BCF937",
"id":obj.personInfo.folk.id,
"name":obj.personInfo.folk.name,
"orgRange":[],
"orgRangeIncludeSubOrg":[]
});

mbos('mailingAddress').value(obj.personInfo.addressTX ) //通信地址
mbos('birthday').value(obj.personInfo.birthday ) //出生年月
mbos('registeredRegistered').value(obj.personInfo.nativePlace ) //户口所在地(户籍地址)
mbos('personName').value(obj.personInfo.name ) ;//
mbos('phone').value(obj.contactInfo.telNum ) ;//手机号码
mbos('email').value(obj.contactInfo.email ) ;//电子邮箱
mbos('emergencyContactPhone').value(obj.contactInfo.assTel ) ;//紧急联系人姓名
mbos('emergencyContactName').value(obj.contactInfo.assName ) ; //紧急联系人姓名
mbos('iDcardbegins').value(obj.personInfo.idCardBeginDate ) ;//身份证有效期开始
mbos('iDcardExpiry').value(obj.personInfo.idCardEndDate ) ;//身份证有效期截止
mbos('longTermvalidity').value(obj.personInfo.idCardLongEffect ) ;//身份证长期有效

console.log("------------------员工基本信息---------------");
console.log(obj.personInfo);
console.log(data);



//----------------------------------------------------------------------
var applierID=obj.personInfo.number.id;
console.log("人员id");
console.log(obj.personInfo.number.id);
mbos.eas.invokeScript({
name:"getBillID",
param:[applierID],
success:function(data){
console.log("根据人员id获取单据id----");
console.log(data);
if(data&&data.length >0){
var billid = data[0].fid;
mbos('id').value(billid);
}
},
error:function(data){
mbos.msgBox.showInfo("获取单据id出错");//将打印服务端的sql语句
}
})
//----------------------------------------------------------------------

}

var fail = function(data){
console.log(data);
}

mbos.eas.invokeScript("getPersonInfoForMobile",null,success,fail);


_private.getpersonTechPostInfoEvent();//获取职称信息
_private.getpersonRewardPunishInfoEvent();//奖惩信息
_private.getPersonDegreeEvent();//教育信息

return page.pageinit && page.pageinit(event);
}




mbos('page').bind('onCreateData',function(){



})


//加载时获取单据id
_private.getBillIDEvent = function(){
var applierID=mbos("entity").value().person.id;
mbos.eas.invokeScript({
name:"getBillID",
param:[applierID],
success:function(data){
if(data&&data.length >0){
var billid = data[0];
mbos('id').value(billid);
}
},
error:function(data){
mbos.msgBox.showInfo("获取单据id出错");//将打印服务端的sql语句
}
})

}



// 初始化 新增职称息分录
_private.getpersonTechPostInfoEvent = function(){


var success = function(data){
//先移除所有分录
var obj = eval('(' + data.resultTechPost+ ')');
personTechPostInfos= (obj.personTechPostInfo);
console.log("---------------------职称信息-----------------------");
console.log(personTechPostInfos);

for(var i in personTechPostInfos){
if( mbos('entity').value().entrys.length<=0){
mbos('editgrid1').addEntry();
}
}
}

var fail = function(data){
mbos.ui.showInfo(data);
console.log(data);
}
mbos.eas.invokeScript("getTechPostForMobile",null,success,fail);
}


// 初始化 新增教育信息分录
_private.getPersonDegreeEvent = function(){

var success = function(data){
var obj = eval('(' + data.resultEducation+ ')');
personEducationInfos= (obj.personEducationInfo);
console.log("---------------------教育信息------------------------");
console.log(data);
console.log(personEducationInfos);
for(var i in personEducationInfos){
if( mbos('entity').value().entrys.length<=0){
mbos('editgrid3').addEntry();
}
}
}
var fail = function(data){
mbos.ui.showInfo(data);
console.log(data);
}
mbos.eas.invokeScript("getEducationForMobile",null,success,fail);



mbos('editgrid3').bind('afterRendered',function(e){
e.index;//新增分录的序号
console.log( "教育分录序列号");
console.log( e.index );

//教育经历赋值-------------------------------------------------------------------------------------------------------
for(var i in personEducationInfos){
var personEducationInfo= (personEducationInfos[i]);

//学习形式F7
if(personEducationInfo.hasOwnProperty('studyPattern')){
var f7studyPattern={};
f7studyPattern.id=personEducationInfo.studyPattern.id;
f7studyPattern.name=personEducationInfo.studyPattern.name;
f7studyPattern.number=personEducationInfo.studyPattern.number;
mbos('entity').value().entrys3[i].studyType =f7studyPattern; //学习形式
}

// mbos('entity').value().entrys3[i].id ="dB/qwcH5TlyeOazPFLZG/OrQyf0="; //教育信息中的分录id 二开表中的分录id
mbos('entity').value().entrys3[i].shrId =personEducationInfo.id ; // 分录id shr中的

//-------------------------------------------获取分录id------------------------------------
mbos.eas.invokeScript({
name:"getEntrys3",
param:[personEducationInfo.id],
success:function(data){
console.log("根据shr分录id获取教育信息分录id----");
console.log(data);
if(data&&data.length >0){
var entryid = data[0].fid;
mbos('entity').value().entrys3[i].id =entryid;
}
},
error:function(data){
mbos.msgBox.showInfo("获取教育信息分录id");//将打印服务端的sql语句
}
})
//-------------------------------------------获取分录id-------------------------------------

//----------------------------------------------------------------------------------------------
mbos('entity').value().entrys3[i].school =personEducationInfo.graduateSchool ; //学校
mbos('entity').value().entrys3[i].admissionTime =personEducationInfo.enrollDate ; //入学时间
mbos('entity').value().entrys3[i].graduationTime =personEducationInfo.graduateDate ; //毕业时间

mbos('entity').value().entrys3[i].specialty =personEducationInfo.specialty ; //专业
mbos('entity').value().entrys3[i].educationalSystem =personEducationInfo.studyLength ; // 学制

//学历F7
if(personEducationInfo.hasOwnProperty('diploma')){
var f7diploma={};
f7diploma.id=personEducationInfo.diploma.id;
f7diploma.name=personEducationInfo.diploma.name;
f7diploma.number=personEducationInfo.diploma.number;
mbos('entity').value().entrys3[i].education =f7diploma ; // 学历 (分录的F7字段赋值)
}


//学位F7
if(personEducationInfo.hasOwnProperty('degree')){
var f7degree={};
f7degree.id=personEducationInfo.degree.id;
f7degree.name=personEducationInfo.degree.name;
f7degree.number=personEducationInfo.degree.number;
mbos('entity').value().entrys3[i].academic =f7degree ; // 学位 (分录的F7字段赋值)
}
}
})


}


// 初始化 新增奖惩信息分录
_private.getpersonRewardPunishInfoEvent = function(){
var success = function(data){
var obj = eval('(' + data.resultRewardPunish+ ')');
personRewardPunishInfos= (obj.personRewardPunishInfo);
console.log("---------------------奖惩信息------------------------");
console.log(obj);
for(var i in personRewardPunishInfos){
if( mbos('entity').value().entrys.length<=0){
mbos('editgrid2').addEntry();
}
}

}
var fail = function(data){
mbos.ui.showInfo(data);
console.log(data);
}
mbos.eas.invokeScript("getRewardPunishForMobile",null,success,fail);
}



mbos('editgrid1').bind('afterRendered',function(e){
e.index;//新增分录的序号
console.log( "职称分录序列号");
console.log( e.index );
//职称信息-----------------------------------------------------------------------------------------------------------------
for(var i in personTechPostInfos){
var personTechPostInfo= (personTechPostInfos[i]);

if(personTechPostInfo.hasOwnProperty('techPost')){
//职称F7
var f7techPost={};
f7techPost.id=personTechPostInfo.techPost.id;
f7techPost.name=personTechPostInfo.techPost.name;
f7techPost.number=personTechPostInfo.techPost.number;
mbos('entity').value().entrys[i].title =f7techPost ; //职称
}
mbos('entity').value().entrys[i].shrId =personTechPostInfo.id; //职称分录id shr中的

//--------------------------------------------------------------------------------------------------
mbos.eas.invokeScript({
name:"getEntrysId",
param:[personTechPostInfo.id],
success:function(data){
console.log("根据shr分录id获取职称信息分录id----");
console.log(data);
if(data&&data.length >0){
var entryid = data[0].fid;
mbos('entity').value().entrys[i].id =entryid;
}
},
error:function(data){
mbos.msgBox.showInfo("获取职称信息分录id");//将打印服务端的sql语句
}
})
//-------------------------------------------------------------------------------------------------

mbos('entity').value().entrys[i].awardDate =personTechPostInfo.conferDate; //职称授予日期
mbos('entity').value().entrys[i].titleContent =personTechPostInfo.technicalCont; //职称内容
mbos('entity').value().entrys[i].rewardAndPunishUnittxt =personTechPostInfo.gradeUnit; //评定单位
mbos('entity').value().entrys[i].certifiCateno =personTechPostInfo.certificateNo; //证书编号
mbos('entity').value().entrys[i].highestProfessional =personTechPostInfo.isHighTechnical; // 最高职称
}

})



//分录渲染后会执行
mbos('editgrid2').bind('afterRendered',function(e){
e.index;//新增分录的序号
console.log( "奖惩分录序列号");
console.log( e.index );

//奖惩信息赋值----------------------------------------------------------------------------------------------------
for(var i in personRewardPunishInfos){
var personRewardPunishInfo= (personRewardPunishInfos[i]);


if(personRewardPunishInfo.hasOwnProperty('rpType')){
//奖罚类型F7
var f7rpType={};
f7rpType.id=personRewardPunishInfo.rpType.id;
f7rpType.name=personRewardPunishInfo.rpType.name;
f7rpType.number=personRewardPunishInfo.rpType.number;
mbos('entity').value().entrys2[i].rewardPunishmentType =f7rpType ; //奖罚类型
}

if(personRewardPunishInfo.hasOwnProperty('rpLevel')){
//奖罚级别F7
var rpLevelF7={};
rpLevelF7.id=personRewardPunishInfo.rpLevel.id;
rpLevelF7.name=personRewardPunishInfo.rpLevel.name;
rpLevelF7.number=personRewardPunishInfo.rpLevel.number;
mbos('entity').value().entrys2[i].rewardPunishmentLevel =rpLevelF7 ; // 奖罚级别
}
//奖惩分录id shr shrId
mbos('entity').value().entrys2[i].shrId =personRewardPunishInfo.id ;


//--------------------------------------------------------------------------------------------------
mbos.eas.invokeScript({
name:"getEntrys2",
param:[personRewardPunishInfo.id],
success:function(data){
console.log("根据shr分录id获取奖惩信息分录id----");
console.log(data);
if(data&&data.length >0){
var entryid = data[0].fid;
mbos('entity').value().entrys2[i].id =entryid;
}
},
error:function(data){
mbos.msgBox.showInfo("获取奖惩信息分录id");//将打印服务端的sql语句
}
})
//-------------------------------------------------------------------------------------------------


mbos('entity').value().entrys2[i].rewardAndPunishment =personRewardPunishInfo.content ; //奖罚内容
mbos('entity').value().entrys2[i].rewardPunishmentDate =personRewardPunishInfo.occurDate ; //奖惩时间
mbos('entity').value().entrys2[i].rewardAndPunishUnittxt =personRewardPunishInfo.jcdw ; //奖惩单位
mbos('entity').value().entrys2[i].rewardPunishmentwh =personRewardPunishInfo.jcwh; //奖罚文号
mbos('entity').value().entrys2[i].rewardPunishmenttitle =personRewardPunishInfo.title ; // 奖惩信息标
}

})





_private.showDefaultImg = function(img){
var imgsrc= ['data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAB4CAYAAAAE9le0AAAEcUlEQVR42u2cV27rMBBFuf+1pfdq',
'I7049haUdw0IMPRkiSocjqLzcT/SbIdHnMYZhs1mUyA/CiwCQBBAAIIAAhAEEIAggACEhQAIAghA',
'EEAAggACEAQQgCCAIIAABAEEIAggAHGm9XpdfH9/Fx8fH8Xb21vx/v6+/VrfB4gRAC387e1tcXx8',
'XBwcHOzV0dHR9vdeXl4mCcg1kNVqVTw8PBSHh4eNEPZJf3d3d1d8fX0BZIh+fn6Kx8fH3iDqwAis',
'AAOko+QP2sxSX8mcvb6+AiRWz8/Po+2Kpt2yWCwA0iYtUk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WZdguTluNz1fc2BWJ5gWXVFLRVA3bzF+ubI4aardA377C880oZtiCU',
'anvilZuUB1apo6uqZMbNgXi/QGbKw6MhZwHxL0qWwxyISgVlCyf6X3Qu0kqKAAIQBBAEEIAggAAE',
'AQQgCCAAQQABCIsAEAQQgCCAAAQBBCAIIABBAEEAmYZ+Acsb6tSP1j3TAAAAAElFTkSuQmCC'].join('');
$("#photo").attr("src", imgsrc);
//img.onerror = null;
}





_this.edit = function(event){


return page.edit && page.edit(event);

}
_this.addnew = function(event){

// _private.save(event);

return page.addnew && page.addnew(event);

}
_this.save = function(event){

return page.save && page.save(event);

}

_this.submit = function(event){


console.log( "点提交之后的单据id" );
console.log( mbos("entity").value().id );
var params = [];
var param={};
var billId=mbos("entity").value().id;
param.billId=billId;
params[0] = param;
var success = function(data){
// //提交后删除 这个员工的所有分录信息
// mbos.eas.invokeScript({
// name:"deleteAllEntrys",
// param:[mbos("entity").value().id],
// success:function(data){

// },
// error:function(data){
// mbos.msgBox.showInfo(data);
// }
// })

}
var fail = function(data){
mbos.msgBox.showError(data);
}


mbos.eas.invokeScript("auditPersonInfo",params,success,fail);// 审核方法----------
return page.submit && page.submit(event);

}


_this.back = function(event){

return page.back && page.back(event);

}