1. 程式人生 > >easyui 獲取 列表複選框選中內容

easyui 獲取 列表複選框選中內容

//批量修改商戶返現比例
function cashbackPercentage(){
var chk_value =[];
var percentage  = $("#percentage").val();
if( percentage=='' || percentage < 0 || percentage > 20 ){
EasyuiUtils.alertMsg("請輸入0~20之間的返現比例!");
return;
}
var url="${pageContext.request.contextPath}/balrebateruleSpecial/percentage";
//var rows = $('#dg').datagrid('getRows');
var rows = $('#dg').datagrid('getSelections');
for(var i=0;i<rows.length;i++){
if(rows[i].sid==null){
EasyuiUtils.alertMsg("請選擇已配置過分傭比例的商品!");
return;
}else{
chk_value.push(rows[i].sid);
}
}
if(chk_value.length==0){
EasyuiUtils.alertMsg("請先選擇商品!");
}else{
 var ids=chk_value.toString(); 
EasyuiUtils.confirm("批量修改,請確定返現比例準確!",
function(){
$.post(url,{merchantRebatePercentage:percentage,ids:ids},function(result){
   if(result=="success"){
   EasyuiUtils.alertMsg("批量修改成功!");
   doSearch('frm', 'dg');
   }
   else{
   EasyuiUtils.alertMsg("系統忙,請稍後操作");
   }
 });
 });
 
}

}

<!-- 資料列表 -->
<table id="dg" class="easyui-datagrid" toolbar="#tb" fitColumns='false'
data-options="  title: '無代理商商戶結算返利配置(個性化)',
method: 'post',
url: '${pageContext.request.contextPath}/balrebateruleSpecial/proxySpecialList?custId='+${custId},
pagination: 'true',
pagePosition: 'bottom',
pageNumber: 1,
pageSize: '20',
rownumbers: 'true',
fit: 'true',
fitColumns: 'true',
fixed: 'true',
rownumbers: true,
loadMsg: '載入中,請稍後..',
onLoadSuccess:function(data){setBtnStyle(data);},
onLoadError:function(){alert(1)}
">
<thead>
<th field="ck" data-options="field:'sid'" checkbox="true"></th>
<th data-options="field:'ruleName'">分傭規則名稱</th>
<th data-options="field:'custId',formatter: function(value,row,index){return convertData('custId',value,row,index);}">客戶編號</th>
<th data-options="field:'shopProductName'">商品名稱</th>
<th data-options="field:'operatorsCode',formatter: function(value,row,index){return convertData('operatorsCode',value,row,index);}">運營商</th>
<th data-options="field:'geographicalScope',formatter: function(value,row,index){return convertData('geographicalScope',value,row,index);}">地域範圍</th>
<th data-options="field:'provinceName'">省名稱</th>
<th data-options="field:'sellingPrice'">售價(元)</th>
<!-- <th data-options="field:'proxyRebatePercentage'">代理商返現比例</th> -->
<th data-options="field:'merchantRebatePercentage',formatter: function(value,row,index){return convertData('merchantRebatePercentage',value,row,index);}">商戶返現比例</th>
<th data-options="field:'enableStartdate',formatter: function(value,row,index){return EasyuiUtils.formatDate2(value,row,index);}">有效開始時間</th>
<th data-options="field:'enableEnddate',formatter: function(value,row,index){return   EasyuiUtils.formatDate2(value,row,index);}">有效結束時間</th>
<th data-options="field:'centCommission',formatter: function(value,row,index){return   convertData('centCommission',value,row,index);}">是否分傭</th>
<!-- <th data-options="field:'isEffect', formatter: function(value,row,index){return convertData('isEffect', value,row,index);}">狀態</th> -->
<th data-options="width:300, field:'操作', formatter: function(value,row,index){return convertData('action', value,row,index);}">操作</th>
</thead>
</table>