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
function 
canshuadd(){
    
var 
html=
'<div class="panel panel-default toggle">'
;
      
//  html+='<label class="col-lg-2 control-label">*名称:</label>';
        
html+=
'<div class="col-lg-4" style="margin-left:60px;margin-top:40px;">'
;
        
html+=
'<input type="hidden" name="style" id="style"  value="add">'
;
        
html+=
'名称:<input type="text" id="parmaName" name="parmaName" value="" >'
;
        
html+=
'</div>'
;
        
html+=
'</div>'
;
 
    
layer.open({
        
shade: 0.8,
        
title: 
'添加参数名称'
,
        
type: 1,
        
area : [
'400px' 
'200px'
],
        
btn: [
'提交'
'取消'
],
        
yes: 
function
(index, layero){
            
var 
parma = {};
            
parma.parentId=parentId1;
            
parma.style=$(
"#style"
).val();
            
parma.parmaName = $(
"#parmaName"
).val();
            
console.log(parma.parmaName);console.log(parma.parentId);console.log(parma.style);
            
if
(parma.parmaName== 
""
){
                
layer.msg(
"数据不能为空"
);
                
layer.close(index);
                
return 
false
;
            
}
            
$.post(submiturl,parma,
function
(data){
                
if
(data == 1){
                    
window.location.href=window.location.href;
                    
layer.msg(
"操作成功"
);
                    
layer.close(index);
                
}
else 
if
(data==3){
                    
layer.msg(
"数据重复了。"
)
                
}
                
else
{
                    
layer.msg(
"操作失败"
);
                
}
            
});
            
layer.close(index);
        
},
        
close : 
function
(index){
            
layer.close(index);
        
},
 
 
 
 
        
content: html
    
});
    
return 
false
;
}
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
传参数到iframe页面打开页面并进行数据验证
function 
typemod(pr){
    
_followTypeId=$(pr).attr(
'data'
);
    
var 
submiturl=$(pr).attr(
'data1'
);
    
var 
houseediturl=$(pr).attr(
'data2'
);
    
layer.open({
        
shade: 0.8,
        
title: 
'修改参数名称'
,
        
type: 2,
        
area: [
'600px'
'580px'
],
        
btn: [
'提交'
'取消'
],
        
yes: 
function 
(index, layero) {
            
var 
parma = {};
            
parma.followTypeId =_followTypeId;
            
parma.style =
'mod'
;
            
parma.followText = $.trim(layer.getChildFrame(
'[name="followText"]'
, index).val());
            
parma.examineStyle = $.trim(layer.getChildFrame(
'input:radio[name=examineStyle]:checked'
,index).val());
            
//parma.style = $.trim(layer.getChildFrame('[name="style"]', index).val());
            
parma.range =$.trim(layer.getChildFrame(
'[name="range"]'
, index).val());
            
parma.examineJob =$.trim(layer.getChildFrame(
'[name="examineJob"]'
, index).val());
            
console.log(parma.followText);
            
console.log(parma.style);
            
console.log(parma.examineStyle);
            
console.log(parma.range);
            
console.log(parma.examineJob);
            
if 
(parma.followText == 
""
) {
                
layer.msg(
"数据不能为空"
);
                
layer.close(index);
                
return 
false
;
            
}
            
$.post(submiturl, parma, 
function 
(data) {
                
if 
(data == 1) {
                    
window.location.href = window.location.href;
                    
layer.msg(
"操作成功"
);
                    
layer.close(index);
                
else 
if 
(data == 3) {
                    
layer.msg(
"数据重复了。"
)
                
}
                
else 
{
                    
layer.msg(
"操作失败"
);
                
}
            
});
            
layer.close(index);
        
},
        
close: 
function 
(index) {
            
layer.close(index);
        
},
        
content: houseediturl+
'&followTypeId='
+_followTypeId
    
});
    
return 
false
;
}

本文转自 liang3391 51CTO博客,原文链接:http://blog.51cto.com/liang3391/1873849