device-alarm.html.bak3 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043
  1. <!DOCTYPE html>
  2. <html lang="zh-CN" class="iframe-content">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>设备告警信息 - 爱智农</title>
  7. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css">
  8. <link rel="stylesheet" href="https://at.alicdn.com/t/font_3114978_qe0b39no76.css">
  9. <link rel="stylesheet" href="../assets/css/global.css">
  10. <style>
  11. body {
  12. font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  13. background-color: #f5f7f9;
  14. color: #333;
  15. margin: 0;
  16. padding: 0;
  17. height: auto;
  18. overflow-y: auto;
  19. overflow-x: hidden;
  20. min-height: 100%;
  21. }
  22. .page-container {
  23. padding: 20px;
  24. padding-top: 70px; /* 添加顶部边距,为按钮留出空间 */
  25. position: relative;
  26. min-height: 100vh;
  27. width: 100%;
  28. max-width: 100%;
  29. box-sizing: border-box;
  30. }
  31. .card {
  32. background-color: white;
  33. border-radius: 8px;
  34. box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  35. }
  36. .table-container {
  37. position: relative;
  38. overflow-x: auto;
  39. }
  40. table {
  41. width: 100%;
  42. border-collapse: separate;
  43. border-spacing: 0;
  44. }
  45. th {
  46. white-space: nowrap;
  47. position: relative;
  48. overflow: visible;
  49. max-width: none;
  50. text-overflow: clip;
  51. background-color: #f9fafb;
  52. padding: 12px 16px;
  53. text-align: left;
  54. font-weight: 500;
  55. color: #6b7280;
  56. border-bottom: 1px solid #e5e7eb;
  57. }
  58. td {
  59. white-space: nowrap;
  60. max-width: 200px;
  61. overflow: hidden;
  62. text-overflow: ellipsis;
  63. padding: 12px 16px;
  64. border-bottom: 1px solid #e5e7eb;
  65. }
  66. tr:hover {
  67. background-color: #f9fafb;
  68. }
  69. tr:hover td:last-child {
  70. background-color: #f9fafb;
  71. }
  72. /* 固定最后一列(操作列)样式 */
  73. .table-fixed-right {
  74. position: relative;
  75. }
  76. .table-fixed-right th:last-child,
  77. .table-fixed-right td:last-child {
  78. position: sticky;
  79. right: 0;
  80. z-index: 2;
  81. background-color: white;
  82. box-shadow: -5px 0 5px -5px rgba(0, 0, 0, 0.1);
  83. }
  84. .table-fixed-right th:last-child {
  85. background-color: #f9fafb;
  86. }
  87. /* 表格滚动控件 */
  88. .table-scroll-controls {
  89. display: none;
  90. position: absolute;
  91. top: 50%;
  92. transform: translateY(-50%);
  93. width: 100%;
  94. pointer-events: none;
  95. z-index: 3;
  96. }
  97. .table-scroll-btn {
  98. position: absolute;
  99. width: 32px;
  100. height: 32px;
  101. border-radius: 50%;
  102. background-color: rgba(255, 255, 255, 0.9);
  103. color: #4CAF50;
  104. border: 1px solid #e0e0e0;
  105. display: flex;
  106. align-items: center;
  107. justify-content: center;
  108. cursor: pointer;
  109. pointer-events: auto;
  110. box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  111. z-index: 4;
  112. }
  113. .table-scroll-left {
  114. left: 10px;
  115. }
  116. .table-scroll-right {
  117. right: 10px;
  118. }
  119. .has-overflow .table-scroll-controls {
  120. display: block;
  121. }
  122. .btn {
  123. display: inline-flex;
  124. align-items: center;
  125. justify-content: center;
  126. padding: 8px 16px;
  127. border-radius: 4px;
  128. font-weight: 500;
  129. cursor: pointer;
  130. transition: all 0.2s;
  131. }
  132. .btn-primary {
  133. background-color: #4CAF50;
  134. color: white;
  135. }
  136. .btn-primary:hover {
  137. background-color: #388E3C;
  138. }
  139. .btn-default {
  140. background-color: white;
  141. border: 1px solid #d1d5db;
  142. color: #374151;
  143. }
  144. .btn-default:hover {
  145. background-color: #f9fafb;
  146. }
  147. .btn-danger {
  148. background-color: #ef4444;
  149. color: white;
  150. }
  151. .btn-danger:hover {
  152. background-color: #dc2626;
  153. }
  154. .btn-warning {
  155. background-color: #f59e0b;
  156. color: white;
  157. }
  158. .btn-warning:hover {
  159. background-color: #d97706;
  160. }
  161. .btn-sm {
  162. padding: 4px 8px;
  163. font-size: 12px;
  164. }
  165. .btn-icon {
  166. margin-right: 4px;
  167. }
  168. /* 搜索表单样式 */
  169. .search-form {
  170. display: grid;
  171. grid-template-columns: repeat(2, 1fr);
  172. gap: 16px;
  173. padding: 10px 0;
  174. }
  175. @media (max-width: 768px) {
  176. .search-form {
  177. grid-template-columns: 1fr;
  178. }
  179. }
  180. .search-form-item {
  181. display: flex;
  182. align-items: center;
  183. }
  184. .search-form-label {
  185. width: 85px;
  186. font-size: 14px;
  187. color: #333;
  188. text-align: right;
  189. padding-right: 10px;
  190. white-space: nowrap;
  191. }
  192. .search-form-actions {
  193. grid-column: span 2;
  194. display: flex;
  195. justify-content: center;
  196. gap: 16px;
  197. margin-top: 16px;
  198. }
  199. @media (max-width: 768px) {
  200. .search-form-actions {
  201. grid-column: 1;
  202. }
  203. }
  204. /* 日期选择器样式 */
  205. .date-range {
  206. display: flex;
  207. gap: 8px;
  208. }
  209. .date-input {
  210. padding: 8px 12px;
  211. border: 1px solid #d1d5db;
  212. border-radius: 4px;
  213. flex-grow: 1;
  214. width: 100%;
  215. cursor: pointer;
  216. background-color: white;
  217. }
  218. .input {
  219. padding: 8px 12px;
  220. border: 1px solid #d1d5db;
  221. border-radius: 4px;
  222. flex-grow: 1;
  223. }
  224. .input:focus {
  225. outline: none;
  226. border-color: #4CAF50;
  227. box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
  228. }
  229. /* 多选下拉框样式 */
  230. .select-container {
  231. position: relative;
  232. width: 100%;
  233. }
  234. .select {
  235. padding: 8px 12px;
  236. border: 1px solid #d1d5db;
  237. border-radius: 4px;
  238. background-color: white;
  239. width: 100%;
  240. appearance: none;
  241. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  242. background-repeat: no-repeat;
  243. background-position: right 8px center;
  244. background-size: 16px;
  245. padding-right: 32px;
  246. }
  247. .select:focus {
  248. outline: none;
  249. border-color: #4CAF50;
  250. box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
  251. }
  252. .select[multiple] {
  253. padding: 6px;
  254. overflow-y: auto;
  255. max-height: 120px;
  256. }
  257. /* 多选选项样式 */
  258. .select[multiple] option {
  259. padding: 6px 8px;
  260. margin: 2px 0;
  261. border-radius: 3px;
  262. cursor: pointer;
  263. }
  264. .select[multiple] option:checked {
  265. background-color: rgba(76, 175, 80, 0.2);
  266. color: #333;
  267. }
  268. .select[multiple] option:hover {
  269. background-color: rgba(76, 175, 80, 0.1);
  270. }
  271. .modal-overlay {
  272. position: fixed;
  273. top: 0;
  274. left: 0;
  275. right: 0;
  276. bottom: 0;
  277. background-color: rgba(0, 0, 0, 0.5);
  278. display: flex;
  279. align-items: center;
  280. justify-content: center;
  281. z-index: 50;
  282. display: none;
  283. }
  284. .modal {
  285. background-color: white;
  286. border-radius: 8px;
  287. width: 100%;
  288. max-width: 600px;
  289. box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  290. }
  291. .modal-header {
  292. padding: 16px 24px;
  293. border-bottom: 1px solid #e5e7eb;
  294. display: flex;
  295. align-items: center;
  296. justify-content: space-between;
  297. }
  298. .modal-title {
  299. font-size: 18px;
  300. font-weight: 500;
  301. }
  302. .modal-close {
  303. cursor: pointer;
  304. font-size: 20px;
  305. }
  306. .modal-body {
  307. padding: 24px;
  308. }
  309. .modal-footer {
  310. padding: 16px 24px;
  311. border-top: 1px solid #e5e7eb;
  312. display: flex;
  313. justify-content: flex-end;
  314. gap: 8px;
  315. }
  316. .badge {
  317. display: inline-block;
  318. padding: 2px 8px;
  319. border-radius: 9999px;
  320. font-size: 12px;
  321. font-weight: 500;
  322. }
  323. .badge-success {
  324. background-color: #d1fae5;
  325. color: #065f46;
  326. }
  327. .badge-warning {
  328. background-color: #fef3c7;
  329. color: #92400e;
  330. }
  331. .badge-danger {
  332. background-color: #fee2e2;
  333. color: #b91c1c;
  334. }
  335. .pagination {
  336. display: flex;
  337. align-items: center;
  338. justify-content: flex-end;
  339. gap: 4px;
  340. }
  341. .pagination-item {
  342. display: inline-flex;
  343. align-items: center;
  344. justify-content: center;
  345. width: 32px;
  346. height: 32px;
  347. border-radius: 4px;
  348. cursor: pointer;
  349. transition: all 0.2s;
  350. }
  351. .pagination-item:hover {
  352. background-color: #f3f4f6;
  353. }
  354. .pagination-item.active {
  355. background-color: #4CAF50;
  356. color: white;
  357. }
  358. .pagination-item.disabled {
  359. color: #9ca3af;
  360. cursor: not-allowed;
  361. }
  362. .timeline {
  363. position: relative;
  364. padding-left: 32px;
  365. }
  366. .timeline-item {
  367. position: relative;
  368. padding-bottom: 16px;
  369. }
  370. .timeline-item:last-child {
  371. padding-bottom: 0;
  372. }
  373. .timeline-item::before {
  374. content: "";
  375. position: absolute;
  376. left: -24px;
  377. top: 6px;
  378. width: 12px;
  379. height: 12px;
  380. border-radius: 50%;
  381. background-color: #4CAF50;
  382. z-index: 1;
  383. }
  384. .timeline-item::after {
  385. content: "";
  386. position: absolute;
  387. left: -19px;
  388. top: 18px;
  389. width: 2px;
  390. height: calc(100% - 18px);
  391. background-color: #e5e7eb;
  392. }
  393. .timeline-item:last-child::after {
  394. display: none;
  395. }
  396. .timeline-time {
  397. font-size: 12px;
  398. color: #6b7280;
  399. margin-bottom: 2px;
  400. }
  401. .alarm-type-urgent {
  402. border-left: 4px solid #ef4444;
  403. }
  404. .alarm-type-warning {
  405. border-left: 4px solid #f59e0b;
  406. }
  407. .alarm-type-notice {
  408. border-left: 4px solid #3b82f6;
  409. }
  410. /* 修复按钮被遮挡的问题 */
  411. .action-buttons {
  412. position: relative;
  413. z-index: 1000 !important;
  414. }
  415. /* 多选框样式 */
  416. select[multiple] {
  417. height: auto;
  418. min-height: 38px;
  419. padding: 4px 8px;
  420. }
  421. select[multiple] option {
  422. padding: 4px 8px;
  423. margin: 2px 0;
  424. border-radius: 2px;
  425. }
  426. select[multiple] option:checked {
  427. background-color: rgba(76, 175, 80, 0.1);
  428. color: #4CAF50;
  429. }
  430. /* 日期选择器样式 */
  431. input[type="date"] {
  432. padding: 8px 12px;
  433. border: 1px solid #d1d5db;
  434. border-radius: 4px;
  435. }
  436. input[type="date"]:focus {
  437. outline: none;
  438. border-color: #4CAF50;
  439. box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
  440. }
  441. </style>
  442. </head>
  443. <body>
  444. <div class="page-container responsive-container">
  445. <div class="flex justify-between items-center mb-6">
  446. <h1 class="text-2xl font-bold">设备告警信息</h1>
  447. <div class="flex gap-2 action-buttons">
  448. <button class="btn btn-default">
  449. <i class="iconfont icon-reload btn-icon"></i>
  450. 刷新数据
  451. </button>
  452. <button class="btn btn-primary" style="position: relative; z-index: 1000;">
  453. <i class="iconfont icon-setting btn-icon"></i>
  454. 告警设置
  455. </button>
  456. </div>
  457. </div>
  458. <div class="card p-6 mb-6">
  459. <div class="search-form">
  460. <!-- 设备编号 关键词搜索 -->
  461. <div class="search-form-item">
  462. <label class="search-form-label">设备编号:</label>
  463. <input type="text" class="input flex-1" placeholder="请输入设备编号关键词">
  464. </div>
  465. <!-- 设备名称 关键词搜索 -->
  466. <div class="search-form-item">
  467. <label class="search-form-label">设备名称:</label>
  468. <input type="text" class="input flex-1" placeholder="请输入设备名称关键词">
  469. </div>
  470. <!-- 告警等级 下拉框多选 -->
  471. <div class="search-form-item">
  472. <label class="search-form-label">告警等级:</label>
  473. <select class="select flex-1" multiple size="3">
  474. <option value="urgent">紧急</option>
  475. <option value="warning">警告</option>
  476. <option value="notice">提示</option>
  477. </select>
  478. </div>
  479. <!-- 设备类型 下拉框多选 -->
  480. <div class="search-form-item">
  481. <label class="search-form-label">设备类型:</label>
  482. <select class="select flex-1" multiple size="4">
  483. <option value="sensor">传感器</option>
  484. <option value="camera">摄像设备</option>
  485. <option value="controller">控制器</option>
  486. <option value="weather">气象设备</option>
  487. </select>
  488. </div>
  489. <!-- 所属农场 -->
  490. <div class="search-form-item">
  491. <label class="search-form-label">所属农场:</label>
  492. <select class="select flex-1">
  493. <option value="">全部</option>
  494. <option value="demo">示范农场</option>
  495. <option value="smart">智慧农场</option>
  496. </select>
  497. </div>
  498. <!-- 所属地块 -->
  499. <div class="search-form-item">
  500. <label class="search-form-label">所属地块:</label>
  501. <select class="select flex-1">
  502. <option value="">全部</option>
  503. <option value="east1">东区1号地块</option>
  504. <option value="east2">东区2号地块</option>
  505. <option value="west1">西区1号地块</option>
  506. <option value="south3">南区3号地块</option>
  507. <option value="north1">北区1号地块</option>
  508. </select>
  509. </div>
  510. <!-- 设备状态 -->
  511. <div class="search-form-item">
  512. <label class="search-form-label">设备状态:</label>
  513. <select class="select flex-1">
  514. <option value="">全部</option>
  515. <option value="1">已处理</option>
  516. <option value="0">未处理</option>
  517. <option value="2">处理中</option>
  518. </select>
  519. </div>
  520. <!-- 搜索按钮区域 -->
  521. <div class="search-form-actions">
  522. <button class="btn btn-primary">
  523. <i class="iconfont icon-search btn-icon"></i>
  524. 搜索
  525. </button>
  526. <button class="btn btn-default">
  527. <i class="iconfont icon-reload btn-icon"></i>
  528. 重置
  529. </button>
  530. </div>
  531. </div>
  532. </div>
  533. <div class="card">
  534. <div class="table-container">
  535. <div class="table-scroll-controls">
  536. <button class="table-scroll-btn table-scroll-left">
  537. <i class="iconfont icon-left"></i>
  538. </button>
  539. <button class="table-scroll-btn table-scroll-right">
  540. <i class="iconfont icon-right"></i>
  541. </button>
  542. </div>
  543. <table class="table-fixed-right">
  544. <thead>
  545. <tr>
  546. <th>告警ID</th>
  547. <th>告警等级</th>
  548. <th>设备名称</th>
  549. <th>设备编号</th>
  550. <th>设备类型</th>
  551. <th>所属地块</th>
  552. <th>所属农场</th>
  553. <th>告警内容</th>
  554. <th>告警时间</th>
  555. <th>处理状态</th>
  556. <th>处理人</th>
  557. <th>处理时间</th>
  558. <th class="min-w-[150px]">操作</th>
  559. </tr>
  560. </thead>
  561. <tbody>
  562. <tr>
  563. <td>ALM-20230001</td>
  564. <td><span class="badge badge-danger">紧急</span></td>
  565. <td>土壤传感器 #2</td>
  566. <td>SNS-20230002</td>
  567. <td>传感器</td>
  568. <td>东区2号地块</td>
  569. <td>示范农场</td>
  570. <td>电池电量过低,即将无法工作</td>
  571. <td>2023-05-15 10:25:36</td>
  572. <td><span class="badge badge-danger">未处理</span></td>
  573. <td>-</td>
  574. <td>-</td>
  575. <td>
  576. <div class="flex gap-2">
  577. <button class="btn btn-default btn-sm view-btn" data-id="1">
  578. <i class="iconfont icon-eye btn-icon"></i>
  579. 查看
  580. </button>
  581. <button class="btn btn-primary btn-sm handle-btn" data-id="1">
  582. <i class="iconfont icon-check btn-icon"></i>
  583. 处理
  584. </button>
  585. </div>
  586. </td>
  587. </tr>
  588. <tr>
  589. <td>ALM-20230002</td>
  590. <td><span class="badge badge-warning">警告</span></td>
  591. <td>摄像头 #3</td>
  592. <td>CAM-20230003</td>
  593. <td>摄像设备</td>
  594. <td>西区1号地块</td>
  595. <td>示范农场</td>
  596. <td>信号弱,视频画面不稳定</td>
  597. <td>2023-05-15 09:18:42</td>
  598. <td><span class="badge badge-warning">处理中</span></td>
  599. <td>张三</td>
  600. <td>2023-05-15 10:20:15</td>
  601. <td>
  602. <div class="flex gap-2">
  603. <button class="btn btn-default btn-sm view-btn" data-id="2">
  604. <i class="iconfont icon-eye btn-icon"></i>
  605. 查看
  606. </button>
  607. <button class="btn btn-primary btn-sm handle-btn" data-id="2">
  608. <i class="iconfont icon-check btn-icon"></i>
  609. 处理
  610. </button>
  611. </div>
  612. </td>
  613. </tr>
  614. <tr>
  615. <td>ALM-20230003</td>
  616. <td><span class="badge badge-danger">紧急</span></td>
  617. <td>水位传感器 #1</td>
  618. <td>WLV-20230001</td>
  619. <td>传感器</td>
  620. <td>南区3号地块</td>
  621. <td>智慧农场</td>
  622. <td>水位超过预警线,可能发生溢出</td>
  623. <td>2023-05-15 08:45:20</td>
  624. <td><span class="badge badge-success">已处理</span></td>
  625. <td>李四</td>
  626. <td>2023-05-15 09:30:42</td>
  627. <td>
  628. <div class="flex gap-2">
  629. <button class="btn btn-default btn-sm view-btn" data-id="3">
  630. <i class="iconfont icon-eye btn-icon"></i>
  631. 查看
  632. </button>
  633. </div>
  634. </td>
  635. </tr>
  636. <tr>
  637. <td>ALM-20230004</td>
  638. <td><span class="badge badge-warning">警告</span></td>
  639. <td>气象站 #1</td>
  640. <td>WEA-20230001</td>
  641. <td>气象设备</td>
  642. <td>北区1号地块</td>
  643. <td>智慧农场</td>
  644. <td>湿度传感器异常,读数不稳定</td>
  645. <td>2023-05-14 17:32:15</td>
  646. <td><span class="badge badge-danger">未处理</span></td>
  647. <td>-</td>
  648. <td>-</td>
  649. <td>
  650. <div class="flex gap-2">
  651. <button class="btn btn-default btn-sm view-btn" data-id="4">
  652. <i class="iconfont icon-eye btn-icon"></i>
  653. 查看
  654. </button>
  655. <button class="btn btn-primary btn-sm handle-btn" data-id="4">
  656. <i class="iconfont icon-check btn-icon"></i>
  657. 处理
  658. </button>
  659. </div>
  660. </td>
  661. </tr>
  662. <tr>
  663. <td>ALM-20230005</td>
  664. <td><span class="badge badge-primary" style="background-color: #dbeafe; color: #1e40af;">提示</span></td>
  665. <td>自动灌溉控制器 #1</td>
  666. <td>IRR-20230001</td>
  667. <td>控制器</td>
  668. <td>东区1号地块</td>
  669. <td>示范农场</td>
  670. <td>设备需要例行维护检查</td>
  671. <td>2023-05-14 14:10:08</td>
  672. <td><span class="badge badge-success">已处理</span></td>
  673. <td>王五</td>
  674. <td>2023-05-14 16:45:20</td>
  675. <td>
  676. <div class="flex gap-2">
  677. <button class="btn btn-default btn-sm view-btn" data-id="5">
  678. <i class="iconfont icon-eye btn-icon"></i>
  679. 查看
  680. </button>
  681. </div>
  682. </td>
  683. </tr>
  684. </tbody>
  685. </table>
  686. </div>
  687. <div class="p-4 flex justify-between items-center">
  688. <div class="text-sm text-gray-500">
  689. 共 <span class="font-medium">24</span> 条记录,每页 <span class="font-medium">10</span> 条
  690. </div>
  691. <div class="pagination">
  692. <div class="pagination-item disabled">
  693. <i class="iconfont icon-left"></i>
  694. </div>
  695. <div class="pagination-item active">1</div>
  696. <div class="pagination-item">2</div>
  697. <div class="pagination-item">3</div>
  698. <div class="pagination-item">
  699. <i class="iconfont icon-right"></i>
  700. </div>
  701. </div>
  702. </div>
  703. </div>
  704. </div>
  705. <!-- 告警详情弹窗 -->
  706. <div class="modal-overlay" id="alarmDetailModal">
  707. <div class="modal">
  708. <div class="modal-header">
  709. <h3 class="modal-title">告警详情</h3>
  710. <div class="modal-close" id="closeDetailModal">&times;</div>
  711. </div>
  712. <div class="modal-body">
  713. <div class="p-4 mb-4 bg-red-50 alarm-type-urgent">
  714. <div class="flex justify-between items-center mb-2">
  715. <span class="badge badge-danger">紧急</span>
  716. <span class="text-sm text-gray-500">2023-05-15 10:25:36</span>
  717. </div>
  718. <h3 class="text-lg font-bold mb-2">电池电量过低,即将无法工作</h3>
  719. <p class="text-gray-600 mb-2">土壤传感器 #2 (SNS-20230002) 电池电量低于10%,请尽快更换电池,否则设备将在24小时内无法正常工作。</p>
  720. <div class="flex justify-between text-sm text-gray-500">
  721. <span>告警ID: ALM-20230001</span>
  722. <span>设备位置: 东区2号地块</span>
  723. </div>
  724. </div>
  725. <div class="mb-4">
  726. <h4 class="font-medium mb-2">设备信息</h4>
  727. <div class="grid grid-cols-2 gap-4">
  728. <div>
  729. <div class="text-xs text-gray-500 mb-1">设备ID</div>
  730. <div class="font-medium">SNS-20230002</div>
  731. </div>
  732. <div>
  733. <div class="text-xs text-gray-500 mb-1">设备类型</div>
  734. <div class="font-medium">土壤传感器</div>
  735. </div>
  736. <div>
  737. <div class="text-xs text-gray-500 mb-1">安装位置</div>
  738. <div class="font-medium">东区2号地块</div>
  739. </div>
  740. <div>
  741. <div class="text-xs text-gray-500 mb-1">安装时间</div>
  742. <div class="font-medium">2023-01-20</div>
  743. </div>
  744. </div>
  745. </div>
  746. <div class="mb-4">
  747. <h4 class="font-medium mb-2">告警状态</h4>
  748. <div class="mb-1 flex justify-between">
  749. <span>当前状态</span>
  750. <span class="font-medium text-red-600">未处理</span>
  751. </div>
  752. <div class="mb-1 flex justify-between">
  753. <span>处理人</span>
  754. <span class="font-medium">-</span>
  755. </div>
  756. <div class="mb-1 flex justify-between">
  757. <span>处理时间</span>
  758. <span class="font-medium">-</span>
  759. </div>
  760. </div>
  761. <div>
  762. <h4 class="font-medium mb-2">处理记录</h4>
  763. <div class="text-center text-gray-500 py-4">
  764. 暂无处理记录
  765. </div>
  766. </div>
  767. </div>
  768. <div class="modal-footer">
  769. <button class="btn btn-default" id="cancelDetailBtn">关闭</button>
  770. </div>
  771. </div>
  772. </div>
  773. <!-- 处理告警弹窗 -->
  774. <div class="modal-overlay" id="alarmHandleModal">
  775. <div class="modal">
  776. <div class="modal-header">
  777. <h3 class="modal-title">处理告警</h3>
  778. <div class="modal-close" id="closeHandleModal">&times;</div>
  779. </div>
  780. <div class="modal-body">
  781. <div class="p-4 mb-4 bg-red-50 alarm-type-urgent">
  782. <h3 class="text-lg font-bold mb-2">电池电量过低,即将无法工作</h3>
  783. <p class="text-gray-600">土壤传感器 #2 (SNS-20230002)</p>
  784. </div>
  785. <div class="form-group mb-4">
  786. <label class="block font-medium mb-1">处理状态</label>
  787. <select class="w-full border border-gray-300 rounded p-2 focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-transparent">
  788. <option value="1">已处理</option>
  789. <option value="2">处理中</option>
  790. <option value="3">忽略</option>
  791. </select>
  792. </div>
  793. <div class="form-group mb-4">
  794. <label class="block font-medium mb-1">处理方式</label>
  795. <select class="w-full border border-gray-300 rounded p-2 focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-transparent">
  796. <option value="replace">更换设备</option>
  797. <option value="repair">维修设备</option>
  798. <option value="battery">更换电池</option>
  799. <option value="restart">重启设备</option>
  800. <option value="other">其他</option>
  801. </select>
  802. </div>
  803. <div class="form-group mb-4">
  804. <label class="block font-medium mb-1">处理说明</label>
  805. <textarea class="w-full border border-gray-300 rounded p-2 focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-transparent" rows="3" placeholder="请输入处理说明..."></textarea>
  806. </div>
  807. <div class="form-group">
  808. <label class="flex items-center">
  809. <input type="checkbox" class="mr-2">
  810. <span>通知相关人员</span>
  811. </label>
  812. </div>
  813. </div>
  814. <div class="modal-footer">
  815. <button class="btn btn-default" id="cancelHandleBtn">取消</button>
  816. <button class="btn btn-primary" id="submitHandleBtn">提交</button>
  817. </div>
  818. </div>
  819. </div>
  820. <script>
  821. document.addEventListener("DOMContentLoaded", function() {
  822. // 初始化表格滚动功能
  823. function initTableScroll() {
  824. const tableContainer = document.querySelector(".table-container");
  825. if (!tableContainer) return;
  826. const scrollLeftBtn = document.querySelector(".table-scroll-left");
  827. const scrollRightBtn = document.querySelector(".table-scroll-right");
  828. if (!scrollLeftBtn || !scrollRightBtn) return;
  829. // 检查表格是否需要水平滚动
  830. function checkTableOverflow() {
  831. if (tableContainer.scrollWidth > tableContainer.clientWidth) {
  832. tableContainer.classList.add("has-overflow");
  833. } else {
  834. tableContainer.classList.remove("has-overflow");
  835. }
  836. }
  837. // 左右滚动按钮点击事件
  838. scrollLeftBtn.addEventListener("click", function() {
  839. tableContainer.scrollLeft -= 150;
  840. });
  841. scrollRightBtn.addEventListener("click", function() {
  842. tableContainer.scrollLeft += 150;
  843. });
  844. // 初始检查和窗口大小变化时检查
  845. checkTableOverflow();
  846. window.addEventListener("resize", checkTableOverflow);
  847. // 滚动事件处理
  848. tableContainer.addEventListener("scroll", function() {
  849. // 根据滚动位置显示/隐藏滚动按钮
  850. if (tableContainer.scrollLeft <= 10) {
  851. scrollLeftBtn.style.opacity = "0.5";
  852. } else {
  853. scrollLeftBtn.style.opacity = "1";
  854. }
  855. if (tableContainer.scrollLeft >= tableContainer.scrollWidth - tableContainer.clientWidth - 10) {
  856. scrollRightBtn.style.opacity = "0.5";
  857. } else {
  858. scrollRightBtn.style.opacity = "1";
  859. }
  860. });
  861. // 初始触发滚动事件,设置初始按钮状态
  862. tableContainer.dispatchEvent(new Event("scroll"));
  863. }
  864. // 初始化表格滚动
  865. initTableScroll();
  866. // 告警详情弹窗
  867. const alarmDetailModal = document.getElementById('alarmDetailModal');
  868. const closeDetailModal = document.getElementById('closeDetailModal');
  869. const cancelDetailBtn = document.getElementById('cancelDetailBtn');
  870. const viewBtns = document.querySelectorAll('.view-btn');
  871. // 查看告警详情
  872. viewBtns.forEach(btn => {
  873. btn.addEventListener('click', function() {
  874. const alarmId = this.getAttribute('data-id');
  875. alarmDetailModal.style.display = 'flex';
  876. // 实际应用中应该根据ID获取告警详情
  877. });
  878. });
  879. // 关闭详情弹窗
  880. function closeDetailModal() {
  881. alarmDetailModal.style.display = 'none';
  882. }
  883. closeDetailModal.addEventListener('click', closeDetailModal);
  884. cancelDetailBtn.addEventListener('click', closeDetailModal);
  885. // 告警处理弹窗
  886. const alarmHandleModal = document.getElementById('alarmHandleModal');
  887. const closeHandleModal = document.getElementById('closeHandleModal');
  888. const cancelHandleBtn = document.getElementById('cancelHandleBtn');
  889. const submitHandleBtn = document.getElementById('submitHandleBtn');
  890. const handleBtns = document.querySelectorAll('.handle-btn');
  891. // 处理告警
  892. handleBtns.forEach(btn => {
  893. btn.addEventListener('click', function() {
  894. const alarmId = this.getAttribute('data-id');
  895. alarmHandleModal.style.display = 'flex';
  896. // 实际应用中应该根据ID获取告警详情
  897. });
  898. });
  899. // 关闭处理弹窗
  900. function closeHandleModal() {
  901. alarmHandleModal.style.display = 'none';
  902. }
  903. closeHandleModal.addEventListener('click', closeHandleModal);
  904. cancelHandleBtn.addEventListener('click', closeHandleModal);
  905. // 提交处理
  906. submitHandleBtn.addEventListener('click', function() {
  907. alert('告警处理已提交');
  908. closeHandleModal();
  909. // 实际应用中应该提交处理信息到后端
  910. });
  911. // 点击弹窗外部关闭弹窗
  912. window.addEventListener('click', function(e) {
  913. if (e.target === alarmDetailModal) {
  914. closeDetailModal();
  915. }
  916. if (e.target === alarmHandleModal) {
  917. closeHandleModal();
  918. }
  919. });
  920. });
  921. </script>
  922. </body>
  923. </html>