base.js
4.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
$(function(){
//文本框Style
$(".txt").mouseover(function(){
$(this).addClass("txt_o");
}).mouseout(function(){
$(this).removeClass("txt_o");
}).focus(function(){
$(this).addClass("txt_s");
}).blur(function(){
$(this).removeClass("txt_s");
});
//表格折叠
$(".tform").find("tbody tr th[_show]").each(function(i){
//加入折叠提示
if($(this).attr("_show")=="no"){
$(this).append(" <button type=\"button\" class=\"tbody_up\"></button>");
}else{
$(this).append(" <button type=\"button\" class=\"tbody_down\"></button>");
}
//折叠动作
$(this).click(function(){
if($(this).find("button[class^='tbody_']").attr("class")=="tbody_up"){
$(this).find("button[class^='tbody_']").attr("class","tbody_down");
$(this).parent("tr").parent("tbody").find("tr").not($(this).parent("tr")).hide();
}else if($(this).find("button[class^='tbody_']").attr("class")=="tbody_down"){
$(this).find("button[class^='tbody_']").attr("class","tbody_up");
$(this).parent("tr").parent("tbody").find("tr").not($(this).parent("tr")).show();
}
}).mouseover(function(){
$(this).addClass("mouseon");
}).mouseout(function(){
$(this).removeClass("mouseon");
}).click();
});
//列表行高亮
$("table[_dlist*='light']").children("tbody").children("tr").mouseover(function(){
if($(this).attr("_nolight")!="yes")$(this).addClass("t_on");
}).mouseout(function(){
$(this).removeClass("t_on");
});
//列表行整行选择
$("table[_dlist*='check']").each(function(){
//处理行点击
$(this).find("tbody tr").click(function(){
checkbox = $(this).find("td input[type='checkbox']");
tr = $(this);
if(checkbox.attr("checked")===false){
checkbox.attr("checked","checked");
tr.addClass("t_sl");
}else{
checkbox.removeAttr("checked");
tr.removeClass("t_sl");
}
});
//处理checkbox点击
$(this).find("td input[type='checkbox']").click(function(){
tr = $(this).parent("td").parent("tr");
if($(this).attr("checked")===false){
$(this).attr("checked","checked");
tr.removeClass("t_sl");
}else{
$(this).removeAttr("checked");
tr.addClass("t_sl");
}
});
//排除链接及按钮点击
$(this).find("tbody tr td a,tbody tr td button,tbody tr td table").click(function(){
tr = $(this).parent("td").parent("tr");
checkbox = tr.find("td input[type='checkbox']");
if(checkbox.attr("checked")===false){
checkbox.attr("checked","checked");
tr.removeClass("t_sl");
}else{
checkbox.removeAttr("checked");
tr.addClass("t_sl");
}
});
});
//高亮初始化
setChecklight();
//全选按钮
$("button[_click='allSelect']").click(function(){
ckbox = $(this).parent("td").parent("tr").parent("tbody").find("td input[type='checkbox']");
ckbox.attr("checked","checked");
setChecklight();
});
//反选按钮
$("button[_click='unSelect']").click(function(){
ckbox = $(this).parent("td").parent("tr").parent("tbody").find("td input[type='checkbox']");
ckbox.each(function(){
$(this).attr("checked") === false ? $(this).attr("checked","checked") : $(this).removeAttr("checked");
});
setChecklight();
});
//自定义提交
$("button[_submit]").click(function(){
url = $(this).attr("_submit");
if(/\[new\].*/.test(url)){
url = url.replace(/\[new\]/,"");
}else{
url = $(this).parents("form").attr("action")+url;
}
$(this).parents("form").attr("action",url).submit();
});
});
/*高亮初始化*/
function setChecklight(){
$(".tlist[_dlist*='check']").find("tbody tr td input[type='checkbox']").each(function(i){
tr = $(this).parent("td").parent("tr");
if($(this).attr("checked")){
tr.addClass("t_sl");
}else{
tr.removeClass("t_sl");
}
});
}
/*栏目跳转*/
function AC(mid){
f = $(window.parent.document);
mlink = f.find("a[id='"+mid+"']");
if(mlink.size()>0){
box = mlink.parents("div[id^='menu_']");
boxid = box.attr("id").substring(5,128);
if($("body").attr("class")!="showmenu")$("#togglemenu").click();
if(mlink.attr("_url")){
$("#menu").find("div[id^=menu]").hide();
box.show();
mlink.addClass("thisclass").blur().parents("#menu").find("ul li a").not(mlink).removeClass("thisclass");
if($("#mod_"+boxid).attr("class")==""){
$("#nav").find("a").removeClass("thisclass");
$("#nav").find("a[id='mod_"+boxid+"']").addClass("thisclass").blur();
}
window.location.href = mlink.attr("_url");
}else if(mlink.attr("_open") && mlink.attr("_open")!=undefined){
window.open(mlink.attr("_open"));
}
}
}