<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"> 销售产品:<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);
}