<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="contextPath" value="${pageContext.request.contextPath}"></c:set>
<link rel="stylesheet" href="${contextPath}/static/assets/css/jquery-ui.css" />
<link rel="stylesheet" href="${contextPath}/static/assets/css/datepicker.css" />
<link rel="stylesheet" href="${contextPath}/static/assets/css/ui.jqgrid.css" />
<!--律师管理 ————>律师提现  -->
<div class="row">
	<div class="col-xs-12">
		<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
							&times;
						</button>
						<h4 class="modal-title" id="myModalLabel">
							佣金宝批量代发
						</h4>
					</div>
					<div class="modal-body" id="mtk">
						正在上传代发名单,请勿进行另外操作..........
					</div>
					<div class="modal-footer" id="mtkbut">
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭
						</button>
						<button type="button" class="btn btn-primary" id="confirm" onclick=confirm()>
							发放
						</button>
					</div>
				</div><!-- /.modal-content -->
			</div><!-- /.modal -->
		</div>
		<!-- 搜索框开始 -->
		<div class="dropdown">
			开始时间：<input type="text" class="input-sm" placeholder="开始时间" id="startDate"/>
			结束时间：<input type="text" class="input-sm" placeholder="结束时间" id="endDate"/>
			关键字:<input id="keyword" class="input-medium search-query" type="text" />
			<select class="select" id="type">
				<option value="" selected = "selected">提现类型</option>
				<option value="1">积分提现</option>
				<option value="0">余额提现</option>
			</select>
			<select class="select" id="isOnline">
				<option value="" selected="selected">所有提现</option>
				<option value="0" >律师提现</option>
				<option value="1">渠道提现</option>
			</select>
			<select class="select" id="status">
				<option value="" selected="selected">提现状态</option>
				<option value="0" >申请中</option>
				<option value="1">审核通过</option>
				<option value="2">审核不通过</option>
				<option value="3">转账中</option>
				<option value="4">已到账</option>
				<option value="5">转账失败</option>
			</select>
			<button id="searchd" type="submit" class="btn" <%--onClick="searchd"--%>>搜索</button>
			<button id="expoltExcel" class="btn btn-info">导出Excel</button>
			<button type="button" class="btn btn-primary btn-sm" onclick='countInfo();' id="calc">
				计算筛选后的提现信息
			</button>
			<div id ="calc-result" class="bg-info" style="display:none">
				<p>申请中：<span id="status0">暂无此类订单</span>&nbsp;&nbsp;&nbsp;&nbsp;审核通过：<span id="status1">暂无此类订单</span></p>
				<p>审核不通过：<span id="status2">暂无此类订单</span>&nbsp;&nbsp;&nbsp;&nbsp;转账中：<span id="status3">暂无此类订单</span></p>
				<p>已到账：<span id="status4">暂无此类订单</span>&nbsp;&nbsp;&nbsp;&nbsp;转账失败：<span id="status5">暂无此类订单</span></p>
			</div>
			<button id="batch-opertaion-btn" type="submit" class="btn" onClick="batch_operation_action();" style="color: #4ebc30	">操作</button>
			<button id="test1" type="submit" onclick=substitute(); class="btn">代发</button>
			<button id="test12" type="submit" onclick=test(); class="btn">测试</button>
			<!-- 搜索框结束 -->
			<table id="grid-table"></table>
			<div id="grid-pager"></div>
			<script type="text/javascript">
				var $path_base = "${contextPath}/static";//in Ace demo this will be used for editurl parameter
			</script>
			<!-- PAGE CONTENT ENDS -->
		</div>
		<!-- /.col -->
	</div>
	<!-- /.row -->
<div id="modal-table" class="modal fade" tabindex="-1" data-backdrop="static">
	<div class="modal-dialog" style="min-width: 820px;">

	</div><!-- /.modal-dialog -->

