fastadmin搜索时同步进行修改
时间:2023年07月02日
/来源:网络
/编辑:佚名
这上面的统计要和下面的时间搜索进行实时同步

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表格事件中存在

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表格事件中存在

新闻资讯 更多
- 【建站知识】查询nginx日志状态码大于400的请求并打印整行04-03
- 【建站知识】Python中的logger和handler到底是个什么?04-03
- 【建站知识】python3拉勾网爬虫之(您操作太频繁,请稍后访问)04-03
- 【建站知识】xpath 获取meta里的keywords及description的方法04-03
- 【建站知识】python向上取整以50为界04-03
- 【建站知识】scrapy xpath遇见乱码解决04-03
- 【建站知识】scrapy爬取后中文乱码,解决word转为html 时cp1252编码问题04-03
- 【建站知识】scrapy采集—爬取中文乱码,gb2312转为utf-804-03