这上面的统计要和下面的时间搜索进行实时同步
1、在js文件中添加如下代码,必须添加在var table = $(“#table”);之后
js复制代码table.on('common-search.bs.table', function (event, table) {
//获取同步搜索需要传递的数据
var d = {};
var t = $('.form-commonsearch').serializeArray();
//t的值为[{name: "a1", value: "xx"},
//{name: "a2", value: "xx"}...]
var i=1;
var xyg = {};
var dyg = '';
var filter = {};
var op = {};
$.each(t, function() {
d[this.name] = this.value;
if(i%2 != 0){//第一个
dyg = this.value;
}else{
xyg[this.name] = this.value;
if(this.value && (dyg)){
filter[this.name] = this.value;
op[this.name] = dyg;
}
}
i++;
});
filter = (JSON.stringify(filter));
op = (JSON.stringify(op));
//ajax进行同步数据
$.ajax({
type: "GET",
async: false,
jsonType: "JSON",
// data:{addtabs:1,sort:'id',order:'desc',offset:0,limit:10,filter:filter,op:op},
url: "recharge_order/index?atype=tj&addtabs=1&sort=id&order=desc&offset=0&limit=10&filter="+filter+"&op="+op,
success: function (res) {
$('#zbf').html(res.zbf);
$('#wx').html(res.wx);
$('#zg').html(res.zg);
}
});
});
触发条件在fastadmin表格事件中存在