device-alarm-orig.html 37 KB

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