本文主要是介绍普元-提高效率:查询、删除、保存(),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.写一个公共查询、删除逻辑流
查询:
点击逻辑构件空白处:
此处的name则你前端JSP传递过来的实体、查询实体名称
删除:params是前端页面你勾选的数据
空白处:
保存:
空白处:
2.jsp页面:form表单放入你的查询条件(即界面显示或部分隐藏字段)
此处的bgtOrgId和setOfBooksId为隐藏字段。
<form id="searchform">
<div class="nui-toolbar" style="border-bottom: 0; padding: 0px;">
<table style="width:100%;" class="nui-form-table">
<tr>
<th class="form_label">类型代码:</th>
<td><input id="bgtJournalTypeCode" name="criteria/_expr[2]/bgtJournalTypeCode" class="nui-textbox nui-form-input" /></td>
<th class="form_label">类型描述:</th>
<td><input id="description" name="criteria/_expr[3]/description" class="nui-textbox nui-form-input"/></td>
<th class="form_label"></th>
<td>
<a class="mini-button" iconCls="fssc-save" οnclick="search()">查询</a>
<a class="mini-button" iconCls="fssc-ok" οnclick="onReset()">重置</a>
</td>
</tr>
</table>
</div>
<input class="nui-hidden" name="criteria/_expr[1]/bgtOrgId" id="bgtOrgId" value=""/>
<input class="nui-hidden" name="criteria/_expr[1]/_op" value="=">
<input class="nui-hidden" name="criteria/_expr[2]/_op" value="like">
<input class="nui-hidden" name="criteria/_expr[3]/_op" value="like">
<input class="nui-hidden" id="setOfBooksId" name="setOfBooksId" >
</form>
删除按钮:
<div style="width:100%;">
<div class="mini-toolbar" style="border-bottom:0;padding:0px;">
<table style="width:100%;">
<tr>
<td style="width:100%;">
<a class="nui-button" iconCls="fssc-save" οnclick="saveData()">保存</a>
<a class="nui-button" iconCls="fssc-collapse" οnclick="removeRow()">删除</a>
</td>
</tr>
</table>
</div>
</div>
grid列表:此处的URL是你前面建的公共查询逻辑构件
<div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" allowAlternating="true"
allowResize="false" pageSize="10" showPager="true" allowcellvalid="true" frozenStartColumn="0" frozenEndColumn="4"
allowCellEdit="true" allowCellSelect="true" multiSelect="true" oncellbeginedit="onCellBeginEdit" oncellendedit="" oncellvalidation=""
url="com.sgai.fssc.service.hec4cwgx.common.common.queryCommonConf.biz.ext" dataField="dataList" totalCount="total">
<div property="columns" >
<div type="checkcolumn"></div>
<div field="bgtJournalTypeCode" align="center" headerAlign="center" width="100" vtype="required">类型代码
<input property="editor" class="mini-textbox" allowInput="true" style="width:100%;" />
</div>
............................此处字段太多久不放上了了
</div>
</div>
JS:如:
<script type="text/javascript">
var form = new nui.Form("#searchform");
var grid1 = nui.get("datagrid1");
var name = "com.sgai.fssc.service.hec4cwgx.bgtEntity.BgtJournalTypes";
search();
function search(){
//查询所属公司账簿的预算组织
nui.ajax({
url:"com.sgai.fssc.service.hec4cwgx.bgt.bgtperiods.queryBgtOrgCode.biz.ext",
type:'post',
contentType:'text/json',
success:function(datas){
if(datas.datas[0].bgtOrgCode==""){
showAlert("系统提示","请配置预算组织定义");
}else{
nui.get("bgtOrgId").setValue(datas.datas[0].sid);
nui.get("setOfBooksId").setValue(datas.datas[0].setOfBooksId);
var json = form.getData(false,false);
var queryName = "com.sgai.fssc.service.hec4cwgx.bgtEntity.QueryBgtJournalTypeDef";//实体、查询实体名称
json.name = queryName;
grid1.load(json);
}
}
});
}
//删除
function removeRow(){
var rows=grid1.getSelecteds();
if(rows.length > 0){
var json=nui.encode({"params":rows,name:name});
nui.confirm("确定删除选中记录?", "系统提示", function(action){
if(action!="ok")return;
nui.ajax({
url:"com.sgai.fssc.service.hec4cwgx.common.common.delCommonConf.biz.ext",
type:'post',
data:json,
contentType:'text/json',
success:function(text){
search();
}
});
});
} else {
showAlert("失败","请选中一条记录");
}
}
function saveData(){
grid1.validate();
if(!grid1.isValid())return;
var data = grid1.getChanges();
var json=nui.encode({params:data,name:name});
nui.ajax({
url:"com.sgai.fssc.service.hec4cwgx.common.common.saveCommonConf.biz.ext",
type:'post',
contentType:'text/json',
data:json,
success:function(text){
var rtn = text.rtn;
if(rtn == "1"){
showAlert("成功","保存成功!");
search();
} else {
showAlert("失败","保存失败!");
}
}
});
}
</script>
这篇关于普元-提高效率:查询、删除、保存()的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!