-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtiming.html
More file actions
128 lines (126 loc) · 4.37 KB
/
timing.html
File metadata and controls
128 lines (126 loc) · 4.37 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>配时方案</title>
<link rel="stylesheet" href="css/index.css">
<link rel="stylesheet" href="css/reasyui.css">
<script src="js/libs/jquery-1.11.2.js"></script>
<!--<script src="js/phase.js"></script><-->
<script>
//设置行,列
var cols=4; //11列
var rows=16; //16行
var htmlstr="<tr>";
for(i=1;i<=rows;i++){
htmlstr+="<td class='col-sm-1'>"+i+"</td>";
if (i<10) {
i = "0" +i;
};
for(j=1;j<=cols;j++){
if (j<10) {
j = "0" +j;
};
htmlstr+="<td class='col-sm-1'><input class='form-control' type='text' name="+"p"+i+j+" id="+"P"+i+j+"></td>";
}
htmlstr+="</tr>";
}
document.getElementById('phase1').innerHTML = htmlstr;
$.ajax({
type: "POST",
url: "/test",
contentType: 'application/json',
dataType: "json",
success:function(data){
console.log(data);
// var test1 = data.returnJson[0].list_1[0]; //循环遍历品牌表数据并赋给input
$.each(data,function(key,item){
$("#"+key).val(item); //返回结果为null时,转换成空字符串
})
},
error:function(){
alert("加载资源失败");
}
});
function mysubmit()
{
if(window.confirm("确定要提交吗?"))
{
$.ajax({
type: "POST",
url: "/test",
contentType: 'application/json',
dataType: "json",
data: $('#form1').serialize(),
success:function(data){
console.log(data);
$.each(data,function(key,item){
$("#"+key).val(item); //返回结果为null时,转换成空字符串
})
},
error: function(data, type, err){
console.log("ajax错误类型:"+type);
console.log(err);
}
});
}
else
{
return false;
}
}
function myrst(){
if(window.confirm("确定要重置吗?"))
{
$.ajax({
type: "POST",
url: "/test",
contentType: 'application/json',
dataType: "json",
success:function(data){
console.log(data);
// var test1 = data.returnJson[0].list_1[0]; //循环遍历品牌表数据并赋给input
$.each(data,function(key,item){
$("#"+key).val(item); //返回结果为null时,转换成空字符串
})
},
error:function(){
alert("加载资源失败");
}
})
}
else
{
return false;
}
};
</script>
</head>
<body>
<section class="container-fluid">
<form class="form-horizontal" id="form1" action="#">
<h2 class="legend">配时方案</h2>
<fieldset>
<div class="col-lg-12">
<table class="table">
<thead>
<tr>
<th class="col-sm-1">序号</th>
<th class="col-sm-1">周期</th>
<th class="col-sm-1">相位差</th>
<th class="col-sm-1">协调相位</th>
<th class="col-sm-1">绿信比</th>
</tr>
</thead>
<tbody id="phase1"></tbody>
</table>
</div>
<div class="main-submit">
<button class="btn btn-frist btn-primary" type="button" onclick="mysubmit()">提交</button>
<button class="btn btn-frist btn-primary" type="button" onclick="myrst()">重置</button>
</div>
</fieldset>
</form>
</section>
</body>
</html>