您的位置:首页 > 其它

版本2.0字典条目

2009-07-10 13:00 197 查看
DictionaryModel

package cn.hnisi.gdrk.models.sys.dictionary;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import org.apache.commons.lang.StringUtils;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
import cn.hnisi.architecture.AbstractModel;
import cn.hnisi.architecture.common.util.CommonUtil;
import cn.hnisi.dict.dictionary.Dictionary;
import cn.hnisi.dict.dictionary.DictionaryDAOEx;
import cn.hnisi.dict.dictionarykind.DictionaryKind;
import cn.hnisi.gdrk.utils.BizGlobalConstants;
import cn.hnisi.gdrk.utils.CommonFunction;
import cn.hnisi.gdrk.utils.GenarateConnection;
import cn.hnisi.gdrk.utils.GlobalConstants;
import cn.hnisi.gdrk.workflow.jbpmengine.util.QueryConVo;

/**
*
* @author:denghuimin ,yanghanming
* @createTime:Jul 7, 2009 9:41:56 AM
* @function:字典条目类
*/
@SuppressWarnings("unchecked")
public class DictionaryModel extends AbstractModel {
private Dictionary dictionary;
private Dictionary cloneDic;
private DictionaryKind dictionaryKind;
private DictionaryDAOEx dictionaryDAOEx;
private String kindTemp;
private String detailTemp;
// 控件可操作标志
private boolean bolSave = true;
private boolean bolInput = true;
private boolean bolModify = false;
private boolean bolCancel = true;
// 是否可保存标志
private boolean bolCanSave = true;
private boolean bolUpdate = true;
// 分页控制标志
private boolean bolByQuery = true;
private List<Dictionary> diclist;
// 查询条件变量
private String codeCondition;
// 错误信息变量
private String errorStr = null;

private String save = null;
// 字典条目变量
private String dictionaryKinds;
private String dictionaryCode;
private String dictionaryDetail;
private String dictionarySpell;
private String dictionaryWb;
private String dictionaryHomophony;
private String dictionarySource;
private String dictionaryNote;

// 常量
private static final String SCBZ0 = "0";
private static final String SCBZ1 = "1";
private static final String ModifyDictionaryPane = "ModifyDictionaryPane";
private static final String DictionaryListPane = "DictionaryListPane";
private static final String AddDictionaryPane = "AddDictionaryPane";
// 分页变量
protected int rowCount = 0; // 记录数
protected int pageCount = 0; // 总页数
protected int pageSize = GlobalConstants.DEFAULT_PAGE_SIZE;// 每页显示的条数
protected int currentPageNumber = GlobalConstants.DEFAULT_PAGE_NUMBER;// 当前页码
protected int gotoPageNumber = GlobalConstants.DEFAULT_PAGE_NUMBER;

/**
*
* @author:denghuimin,yanghanming
* @createTime:Jul 9, 2009 12:18:01 AM
* @function:重写父类方法doSaveToDB
*/
public String doSaveToDB() {
Map requestParams = FacesContext.getCurrentInstance()
.getExternalContext().getRequestParameterMap();
save = (String) requestParams.get("saveFlag");
if (this.getSave().equals("save")) {
this.save();
this.fromOutcome = "AddDictionaryPane";
} else {
this.update();
this.fromOutcome = "ModifyDictionaryPane";
}
return null;
}

/**
*
* @author:denghuimin ,yanghanming
* @createTime:Jul 7, 2009 9:48:45 AM
* @function:保存字典条目:先校验拼音头和字典代码,如果字典条目代码存在 (分删除标志为1和为0两种情况,删除为1,默认为0)则不保存,如果是删除了的则恢复。
* @param:
* @return:
*/
public String save() {
// 可保存标志
bolCanSave = true;
// 判断是否存在相同的代码
bolCanSave = isExist();
// 不存在相同的字典条目代码则保存
if (bolCanSave) {
// 因hibernate原因,数据库默认不起作用,显式设置删除标志为0
dictionary.setScbz(SCBZ0);
dictionary.setDetail(this.getDictionaryDetail());
dictionary.setCode(this.getDictionaryCode());
dictionary.setSpell(this.getDictionarySpell());
dictionary.setHomophony(this.getDictionaryHomophony());
dictionary.setWb(this.getDictionaryWb());
dictionary.setSource(this.getDictionarySource());
dictionary.setNote(this.getDictionaryNote());
dictionaryDAOEx.save(dictionary);
}

return null;
}

public boolean isExist() {
// 根据字典条目类型查出所有字典条目
List<Dictionary> listTemp = dictionaryDAOEx.findByKind(dictionary
.getKind());
// 存在,设置返回标志
boolean bolResult = true;
// 遍历数据库中的相应的dictionary,查看代码是否存在,存在则不保存,已删除的则恢复
for (int i = 0; listTemp != null && i < listTemp.size(); i++) {
// 根据字典代码比较
if (StringUtils.equals(dictionary.getCode(), listTemp.get(i)
.getCode())) {
// 存在且删除标志为0
if (StringUtils.equals(listTemp.get(i).getScbz(), SCBZ0)) {
addMessage(FacesMessage.SEVERITY_WARN, null,
"该字典代码已存在,请使用其他代码!");
bolResult = false;
break;
} else {
// 存在且删除标志为1
// 恢复已删除字典条目,设置删除标志为0,并更新字典条目
listTemp.get(i).setScbz(SCBZ0);
dictionary = listTemp.get(i);
dictionaryDAOEx.attachDirty(dictionary);
addMessage(FacesMessage.SEVERITY_INFO, null,
"该字典代码已删除,现在恢复!");
bolResult = false;
break;
}
}
}
return bolResult;
}

/**
*
* @author:denghuimin, yanghanming
* @createTime:Jul 7, 2009 10:12:25 AM
* @function:更新函数
* @return:
*/
public String update() {
// 从原始的克隆对象再次克隆,用于比较字典代码是否发生修改,若没发生修改则可更新
Dictionary dic = (Dictionary) CommonUtil.cloneObject(cloneDic);
// 若字典代码没发生变化则可更新,否则进一步判断代码是否存在
if (StringUtils.equals(dic.getCode(), dictionary.getCode())) {
dictionaryDAOEx.attachDirty(dictionary);
} else {
bolSave = true;
bolModify = false;
bolCancel = true;
bolInput = true;
bolUpdate = isExist();
if (bolUpdate) {
dictionaryDAOEx.merge(dictionary);
}
}
return null;
}

/**
*
* @author:denghuimin, yanghanming
* @createTime:Jul 7, 2009 10:09:36 AM
* @function:逻辑删除字典条目
* @return:
*/
public String remove() {
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
public void doInTransactionWithoutResult(
TransactionStatus transactionStatus) {
// 获取页面传来的字典的id,遍历diclist表,如果diclist存在相同的字典条目,则从diclist中删除
Map requestParams = FacesContext.getCurrentInstance()
.getExternalContext().getRequestParameterMap();
String id = (String) requestParams.get("id");
for (int i = 0; diclist != null && i < diclist.size(); i++) {
dictionary = diclist.get(i);
if (dictionary.getId().equals(id)) {
diclist.remove(i);
break;
}
}
// 逻辑删除字典条目,设置删除标志,1代表删除,0代表不删除
dictionary.setScbz(SCBZ1);
dictionaryDAOEx.attachDirty(dictionary);
}
});
return null;
}

