device-alarm.html.bak2 33 KB

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