-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatephase.html
More file actions
154 lines (154 loc) · 5.06 KB
/
statephase.html
File metadata and controls
154 lines (154 loc) · 5.06 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
<!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>
//设置行,列
var cols=32; //11列
var rows=32; //16行
var htmlstr="<tr>";
for(i=1;i<=rows;i++){
htmlstr+="<td>"+i+"</td></td>";
if (i<10) {
i = "0" +i;
};
for(j=1;j<=cols;j++){
if (j<10) {
j = "00" +j;
} else if (j>=10 && j<100) {
j = "0" + j;
} else {
j = j;
}
htmlstr+="<td><input type='checkbox' name="+"p"+i+j+" id="+"p"+i+j+" value="+"p"+i+j+"></td>";
}
htmlstr+="</tr>";
}
document.getElementById('phase1').innerHTML = htmlstr;
$.ajax({
type: "POST",
url: "/stage1",
success:function(data){
console.log(data);
$.each(data.stage1[0], function(key,item){
// $("input[name='test1'][value='"+item+"']").attr("checked","checked");
$("#"+key).val(item).attr("checked","checked");
});
},
error:function(){
alert("加载资源失败");
}
});
function mysubmit()
{
if(window.confirm("确定要提交吗?"))
{
// var test1 = $("input[name='test1']:checked").serialize();
$.ajax({
type: "POST",
url: "/stage1",
contentType: 'application/json',
dataType: "json",
data: $('#form1').serialize(),
success:function(data){
console.log(data);
$.each(data.stage1[0],function(key,item){
$("#"+key).val(item).attr("checked","checked");
});
},
error:function(){
alert("加载资源失败");
}
})
}
else
{
return false;
}
}
function myrst(){
if(window.confirm("确定要重置吗?"))
{
$.ajax({
type: "POST",
url: "/stage1",
contentType: 'application/json',
dataType: "json",
success:function(data){
console.log(data);
$.each(data.stage1[0],function(key,item){
$("#"+key).val(item).attr("checked","checked");
});
},
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 >阶段</th>
<th >1</th>
<th >2</th>
<th >3</th>
<th >4</th>
<th >5</th>
<th >6</th>
<th >7</th>
<th >8</th>
<th>9</th>
<th>10</th>
<th>11</th>
<th>12</th>
<th>13</th>
<th>14</th>
<th>15</th>
<th>16</th>
<th>17</th>
<th>18</th>
<th>19</th>
<th>20</th>
<th>21</th>
<th>22</th>
<th>23</th>
<th>24</th>
<th>25</th>
<th>26</th>
<th>27</th>
<th>28</th>
<th>29</th>
<th>30</th>
<th>31</th>
<th>32</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>