device-alarm.html.bak4 35 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. <PLACEHOLDER>
  460. <PLACEHOLDER>
  461. <PLACEHOLDER>
  462. <PLACEHOLDER>
  463. <PLACEHOLDER>
  464. <PLACEHOLDER>
  465. <PLACEHOLDER>
  466. <PLACEHOLDER>
  467. <PLACEHOLDER>
  468. <PLACEHOLDER>
  469. <PLACEHOLDER>
  470. <PLACEHOLDER>
  471. <PLACEHOLDER>
  472. <PLACEHOLDER>
  473. <PLACEHOLDER>
  474. <PLACEHOLDER>
  475. <PLACEHOLDER>
  476. <PLACEHOLDER>
  477. <PLACEHOLDER>
  478. <PLACEHOLDER>
  479. <PLACEHOLDER>
  480. <PLACEHOLDER>
  481. <PLACEHOLDER>
  482. <PLACEHOLDER>
  483. <PLACEHOLDER>
  484. <PLACEHOLDER>
  485. <PLACEHOLDER>
  486. <PLACEHOLDER>
  487. <PLACEHOLDER>
  488. <PLACEHOLDER>
  489. <PLACEHOLDER>
  490. <PLACEHOLDER>
  491. <PLACEHOLDER>
  492. <PLACEHOLDER>
  493. <PLACEHOLDER>
  494. <PLACEHOLDER>
  495. <PLACEHOLDER>
  496. <PLACEHOLDER>
  497. <PLACEHOLDER>
  498. <PLACEHOLDER>
  499. <PLACEHOLDER>
  500. <PLACEHOLDER>
  501. <PLACEHOLDER>
  502. <PLACEHOLDER>
  503. <PLACEHOLDER>
  504. <PLACEHOLDER>
  505. <PLACEHOLDER>
  506. <PLACEHOLDER>
  507. <PLACEHOLDER>
  508. <PLACEHOLDER>
  509. <PLACEHOLDER>
  510. <PLACEHOLDER>
  511. <PLACEHOLDER>
  512. <PLACEHOLDER>
  513. <PLACEHOLDER>
  514. <PLACEHOLDER>
  515. <PLACEHOLDER>
  516. <PLACEHOLDER>
  517. <PLACEHOLDER>
  518. <PLACEHOLDER>
  519. <PLACEHOLDER>
  520. <PLACEHOLDER>
  521. <PLACEHOLDER>
  522. <PLACEHOLDER>
  523. <PLACEHOLDER>
  524. <PLACEHOLDER>
  525. <PLACEHOLDER>
  526. <PLACEHOLDER>
  527. <PLACEHOLDER>
  528. <div class="search-form-actions">
  529. <button class="btn btn-primary">
  530. <i class="iconfont icon-search btn-icon"></i>
  531. 搜索
  532. </button>
  533. <button class="btn btn-default">
  534. <i class="iconfont icon-reload btn-icon"></i>
  535. 重置
  536. </button>
  537. </div>
  538. </div>
  539. </div>
  540. <div class="card">
  541. <div class="table-container">
  542. <div class="table-scroll-controls">
  543. <button class="table-scroll-btn table-scroll-left">
  544. <i class="iconfont icon-left"></i>
  545. </button>
  546. <button class="table-scroll-btn table-scroll-right">
  547. <i class="iconfont icon-right"></i>
  548. </button>
  549. </div>
  550. <table class="table-fixed-right">
  551. <thead>
  552. <tr>
  553. <th>告警ID</th>
  554. <th>告警等级</th>
  555. <th>设备名称</th>
  556. <th>设备编号</th>
  557. <th>设备类型</th>
  558. <th>所属地块</th>
  559. <th>所属农场</th>
  560. <th>告警内容</th>
  561. <th>告警时间</th>
  562. <th>处理状态</th>
  563. <th>处理人</th>
  564. <th>处理时间</th>
  565. <th class="min-w-[150px]">操作</th>
  566. </tr>
  567. </thead>
  568. <tbody>
  569. <tr>
  570. <td>ALM-20230001</td>
  571. <td><span class="badge badge-danger">紧急</span></td>
  572. <td>土壤传感器 #2</td>
  573. <td>SNS-20230002</td>
  574. <td>传感器</td>
  575. <td>东区2号地块</td>
  576. <td>示范农场</td>
  577. <td>电池电量过低,即将无法工作</td>
  578. <td>2023-05-15 10:25:36</td>
  579. <td><span class="badge badge-danger">未处理</span></td>
  580. <td>-</td>
  581. <td>-</td>
  582. <td>
  583. <div class="flex gap-2">
  584. <button class="btn btn-default btn-sm view-btn" data-id="1">
  585. <i class="iconfont icon-eye btn-icon"></i>
  586. 查看
  587. </button>
  588. <button class="btn btn-primary btn-sm handle-btn" data-id="1">
  589. <i class="iconfont icon-check btn-icon"></i>
  590. 处理
  591. </button>
  592. </div>
  593. </td>
  594. </tr>
  595. <tr>
  596. <td>ALM-20230002</td>
  597. <td><span class="badge badge-warning">警告</span></td>
  598. <td>摄像头 #3</td>
  599. <td>CAM-20230003</td>
  600. <td>摄像设备</td>
  601. <td>西区1号地块</td>
  602. <td>示范农场</td>
  603. <td>信号弱,视频画面不稳定</td>
  604. <td>2023-05-15 09:18:42</td>
  605. <td><span class="badge badge-warning">处理中</span></td>
  606. <td>张三</td>
  607. <td>2023-05-15 10:20:15</td>
  608. <td>
  609. <div class="flex gap-2">
  610. <button class="btn btn-default btn-sm view-btn" data-id="2">
  611. <i class="iconfont icon-eye btn-icon"></i>
  612. 查看
  613. </button>
  614. <button class="btn btn-primary btn-sm handle-btn" data-id="2">
  615. <i class="iconfont icon-check btn-icon"></i>
  616. 处理
  617. </button>
  618. </div>
  619. </td>
  620. </tr>
  621. <tr>
  622. <td>ALM-20230003</td>
  623. <td><span class="badge badge-danger">紧急</span></td>
  624. <td>水位传感器 #1</td>
  625. <td>WLV-20230001</td>
  626. <td>传感器</td>
  627. <td>南区3号地块</td>
  628. <td>智慧农场</td>
  629. <td>水位超过预警线,可能发生溢出</td>
  630. <td>2023-05-15 08:45:20</td>
  631. <td><span class="badge badge-success">已处理</span></td>
  632. <td>李四</td>
  633. <td>2023-05-15 09:30:42</td>
  634. <td>
  635. <div class="flex gap-2">
  636. <button class="btn btn-default btn-sm view-btn" data-id="3">
  637. <i class="iconfont icon-eye btn-icon"></i>
  638. 查看
  639. </button>
  640. </div>
  641. </td>
  642. </tr>
  643. <tr>
  644. <td>ALM-20230004</td>
  645. <td><span class="badge badge-warning">警告</span></td>
  646. <td>气象站 #1</td>
  647. <td>WEA-20230001</td>
  648. <td>气象设备</td>
  649. <td>北区1号地块</td>
  650. <td>智慧农场</td>
  651. <td>湿度传感器异常,读数不稳定</td>
  652. <td>2023-05-14 17:32:15</td>
  653. <td><span class="badge badge-danger">未处理</span></td>
  654. <td>-</td>
  655. <td>-</td>
  656. <td>
  657. <div class="flex gap-2">
  658. <button class="btn btn-default btn-sm view-btn" data-id="4">
  659. <i class="iconfont icon-eye btn-icon"></i>
  660. 查看
  661. </button>
  662. <button class="btn btn-primary btn-sm handle-btn" data-id="4">
  663. <i class="iconfont icon-check btn-icon"></i>
  664. 处理
  665. </button>
  666. </div>
  667. </td>
  668. </tr>
  669. <tr>
  670. <td>ALM-20230005</td>
  671. <td><span class="badge badge-primary" style="background-color: #dbeafe; color: #1e40af;">提示</span></td>
  672. <td>自动灌溉控制器 #1</td>
  673. <td>IRR-20230001</td>
  674. <td>控制器</td>
  675. <td>东区1号地块</td>
  676. <td>示范农场</td>
  677. <td>设备需要例行维护检查</td>
  678. <td>2023-05-14 14:10:08</td>
  679. <td><span class="badge badge-success">已处理</span></td>
  680. <td>王五</td>
  681. <td>2023-05-14 16:45:20</td>
  682. <td>
  683. <div class="flex gap-2">
  684. <button class="btn btn-default btn-sm view-btn" data-id="5">
  685. <i class="iconfont icon-eye btn-icon"></i>
  686. 查看
  687. </button>
  688. </div>
  689. </td>
  690. </tr>
  691. </tbody>
  692. </table>
  693. </div>
  694. <div class="p-4 flex justify-between items-center">
  695. <div class="text-sm text-gray-500">
  696. 共 <span class="font-medium">24</span> 条记录,每页 <span class="font-medium">10</span> 条
  697. </div>
  698. <div class="pagination">
  699. <div class="pagination-item disabled">
  700. <i class="iconfont icon-left"></i>
  701. </div>
  702. <div class="pagination-item active">1</div>
  703. <div class="pagination-item">2</div>
  704. <div class="pagination-item">3</div>
  705. <div class="pagination-item">
  706. <i class="iconfont icon-right"></i>
  707. </div>
  708. </div>
  709. </div>
  710. </div>
  711. </div>
  712. <!-- 告警详情弹窗 -->
  713. <div class="modal-overlay" id="alarmDetailModal">
  714. <div class="modal">
  715. <div class="modal-header">
  716. <h3 class="modal-title">告警详情</h3>
  717. <div class="modal-close" id="closeDetailModal">&times;</div>
  718. </div>
  719. <div class="modal-body">
  720. <div class="p-4 mb-4 bg-red-50 alarm-type-urgent">
  721. <div class="flex justify-between items-center mb-2">
  722. <span class="badge badge-danger">紧急</span>
  723. <span class="text-sm text-gray-500">2023-05-15 10:25:36</span>
  724. </div>
  725. <h3 class="text-lg font-bold mb-2">电池电量过低,即将无法工作</h3>
  726. <p class="text-gray-600 mb-2">土壤传感器 #2 (SNS-20230002) 电池电量低于10%,请尽快更换电池,否则设备将在24小时内无法正常工作。</p>
  727. <div class="flex justify-between text-sm text-gray-500">
  728. <span>告警ID: ALM-20230001</span>
  729. <span>设备位置: 东区2号地块</span>
  730. </div>
  731. </div>
  732. <div class="mb-4">
  733. <h4 class="font-medium mb-2">设备信息</h4>
  734. <div class="grid grid-cols-2 gap-4">
  735. <div>
  736. <div class="text-xs text-gray-500 mb-1">设备ID</div>
  737. <div class="font-medium">SNS-20230002</div>
  738. </div>
  739. <div>
  740. <div class="text-xs text-gray-500 mb-1">设备类型</div>
  741. <div class="font-medium">土壤传感器</div>
  742. </div>
  743. <div>
  744. <div class="text-xs text-gray-500 mb-1">安装位置</div>
  745. <div class="font-medium">东区2号地块</div>
  746. </div>
  747. <div>
  748. <div class="text-xs text-gray-500 mb-1">安装时间</div>
  749. <div class="font-medium">2023-01-20</div>
  750. </div>
  751. </div>
  752. </div>
  753. <div class="mb-4">
  754. <h4 class="font-medium mb-2">告警状态</h4>
  755. <div class="mb-1 flex justify-between">
  756. <span>当前状态</span>
  757. <span class="font-medium text-red-600">未处理</span>
  758. </div>
  759. <div class="mb-1 flex justify-between">
  760. <span>处理人</span>
  761. <span class="font-medium">-</span>
  762. </div>
  763. <div class="mb-1 flex justify-between">
  764. <span>处理时间</span>
  765. <span class="font-medium">-</span>
  766. </div>
  767. </div>
  768. <div>
  769. <h4 class="font-medium mb-2">处理记录</h4>
  770. <div class="text-center text-gray-500 py-4">
  771. 暂无处理记录
  772. </div>
  773. </div>
  774. </div>
  775. <div class="modal-footer">
  776. <button class="btn btn-default" id="cancelDetailBtn">关闭</button>
  777. </div>
  778. </div>
  779. </div>
  780. <!-- 处理告警弹窗 -->
  781. <div class="modal-overlay" id="alarmHandleModal">
  782. <div class="modal">
  783. <div class="modal-header">
  784. <h3 class="modal-title">处理告警</h3>
  785. <div class="modal-close" id="closeHandleModal">&times;</div>
  786. </div>
  787. <div class="modal-body">
  788. <div class="p-4 mb-4 bg-red-50 alarm-type-urgent">
  789. <h3 class="text-lg font-bold mb-2">电池电量过低,即将无法工作</h3>
  790. <p class="text-gray-600">土壤传感器 #2 (SNS-20230002)</p>
  791. </div>
  792. <div class="form-group mb-4">
  793. <label class="block font-medium mb-1">处理状态</label>
  794. <select class="w-full border border-gray-300 rounded p-2 focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-transparent">
  795. <option value="1">已处理</option>
  796. <option value="2">处理中</option>
  797. <option value="3">忽略</option>
  798. </select>
  799. </div>
  800. <div class="form-group mb-4">
  801. <label class="block font-medium mb-1">处理方式</label>
  802. <select class="w-full border border-gray-300 rounded p-2 focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-transparent">
  803. <option value="replace">更换设备</option>
  804. <option value="repair">维修设备</option>
  805. <option value="battery">更换电池</option>
  806. <option value="restart">重启设备</option>
  807. <option value="other">其他</option>
  808. </select>
  809. </div>
  810. <div class="form-group mb-4">
  811. <label class="block font-medium mb-1">处理说明</label>
  812. <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>
  813. </div>
  814. <div class="form-group">
  815. <label class="flex items-center">
  816. <input type="checkbox" class="mr-2">
  817. <span>通知相关人员</span>
  818. </label>
  819. </div>
  820. </div>
  821. <div class="modal-footer">
  822. <button class="btn btn-default" id="cancelHandleBtn">取消</button>
  823. <button class="btn btn-primary" id="submitHandleBtn">提交</button>
  824. </div>
  825. </div>
  826. </div>
  827. <script>
  828. document.addEventListener("DOMContentLoaded", function() {
  829. // 初始化表格滚动功能
  830. function initTableScroll() {
  831. const tableContainer = document.querySelector(".table-container");
  832. if (!tableContainer) return;
  833. const scrollLeftBtn = document.querySelector(".table-scroll-left");
  834. const scrollRightBtn = document.querySelector(".table-scroll-right");
  835. if (!scrollLeftBtn || !scrollRightBtn) return;
  836. // 检查表格是否需要水平滚动
  837. function checkTableOverflow() {
  838. if (tableContainer.scrollWidth > tableContainer.clientWidth) {
  839. tableContainer.classList.add("has-overflow");
  840. } else {
  841. tableContainer.classList.remove("has-overflow");
  842. }
  843. }
  844. // 左右滚动按钮点击事件
  845. scrollLeftBtn.addEventListener("click", function() {
  846. tableContainer.scrollLeft -= 150;
  847. });
  848. scrollRightBtn.addEventListener("click", function() {
  849. tableContainer.scrollLeft += 150;
  850. });
  851. // 初始检查和窗口大小变化时检查
  852. checkTableOverflow();
  853. window.addEventListener("resize", checkTableOverflow);
  854. // 滚动事件处理
  855. tableContainer.addEventListener("scroll", function() {
  856. // 根据滚动位置显示/隐藏滚动按钮
  857. if (tableContainer.scrollLeft <= 10) {
  858. scrollLeftBtn.style.opacity = "0.5";
  859. } else {
  860. scrollLeftBtn.style.opacity = "1";
  861. }
  862. if (tableContainer.scrollLeft >= tableContainer.scrollWidth - tableContainer.clientWidth - 10) {
  863. scrollRightBtn.style.opacity = "0.5";
  864. } else {
  865. scrollRightBtn.style.opacity = "1";
  866. }
  867. });
  868. // 初始触发滚动事件,设置初始按钮状态
  869. tableContainer.dispatchEvent(new Event("scroll"));
  870. }
  871. // 初始化表格滚动
  872. initTableScroll();
  873. // 告警详情弹窗
  874. const alarmDetailModal = document.getElementById('alarmDetailModal');
  875. const closeDetailModal = document.getElementById('closeDetailModal');
  876. const cancelDetailBtn = document.getElementById('cancelDetailBtn');
  877. const viewBtns = document.querySelectorAll('.view-btn');
  878. // 查看告警详情
  879. viewBtns.forEach(btn => {
  880. btn.addEventListener('click', function() {
  881. const alarmId = this.getAttribute('data-id');
  882. alarmDetailModal.style.display = 'flex';
  883. // 实际应用中应该根据ID获取告警详情
  884. });
  885. });
  886. // 关闭详情弹窗
  887. function closeDetailModal() {
  888. alarmDetailModal.style.display = 'none';
  889. }
  890. closeDetailModal.addEventListener('click', closeDetailModal);
  891. cancelDetailBtn.addEventListener('click', closeDetailModal);
  892. // 告警处理弹窗
  893. const alarmHandleModal = document.getElementById('alarmHandleModal');
  894. const closeHandleModal = document.getElementById('closeHandleModal');
  895. const cancelHandleBtn = document.getElementById('cancelHandleBtn');
  896. const submitHandleBtn = document.getElementById('submitHandleBtn');
  897. const handleBtns = document.querySelectorAll('.handle-btn');
  898. // 处理告警
  899. handleBtns.forEach(btn => {
  900. btn.addEventListener('click', function() {
  901. const alarmId = this.getAttribute('data-id');
  902. alarmHandleModal.style.display = 'flex';
  903. // 实际应用中应该根据ID获取告警详情
  904. });
  905. });
  906. // 关闭处理弹窗
  907. function closeHandleModal() {
  908. alarmHandleModal.style.display = 'none';
  909. }
  910. closeHandleModal.addEventListener('click', closeHandleModal);
  911. cancelHandleBtn.addEventListener('click', closeHandleModal);
  912. // 提交处理
  913. submitHandleBtn.addEventListener('click', function() {
  914. alert('告警处理已提交');
  915. closeHandleModal();
  916. // 实际应用中应该提交处理信息到后端
  917. });
  918. // 点击弹窗外部关闭弹窗
  919. window.addEventListener('click', function(e) {
  920. if (e.target === alarmDetailModal) {
  921. closeDetailModal();
  922. }
  923. if (e.target === alarmHandleModal) {
  924. closeHandleModal();
  925. }
  926. });
  927. });
  928. </script>
  929. </body>
  930. </html>