/**
*
* @author:denghuimin , yanghanming
* @createTime:Jul 7, 2009 10:27:03 AM
* @function:
* @return:
*/
public String addDicLink() {
this.dictionary.setKind(kindTemp);
return AddDictionaryPane;
}

/**
*
* @author:denghuimin , yanghanming
* @createTime:Jul 7, 2009 10:28:47 AM
* @function:点击修改时候,改变控件的可用性
* @return:
*/
public String changeFlag() {
bolSave = false;
bolModify = true;
bolCancel = false;
bolInput = false;
return null;
}

/**
*
* @author:denghuimin , yanghanming
* @createTime:Jul 7, 2009 10:30:02 AM
* @function:取消修改操作
* @return:
*/
public String recover() {
Dictionary dic = (Dictionary) CommonUtil.cloneObject(cloneDic);
this.setDictionary(dic);
return null;
}

/**
*
* @author:denghuimin , yanghanming
* @createTime:Jul 7, 2009 10:31:07 AM
* @function:跳转到修改页面
* @return:
*/
public String to() {
bolSave = true;
bolModify = false;
bolCancel = true;
bolInput = true;
// 获取页面传来的字典条目id
Map requestParams = FacesContext.getCurrentInstance()
.getExternalContext().getRequestParameterMap();
String id = (String) requestParams.get("id");
// 遍历diclist表,在diclist表中找到相应的字典条目
for (int i = 0; diclist != null && i < diclist.size(); i++) {
Dictionary dictTemp = (Dictionary) diclist.get(i);
if (dictTemp.getId().equals(id)) {
this.setDictionary(dictTemp);
// 克隆相应的副本作为取消修改操作时恢复字典條目
cloneDic = new Dictionary();
cloneDic = (Dictionary) CommonUtil.cloneObject(dictTemp);
break;
}
}
return ModifyDictionaryPane;
}