</div>
	<div id="modal-batch-operation-deatil" class="modal fade" tabindex="-1"
		 data-backdrop="static">
		<div class="modal-dialog" style="min-width: 450px;">
			<div class="modal-content">
				<div class="modal-header no-padding">
					<div class="table-header">
						<button type="button" class="close" data-dismiss="modal"
								aria-hidden="true">
							<span class="white">&times;</span>
						</button>
						操作修改
					</div>
				</div>
				<div class="modal-body" id="modal-batch-operation-deatil-body">
					<form id="showDistribution" class="form-horizontal">
                        <div class="form-group" >
                            <label class="col-sm-3 control-label">状态:</label>
                            <select class="select" id="mod-batch-state">
								<option value="" selected="selected">请选择</option>
								<option value="0" >申请中</option>
								<option value="1">审核通过</option>
								<option value="2">审核不通过</option>
								<option value="3">转账中</option>
								<option value="4">已到账</option>
								<option value="5">转账失败</option>
                            </select>
                        </div>
                        <div class="form-group" >
                            <label class="col-sm-3 control-label">备注:</label>
                            <input type="text" id="mod-batch-remark" class="col-sm-6">
                        </div>
					</form>
				</div>
				<div class="modal-footer no-margin-top">
					<div class="text-center">
						<button class="btn btn-sm" data-dismiss="modal">
							<i class="ace-icon fa fa-share bigger-160"></i> 关闭
						</button>
						<button class="btn btn-sm btn-primary" onclick="batch_operation_submit_action();">
							<i class="ace-icon fa fa-floppy-o bigger-160"></i> 保存
						</button>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<!-- page specific plugin scripts -->
