jquery樣式點選任意一個樹展開合併
阿新 • • 發佈:2019-02-10
function yincang(number){
var DisPlay = $("#div" + number).css("display");
if( DisPlay != "none"){
$('.child_ul').slideUp(); //隱藏
$('.child_ul').empty(); //資料清空
}else{
$('.child_ul').slideUp(); //隱藏
$("#div" + number).slideToggle(); //當前的資料隱藏顯示
}
}
function show(fdid, hospId, name, number) {
yincang(number);
$('.pop_wrap').hide();
$("#div" + number).empty(); //清空之前的資料
var name = name; //一級科室名稱
var pid = fdid; //obj 當前科室的fdID作二級目錄的Pid
$("#p_fdid").val(pid); //一級科室的ID
var hospId = hospId; //醫院ID
var number = number; //編號標記
$("#pName").val(name);//一級目錄
$("#number").val(number);//編號
var dayTime = $("#dayTime").val();
$.post(_path + "/front/mobile/wx/wxHospDeptController",
{
"pid" : pid,
"hospId" : hospId,
dayTime : dayTime
},
function(data) {
if (data.result == '1') {
$('.pop_wrap').show();
document.getElementById('errorMessage').innerHTML = '您在三個月內已爽約3次!不可預約掛號';
return false;
} else {
//拼接Html
if (data.entity != null) { //當存在二級目錄的時候,迴圈顯示二級目錄
var pName = $("#pName").val();
var number = $("#number").val();
for (var i = 0; i < data.entity.length; i++) {
$("#div" + number).append("<input type='hidden' id='fdid' name='fdid' value='"+data.entity[i].fdid+"'></input>"
+ "<input type='hidden' id='pid' name='pid' value='"+data.entity[i].pid+"'></input>"
+ "<input type='hidden' id='hospId' name='hospId' value='"+data.entity[i].hospId+"'></input>"
+ "<li><a class='child_list_a' onclick=twoDirectory('"
+ data.entity[i].fdid
+ "','"
+ data.entity[i].name
+ "')>"
+ data.entity[i].name
+ "<i class='icon_arrow icon_arrow01'></i></a></li>");
}
} else {//當不存在二級目錄的時候,直接跳轉頁面
var deptId = $("#p_fdid").val(); //一級科室ID
var hospId = $("#hospId").val();//醫院ID
var dayTime = $("#dayTime").val();//預約時間
var timeFlg = $("#timeFlg").val(); //標識
var pName = $("#pName").val(); //一級科室名稱
var url = _path
+ "/front/mobile/wx/doctorList?deptId="
+ deptId + "&hospId=" + hospId
+ "&dayTime=" + dayTime
+ "&timeFlg=" + timeFlg
+ "&name=" + pName;
location.href = url;
}
}
});
}
var DisPlay = $("#div" + number).css("display");
if( DisPlay != "none"){
$('.child_ul').slideUp(); //隱藏
$('.child_ul').empty(); //資料清空
}else{
$('.child_ul').slideUp(); //隱藏
$("#div" + number).slideToggle(); //當前的資料隱藏顯示
}
}
function show(fdid, hospId, name, number) {
yincang(number);
$('.pop_wrap').hide();
$("#div" + number).empty(); //清空之前的資料
var name = name; //一級科室名稱
var pid = fdid; //obj 當前科室的fdID作二級目錄的Pid
$("#p_fdid").val(pid); //一級科室的ID
var hospId = hospId; //醫院ID
var number = number; //編號標記
$("#pName").val(name);//一級目錄
$("#number").val(number);//編號
var dayTime = $("#dayTime").val();
$.post(_path + "/front/mobile/wx/wxHospDeptController",
{
"pid" : pid,
"hospId" : hospId,
dayTime : dayTime
},
function(data) {
if (data.result == '1') {
$('.pop_wrap').show();
document.getElementById('errorMessage').innerHTML = '您在三個月內已爽約3次!不可預約掛號';
return false;
} else {
//拼接Html
if (data.entity != null) { //當存在二級目錄的時候,迴圈顯示二級目錄
var pName = $("#pName").val();
var number = $("#number").val();
for (var i = 0; i < data.entity.length; i++) {
$("#div" + number).append("<input type='hidden' id='fdid' name='fdid' value='"+data.entity[i].fdid+"'></input>"
+ "<input type='hidden' id='pid' name='pid' value='"+data.entity[i].pid+"'></input>"
+ "<input type='hidden' id='hospId' name='hospId' value='"+data.entity[i].hospId+"'></input>"
+ "<li><a class='child_list_a' onclick=twoDirectory('"
+ data.entity[i].fdid
+ "','"
+ data.entity[i].name
+ "')>"
+ data.entity[i].name
+ "<i class='icon_arrow icon_arrow01'></i></a></li>");
}
} else {//當不存在二級目錄的時候,直接跳轉頁面
var deptId = $("#p_fdid").val(); //一級科室ID
var hospId = $("#hospId").val();//醫院ID
var dayTime = $("#dayTime").val();//預約時間
var timeFlg = $("#timeFlg").val(); //標識
var pName = $("#pName").val(); //一級科室名稱
var url = _path
+ "/front/mobile/wx/doctorList?deptId="
+ deptId + "&hospId=" + hospId
+ "&dayTime=" + dayTime
+ "&timeFlg=" + timeFlg
+ "&name=" + pName;
location.href = url;
}
}
});
}