/**
*
* @author:denghuimin , yanghanming
* @createTime:Jul 7, 2009 10:36:26 AM
* @function:
* @param otherCondition
* @return:
*/
public String findByQueryCondition(String otherCondition) {
String errMessage = "";
List list = new ArrayList<QueryConVo>();
// 点击“字典维护”链接时候,执行此函数,判断bolByQuery标志,第一次获取页面传来的字典类型kind
if (bolByQuery) {
bolByQuery = false;
Map requestParams = FacesContext.getCurrentInstance()
.getExternalContext().getRequestParameterMap();
// kindTemp,获取页面传来的字典类型的kind,并以此为条件查找对应的字典条目
kindTemp = (String) requestParams.get("kind");
// detailTemp,获取页面传来的字典类型的中文含义,用来设置字典条目列表的标题
// 页面传过来时出现非中文字符,需要转换为中文字符
detailTemp = CommonFunction
.escapeSequenceToString((String) requestParams
.get("detail"));
this.getDictionaryKind().setDetail(detailTemp);
this.getDictionaryKind().setKind(kindTemp);
if (StringUtils.isNotBlank(kindTemp)) {
QueryConVo conVo = new QueryConVo(dictionaryDAOEx.KIND,
kindTemp);
list.add(conVo);
}
}
// 点击字典条目列表页面“查询”按钮时候,根据条件查询相应的字典条目
else {
if (StringUtils.isNotBlank(kindTemp)) {
QueryConVo conVo = new QueryConVo(dictionaryDAOEx.KIND,
kindTemp);
list.add(conVo);
}
}
diclist = new ArrayList<Dictionary>();
GenarateConnection gc = (GenarateConnection) getCtx().getBean(
BizGlobalConstants.X_GCONNECTION);
String hql = "from Dictionary as ti where 1=1 and ti.scbz ='0'";
try {
this.diclist = gc.findListForPage(hql, list, this
.getCurrentPageNumber(), this.getPageSize());
this.rowCount = gc.findCountForPage(hql, list, this
.getCurrentPageNumber(), this.getPageSize());
this.setRowCount(rowCount);
} catch (Exception e) {
e.printStackTrace();
}
return errMessage.trim();
}

/**
*
* @author:denghuimin , yanghanming
* @createTime:Jul 7, 2009 10:46:56 AM
* @function:查询时在diclist表里面查,不用再次查找数据库
* @return:
*/
public String findInDiclist() {
String code = this.getCodeCondition();
List tempList = new ArrayList();
for (int i = 0; StringUtils.isNotBlank(code) && diclist != null
&& i < diclist.size(); i++) {
dictionary = (Dictionary) diclist.get(i);
if (dictionary.getCode().equals(code)) {
tempList.add(dictionary);
}
}
diclist = tempList;
this.setRowCount(diclist.size());
return null;
}

public String doBriefQuery() {
String errMessage = "";
errMessage = findByQueryCondition(dictionary.getKind());
this.fromOutcome = DictionaryListPane;
return errMessage;
}

/**
* 获取记录总数
*
* @return
*/
public int getRowCount() {
return rowCount;
}

/**
* 设置记录总数
*
* @param recordCount
*/
public void setRowCount(int recordCount) {
this.rowCount = recordCount;
}

/**
* 获取页数
*/
public int getPageCount() {
if ((rowCount % pageSize) == 0) {
pageCount = this.rowCount / this.pageSize;
} else {
pageCount = this.rowCount / this.pageSize + 1;
}
return pageCount;

}

/**
* 设置页数
*/
public void setPageCount(int pageCount) {
this.pageCount = pageCount;
}

/**
* 获取每页记录数
*/
public int getPageSize() {
return pageSize;
}

/**
* 设置每页记录数
*
* @param pageSize
*/
public void setPageSize(int pageSize) {
if (pageSize < 1) {
this.pageSize = GlobalConstants.DEFAULT_PAGE_SIZE;
} else {
this.pageSize = pageSize;
}
}

/**
* 获取指定页
*
* @return
*/
public int getCurrentPageNumber() {
return currentPageNumber;
}

/**
* 设置指定页
*
* @param arg
*/
public void setCurrentPageNumber(int arg) {
if (arg < 1) {
this.currentPageNumber = GlobalConstants.DEFAULT_PAGE_NUMBER;
} else {
this.currentPageNumber = arg;
}

}

