php cate,php laravel 多条件筛选

//初始化选中科室functionselectedDepart(dp){

if(dp){

$("#select-no").html("");

vardepart= $("#condition-depart li>a[data-id="+dp+"]");

depart.addClass("selected").siblings().removeClass("selected");

varcopyThisA= ""+depart.text()+"";

if($("#selectA").length> 0) {

$("#selectAspan").html(depart.text());

} else{

$("#condition-checked").prepend(copyThisA);

}

}

}

//初始化选中职称functionselectedPr(pr){

if(pr){

$("#select-no").html("");

vartitle= $("#condition-position a[data-id="+pr+"]");

title.addClass("selected").siblings().removeClass("selected");

varcopyThisB= ""+title.text()+"";

if($("#selectB").length> 0) {

$("#selectBspan").html(title.text());

} else{

$("#condition-checked").append(copyThisB);

}

}

}

//筛选参数functiongetQueryString(){

varresult= location.search.match(newRegExp("[\?\&][^\?\&]+=[^\?\&]+","g"));

if(result== null){

return"";

}

for(vari= 0; i< result.length; i++){

result[i] = result[i].substring(1);

}

returnresult;

}

//重新定义urlfunctiongoSort(name,value,that) {

varstring_array= getQueryString();

varoldUrl= document.URL;

varnewUrl;

if(string_array.length > 0)//如果已经有筛选条件{

varrepeatField= false;

for(vari= 0; i< string_array.length; i++) {

if(!(string_array[i].indexOf(name) == -1)) {

repeatField= true;//如果有重复筛选条件,替换条件值newUrl= oldUrl.replace(string_array[i], name + "="+ value);

}

}

// 如果没有重复的筛选字段if(repeatField== false) {

newUrl= oldUrl+ "&"+ name + "="+ value;

}

}

if(string_array.length == false) {

newUrl= document.URL + "?"+ name + "="+ value;

}

that.attr('href', newUrl);

}

//删除筛选functiondeleteSort(name,that){

varstring_array= getQueryString();

varoldUrl= document.URL;

varnewUrl= oldUrl.split('?')[0];

varlen= string_array.length;

varreg=newRegExp(name);

if(len> 0){

for(vari=0;i

if(string_array[i].match(reg)){

string_array.pop(string_array[i]);

}

}

}

if(string_array.length>0){

newUrl= newUrl+'?'+string_array[0]

}

that.attr('href',newUrl);

}

$(document).ready(function() {

//初始化$("#doctor-condition .cate li:first").addClass('cur');

$("#condition-departli:first").show().siblings().hide();

$("#doctor-condition .cate li").hover(function() {

$(this).addClass("cur").siblings().removeClass("cur");

$("#doctor-condition .depart li").eq($(this).index()).show().siblings().hide();

});

$("#condition-departa").click(function() {

$("#select-no").html("");

$(this).addClass("selected").siblings().removeClass("selected");

varcopyThisA= ""+$(this).text()+"";

if($("#selectA").length> 0) {

$("#selectAspan").html($(this).text());

} else{

$("#condition-checked").prepend(copyThisA);

}

//筛选varvalue= $(this).attr('data-id');

varname= 'dp';

goSort(name,value,$(this));

});

$("#condition-positiona").click(function() {

$("#select-no").html("");

$(this).addClass("selected").siblings().removeClass("selected");

varcopyThisB= ""+$(this).text()+"";

if($("#selectB").length> 0) {

$("#selectBspan").html($(this).text());

} else{

$("#condition-checked").append(copyThisB);

}

//筛选varvalue= $(this).attr('data-id');

varname= 'pr';

goSort(name,value,$(this));

});

});

functionconditionRemoveA(ele){

ele.remove();

$("#condition-departa.selected").removeClass('selected');

if($("#condition-checkeda").length==0){

$("#condition-checked #select-no").html("尚未选择");

}

//删除链接中的dp参数并重定向deleteSort('dp',ele);

}

functionconditionRemoveB(ele){

ele.remove();

$("#condition-positiona.selected").removeClass('selected');

if($("#condition-checkeda").length==0){

$("#condition-checked #select-no").html("尚未选择");

}

//删除链接中的pr参数并重定向deleteSort('pr',ele);

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值