-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomputerlist.php
More file actions
157 lines (152 loc) · 6.6 KB
/
computerlist.php
File metadata and controls
157 lines (152 loc) · 6.6 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>电脑捐赠清单</title>
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://unpkg.com/bootstrap-table@1.14.2/dist/bootstrap-table.min.css" rel="stylesheet">
<script src="https://unpkg.com/bootstrap-table@1.14.2/dist/bootstrap-table.min.js"></script>
<link rel="stylesheet" href="application/views/sqllesson/main.css">
<link rel="stylesheet" href="application/views/sqllesson/list.css">
<link rel="stylesheet" href="application/views/sqllesson/donate.css">
<script>
window.onload = function() {
var str1 = "";
var str2 = "";
var str3 = "";
$.ajax({
type: "POST",
async: false,
url: "./index.php?/pages/sqlGet/gettable_computer1",
dataType: "json",
success: function(result) {
var dataObj = result; //初始化表格信息
$.each(dataObj, function(index, item) {
str1 += "<tr "+"onclick=\"melody(this);\""+"id=\""+item.ID+"\">";
str1 += "<td>" + item.ID + "</td>";
str1 += "<td>" + item.type + "</td>";
str1 += "<td>" + item.donorname + "</td>";
str1 += "<td>" + "库存内" + "</td>";
switch (item.status) {
case "1":
str1 += "<td>存入库存</td>";
break;
case "2":
str1 += "<td>保管</td>";
break;
case "3":
str1 += "<td>已捐赠</td>";
break;
}
str1 += "</tr>";
});
}
})
$.ajax({
type: "POST",
async: false,
url: "./index.php?/pages/sqlGet/gettable_computer2",
dataType: "json",
success: function(result) {
var dataObj = result; //初始化表格信息
$.each(dataObj, function(index, item) {
str1 += "<tr "+"onclick=\"melody(this);\""+"id=\""+item.ID+"\">";
str2 += "<td>" + item.ID + "</td>";
str2 += "<td>" + item.type + "</td>";
str2 += "<td>" + item.donorname + "</td>";
str2 += "<td>" + item.ownername + "</td>";
switch (item.status) {
case "1":
str2 += "<td>存入库存</td>";
break;
case "2":
str2 += "<td>保管</td>";
break;
case "3":
str2 += "<td>已捐赠</td>";
break;
}
str2 += "</tr>";
});
}
})
$.ajax({
type: "POST",
async: false,
url: "./index.php?/pages/sqlGet/gettable_computer3",
dataType: "json",
success: function(result) {
var dataObj = result; //初始化表格信息
$.each(dataObj, function(index, item) {
str1 += "<tr "+"onclick=\"melody(this);\""+"id=\""+item.ID+"\">";
str3 += "<td>" + item.ID + "</td>";
str3 += "<td>" + item.type + "</td>";
str3 += "<td>" + item.donorname + "</td>";
str3 += "<td>" + item.ownername + "</td>";
switch (item.status) {
case "1":
str3 += "<td>存入库存</td>";
break;
case "2":
str3 += "<td>保管</td>";
break;
case "3":
str3 += "<td>已捐赠</td>";
break;
}
str3 += "</tr>";
});
}
})
var str = str1 + str2 + str3;
$("#table").html(str); //把内容入到这个div中即完成
}
function melody(aim){
$.ajax({
type: "POST",
async: false,
url: "./index.php?/pages/sqlGet/searchcomputer",
data:{'id':aim.id},
dataType: "json",
success: function(result) {
var dataObj = result; //初始化表格信息
var str1="";
$.each(dataObj, function(index, item) {
str1+="<img src=\""+item.photo_url+"\">";
str1+="<div>型号:"+item.type+"</div>";
str1+="<div>备注:"+item.remark+"</div>";
});
$("#modal").html(str1); //把内容入到这个div中即完成
$('#computer-model').modal('show');
}
})
}
</script>
</head>
<body>
<div class="donate-big-title">捐赠公益 <small>点击表格可显示详细信息</small></div>
<table class="text-center table">
<thead>
<tr>
<th>ID</th>
<th>型号</th>
<th>捐赠者</th>
<th>持有者</th>
<th>状态</th>
</tr>
</thead>
<tbody id="table">
</tbody>
</table>
<div class="modal fade" id="computer-model" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="info" id="modal">
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
</body>
</html>