/**
* 第一页
*/
public String first() {
this.currentPageNumber = 1;
doBriefQuery();
toMerge();
return null;
}

/**
* 最后一页
*
* @return
*/
public String last() {
this.currentPageNumber = this.pageCount;
doBriefQuery();
toMerge();
return null;
}

/**
* 上页
*/
public String previous() {

this.currentPageNumber--;
if (this.currentPageNumber < 1)
this.currentPageNumber = 1;
if (this.currentPageNumber > this.pageCount)
this.currentPageNumber = this.pageCount;
doBriefQuery();
toMerge();
return null;
}

/**
* 下页
*
* @return
*/
public String next() {
this.currentPageNumber++;
if (this.currentPageNumber < 1)
this.currentPageNumber = 1;
if (this.currentPageNumber > this.pageCount)
this.currentPageNumber = this.pageCount;
doBriefQuery();
toMerge();
return null;
}

/**
* 去到指定页
*
* @return
*/
public String go() {
if (this.gotoPageNumber < 1) {
this.currentPageNumber = 1;
gotoPageNumber = 1;
} else if (this.gotoPageNumber > this.pageCount) {
this.currentPageNumber = this.pageCount;
this.gotoPageNumber = this.pageCount;
} else {
this.currentPageNumber = this.gotoPageNumber;
}
doBriefQuery();
toMerge();
return null;
}

/*
* 获取指定页
*/
public int getGotoPageNumber() {
return gotoPageNumber;
}

public void setGotoPageNumber(int gotoPageNumber) {
this.gotoPageNumber = gotoPageNumber;
}

public Dictionary getDictionary() {
return dictionary;
}

public void setDictionary(Dictionary dictionary) {
this.dictionary = dictionary;
}

public Dictionary getCloneDic() {
return cloneDic;
}

public void setCloneDic(Dictionary cloneDic) {
this.cloneDic = cloneDic;
}

public DictionaryKind getDictionaryKind() {
return dictionaryKind;
}

public void setDictionaryKind(DictionaryKind dictionaryKind) {
this.dictionaryKind = dictionaryKind;
}

public DictionaryDAOEx getDictionaryDAOEx() {
return dictionaryDAOEx;
}

public void setDictionaryDAOEx(DictionaryDAOEx dictionaryDAOEx) {
this.dictionaryDAOEx = dictionaryDAOEx;
}

public String getKindTemp() {
return kindTemp;
}

public void setKindTemp(String kindTemp) {
this.kindTemp = kindTemp;
}

public String getDetailTemp() {
return detailTemp;
}

public void setDetailTemp(String detailTemp) {
this.detailTemp = detailTemp;
}

public boolean isBolSave() {
return bolSave;
}

public void setBolSave(boolean bolSave) {
this.bolSave = bolSave;
}

public boolean isBolInput() {
return bolInput;
}

public void setBolInput(boolean bolInput) {
this.bolInput = bolInput;
}

public boolean isBolModify() {
return bolModify;
}

public void setBolModify(boolean bolModify) {
this.bolModify = bolModify;
}

public boolean isBolCanSave() {
return bolCanSave;
}

public void setBolCanSave(boolean bolCanSave) {
this.bolCanSave = bolCanSave;
}

public boolean isBolByQuery() {
return bolByQuery;
}

public void setBolByQuery(boolean bolByQuery) {
this.bolByQuery = bolByQuery;
}

public List<Dictionary> getDiclist() {
return diclist;
}

public void setDiclist(List<Dictionary> diclist) {
this.diclist = diclist;
}

public boolean isBolCancel() {
return bolCancel;
}

public void setBolCancel(boolean bolCancel) {
this.bolCancel = bolCancel;
}

public static String getSCBZ0() {
return SCBZ0;
}

public static String getSCBZ1() {
return SCBZ1;
}

public String getCodeCondition() {
return codeCondition;
}

public void setCodeCondition(String codeCondition) {
this.codeCondition = codeCondition;
}

public static String getModifyDictionaryPane() {
return ModifyDictionaryPane;
}

public static String getDictionaryListPane() {
return DictionaryListPane;
}

public static String getAddDictionaryPane() {
return AddDictionaryPane;
}

public String getSave() {
return save;
}

public void setSave(String save) {
this.save = save;
}

public String getDictionaryKinds() {
return dictionaryKinds;
}

public void setDictionaryKinds(String dictionaryKinds) {
this.dictionaryKinds = dictionaryKinds;
}

public String getDictionaryCode() {
return dictionaryCode;
}

