记录使用jeecg页面添加自定义查询

26 篇文章 2 订阅
10 篇文章 0 订阅
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<link rel="stylesheet" href="plug-in/select2/css/select2.min.css">
<script type="text/javascript" src="plug-in/select2/js/select2.full.min.js"></script>
<div class="easyui-layout" fit="true">
  <div region="center" style="padding:0px;border:0px">
  <t:datagrid name="priceFreightpriceList" checkbox="true" pagination="true" fitColumns="false" title="运费管理" sortName="createDate" actionUrl="priceFreightpriceController.do?datagrid&priceLevel=${priceLevel }&priceType=${priceType }" idField="id" fit="true" queryMode="group">
   <t:dgCol title="取自序列seq_price"  field="id"  hidden="true"  queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="回退"  field="priceWithdrawsign"  queryMode="group"  dictionary="is_main" width="120"></t:dgCol>
   <t:dgCol title="状态"  field="priceStatus"  queryMode="single" query="true"  dictionary="frestatus" width="120"></t:dgCol>
   <t:dgCol title="外部备注"  field="priceNote"  queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="产品类型"  field="productType"  queryMode="single"  query="true"  dictionary="pro_type" width="120"></t:dgCol>
   <t:dgCol title="计费地点"  field="sysCompanyCode"  queryMode="group"  dictionary="t_s_depart,org_code,departname"  width="120"></t:dgCol>
   <t:dgCol title="销售产品"  field="productId"  queryMode="single"  hidden="true"  width="150"></t:dgCol>
   <t:dgCol title="销售产品"  field="productName"  queryMode="single"  width="150"></t:dgCol>
   <t:dgCol title="产品分类"  field="groupCode"  queryMode="group"  width="120"  dictionary="pro_group"></t:dgCol>
   <t:dgCol title="币种"  field="currencykindCode"  queryMode="group"  dictionary="customer_curr,curr_code,curr_name" width="120"></t:dgCol>
   <t:dgCol title="显示"  field="priceZonestyle"  queryMode="group"  width="120"></t:dgCol>
   <c:if test="${priceLevel != 'COST'}">
	   <t:dgCol title="内部备注"  field="priceInsideNote"  queryMode="group"  width="120"></t:dgCol>
   </c:if>
   <t:dgCol title="生效日期"  field="priceStartdate"  formatter="yyyy-MM-dd hh:mm:ss"  queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="失效日期"  field="priceEnddate"  formatter="yyyy-MM-dd hh:mm:ss"  queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="创建人"  field="createName"  queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="创建日期"  field="createDate"  formatter="yyyy-MM-dd"  queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="更新人"  field="updateName"  queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="更新日期"  field="updateDate"  formatter="yyyy-MM-dd"  queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="有效日期"  field="validDate"  formatter="yyyy-MM-dd"  queryMode="single"  query="true"  hidden="true" width="120"></t:dgCol>
   <%--    <t:dgCol title="组织机构id"  field="organizationId"  queryMode="group"  width="120"></t:dgCol> --%>
   <t:dgCol title="操作" field="opt" width="100"></t:dgCol>
   <t:dgDelOpt title="删除" url="priceFreightpriceController.do?doDel&id={id}" urlclass="ace_button"  urlfont="fa-trash-o"/>
   <t:dgToolBar title="录入" icon="icon-add" url="priceFreightpriceController.do?goAdd&priceType=${priceType }&priceLevel=${priceLevel }" funname="add"  width="100%"></t:dgToolBar>
	<t:dgToolBar title="编辑" icon="icon-edit" url="priceFreightpriceController.do?goUpdate&priceType=${priceType }&priceLevel=${priceLevel }" funname="update"  width="100%"></t:dgToolBar>
   <t:dgToolBar title="批量删除"  icon="icon-remove" url="priceFreightpriceController.do?doBatchDel" funname="deleteALLSelect"></t:dgToolBar>
   <t:dgToolBar title="查看" icon="icon-search" url="priceFreightpriceController.do?goUpdate" funname="detail"  width="100%"></t:dgToolBar>
   <t:dgToolBar title="导入" icon="icon-put" funname="ImportXls"></t:dgToolBar>
   <t:dgToolBar title="导出" icon="icon-putout" funname="ExportXls"></t:dgToolBar>
   <t:dgToolBar title="模板下载" icon="icon-putout" funname="ExportXlsByT"></t:dgToolBar>
  </t:datagrid>
  <div id="tempSearchColums6" style="display: none;">
     <div name="searchColums6">&nbsp;&nbsp;&nbsp;&nbsp; 销售产品:<input type="text" id="productId1"  name="productId1"  style="width:150px" />  </div>
   </div>
  </div>
 </div>
 <script type="text/javascript">
 $(document).ready(function(){
	 var curTime = new Date();

	$(":input[ name = 'validDate' ]").val(formatDate(curTime))
	
	 var datagrid = $("#priceFreightpriceListtb");
	 datagrid.find("div[name='searchColums']").find("form#priceFreightpriceListForm").append($("#tempSearchColums6 div[name='searchColums6']").html());
	  $("#tempSearchColums6").html('');
	   
	 //产品(运输方式)
	$.ajax({
		url : 'predictOrderController.do?getProduct',
		type : 'GET',
		dataType : 'JSON',
		delay : 250,
		cache : true,
		success : function(data) {
			var pcname = new Array();
			for (var i = 0; i < data.length; i++) {
				var pcnameObj = {};
				pcnameObj.id = data[i].id;
				pcnameObj.text = data[i].product_name;
				pcname.push(pcnameObj);
			}
			$("#productId1").select2({
				data : pcname,
				placeholder : '---请选择销售产品---',// 默认文字提示
				language : "zh-CN",// 汉化
				allowClear : true
			// 允许清空
			});
		}
	})
 });
 
 function formatDate(now) { 
     var year=now.getFullYear(); 
     var month=now.getMonth()+1; 
     var date=now.getDate(); 
     return year+"-"+month+"-"+date;
} 
 </script>

坑点:datagrid.find(“div[name=‘searchColums’]”) 这个是固定的,不需要修改;$("#priceFreightpriceListtb")根据 datagrid 的 name然后在加上 “td” ,然后在 find方法里 find(“form#priceFreightpriceListForm”) 是根据 datagrid 的 name 加上 “Form”;

后台datagrid 使用自己sql 拼接的字段

@RequestMapping(params = "datagrid2")
public void datagrid2(HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
	String whereSql="";
	//国家编码
	String ctCode = request.getParameter("ctCode");   
	if(StringUtils.isNotBlank(ctCode)) {
      whereSql += " and ct_code='"+ctCode+"' \n";
    }
	
	
	String sql="select count(1)\n" + 
					"from country" + 
					"where 1=1 "+whereSql;
	List<Map<String, Object>> returnList=jdbcTemplate.queryForList(sql);
	dataGrid.setTotal(returnList.size());
	
	sql="select * from country" + 
		"where 1=1 "+whereSql;
		
	List<Map<String, Object>> maplist=systemService.findForJdbc(sql +" limit "+(dataGrid.getPage()-1)*dataGrid.getRows()+","+dataGrid.getRows(), null);	
	
	dataGrid.setResults(maplist); 
	TagUtil.datagrid(response, dataGrid);
}
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值