<script type="text/javascript">
		var scripts = [ null,  "${contextPath}/static/assets/js/date-time/bootstrap-datepicker.js", "${contextPath}/static/assets/js/date-time/locales/bootstrap-datepicker.zh-CN.js", "${contextPath}/static/assets/js/jqGrid/jquery.jqGrid.js", "${contextPath}/static/assets/js/jqGrid/i18n/grid.locale-cn.js", null ]
       /* function view_change() {
            $('#batch-opertaion-btn').css('display','none');
            $.each($("input[name='checkbox-batch-id']:checked"),function(){
                $('#batch-opertaion-btn').css('display','');
            });
        }*/

		function countInfo() {
			var startDate = $("#startDate").val();
			var endDate = $("#endDate").val();
			$.ajax({
				dataType : "json",
				url : "${contextPath}/fs/report/getCountInfo",
				type : "post",
				data : {
					'startDate' : startDate,
					'endDate' : endDate
				},
				complete : function(ret) {
					var ret = eval("(" + ret.responseText + ")");
					console.log(ret)
					console.log(ret.succ  === "1")
					if (ret.succ  === "1"){
						$("#calc-result").html(ret.noInfo)
					}else{
						var  ss = "申请中&nbsp;&nbsp;&nbsp;&nbsp;订单数："+ret.status0Count+"&nbsp;&nbsp;总金额："+ret.status0Sum+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
						ss += "审核通过&nbsp;&nbsp;&nbsp;&nbsp;订单数："+ret.status1Count+"&nbsp;&nbsp;总金额："+ret.status1Sum+"<br>";
						ss += "审核不通过&nbsp;&nbsp;&nbsp;&nbsp;订单数："+ret.status2Count+"&nbsp;&nbsp;总金额："+ret.status2Sum+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
						ss += "转账中&nbsp;&nbsp;&nbsp;&nbsp;订单数："+ret.status3Count+"&nbsp;&nbsp;总金额："+ret.status3Sum+"<br>";
						ss += "已到账&nbsp;&nbsp;&nbsp;&nbsp;订单数："+ret.status4Count+"&nbsp;&nbsp;总金额："+ret.status4Sum+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
						ss += "转账失败&nbsp;&nbsp;&nbsp;&nbsp;订单数："+ret.status5Count+"&nbsp;&nbsp;总金额："+ret.status5Sum+"<br>";
						$("#calc-result").html(ss)
					}
				}
			});
			if( $("#calc-result").css("display")==='none' ){
				$("#calc-result").show();
			}else{
				$("#calc-result").hide();
			}
		}
        /**
         * 操作批量
         */
        function batch_operation_action () {
            var isFirstElement = true;
            var firstState = "";
            var operation = true;
            /*$.each($("input[name='checkbox-batch-id']:checked"),function() {
                var rowData = $("#grid-table").jqGrid('getRowData',$(this).val());
                if (isFirstElement){
                    firstState = rowData.status;
                    $("#mod-batch-state").html(formater_select(rowData));
                    $("#mod-batch-remark").val(rowData.remark);
                }
                if (firstState) {
                    if (firstState != rowData.status) {
                        alert("操作的同批次，状态需要相同.请修改选择");
                        operation = false;
                        return;
                    }
                }
                isFirstElement = false;
            });
			var rowData = $("#grid-table").jqGrid('getRowData',$(this).val());
			$("#mod-batch-state").html(formater_select(rowData));*/
            if (operation) {
                $("#modal-batch-operation-deatil").modal("toggle");
            }
		}
        function batch_operation_submit_action () {
            var ids = new Array();
            /*$.each($("input[name='checkbox-batch-id']:checked"),function() {
                var rowData = $("#grid-table").jqGrid('getRowData',$(this).val());
                ids.push(rowData.id);
            });*/
			ids = $("#grid-table").jqGrid("getGridParam", "selarrrow");
            $.ajax({
                dataType : "json",
                url : "${contextPath}/fs/report/batchOperateLawyerWithdraw",
                type : "post",
                data : {
                    'status': $("#mod-batch-state").val(),
                    'remark': $("#mod-batch-remark").val(),
                    'ids' : ids,
				},
                traditional: true,//这里设置为true
                complete : function(ret) {
                    if(ret.success){
                        $("#modal-batch-operation-deatil").modal("toggle");
                        alert('保存成功');
                        var keyword =$("#keyword").val();
                        var startDate =$("#startDate").val();
                        var endDate =$("#endDate").val();
                        // $('#batch-opertaion-btn').css('display','none');
                        gloableGrid.setGridParam({data:'json',url : '${contextPath}/fs/report/getLawyerWithdraw', postData:{keyword:keyword, startDate:startDate, endDate:endDate}}).trigger('reloadGrid');
                    }else{
                        alert(ret.message);
                    }
                }
            });
        }
		function formater_select(rowData){
            html_str = ""
            var cellvalue=rowData.status;
            if(cellvalue=="申请中"){
                html_str +='<option value="0" selected="selected">申请中</option>';
                html_str +='<option value="1">审核通过</option>';
                html_str +='<option value="2">审核不通过</option>';
            }else if(cellvalue=="通过"){
                html_str +='<option value="1" selected="selected">审核通过</option>';
                html_str +='<option value="3">转帐中</option>';
            }else if(cellvalue=="不通过"){
                html_str +='<option value="2" selected="selected">审核不通过</option>';
            }else if(cellvalue=="转帐中"){
                html_str +='<option value="3" selected="selected">转帐中</option>';
                html_str +='<option value="4">已到帐</option>';
                html_str +='<option value="5">转帐失败</option>';
            }else if(cellvalue=="已到帐"){
                html_str +='<option value="4" selected="selected">已到帐</option>';
            }else if(cellvalue=="转帐失败"){
                html_str +='<option value="5" selected="selected">转帐失败</option>';
            }
            return html_str;
        }

        var gloableGrid = "";
        $('.page-content-area').ace_ajax('loadScripts', scripts, function() {
        	// inline scripts related to this page
        	jQuery(function($) {
        		var grid_selector = "#grid-table";
        		var pager_selector = "#grid-pager";
				//搜索
				$("#searchd").click(function(){
					var keyword =$("#keyword").val();
					var startDate =$("#startDate").val();
					var endDate =$("#endDate").val();
					var type =$("#type").val();
					var isOnline =$("#isOnline").val();
					var status =$("#status").val();
			    	myGrid.setGridParam({data:'json',url : '${contextPath}/fs/report/getLawyerWithdraw',
						postData:{keyword:keyword, startDate:startDate, endDate:endDate,type:type,status:status,
							isOnline:isOnline}}).trigger('reloadGrid');
				});
        		// resize to fit page size
        		$(window).on('resize.jqGrid', function() {
        			$(grid_selector).jqGrid('setGridWidth', $(".page-content").width());
        		})
        		// resize on sidebar collapse/expand
        	var parent_column = $(grid_selector).closest('[class*="col-"]');
        		$(document).on('settings.ace.jqGrid', function(ev, event_name, collapsed) {
        			if (event_name === 'sidebar_collapsed' || event_name === 'main_container_fixed') {
        				// setTimeout is for webkit only to give time for DOM changes and then redraw!!!
        				setTimeout(function() {
        					$(grid_selector).jqGrid('setGridWidth', parent_column.width());
        				}, 0);
        			}
        		})
        	var myGrid=	jQuery(grid_selector).jqGrid({
        			subGrid : false,
        			url : "${contextPath}/fs/report/getLawyerWithdraw",
        			datatype : "json",
        			height : '100%',
        			width : 'auto',
        			colNames : [/*'选择',*/'申请时间', '提现订单号', '律师姓名', '身份证号码', '余额', '剩余积分', '手机', '账户名', '帐号','银行名（支行）','银行名' ,'提现金额','提现类型','代付律师服务费','代缴税费','代缴个税','实际到帐','状态', '审核时间','备注'],
        			colModel : [/*{
                        name : 'id',
                        index : 'batchOperation',
                        label : '批量操作',
                        width : 50,
                        editable : false,
                        formatter:batchOperationFormatter
                    }, */{
        				name : 'applyTime',
        				index : 'applyTime',
        				width : 120,
        				editable : false,
        				search : false
        			}, {
        				name : 'id',
        				index : 'id',
        				width : 120,
        				editable : false,
        				search : false
        			},{
        				name : 'lawyer',
        				index : 'lawyer',
        				width : 80,
        				editable : false
        			}, {
        				name : 'idCard',
        				index : 'idCard',
        				width : 120,
        				editable : false,
        				search : false
        			}, {
        				name : 'balance',
        				index : 'balance',
        				editable : false,
        				width : 80,
        			}, {
        				name : 'points',
        				index : 'points',
        				editable : false,
        				width : 80,
        			},{
        				name : 'mobile',
        				index : 'mobile',
        				width : 80,
        				editable : false
        			}, {
        				name : 'bankAccountName',
        				index : 'bankAccountName',
        				editable : false,
        				width : 120,
        			}, {
        				name : 'bankAccount',
        				index : 'bankAccount',
        				editable : false,
        				width : 160
        			}, {
        				name : 'bankName',
        				index : 'bankName',
        				width : 160,
        				editable : false
        			}, {
                        name : 'bankShortName',
                        index : 'bankShortName',
                        width : 160,
                        editable : false
                    }, {
        				name : 'money',
        				index : 'money',
        				width : 110,
        				editable : false,
        				search : false
        			},{
                        name : 'type',
                        index : 'type',
                        width : 110,
                        editable : false,
                        search : false
                    }, {
        				name : 'moneyls',
        				index : 'moneyls',
        				width : 110,
        				editable : false,
        				search : false
        			}, {
           				name : 'tax',
           				index : 'tax',
           				width : 110,
           				editable : false,
           				search : false,
        			}, {
           				name : 'gs',
           				index : 'gs',
           				width : 110,
           				editable : false,
           				search : false,
        			}, {
        				name : 'actualMoney',
        				index : 'actualMoney',
        				width : 110,
        				editable : false,
        				search : false,
        			} , {
        				name : 'status',
        				index : 'status',
        				label : '状态',
        				width : 190,
        				editable : true,
        				edittype : "select",
        				//editoptions:{value:"0:申请中;1:审核通过;2:审核不通过;3:转帐中;4:已到帐;5:转帐失败"},formatter:defaultValStatus
        				editoptions:{value:gettypes},
						formatter:defaultValStatus
        			}, {
        				name : 'checkTime',
        				index : 'checkTime',
        				width : 120,
        				editable : false,
        				search : false
        			}, {
        			    name : 'remark',
						index : 'remark',
						width : 150,
						editable : true,
						search : false,
						edittype: 'textarea',
        			} ],
        			//scroll : 1, // set the scroll property to 1 to enable paging with scrollbar - virtual loading of records
        			sortname : "applyTime",
        			sortorder : "desc",
        			viewrecords : true,
        			rowNum : 10,
        			rowList : [ 10, 20, 30, 300, 500 ],
        			pager : pager_selector,
        			altRows : true,
        			//toppager : true,
        			multiselect : true,
        			//multikey : "ctrlKey",
        	        multiboxonly : false,
        			loadComplete : function() {
        				var table = this;
        				setTimeout(function(){
        					styleCheckbox(table);
        					updateActionIcons(table);
        					updatePagerIcons(table);
        					enableTooltips(table);
        				}, 0);
        			},
        			editurl : "${contextPath}/fs/report/operateLawyerWithdraw"
        			//caption : "用户管理列表",
        			//autowidth : true,
        			/**
        			grouping : true,
        			groupingView : {
        				 groupField : ['name'],
        				 groupDataSorted : true,
        				 plusicon : 'fa fa-chevron-down bigger-110',
        				 minusicon : 'fa fa-chevron-up bigger-110'
        			},
        			*/
        		});
        		gloableGrid = myGrid;
        	$(window).triggerHandler('resize.jqGrid');// trigger window resize to make the grid get the correct size
        		// enable search/filter toolbar
        		// jQuery(grid_selector).jqGrid('filterToolbar',{defaultSearch:true,stringResult:true})
        		// jQuery(grid_selector).filterToolbar({});
        		// switch element when editing inline
        		function aceSwitch(cellvalue, options, cell) {
        			setTimeout(function() {
        				$(cell).find('input[type=checkbox]').addClass('ace ace-switch ace-switch-5').after('<span class="lbl"></span>');
        			}, 0);
        		}

        		// navButtons
        		jQuery(grid_selector).jqGrid('navGrid', pager_selector, { // navbar options
        			edit : <shiro:hasPermission name="${ROLE_KEY}:LawyerWithdraw:edit">true</shiro:hasPermission><shiro:lacksPermission name="${ROLE_KEY}:LawyerWithdraw:edit">false</shiro:lacksPermission>,
        			editicon : 'ace-icon fa fa-pencil blue',
        			add : <shiro:hasPermission name="${ROLE_KEY}:LawyerWithdraw:add">true</shiro:hasPermission><shiro:lacksPermission name="${ROLE_KEY}:LawyerWithdraw:add">false</shiro:lacksPermission>,
        			addicon : 'ace-icon fa fa-plus-circle purple',
        			del : <shiro:hasPermission name="${ROLE_KEY}:LawyerWithdraw:delete">true</shiro:hasPermission><shiro:lacksPermission name="${ROLE_KEY}:LawyerWithdraw:delete">false</shiro:lacksPermission>,
        			delicon : 'ace-icon fa fa-trash-o red',
        			search : <shiro:hasPermission name="${ROLE_KEY}:LawyerWithdraw:search">true</shiro:hasPermission><shiro:lacksPermission name="${ROLE_KEY}:LawyerWithdraw:search">false</shiro:lacksPermission>,
        			searchicon : 'ace-icon fa fa-search orange',
        			refresh : true,
        			refreshicon : 'ace-icon fa fa-refresh blue',
        			view : <shiro:hasPermission name="${ROLE_KEY}:LawyerWithdraw:view">true</shiro:hasPermission><shiro:lacksPermission name="${ROLE_KEY}:LawyerWithdraw:view">false</shiro:lacksPermission>,
        			viewicon : 'ace-icon fa fa-search-plus grey'
        		}, {
        			// edit record form
        			// closeAfterEdit: true,
        			// width: 700,
        			recreateForm : true,
        			beforeShowForm : function(e) {
        				var form = $(e[0]);
        				form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" align="center"/>')
        				style_edit_form(form);
        			},
    				errorTextFormat: function (response) {
    					var result = eval('('+response.responseText+')');
    				    return result.message;
    				}
        		}, {
        			// new record form
        			// width: 700,
        			closeAfterAdd : true,
        			recreateForm : true,
        			viewPagerButtons : false,
        			beforeShowForm : function(e) {
        				var form = $(e[0]);
        				form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />')
        				style_edit_form(form);
        			},
    				errorTextFormat: function (response) {
    					var result = eval('('+response.responseText+')');
    				    return result.message;
    				}
        		}, {
        			// delete record form
        			recreateForm : true,
        			beforeShowForm : function(e) {
        				var form = $(e[0]);
        				if (form.data('styled'))
        					return false;
        				form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />')
        				style_delete_form(form);
        				form.data('styled', true);
        			},
        			onClick : function(e) {
        				// alert(1);
        			}
        		}, {
        			// search form
        			recreateForm : true,
        			afterShowSearch : function(e) {
        				var form = $(e[0]);
        				form.closest('.ui-jqdialog').find('.ui-jqdialog-title').wrap('<div class="widget-header" />')
        				style_search_form(form);
        			},
        			afterRedraw : function() {
        				style_search_filters($(this));
        			},
        			multipleSearch : true
	        		/**
	        		 * multipleGroup:true, showQuery: true
	        		 */
        		}, {
        			// view record form
        			recreateForm : true,
        			beforeShowForm : function(e) {
        				var form = $(e[0]);
        				form.closest('.ui-jqdialog').find('.ui-jqdialog-title').wrap('<div class="widget-header" />')
        			}
        		})

        		// add custom button to export the data to excel
        		if(<shiro:hasPermission name="${ROLE_KEY}:LawyerWithdraw:export">true</shiro:hasPermission><shiro:lacksPermission name="${ROLE_KEY}:LawyerWithdraw:export">false</shiro:lacksPermission>){
    				jQuery(grid_selector).jqGrid('navButtonAdd', pager_selector,{
   					   caption : "",
   				       title : "导出Excel",
   				       buttonicon : "ace-icon fa fa-file-excel-o green",
   				       onClickButton : function () {
   				    	   var keys = [], ii = 0, rows = "";
   				    	   var ids = $(grid_selector).getDataIDs(); // Get All IDs
   				    	   var row = $(grid_selector).getRowData(ids[0]); // Get First row to get the labels
   				    	   //var label = $(grid_selector).jqGrid('getGridParam','colNames');
   	   			    	   for (var k in row) {
   				    	   	   keys[ii++] = k; // capture col names
   				    	   	   rows = rows + k + "\t"; // output each Column as tab delimited
   				    	   }
   				    	   rows = rows + "\n"; // Output header with end of line
   				    	   for (i = 0; i < ids.length; i++) {
   				    	   	   row = $(grid_selector).getRowData(ids[i]); // get each row
   				    	   	   for (j = 0; j < keys.length; j++)
   				    	   		   rows = rows + row[keys[j]] + "\t"; // output each Row as tab delimited
   				    	   	   rows = rows + "\n"; // output each row with end of line
   				    	   }
   				    	   rows = rows + "\n"; // end of line at the end
   				    	   var form = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><meta charset='utf-8'></head><form name='csvexportform' action='${contextPath}/fs/report/operateLawyerWithdraw?oper=excel' method='post'>";
   							var keyword =$("#keyword").val();
   							var startDate =$("#startDate").val();
   							var endDate =$("#endDate").val();
   				    	   form = form + "<input type='hidden' name='keyword' value='" + encodeURIComponent(keyword) + "'>";
   				    	   form = form + "<input type='hidden' name='startDate' value='" + startDate + "'>";
   				    	   form = form + "<input type='hidden' name='endDate' value='" + endDate + "'>";
   				    	   form = form + "</form><script>document.csvexportform.submit();</sc" + "ript></html>";
   				    	   OpenWindow = window.open('', '');
   				    	   console.log(form);
   				    	   OpenWindow.document.write(form);
   				    	   OpenWindow.document.close();
   				       }
   					});
        		}

        		function defaultValStatus(cellvalue, options, rowObject){
        			switch(cellvalue){
					case 0:return "申请中";
					case 1:return "通过";
					case 2:return "不通过";
					case 3:return "转帐中";
					case 4:return "已到帐";
					case 5:return "转帐失败";
					}
				};
                function batchOperationFormatter(id){
					return '<input type="checkbox" name="checkbox-batch-id" value="' +id+ '" onclick="view_change();"/>';
                }
        		function gettypes(){
        			var str="";
        			var cellvalue="0";
        			var rowId=$("#grid-table").jqGrid('getGridParam','selrow');
        			var rowData = $("#grid-table").jqGrid('getRowData',rowId);
        			var cellvalue=rowData.status;
        			if(cellvalue=="申请中"){
        				str+="0:申请中;1:审核通过;2:审核不通过";
        			}else if(cellvalue=="通过"){
        				str+="1:审核通过;3:转帐中";
        			}else if(cellvalue=="不通过"){
        				str+="2:审核不通过";
        			}else if(cellvalue=="转帐中"){
        				str+="3:转帐中;4:已到帐;5:转帐失败";
        			}else if(cellvalue=="已到帐"){
        				str+="4:已到帐";
        			}else if(cellvalue=="转帐失败"){
        				str+="5:转帐失败";
        			}
        			return str;
        		};


        		function style_edit_form(form) {
        			// form.find('input[name=statusCn]').addClass('ace ace-switch ace-switch-5').after('<span class="lbl"></span>');
        			// don't wrap inside a label element, the checkbox value won't be submitted (POST'ed)
        			// .addClass('ace ace-switch ace-switch-5').wrap('<label class="inline" />').after('<span class="lbl"></span>');

        			// update buttons classes
        			var buttons = form.next().find('.EditButton .fm-button');
        			buttons.addClass('btn btn-sm').find('[class*="-icon"]').hide();// ui-icon, s-icon
        			buttons.eq(0).addClass('btn-primary').prepend('<i class="ace-icon fa fa-check"></i>');
        			buttons.eq(1).prepend('<i class="ace-icon fa fa-times"></i>')

        			buttons = form.next().find('.navButton a');
        			buttons.find('.ui-icon').hide();
        			buttons.eq(0).append('<i class="ace-icon fa fa-chevron-left"></i>');
        			buttons.eq(1).append('<i class="ace-icon fa fa-chevron-right"></i>');
        		}

        		function style_delete_form(form) {
        			var buttons = form.next().find('.EditButton .fm-button');
        			buttons.addClass('btn btn-sm btn-white btn-round').find('[class*="-icon"]').hide();// ui-icon, s-icon
        			buttons.eq(0).addClass('btn-danger').prepend('<i class="ace-icon fa fa-trash-o"></i>');
        			buttons.eq(1).addClass('btn-default').prepend('<i class="ace-icon fa fa-times"></i>')
        		}

        		function style_search_filters(form) {
        			form.find('.delete-rule').val('X');
        			form.find('.add-rule').addClass('btn btn-xs btn-primary');
        			form.find('.add-group').addClass('btn btn-xs btn-success');
        			form.find('.delete-group').addClass('btn btn-xs btn-danger');
        		}
        		function style_search_form(form) {
        			var dialog = form.closest('.ui-jqdialog');
        			var buttons = dialog.find('.EditTable')
        			buttons.find('.EditButton a[id*="_reset"]').addClass('btn btn-sm btn-info').find('.ui-icon').attr('class', 'ace-icon fa fa-retweet');
        			buttons.find('.EditButton a[id*="_query"]').addClass('btn btn-sm btn-inverse').find('.ui-icon').attr('class', 'ace-icon fa fa-comment-o');
        			buttons.find('.EditButton a[id*="_search"]').addClass('btn btn-sm btn-purple').find('.ui-icon').attr('class', 'ace-icon fa fa-search');
        		}

        		function beforeDeleteCallback(e) {
        			var form = $(e[0]);
        			if (form.data('styled'))
        				return false;
        			form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />')
        			style_delete_form(form);
        			form.data('styled', true);
        		}

        		function beforeEditCallback(e) {
        			var form = $(e[0]);
        			form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header"/>')
        			style_edit_form(form);
        			$("#editmodgrid-table").show();
        		}

        		function afterCompleteCallback(e) {
        			$("#editmodgrid-table").hide();
        			$(".ui-widget-overlay").hide();
        		}

        		// it causes some flicker when reloading or navigating grid
        		// it may be possible to have some custom formatter to do this as the grid is being created to prevent this
        		// or go back to default browser checkbox styles for the grid
        		function styleCheckbox(table) {
        			/**
        			 * $(table).find('input:checkbox').addClass('ace') .wrap('<label />') .after('<span class="lbl align-top" />') $('.ui-jqgrid-labels th[id*="_cb"]:first-child')
        			 * .find('input.cbox[type=checkbox]').addClass('ace') .wrap('<label />').after('<span class="lbl align-top" />');
        			 */
        		}

        		// unlike navButtons icons, action icons in rows seem to be hard-coded
        		// you can change them like this in here if you want
        		function updateActionIcons(table) {
        			 // var replacement = { 'ui-ace-icon fa fa-pencil' : 'ace-icon fa fa-pencil blue', 'ui-ace-icon fa fa-trash-o' : 'ace-icon fa fa-trash-o red', 'ui-icon-disk' : 'ace-icon fa fa-check green', 'ui-icon-cancel' :
        			 // 'ace-icon fa fa-times red' }; $(table).find('.ui-pg-div span.ui-icon').each(function(){ var icon = $(this); var $class = $.trim(icon.attr('class').replace('ui-icon', '')); if($class in replacement)
        			 //  icon.attr('class', 'ui-icon '+replacement[$class]); })
        		}


        		// replace icons with FontAwesome icons like above
        		function updatePagerIcons(table) {
        			var replacement = {
        				'ui-icon-seek-first' : 'ace-icon fa fa-angle-double-left bigger-140',
        				'ui-icon-seek-prev' : 'ace-icon fa fa-angle-left bigger-140',
        				'ui-icon-seek-next' : 'ace-icon fa fa-angle-right bigger-140',
        				'ui-icon-seek-end' : 'ace-icon fa fa-angle-double-right bigger-140'
        			};
        			$('.ui-pg-table:not(.navtable) > tbody > tr > .ui-pg-button > .ui-icon').each(function() {
        				var icon = $(this);
        				var $class = $.trim(icon.attr('class').replace('ui-icon', ''));

        				if ($class in replacement)
        					icon.attr('class', 'ui-icon ' + replacement[$class]);
        			})
        		}

        		function enableTooltips(table) {
        			$('.navtable .ui-pg-button').tooltip({
        				container : 'body'
        			});
        			$(table).find('.ui-pg-div').tooltip({
        				container : 'body'
        			});
        		}

        		// var selr = jQuery(grid_selector).jqGrid('getGridParam','selrow');

        		$(document).one('ajaxloadstart.page', function(e) {
        			$(grid_selector).jqGrid('GridUnload');
        			$('.ui-jqdialog').remove();
        		});

           		$('#startDate').datepicker({
       		        language: 'zh-CN',
       		        pickTime: false,
       		        todayBtn: true,
       		        autoclose: true,
       		        minView: '2',
       		        forceParse: false,
       		        format:"yyyy-mm-dd"
       		    });
       			$('#endDate').datepicker({
       		        language: 'zh-CN',
       		        pickTime: false,
       		        todayBtn: true,
       		        autoclose: true,
       		        minView: '2',
       		        forceParse: false,
       		        format:"yyyy-mm-dd"
       		    });
        	});
        });

		$("#expoltExcel").click(function () {
			var startDate = $("#startDate").val();
			var endDate = $("#endDate").val();
			var type = $("#type").val();
			var isOnline = $("#isOnline").val();
			var keyword = $("#keyword").val();
			var url = '${contextPath}/fs/excel/getLawyerWithdrawExcel?startDate=' + startDate +
					"&endDate="+endDate+"&type="+type+"&isOnline="+isOnline+"&keyword="+keyword ;
			console.info(url);
			window.open(url);
		});
		/*代发*/
		function substitute(){
			var listId = $("#grid-table").jqGrid("getGridParam", "selarrrow");
			if(listId.length>1){
				$("#mtkbut").hide()
				$("#myModal").modal('toggle')
			}
			$.ajax({
				type:"post",
				url:"${contextPath}/fs/yjb/substitute",
				data:{
					"listId":listId
				},
				dataType:"json",
				success:function(res){
					console.log(res);
					if(res.success==false){
						if(listId.length>1){
							$("#myModal").modal('toggle')
						}
						alert(res.message)
					}else{
						if(res.type==1){//map
							if(res.size>1){//批量
								$("#mtk").text("是否确认发放");
								$("#mtkbut").show()
								$("#confirm").val(res.batchNo);
							}else{//单次
								alert("代发成功")
								location.reload(false);
							}
						}else if(res.type==2){//arrayMap
							alert("代发失败,详情F12")
							for(var i=0;i<res.data.length;i++){
								console.log(res.data[i]);
							}
						}
					}
				}
			})
		}
		/*确认发放*/
		function confirm(){
			$("#myModal").modal('toggle')
			var batchNo = $("#confirm").val();
			$.ajax({
				type:"post",
				url:"${contextPath}/fs/yjb/paymentNote",
				data:{
					"type":2,
					"batchNo":batchNo
				},
				dataType:"json",
				success:function(res){
					alert(res.msg);
					console.log(res);
					location.reload(false);
				}
			})
		}
		function test() {
			$.ajax({
				type:"post",
				url:"${contextPath}/fs/yjb/paymentNote",
				data:{
					"type":8,
					"singleOrBatch":"2"
				},
				dataType:"json",
				success:function(res){
					console.log(res);
				}
			})
		}

</script>