public void setDictionaryCode(String dictionaryCode) {
this.dictionaryCode = dictionaryCode;
}

public String getDictionaryDetail() {
return dictionaryDetail;
}

public void setDictionaryDetail(String dictionaryDetail) {
this.dictionaryDetail = dictionaryDetail;
}

public String getDictionarySpell() {
return dictionarySpell;
}

public void setDictionarySpell(String dictionarySpell) {
this.dictionarySpell = dictionarySpell;
}

public String getDictionaryHomophony() {
return dictionaryHomophony;
}

public void setDictionaryHomophony(String dictionaryHomophony) {
this.dictionaryHomophony = dictionaryHomophony;
}

public String getDictionarySource() {
return dictionarySource;
}

public void setDictionarySource(String dictionarySource) {
this.dictionarySource = dictionarySource;
}

public String getDictionaryNote() {
return dictionaryNote;
}

public void setDictionaryNote(String dictionaryNote) {
this.dictionaryNote = dictionaryNote;
}

public String getDictionaryWb() {
return dictionaryWb;
}

public void setDictionaryWb(String dictionaryWb) {
this.dictionaryWb = dictionaryWb;
}
}


DictionaryListPane

<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:jsfext="http://www.hnisi.cn/jsfext"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:c="http://java.sun.com/jstl/core">
<ui:composition template="/cn/hnisi/gdrk/GDRKWorkspace.xhtml">
<jsfext:javascript
path="/cn/hnisi/gdrk/sys/zdgl/zdtm/js/Validation.js" />
<ui:define name="BizTitleAndToolBar">
<jsfext:defaultFocusedElement value="code" />
<h:form style="margin:0px;" mce_style="margin:0px;">
<jsfext:pageTitle title="维护字典">
<h:commandLink value="增加字典条目(n) " styleClass="toolbarButton"
accesskey="n" onmouseout="toolbarButtonMouseOut(this)"
onmouseover="toolbarButtonMouseOver(this)"
action="#{dictionaryModel.addDicLink}">
</h:commandLink>
<rich:spacer width="10" />
<h:outputLabel value="        "></h:outputLabel>
<h:commandLink value="返回(f) " styleClass="toolbarButton"
accesskey="f" onmouseout="toolbarButtonMouseOut(this)"
onmouseover="toolbarButtonMouseOver(this)"
action="#{dictionaryKindModel.onBriefQueryFormSubmit}">
</h:commandLink>
<rich:spacer width="10" />
<h:outputLabel value="        "></h:outputLabel>
<jsfext:instantHelp helpId="dzgl_bgmlp" />
</jsfext:pageTitle>
</h:form>
</ui:define>
<ui:define name="QueryConditionPanel">
<h:form style="margin:0px;" mce_style="margin:0px;" id="theBriefQueryForm">
<t:saveState value="#{dictionaryModel}" />

<table>
<tr>
<td>
字典代码:
<jsfext:inputText value="#{dictionaryModel.codeCondition}"
id="code" tabindex="1" maxlength="50">
<jsfext:jseventlistener event="onkeydown"
listener="convertEnter2Tab()" />
</jsfext:inputText>
</td>
<td>
<t:commandButton id="briefQueryButton" value=" 查 询 "
action="#{dictionaryModel.findInDiclist}" tabindex="2"
forceId="true" />
</td>
</tr>
</table>
<table align="center">
<tr>
<td height="23" align="center" colspan="2" style="font-size: 15pt" mce_style="font-size: 15pt">
<strong><h:outputLabel
value="#{dictionaryModel.dictionaryKind.detail}">
</h:outputLabel> </strong>

</td>
</tr>
</table>
</h:form>
</ui:define>
<ui:define name="QueryResult">
<h:form style="margin:0px" mce_style="margin:0px">
<t:saveState value="#{dictionaryModel}" />
<table>
<tr>
<td>
<jsfext:dataTableEx needRowClickAction="false" id="dsList2"
model="#{dictionaryModel}" columns="4" checkbox="false"
width="100%" value="#{dictionaryModel.diclist}" title=""
isJbpmList="false" height="500" fsWidth="950" fsHeight="450">

