首页 > 学院 > 开发设计 > 正文

EAS开发之接口小程序上

2019-11-06 06:19:40
字体:
来源:转载
供稿:网友

EAS开发之接口小程序上

PS:排版不好还请见谅

界面控件用法界面代码展示扩展链接

界面控件用法

KDLabelContainer 标签容器控件 为了与标签与文本框或选取框连接起来使界面更加美观。KDBizPRomptBox F7选择框控件 通过自定义query来确定选取框搜索内容,具体用法代码注释里面有。KDButton 按钮控件 在UI中创建按钮,双击进入代码编辑内容,不编辑然后发布,在ui的java文件中即出现响应按钮功能编辑方法。KDTextField 文本框控件 用户可输入文本的控件,默认格式为String,在代码区域可通过 this.name.getText().toString 取得输入内容,通过 this.name.setText(内容) 设置显示内容。MsgBox.showWarning() 弹出框注: 命名要规范; 界面设计要考虑用户体验;

界面代码展示

我会尽可能的完善注释,如有不明白或者错误的地方,请留言给我或者给我发邮件 —— [ 联系我 ]

package com.kingdee.eas.custom.pxb.client;import java.awt.event.*;import net.sf.json.JSONObject;import org.apache.log4j.Logger;import com.kingdee.bos.ui.face.CoreUIObject;import com.kingdee.bos.ctrl.extendcontrols.KDBizPromptBox;import com.kingdee.bos.dao.IObjectValue;import com.kingdee.eas.base.permission.client.UserF7UI;import com.kingdee.eas.basedata.org.client.f7.*;import com.kingdee.eas.basedata.person.client.PersonF7Const;import com.kingdee.eas.basedata.person.client.PersonF7Filter;import com.kingdee.eas.basedata.person.client.PersonF7UI;import com.kingdee.eas.common.client.SysContext;import com.kingdee.eas.custom.pxb.ipxbComFacade;import com.kingdee.eas.custom.pxb.IPxbPreFacade;import com.kingdee.eas.custom.pxb.PxbComFacadeFactory;import com.kingdee.eas.custom.pxb.PxbPreFacadeFactory;import com.kingdee.eas.fm.gnt.common.PersonF7;import com.kingdee.eas.framework.*;import com.kingdee.eas.hr.base.client.F7ListUI;import com.kingdee.eas.util.SysUtil;import com.kingdee.eas.util.client.MsgBox;/** * output class name */public class PxbPerUI extends AbstractPxbPerUI{ private static final Logger logger = CoreUIObject.getLogger(PxbPerUI.class); /** * output class constructor */ public PxbPerUI() throws Exception { super();//自定义F7配置 //setQueryInfo() 查询对象的PK值,String类型,且主对象必须是主键。//set*Format() 设置显示及其他状态的显示属性。 this.pref7.setQueryInfo("com.kingdee.eas.basedata.person.app.PersonQuery"); this.pref7.setEditFormat("$name$"); this.pref7.setDisplayFormat("$name$"); this.pref7.setCommitFormat("$name$"); } /** * output storeFields method */ public void storeFields() { super.storeFields(); } /** * output preadd_actionPerformed method */ //添加员工 protected void preadd_actionPerformed(java.awt.event.ActionEvent e) throws Exception { String pername = null, perid = null,perorg = null,comid = null; String result = ""; //取F7控件查询对象对应key值的数据 if (this.pref7.getValue() != null) { perid = ((AbstractCoreBaseInfo) this.pref7.getValue()).getString("id"); //comid= ((AbstractCoreBaseInfo) this.comf7.getValue()).getString("id"); pername = ((AbstractCoreBaseInfo) this.pref7.getValue()).getString("name_l2"); } else { MsgBox.showWarning("员工或组织不能为空"); SysUtil.abort(); } //调用接口,来使用服务器方法。 IPxbPreFacade ip = PxbPreFacadeFactory.getRemoteInstance(); result = ip.preadd(pername,perid); if(result.equals("已存在")==true){ MsgBox.showWarning("该员工已存在"); }else{ if(result.equals("插入失败")==true){ MsgBox.showWarning("执行插入失败"); } else{ MsgBox.showWarning("添加成功"); } } super.preadd_actionPerformed(e); } /** * output preget_actionPerformed method */ //获得员工数据 protected void preget_actionPerformed(java.awt.event.ActionEvent e) throws Exception { String pername = null, perid = null,perorg = null,comid = null,comname = null; String result = ""; if (this.pref7.getValue() != null) { perid = ((AbstractCoreBaseInfo) this.pref7.getValue()).getString("id"); //comid= ((AbstractCoreBaseInfo) this.comf7.getValue()).getString("id"); pername = ((AbstractCoreBaseInfo) this.pref7.getValue()).getString("name_l2"); //comname = ((AbstractCoreBaseInfo) this.comf7.getValue()).getString("name_l2"); } else { MsgBox.showWarning("员工不能为空"); SysUtil.abort(); } IPxbPreFacade ip = PxbPreFacadeFactory.getRemoteInstance(); result = ip.preget(pername); if(result.equals("员工不存在")){ MsgBox.showWarning("该组织不存在"); }else{ JSONObject jsondata = (JSONObject) JSONObject.fromObject(result); //模拟json数据 //JSONObject json = (JSONObject) JSONObject.fromObject(result) ; //JSONObject jsondata = json.getJSONObject("data"); String id = jsondata.getString("id"); String pid = jsondata.getString("name"); String orgid = jsondata.getString("orgid"); String esid = jsondata.getString("esid"); MsgBox.showWarning("查询成功,员工名字为"+pid+"。");//组织名称为"+comname+"."); super.preget_actionPerformed(e); } } /** * output predel_actionPerformed method */ //删除员工信息 protected void predel_actionPerformed(java.awt.event.ActionEvent e) throws Exception { String pername = null, perid = null,perorg = null,comid = null; String result = ""; if (this.pref7.getValue() != null) { perid = ((AbstractCoreBaseInfo) this.pref7.getValue()).getString("id"); //comid= ((AbstractCoreBaseInfo) this.comf7.getValue()).getString("id"); pername = ((AbstractCoreBaseInfo) this.pref7.getValue()).getString("name_l2"); } else { MsgBox.showWarning("员工或组织不能为空"); SysUtil.abort(); } IPxbPreFacade ip = PxbPreFacadeFactory.getRemoteInstance(); result = ip.predel(perid); MsgBox.showWarning("删除成功"); super.predel_actionPerformed(e); } /** * output preup_actionPerformed method */ //更新员工信息 protected void preup_actionPerformed(java.awt.event.ActionEvent e) throws Exception { String pername = null, perid = null,perorg = null,comid = null,comname = null; String result = ""; if (this.pref7.getValue() != null) { perid = ((AbstractCoreBaseInfo) this.pref7.getValue()).getString("id"); //comid= ((AbstractCoreBaseInfo) this.comf7.getValue()).getString("id"); pername = ((AbstractCoreBaseInfo) this.pref7.getValue()).getString("name_l2"); //comname = ((AbstractCoreBaseInfo) this.comf7.getValue()).getString("name_l2"); } else { MsgBox.showWarning("员工不能为空"); SysUtil.abort(); } //String id = this.preupid.getText().toString(); IPxbPreFacade ip = PxbPreFacadeFactory.getRemoteInstance(); result = ip.preup(perid,pername,comid,pername); if(result.equals("组织不存在")==true){ MsgBox.showWarning("该员工未添加"); }else{ MsgBox.showWarning("组织内容更新完成"); } super.preup_actionPerformed(e); } /** * output precrbd_actionPerformed method */ //创建数据表 protected void precrbd_actionPerformed(java.awt.event.ActionEvent e) throws Exception { IPxbPreFacade ip = PxbPreFacadeFactory.getRemoteInstance(); ip.precrdb(); //super.precrbd_actionPerformed(e); }}

F7配置代码扩展

//行政组织//用系统自带的组织架构F7功能this.setUITitle("培训宝组织管理");//行政组织对象 AdminF7AdminF7 sf7 = new AdminF7();if (!SysContext.getSysContext().getCurrentOrgUnit().getId().toString().equals("00000000-0000-0000-0000-000000000000CCE7AED4")) { sf7.setIsCUFilter(true); } this.comf7.setSelector(sf7); this.comf7.setRequired(true); this.comf7.setValue(SysContext.getSysContext() .getCurrentAdminUnit()); this.comf7up.setSelector(sf7); this.comf7up.setRequired(true); this.comf7up.setValue(SysContext.getSysContext() .getCurrentAdminUnit());

扩展链接

F7实体对象应用可参考



发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表