KuRRe8 commited on
Commit
51c0e57
·
verified ·
1 Parent(s): c379b59

在网页下面,再搞一个类似的表,但是要11列内容

Browse files
Files changed (2) hide show
  1. index.html +46 -1
  2. script.js +50 -1
index.html CHANGED
@@ -118,10 +118,55 @@
118
  </div>
119
  </section>
120
  </main>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
 
122
  <!-- Footer -->
123
  <footer class="bg-gray-800 text-white py-6">
124
- <div class="container mx-auto px-4">
125
  <div class="flex flex-col md:flex-row justify-between items-center">
126
  <div class="mb-4 md:mb-0">
127
  <p class="text-gray-300">© 2023 Faulty Whistle Monitoring System</p>
 
118
  </div>
119
  </section>
120
  </main>
121
+ <!-- Extended Table Section -->
122
+ <section class="mt-12 bg-white rounded-xl shadow-md overflow-hidden">
123
+ <div class="p-6 border-b border-gray-200">
124
+ <h2 class="text-xl font-semibold text-gray-800 flex items-center">
125
+ <i data-feather="list" class="mr-2 text-indigo-500"></i>
126
+ Detailed Sensor Data
127
+ </h2>
128
+ <p class="text-gray-500 mt-1">Comprehensive sensor readings with additional metrics</p>
129
+ </div>
130
+ <div class="overflow-x-auto max-h-96 overflow-y-auto">
131
+ <table class="min-w-full divide-y divide-gray-200 sticky-header">
132
+ <thead class="bg-gray-50">
133
+ <tr>
134
+ <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Sensor ID</th>
135
+ <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Location</th>
136
+ <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Type</th>
137
+ <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Value</th>
138
+ <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Unit</th>
139
+ <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Min</th>
140
+ <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Max</th>
141
+ <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Avg</th>
142
+ <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
143
+ <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Last Calibration</th>
144
+ <th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Next Calibration</th>
145
+ </tr>
146
+ </thead>
147
+ <tbody class="bg-white divide-y divide-gray-200" id="detailedTable">
148
+ <!-- Table rows will be populated by JavaScript -->
149
+ </tbody>
150
+ </table>
151
+ </div>
152
+ <div class="px-6 py-4 bg-gray-50 border-t border-gray-200 flex items-center justify-between">
153
+ <div class="text-sm text-gray-500">
154
+ Showing <span class="font-medium">1</span> to <span class="font-medium">10</span> of <span class="font-medium">24</span> sensors
155
+ </div>
156
+ <div class="flex space-x-2">
157
+ <button class="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">
158
+ Previous
159
+ </button>
160
+ <button class="px-3 py-1 border border-indigo-500 rounded-md text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700">
161
+ Next
162
+ </button>
163
+ </div>
164
+ </div>
165
+ </section>
166
 
167
  <!-- Footer -->
168
  <footer class="bg-gray-800 text-white py-6">
169
+ <div class="container mx-auto px-4">
170
  <div class="flex flex-col md:flex-row justify-between items-center">
171
  <div class="mb-4 md:mb-0">
172
  <p class="text-gray-300">© 2023 Faulty Whistle Monitoring System</p>
script.js CHANGED
@@ -154,4 +154,53 @@ document.addEventListener('DOMContentLoaded', function() {
154
 
155
  tableBody.appendChild(row);
156
  });
157
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
 
155
  tableBody.appendChild(row);
156
  });
157
+
158
+ // Populate detailed table with sample data
159
+ const detailedData = [
160
+ { id: 'S-001', location: 'Engine Bay', type: 'Temperature', value: '28.5', unit: '°C', min: '10', max: '35', avg: '25.2', status: 'normal', lastCalibration: '2023-05-15', nextCalibration: '2023-08-15' },
161
+ { id: 'S-002', location: 'Hydraulic System', type: 'Pressure', value: '8.2', unit: 'bar', min: '5', max: '10', avg: '7.8', status: 'normal', lastCalibration: '2023-04-20', nextCalibration: '2023-07-20' },
162
+ { id: 'S-003', location: 'Wheel Assembly', type: 'Vibration', value: '0.42', unit: 'mm/s', min: '0.1', max: '0.5', avg: '0.38', status: 'warning', lastCalibration: '2023-03-10', nextCalibration: '2023-06-10' },
163
+ { id: 'S-004', location: 'Cabin', type: 'Humidity', value: '65', unit: '%', min: '30', max: '70', avg: '58', status: 'normal', lastCalibration: '2023-06-01', nextCalibration: '2023-09-01' },
164
+ { id: 'S-005', location: 'Fuel Tank', type: 'Level', value: '78', unit: '%', min: '10', max: '100', avg: '72', status: 'normal', lastCalibration: '2023-05-25', nextCalibration: '2023-08-25' },
165
+ { id: 'S-006', location: 'Brake System', type: 'Temperature', value: '95', unit: '°C', min: '20', max: '80', avg: '65', status: 'critical', lastCalibration: '2023-04-15', nextCalibration: '2023-07-15' },
166
+ { id: 'S-007', location: 'Battery', type: 'Voltage', value: '24.3', unit: 'V', min: '22', max: '26', avg: '24.1', status: 'normal', lastCalibration: '2023-06-05', nextCalibration: '2023-09-05' },
167
+ { id: 'S-008', location: 'Coolant System', type: 'Flow Rate', value: '12.5', unit: 'L/min', min: '10', max: '15', avg: '12.8', status: 'normal', lastCalibration: '2023-05-10', nextCalibration: '2023-08-10' },
168
+ { id: 'S-009', location: 'Exhaust', type: 'Temperature', value: '320', unit: '°C', min: '200', max: '350', avg: '280', status: 'normal', lastCalibration: '2023-04-25', nextCalibration: '2023-07-25' },
169
+ { id: 'S-010', location: 'Air Intake', type: 'Pressure', value: '1.02', unit: 'bar', min: '0.95', max: '1.05', avg: '1.01', status: 'normal', lastCalibration: '2023-06-10', nextCalibration: '2023-09-10' }
170
+ ];
171
+
172
+ const detailedTableBody = document.getElementById('detailedTable');
173
+
174
+ detailedData.forEach(item => {
175
+ const row = document.createElement('tr');
176
+
177
+ let statusClass = 'status-warning';
178
+ let statusText = 'Warning';
179
+ if (item.status === 'normal') {
180
+ statusClass = 'status-normal';
181
+ statusText = 'Normal';
182
+ } else if (item.status === 'critical') {
183
+ statusClass = 'status-critical';
184
+ statusText = 'Critical';
185
+ }
186
+
187
+ row.innerHTML = `
188
+ <td class="px-4 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${item.id}</td>
189
+ <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">${item.location}</td>
190
+ <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">${item.type}</td>
191
+ <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500 font-semibold">${item.value}</td>
192
+ <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">${item.unit}</td>
193
+ <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">${item.min}${item.unit}</td>
194
+ <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">${item.max}${item.unit}</td>
195
+ <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">${item.avg}${item.unit}</td>
196
+ <td class="px-4 py-4 whitespace-nowrap">
197
+ <span class="${statusClass}">${statusText}</span>
198
+ </td>
199
+ <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">${item.lastCalibration}</td>
200
+ <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">${item.nextCalibration}</td>
201
+ `;
202
+
203
+ detailedTableBody.appendChild(row);
204
+ });
205
+ });
206
+