<jsfext:columnEx title="类型" value="#{temp.kind}"
isJbpmList="false" haveAction="true">
</jsfext:columnEx>
<rich:column colspan="1">
<f:facet name="header">
<h:outputLabel value="字典代码" />
</f:facet>
<div align="center">
<h:commandLink
style="font-size: 10pt; color: blue; text-decoration: none"
value="#{temp.code}" action="#{dictionaryModel.to}">
<f:param name="id" value="#{temp.id}"></f:param>
</h:commandLink>
</div>
</rich:column>
<jsfext:columnEx title="中文含义" value="#{temp.detail}"
isJbpmList="false" haveAction="true">
</jsfext:columnEx>
<jsfext:columnEx title="拼音头" value="#{temp.spell}"
isJbpmList="false" haveAction="true">
</jsfext:columnEx>
<jsfext:columnEx title="同音" value="#{temp.homophony}"
isJbpmList="false" haveAction="true">
</jsfext:columnEx>
<jsfext:columnEx title="五笔" value="#{temp.wb}"
isJbpmList="false" haveAction="true">
</jsfext:columnEx>
<jsfext:columnEx title="来源" value="#{temp.source}"
isJbpmList="false" haveAction="true">
</jsfext:columnEx>
<jsfext:columnEx title="说明" value="#{temp.note}"
isJbpmList="false" haveAction="true">
</jsfext:columnEx>
<rich:column colspan="1">
<f:facet name="header">
<h:outputLabel value="删除" />
</f:facet>
<div align="center">
<t:commandLink value="删除" styleClass="cbLink_table"
action="#{dictionaryModel.remove}"
onclick="if(!confirm('确定要删除吗?')) return false;">
<f:param name="id" value="#{temp.id}"></f:param>
</t:commandLink>
</div>
</rich:column>
</jsfext:dataTableEx>
</td>
</tr>
</table>
</h:form>
</ui:define>
</ui:composition>
</html>


ModifyDictionaryPane

<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:jsfext="http://www.hnisi.cn/jsfext"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:c="http://java.sun.com/jstl/core">
<ui:composition template="/cn/hnisi/gdrk/GDRKWorkspace.xhtml">
<ui:define name="BizTitleAndToolBar">
<h:form style="margin:0px;" mce_style="margin:0px;">
<jsfext:pageTitle title="修改字典条目">
<h:commandLink value="返回(f) "
styleClass="toolbarButton" accesskey="f"
onmouseout="toolbarButtonMouseOut(this)"
onmouseover="toolbarButtonMouseOver(this)"
action="#{dictionaryModel.onBriefQueryFormSubmit}">
</h:commandLink>
<rich:spacer width="10" />
<h:outputLabel value="        "></h:outputLabel>
<jsfext:instantHelp helpId="dzgl_bgmlp" />
</jsfext:pageTitle>
</h:form>
</ui:define>
<ui:define name="OperationPanel">

<ui:include src="/cn/hnisi/gdrk/sys/zdgl/zdtm/panel/ModifyDictionaryPanel.xhtml" mce_src="cn/hnisi/gdrk/sys/zdgl/zdtm/panel/ModifyDictionaryPanel.xhtml"></ui:include>
</ui:define>
</ui:composition>
</html>


ModifyDictionaryPanel

<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:jsfext="http://www.hnisi.cn/jsfext">
<ui:component>
<jsfext:defaultFocusedElement value="zwhy" />
<jsfext:javascript
path="/cn/hnisi/gdrk/sys/zdgl/zdtm/js/Validation.js" />
<h:form>
<t:saveState value="#{dictionaryModel}" />
<fieldset align="center"
style="width: 800; height: 200; border: 1px solid blue; margin: 0px; padding: 0px;">
<legend>
<span style="font-size: 10pt; font-weight: bold; color: black" mce_style="font-size: 10pt; font-weight: bold; color: black">字典类型信息</span>
</legend>
<table width="90%" align="center" border="0">
<tr>
<td align="right" style="font-size: 10pt" mce_style="font-size: 10pt">
类型:
</td>
<td>
<jsfext:outputText value="#{dictionaryModel.dictionary.kind}"
id="lx" style="width:200px" maxlength="50" />
</td>
<td align="right" style="font-size: 10pt" mce_style="font-size: 10pt">
字典代码:
</td>
<td>
<jsfext:inputText id="dm" size="35" tabindex="4"
value="#{dictionaryModel.dictionary.code}" required="true"
cnName="字典条目代码" disabled="#{dictionaryModel.bolInput}"
maxlength="50">
<jsfext:jseventlistener event="onkeydown"
listener="convertEnter2Tab()" />
</jsfext:inputText>
</td>
</tr>
<tr>
<td align="right" style="font-size: 10pt" mce_style="font-size: 10pt">
中文含义:
</td>
<td>
<jsfext:inputText id="zwhy" size="35" tabindex="1"
value="#{dictionaryModel.dictionary.detail}" required="true"
cnName="字典条目中文含义" disabled="#{dictionaryModel.bolInput}"
maxlength="85">
<jsfext:jseventlistener event="onkeydown"
listener="convertEnter2Tab()" />
</jsfext:inputText>
</td>
<td align="right" style="font-size: 10pt" mce_style="font-size: 10pt">
拼音头:
</td>
<td>
<jsfext:inputText id="py" size="35" tabindex="5"
value="#{dictionaryModel.dictionary.spell}"
disabled="#{dictionaryModel.bolInput}" maxlength="256">
<jsfext:jseventlistener event="onkeydown"
listener="convertEnter2Tab()" />
</jsfext:inputText>
</td>
</tr>
<tr>
<td align="right" style="font-size: 10pt" mce_style="font-size: 10pt">
同音:
</td>
<td>
<jsfext:inputText id="hpy" size="35" tabindex="2"
value="#{dictionaryModel.dictionary.homophony}"
disabled="#{dictionaryModel.bolInput}" maxlength="256">
<jsfext:jseventlistener event="onkeydown"
listener="convertEnter2Tab()" />
</jsfext:inputText>
</td>
<td align="right" style="font-size: 10pt" mce_style="font-size: 10pt">
五笔:
</td>
<td>
<jsfext:inputText id="wb" size="35" tabindex="6"
value="#{dictionaryModel.dictionary.wb}"
disabled="#{dictionaryModel.bolInput}" maxlength="128">
<jsfext:jseventlistener event="onkeydown"
listener="convertEnter2Tab()" />
</jsfext:inputText>
</td>
</tr>
<tr>

