-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdayplan.html
More file actions
152 lines (150 loc) · 5.3 KB
/
dayplan.html
File metadata and controls
152 lines (150 loc) · 5.3 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
<!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=20; //11列
var rows=16; //16行
var htmlstr="<tr>";
for(i=1;i<=rows;i++){
htmlstr+="<td>"+i+"</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 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: "/dayplan1",
contentType: 'application/json',
dataType: "json",
success:function(data){
console.log(data);
// var test1 = data.returnJson[0].list_1[0]; //循环遍历品牌表数据并赋给input
$.each(data.dayplan1[0],function(key,item){
$("#"+key).val(item); //返回结果为null时,转换成空字符串
})
},
error:function(){
alert("加载资源失败");
}
});
function mysubmit()
{
if(window.confirm("确定要提交吗?"))
{
$.ajax({
type: "POST",
url: "/dayplan1",
contentType: 'application/json',
dataType: "json",
data: $('#form1').serialize(),
success:function(data){
console.log(data);
$.each(data.dayplan1[0],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: "/dayplan1",
contentType: 'application/json',
dataType: "json",
success:function(data){
console.log(data);
// var test1 = data.returnJson[0].list_1[0]; //循环遍历品牌表数据并赋给input
$.each(data.dayplan1[0],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 colspan="10">日计划1</th>
<th colspan="11">路口号:<input type="text" style="width: 40px" id="p17001" name="175001"></th>
</tr>
<tr>
<th class="col-sm-1">相位</th>
<th>小时</th>
<th>分钟</th>
<th>方案号</th>
<th>模式</th>
<th>模式1</th>
<th>参数1</th>
<th>模式2</th>
<th>参数2</th>
<th>模式3</th>
<th>参数3</th>
<th>模式4</th>
<th>参数4</th>
<th>模式5</th>
<th>参数5</th>
<th>模式6</th>
<th>参数6</th>
<th>模式7</th>
<th>参数7</th>
<th>模式8</th>
<th>参数8</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>