<td align="right" style="font-size: 10pt" mce_style="font-size: 10pt">
来源:
</td>
<td>
<jsfext:selectOneMenuEx2 id="ly" kind="LY" tabindex="3"
style="width:166px" value="#{dictionaryModel.dictionary.source}"
disabled="#{dictionaryModel.bolInput}" maxlength="128">
<jsfext:jseventlistener event="onkeydown"
listener="convertEnter2Tab()" />
</jsfext:selectOneMenuEx2>
</td>
<td align="right" style="font-size: 10pt" mce_style="font-size: 10pt">
说明:
</td>
<td>
<jsfext:inputText id="sm" size="35" tabindex="7"
value="#{dictionaryModel.dictionary.note}"
disabled="#{dictionaryModel.bolInput}" maxlength="128">
<jsfext:jseventlistener event="onkeydown"
listener="convertEnter2Tab()" />
</jsfext:inputText>
</td>
<t:inputHidden value="update" id="saveFlag" forceId="true" />
</tr>
</table>
<div align="center">
<h:commandButton tabindex="8" value=" 修 改 " id="Modify"
disabled="#{dictionaryModel.bolModify}"
action="#{dictionaryModel.changeFlag}" immediate="true">
</h:commandButton>

<h:commandButton tabindex="9" value=" 保 存 " id="Save"
action="#{dictionaryModel.onMainFormSubmit}"
disabled="#{dictionaryModel.bolSave}" onclick="return check()" />

<h:commandButton tabindex="10" value=" 取 消 " id="Cancel"
action="#{dictionaryModel.recover}"
disabled="#{dictionaryModel.bolCancel}">
</h:commandButton>
</div>
</fieldset>
</h:form>
</ui:component>
</html>


AddDictionaryPane

<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:jsfext="http://www.hnisi.cn/jsfext"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:c="http://java.sun.com/jstl/core">
<ui:composition template="/cn/hnisi/gdrk/GDRKWorkspace.xhtml">
<ui:define name="BizTitleAndToolBar">
<h:form style="margin:0px;" mce_style="margin:0px;">
<jsfext:pageTitle title="增加字典条目">
<h:commandLink value="返回(f)" styleClass="toolbarButton"
accesskey="f" onmouseout="toolbarButtonMouseOut(this)"
onmouseover="toolbarButtonMouseOver(this)"
action="#{dictionaryModel.onBriefQueryFormSubmit}">
</h:commandLink>
<rich:spacer width="10" />
<h:outputLabel value="        "></h:outputLabel>
<jsfext:instantHelp helpId="dzgl_bgmlp" />
</jsfext:pageTitle>
</h:form>
</ui:define>
<ui:define name="OperationPanel">
<ui:include
src="/cn/hnisi/gdrk/sys/zdgl/zdtm/panel/AddDictionaryPanel.xhtml"></ui:include>
</ui:define>
</ui:composition>
</html>


AddDictionaryPanel

<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:jsfext="http://www.hnisi.cn/jsfext">
<ui:component>
<jsfext:javascript path="/cn/hnisi/gdrk/sys/zdgl/zdtm/js/Validation.js" />
<jsfext:defaultFocusedElement value="zwhy" />
<h:form>
<t:saveState value="#{dictionaryModel}" />
<fieldset align="center"
style="width: 800; height: 200; border: 1px solid blue; margin: 0px; padding: 0px;">
<legend>
<span style="font-size: 10pt; font-weight: bold; color: black" mce_style="font-size: 10pt; font-weight: bold; color: black">字典类型信息</span>
</legend>
<table width="90%" align="center" border="0">
<tr>
<td align="right" style="font-size: 10pt" mce_style="font-size: 10pt">
类型:
</td>
<td>
<jsfext:outputText value="#{dictionaryModel.dictionary.kind}"
id="lx" style="width:200px" maxlength="50" />
</td>
<td align="right" style="font-size: 10pt" mce_style="font-size: 10pt">
字典代码:
</td>
<td>
<jsfext:inputText id="dm" size="35" tabindex="4"
value="#{dictionaryModel.dictionaryCode}" required="true"
cnName="字典条目代码" maxlength="50">
<jsfext:jseventlistener event="onkeydown"
listener="convertEnter2Tab()" />
</jsfext:inputText>
<h:message for="dm"></h:message>
</td>
</tr>
<tr>
<td align="right" style="font-size: 10pt" mce_style="font-size: 10pt">
中文含义:
</td>
<td>
<jsfext:inputText id="zwhy" size="35" tabindex="1"
value="#{dictionaryModel.dictionaryDetail}" required="true"
cnName="字典条目中文含义" maxlength="85">
<jsfext:jseventlistener event="onkeydown"
listener="convertEnter2Tab()" />
</jsfext:inputText>
</td>
<td align="right" style="font-size: 10pt" mce_style="font-size: 10pt">
拼音头:
</td>
<td>
<jsfext:inputText id="py" size="35" tabindex="5"
value="#{dictionaryModel.dictionarySpell}" maxlength="256">
<jsfext:jseventlistener event="onkeydown"
listener="convertEnter2Tab()" />
</jsfext:inputText>
</td>
</tr>
<tr>
<td align="right" style="font-size: 10pt" mce_style="font-size: 10pt">
同音:
</td>
<td>
<jsfext:inputText id="hpy" size="35" tabindex="2"
value="#{dictionaryModel.dictionaryHomophony}" maxlength="256">
<jsfext:jseventlistener event="onkeydown"
listener="convertEnter2Tab()" />
</jsfext:inputText>
</td>
<td align="right" style="font-size: 10pt" mce_style="font-size: 10pt">
五笔:
</td>
<td>
<jsfext:inputText id="wb" size="35" tabindex="6"
value="#{dictionaryModel.dictionaryWb}" maxlength="128">
<jsfext:jseventlistener event="onkeydown"
listener="convertEnter2Tab()" />
</jsfext:inputText>
</td>
</tr>
<tr>

<td align="right" style="font-size: 10pt" mce_style="font-size: 10pt">
来源:
</td>
<td>
<jsfext:selectOneMenuEx2 id="ly" kind="LY" tabindex="3"
style="width:166px" value="#{dictionaryModel.dictionarySource}"
maxlength="128">
<jsfext:jseventlistener event="onkeydown"
listener="convertEnter2Tab()" />
</jsfext:selectOneMenuEx2>
</td>
<td align="right" style="font-size: 10pt" mce_style="font-size: 10pt">
说明:
</td>
<td>
<jsfext:inputText id="sm" size="35" tabindex="7"
value="#{dictionaryModel.dictionaryNote}" maxlength="128">
<jsfext:jseventlistener event="onkeydown"
listener="convertEnter2Tab()" />
</jsfext:inputText>
</td>
<t:inputHidden value="save" id="saveFlag" forceId="true" />
</tr>
</table>
<div align="center">
<h:commandButton tabindex="8" value=" 保 存 "
action="#{dictionaryModel.onMainFormSubmit}" onclick="return check()">
</h:commandButton>
</div>
</fieldset>
</h:form>
</ui:component>
</html>


Validation.js

function check() {
var checkSpell = document.getElementById("py").value;
var checkCode = document.getElementById("dm").value;
var re1=/^[a-zA-Z]+$/;
var re2=/^[0-9]+$/;
if (!re2.test(checkCode)) {
alert("代码只能为数字!");
return false;
}
if (!re1.test(checkSpell)) {
alert("拼音头只能为字母!");
return false;
}
return true;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: