field-detail.html 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146
  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. }
  16. .page-container {
  17. padding: 20px;
  18. }
  19. .card {
  20. background-color: white;
  21. border-radius: 8px;
  22. box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  23. }
  24. .btn {
  25. display: inline-flex;
  26. align-items: center;
  27. justify-content: center;
  28. padding: 8px 16px;
  29. border-radius: 4px;
  30. font-weight: 500;
  31. cursor: pointer;
  32. transition: all 0.2s;
  33. }
  34. .btn-primary {
  35. background-color: #4CAF50;
  36. color: white;
  37. }
  38. .btn-primary:hover {
  39. background-color: #388E3C;
  40. }
  41. .btn-default {
  42. background-color: white;
  43. border: 1px solid #d1d5db;
  44. color: #374151;
  45. }
  46. .btn-default:hover {
  47. background-color: #f9fafb;
  48. }
  49. .btn-danger {
  50. background-color: #ef4444;
  51. color: white;
  52. }
  53. .btn-danger:hover {
  54. background-color: #dc2626;
  55. }
  56. .btn-icon {
  57. margin-right: 4px;
  58. }
  59. .tabs {
  60. display: flex;
  61. border-bottom: 1px solid #e5e7eb;
  62. }
  63. .tab {
  64. padding: 12px 20px;
  65. cursor: pointer;
  66. border-bottom: 2px solid transparent;
  67. font-weight: 500;
  68. transition: all 0.2s;
  69. }
  70. .tab:hover {
  71. color: #4CAF50;
  72. }
  73. .tab.active {
  74. color: #4CAF50;
  75. border-bottom: 2px solid #4CAF50;
  76. }
  77. .tab-content {
  78. display: none;
  79. padding: 20px;
  80. }
  81. .tab-content.active {
  82. display: block;
  83. }
  84. .info-group {
  85. margin-bottom: 20px;
  86. }
  87. .info-label {
  88. color: #6b7280;
  89. margin-bottom: 4px;
  90. }
  91. .info-value {
  92. font-weight: 500;
  93. }
  94. .badge {
  95. display: inline-block;
  96. padding: 2px 8px;
  97. border-radius: 9999px;
  98. font-size: 12px;
  99. font-weight: 500;
  100. }
  101. .badge-success {
  102. background-color: #d1fae5;
  103. color: #065f46;
  104. }
  105. .badge-warning {
  106. background-color: #fef3c7;
  107. color: #92400e;
  108. }
  109. .badge-danger {
  110. background-color: #fee2e2;
  111. color: #b91c1c;
  112. }
  113. .table-container {
  114. position: relative;
  115. position: relative;
  116. overflow-x: auto;
  117. }
  118. table {
  119. width: 100%;
  120. border-collapse: separate;
  121. border-spacing: 0;
  122. }
  123. th {
  124. white-space: nowrap;
  125. position: relative;
  126. overflow: visible;
  127. max-width: none;
  128. text-overflow: clip;
  129. white-space: nowrap;
  130. position: relative;
  131. background-color: #f9fafb;
  132. padding: 12px 16px;
  133. text-align: left;
  134. font-weight: 500;
  135. color: #6b7280;
  136. border-bottom: 1px solid #e5e7eb;
  137. }
  138. td {
  139. white-space: nowrap;
  140. max-width: 200px;
  141. overflow: hidden;
  142. text-overflow: ellipsis;
  143. white-space: nowrap;
  144. max-width: 200px;
  145. overflow: hidden;
  146. text-overflow: ellipsis;
  147. padding: 12px 16px;
  148. border-bottom: 1px solid #e5e7eb;
  149. }
  150. tr:hover {
  151. tr:hover td:last-child {
  152. background-color: #f9fafb;
  153. }
  154. /* 固定最后一列(操作列)样式 */
  155. .table-fixed-right {
  156. position: relative;
  157. }
  158. .table-fixed-right th:last-child,
  159. .table-fixed-right td:last-child {
  160. position: sticky;
  161. right: 0;
  162. z-index: 2;
  163. background-color: white;
  164. box-shadow: -5px 0 5px -5px rgba(0, 0, 0, 0.1);
  165. }
  166. .table-fixed-right th:last-child {
  167. background-color: #f9fafb;
  168. }
  169. /* 表格滚动控件 */
  170. .table-scroll-controls {
  171. display: none;
  172. position: absolute;
  173. top: 50%;
  174. transform: translateY(-50%);
  175. width: 100%;
  176. pointer-events: none;
  177. z-index: 3;
  178. }
  179. .table-scroll-btn {
  180. position: absolute;
  181. width: 32px;
  182. height: 32px;
  183. border-radius: 50%;
  184. background-color: rgba(255, 255, 255, 0.9);
  185. color: #4CAF50;
  186. border: 1px solid #e0e0e0;
  187. display: flex;
  188. align-items: center;
  189. justify-content: center;
  190. cursor: pointer;
  191. pointer-events: auto;
  192. box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  193. z-index: 4;
  194. }
  195. .table-scroll-left {
  196. left: 10px;
  197. }
  198. .table-scroll-right {
  199. right: 10px;
  200. }
  201. .has-overflow .table-scroll-controls {
  202. display: block;
  203. } background-color: #f9fafb;
  204. }
  205. .device-item, .person-item {
  206. border: 1px solid #e5e7eb;
  207. border-radius: 8px;
  208. padding: 12px;
  209. margin-bottom: 12px;
  210. display: flex;
  211. justify-content: space-between;
  212. align-items: center;
  213. }
  214. .device-item-bound, .person-item-bound {
  215. background-color: #f0fdf4;
  216. border-color: #4CAF50;
  217. }
  218. .map-container {
  219. height: 500px;
  220. width: 100%;
  221. position: relative;
  222. background-color: #eee;
  223. overflow: hidden;
  224. border-radius: 8px;
  225. }
  226. .map-toolbar {
  227. position: absolute;
  228. top: 20px;
  229. left: 20px;
  230. background-color: white;
  231. border-radius: 8px;
  232. box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  233. padding: 10px;
  234. z-index: 10;
  235. }
  236. .map-tool {
  237. display: flex;
  238. align-items: center;
  239. padding: 8px 12px;
  240. cursor: pointer;
  241. border-radius: 4px;
  242. margin-bottom: 8px;
  243. transition: all 0.2s;
  244. }
  245. .map-tool:hover {
  246. background-color: #f3f4f6;
  247. }
  248. .map-tool.active {
  249. background-color: #e8f5e9;
  250. color: #4CAF50;
  251. }
  252. .map-tool i {
  253. margin-right: 8px;
  254. font-size: 18px;
  255. }
  256. .detail-card {
  257. background: #fff;
  258. border-radius: 8px;
  259. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  260. margin-bottom: 20px;
  261. padding: 24px;
  262. }
  263. .detail-grid {
  264. display: grid;
  265. grid-template-columns: repeat(4, 1fr);
  266. gap: 24px;
  267. }
  268. .detail-item {
  269. display: flex;
  270. flex-direction: column;
  271. gap: 8px;
  272. }
  273. .detail-label {
  274. font-size: 13px;
  275. color: #64748b;
  276. }
  277. .detail-value {
  278. font-size: 14px;
  279. color: #1e293b;
  280. font-weight: 500;
  281. }
  282. .count-badge {
  283. display: inline-flex;
  284. align-items: center;
  285. gap: 4px;
  286. font-size: 13px;
  287. color: #475569;
  288. padding: 2px 4px;
  289. }
  290. .count-badge i {
  291. color: #64748b;
  292. font-size: 13px;
  293. }
  294. .btn-sm {
  295. padding: 4px 12px;
  296. font-size: 13px;
  297. }
  298. .btn-default.active {
  299. background-color: #f0fdf4;
  300. border-color: #4ade80;
  301. color: #16a34a;
  302. }
  303. .search-input {
  304. min-width: 280px;
  305. padding: 8px 12px;
  306. padding-right: 36px;
  307. border: 2px solid #e5e7eb;
  308. border-radius: 6px;
  309. transition: all 0.2s;
  310. }
  311. .search-input:focus {
  312. outline: none;
  313. border-color: #4CAF50;
  314. box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
  315. }
  316. .search-input::placeholder {
  317. color: #9ca3af;
  318. }
  319. table {
  320. border-collapse: separate;
  321. border-spacing: 0;
  322. }
  323. th {
  324. white-space: nowrap;
  325. position: relative;
  326. overflow: visible;
  327. max-width: none;
  328. text-overflow: clip;
  329. white-space: nowrap;
  330. position: relative;
  331. font-weight: 500;
  332. white-space: nowrap;
  333. }
  334. td {
  335. white-space: nowrap;
  336. max-width: 200px;
  337. overflow: hidden;
  338. text-overflow: ellipsis;
  339. white-space: nowrap;
  340. max-width: 200px;
  341. overflow: hidden;
  342. text-overflow: ellipsis;
  343. white-space: nowrap;
  344. }
  345. tbody tr:hover {
  346. tr:hover td:last-child {
  347. background-color: #f9fafb;
  348. }
  349. /* 固定最后一列(操作列)样式 */
  350. .table-fixed-right {
  351. position: relative;
  352. }
  353. .table-fixed-right th:last-child,
  354. .table-fixed-right td:last-child {
  355. position: sticky;
  356. right: 0;
  357. z-index: 2;
  358. background-color: white;
  359. box-shadow: -5px 0 5px -5px rgba(0, 0, 0, 0.1);
  360. }
  361. .table-fixed-right th:last-child {
  362. background-color: #f9fafb;
  363. }
  364. /* 表格滚动控件 */
  365. .table-scroll-controls {
  366. display: none;
  367. position: absolute;
  368. top: 50%;
  369. transform: translateY(-50%);
  370. width: 100%;
  371. pointer-events: none;
  372. z-index: 3;
  373. }
  374. .table-scroll-btn {
  375. position: absolute;
  376. width: 32px;
  377. height: 32px;
  378. border-radius: 50%;
  379. background-color: rgba(255, 255, 255, 0.9);
  380. color: #4CAF50;
  381. border: 1px solid #e0e0e0;
  382. display: flex;
  383. align-items: center;
  384. justify-content: center;
  385. cursor: pointer;
  386. pointer-events: auto;
  387. box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  388. z-index: 4;
  389. }
  390. .table-scroll-left {
  391. left: 10px;
  392. }
  393. .table-scroll-right {
  394. right: 10px;
  395. }
  396. .has-overflow .table-scroll-controls {
  397. display: block;
  398. } background-color: #f8fafc;
  399. }
  400. .btn-danger {
  401. background-color: #fee2e2;
  402. color: #dc2626;
  403. border: 1px solid #fecaca;
  404. }
  405. .btn-danger:hover {
  406. background-color: #fecaca;
  407. }
  408. .filter-tabs {
  409. display: flex;
  410. gap: 1px;
  411. padding: 2px;
  412. background: #f3f4f6;
  413. border-radius: 8px;
  414. }
  415. .filter-tab {
  416. padding: 6px 16px;
  417. font-size: 14px;
  418. border-radius: 6px;
  419. cursor: pointer;
  420. transition: all 0.2s;
  421. background: transparent;
  422. border: none;
  423. color: #6b7280;
  424. position: relative;
  425. display: flex;
  426. align-items: center;
  427. gap: 6px;
  428. }
  429. .filter-tab:hover {
  430. color: #4b5563;
  431. }
  432. .filter-tab.active {
  433. background: white;
  434. color: #4CAF50;
  435. box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  436. }
  437. .filter-badge {
  438. padding: 2px 8px;
  439. font-size: 12px;
  440. border-radius: 10px;
  441. font-weight: 500;
  442. background: #f3f4f6;
  443. }
  444. .filter-tab.active .filter-badge {
  445. background: #ecfdf5;
  446. color: #059669;
  447. }
  448. .filter-tab:not(.active) .filter-badge {
  449. background: #f3f4f6;
  450. color: #6b7280;
  451. }
  452. </style>
  453. </head>
  454. <body>
  455. <div class="page-container">
  456. <div class="flex justify-between items-center mb-6">
  457. <div class="flex items-center">
  458. <a href="field-management.html" class="mr-2">
  459. <i class="iconfont icon-left"></i>
  460. </a>
  461. <h1 class="text-2xl font-bold">地块详情</h1>
  462. </div>
  463. <div class="flex gap-2">
  464. <button class="btn btn-default" id="editBtn">
  465. <i class="iconfont icon-edit btn-icon"></i>
  466. 编辑
  467. </button>
  468. <button class="btn btn-default" id="refreshBtn">
  469. <i class="iconfont icon-reload btn-icon"></i>
  470. 刷新
  471. </button>
  472. </div>
  473. </div>
  474. <div class="card">
  475. <div class="tabs">
  476. <div class="tab active" data-tab="info">基本信息</div>
  477. <div class="tab" data-tab="device">设备绑定</div>
  478. <div class="tab" data-tab="person">人员绑定</div>
  479. <div class="tab" data-tab="map">区域绘制</div>
  480. </div>
  481. <!-- 基本信息 -->
  482. <div class="tab-content active" id="tab-info">
  483. <div class="grid grid-cols-1 gap-4">
  484. <!-- 基础信息展示 -->
  485. <div class="detail-card">
  486. <div class="detail-grid">
  487. <div class="detail-item">
  488. <div class="detail-label">地块编号</div>
  489. <div class="detail-value" id="fieldId">FK20230001</div>
  490. </div>
  491. <div class="detail-item">
  492. <div class="detail-label">地块名称</div>
  493. <div class="detail-value" id="fieldName">东区水稻田A</div>
  494. </div>
  495. <div class="detail-item">
  496. <div class="detail-label">所属农场</div>
  497. <div class="detail-value">智慧农场一号</div>
  498. </div>
  499. <div class="detail-item">
  500. <div class="detail-label">所属区域</div>
  501. <div class="detail-value" id="fieldArea">东区</div>
  502. </div>
  503. <div class="detail-item">
  504. <div class="detail-label">地块类型</div>
  505. <div class="detail-value" id="fieldType">水田</div>
  506. </div>
  507. <div class="detail-item">
  508. <div class="detail-label">面积(亩)</div>
  509. <div class="detail-value" id="fieldSize">120</div>
  510. </div>
  511. <div class="detail-item">
  512. <div class="detail-label">种植作物</div>
  513. <div class="detail-value">水稻</div>
  514. </div>
  515. <div class="detail-item">
  516. <div class="detail-label">土壤类型</div>
  517. <div class="detail-value">黏土</div>
  518. </div>
  519. <div class="detail-item">
  520. <div class="detail-label">灌溉方式</div>
  521. <div class="detail-value">喷灌</div>
  522. </div>
  523. <div class="detail-item">
  524. <div class="detail-label">使用状态</div>
  525. <div class="detail-value">
  526. <span class="badge badge-success">
  527. <i class="iconfont icon-check-circle badge-icon"></i>使用中
  528. </span>
  529. </div>
  530. </div>
  531. <div class="detail-item">
  532. <div class="detail-label">绑定设备</div>
  533. <div class="detail-value">
  534. <span class="count-badge">
  535. <i class="iconfont icon-device"></i>3
  536. </span>
  537. </div>
  538. </div>
  539. <div class="detail-item">
  540. <div class="detail-label">绑定人员</div>
  541. <div class="detail-value">
  542. <span class="count-badge">
  543. <i class="iconfont icon-user"></i>2
  544. </span>
  545. </div>
  546. </div>
  547. <div class="detail-item">
  548. <div class="detail-label">负责人</div>
  549. <div class="detail-value">张三</div>
  550. </div>
  551. <div class="detail-item">
  552. <div class="detail-label">创建时间</div>
  553. <div class="detail-value" id="createTime">2023-05-15</div>
  554. </div>
  555. <div class="detail-item">
  556. <div class="detail-label">上次更新</div>
  557. <div class="detail-value">2023-06-20</div>
  558. </div>
  559. <div class="detail-item col-span-4">
  560. <div class="detail-label">地块描述</div>
  561. <div class="detail-value" id="fieldDesc" style="white-space: pre-line; line-height: 1.5;">
  562. 这是一块位于东区的水稻田,土壤肥沃,水源充足,适合种植水稻。年产量约为10000公斤,是农场的主要粮食生产区域。
  563. </div>
  564. </div>
  565. </div>
  566. </div>
  567. <div class="info-group">
  568. <div class="info-label">作物信息</div>
  569. <div class="table-container mt-2">
  570. <table>
  571. <thead>
  572. <tr>
  573. <th>作物名称</th>
  574. <th>种植面积(亩)</th>
  575. <th>种植时间</th>
  576. <th>预计收获时间</th>
  577. <th class="min-w-[80px]">状态</th>
  578. </tr>
  579. </thead>
  580. <tbody>
  581. <tr>
  582. <td>水稻(早稻)</td>
  583. <td>120</td>
  584. <td>2023-02-15</td>
  585. <td>2023-06-20</td>
  586. <td><span class="badge badge-success">生长中</span></td>
  587. </tr>
  588. </tbody>
  589. </table>
  590. </div>
  591. </div>
  592. </div>
  593. </div>
  594. <!-- 设备绑定 -->
  595. <div class="tab-content" id="tab-device">
  596. <div class="flex justify-between items-center mb-4">
  597. <div class="flex items-center gap-4">
  598. <h3 class="text-lg font-medium">设备列表</h3>
  599. <div class="filter-tabs">
  600. <button class="filter-tab active" data-filter="bound" data-target="device-bound-list">
  601. 已绑定
  602. <span class="filter-badge">3</span>
  603. </button>
  604. <button class="filter-tab" data-filter="unbound" data-target="device-unbound-list">
  605. 未绑定
  606. <span class="filter-badge">8</span>
  607. </button>
  608. </div>
  609. </div>
  610. <div class="relative">
  611. <input type="text" class="search-input" placeholder="搜索设备编号/名称">
  612. <i class="iconfont icon-search absolute right-3 top-1/2 -translate-y-1/2 text-gray-400"></i>
  613. </div>
  614. </div>
  615. <div id="device-bound-list" class="bg-white rounded-lg overflow-hidden">
  616. <table class="min-w-full">
  617. <!-- 已绑定设备表格内容 -->
  618. <thead>
  619. <tr class="bg-gray-50">
  620. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">设备编号</th>
  621. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">设备名称</th>
  622. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">设备类型</th>
  623. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">状态</th>
  624. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">绑定时间</th>
  625. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">操作</th>
  626. </tr>
  627. </thead>
  628. <tbody>
  629. <tr class="border-t border-gray-100">
  630. <td class="px-4 py-3 text-sm">DEV001</td>
  631. <td class="px-4 py-3 text-sm">土壤湿度传感器</td>
  632. <td class="px-4 py-3 text-sm">传感器</td>
  633. <td class="px-4 py-3 text-sm">
  634. <span class="badge badge-success">在线</span>
  635. </td>
  636. <td class="px-4 py-3 text-sm">2023-05-15 10:30</td>
  637. <td class="px-4 py-3 text-sm">
  638. <button class="btn btn-sm btn-danger">解绑</button>
  639. </td>
  640. </tr>
  641. </tbody>
  642. </table>
  643. </div>
  644. <div id="device-unbound-list" class="bg-white rounded-lg overflow-hidden" style="display: none;">
  645. <table class="min-w-full">
  646. <!-- 未绑定设备表格内容 -->
  647. <thead>
  648. <tr class="bg-gray-50">
  649. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">设备编号</th>
  650. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">设备名称</th>
  651. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">设备类型</th>
  652. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">状态</th>
  653. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">操作</th>
  654. </tr>
  655. </thead>
  656. <tbody>
  657. <tr class="border-t border-gray-100">
  658. <td class="px-4 py-3 text-sm">DEV004</td>
  659. <td class="px-4 py-3 text-sm">气象站</td>
  660. <td class="px-4 py-3 text-sm">监测设备</td>
  661. <td class="px-4 py-3 text-sm">
  662. <span class="badge badge-success">在线</span>
  663. </td>
  664. <td class="px-4 py-3 text-sm">
  665. <button class="btn btn-sm btn-primary">绑定</button>
  666. </td>
  667. </tr>
  668. </tbody>
  669. </table>
  670. </div>
  671. <!-- 分页 -->
  672. <div class="flex justify-between items-center mt-4">
  673. <div class="text-sm text-gray-600">
  674. 共 <span class="text-primary font-medium">11</span> 条记录
  675. </div>
  676. <div class="flex items-center gap-2">
  677. <button class="btn btn-default btn-sm" disabled>上一页</button>
  678. <button class="btn btn-default btn-sm bg-primary text-white">1</button>
  679. <button class="btn btn-default btn-sm">2</button>
  680. <button class="btn btn-default btn-sm">下一页</button>
  681. </div>
  682. </div>
  683. </div>
  684. <!-- 人员绑定 -->
  685. <div class="tab-content" id="tab-person">
  686. <div class="flex justify-between items-center mb-4">
  687. <div class="flex items-center gap-4">
  688. <h3 class="text-lg font-medium">人员列表</h3>
  689. <div class="filter-tabs">
  690. <button class="filter-tab active" data-filter="bound" data-target="person-bound-list">
  691. 已绑定
  692. <span class="filter-badge">2</span>
  693. </button>
  694. <button class="filter-tab" data-filter="unbound" data-target="person-unbound-list">
  695. 未绑定
  696. <span class="filter-badge">6</span>
  697. </button>
  698. </div>
  699. </div>
  700. <div class="relative">
  701. <input type="text" class="search-input" placeholder="搜索姓名/职位">
  702. <i class="iconfont icon-search absolute right-3 top-1/2 -translate-y-1/2 text-gray-400"></i>
  703. </div>
  704. </div>
  705. <div id="person-bound-list" class="bg-white rounded-lg overflow-hidden">
  706. <table class="min-w-full">
  707. <!-- 已绑定人员表格内容 -->
  708. <thead>
  709. <tr class="bg-gray-50">
  710. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">工号</th>
  711. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">姓名</th>
  712. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">职位</th>
  713. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">联系方式</th>
  714. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">绑定时间</th>
  715. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">操作</th>
  716. </tr>
  717. </thead>
  718. <tbody>
  719. <tr class="border-t border-gray-100">
  720. <td class="px-4 py-3 text-sm">EMP001</td>
  721. <td class="px-4 py-3 text-sm">
  722. <div class="flex items-center gap-2">
  723. <div class="w-8 h-8 rounded-full bg-green-100 flex items-center justify-center">
  724. <i class="iconfont icon-user text-green-600"></i>
  725. </div>
  726. <span>张三</span>
  727. </div>
  728. </td>
  729. <td class="px-4 py-3 text-sm">农场技术员</td>
  730. <td class="px-4 py-3 text-sm">13800138000</td>
  731. <td class="px-4 py-3 text-sm">2023-05-15 10:30</td>
  732. <td class="px-4 py-3 text-sm">
  733. <button class="btn btn-sm btn-danger">解绑</button>
  734. </td>
  735. </tr>
  736. </tbody>
  737. </table>
  738. </div>
  739. <div id="person-unbound-list" class="bg-white rounded-lg overflow-hidden" style="display: none;">
  740. <table class="min-w-full">
  741. <!-- 未绑定人员表格内容 -->
  742. <thead>
  743. <tr class="bg-gray-50">
  744. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">工号</th>
  745. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">姓名</th>
  746. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">职位</th>
  747. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">联系方式</th>
  748. <th class="px-4 py-3 text-left text-sm font-medium text-gray-600">操作</th>
  749. </tr>
  750. </thead>
  751. <tbody>
  752. <tr class="border-t border-gray-100">
  753. <td class="px-4 py-3 text-sm">EMP004</td>
  754. <td class="px-4 py-3 text-sm">
  755. <div class="flex items-center gap-2">
  756. <div class="w-8 h-8 rounded-full bg-gray-100 flex items-center justify-center">
  757. <i class="iconfont icon-user text-gray-600"></i>
  758. </div>
  759. <span>李四</span>
  760. </div>
  761. </td>
  762. <td class="px-4 py-3 text-sm">农场工人</td>
  763. <td class="px-4 py-3 text-sm">13900139000</td>
  764. <td class="px-4 py-3 text-sm">
  765. <button class="btn btn-sm btn-primary">绑定</button>
  766. </td>
  767. </tr>
  768. </tbody>
  769. </table>
  770. </div>
  771. <!-- 分页 -->
  772. <div class="flex justify-between items-center mt-4">
  773. <div class="text-sm text-gray-600">
  774. 共 <span class="text-primary font-medium">8</span> 条记录
  775. </div>
  776. <div class="flex items-center gap-2">
  777. <button class="btn btn-default btn-sm" disabled>上一页</button>
  778. <button class="btn btn-default btn-sm bg-primary text-white">1</button>
  779. <button class="btn btn-default btn-sm">2</button>
  780. <button class="btn btn-default btn-sm">下一页</button>
  781. </div>
  782. </div>
  783. </div>
  784. <!-- 区域绘制 -->
  785. <div class="tab-content" id="tab-map">
  786. <div class="flex justify-between items-center mb-4">
  787. <h3 class="text-lg font-medium">地块区域绘制</h3>
  788. <button class="btn btn-primary" id="saveMapBtn">
  789. <i class="iconfont icon-save btn-icon"></i>
  790. 保存绘制区域
  791. </button>
  792. </div>
  793. <div class="map-container">
  794. <!-- 地图工具栏 -->
  795. <div class="map-toolbar">
  796. <div class="map-tool active">
  797. <i class="iconfont icon-select"></i>
  798. <span>选择</span>
  799. </div>
  800. <div class="map-tool">
  801. <i class="iconfont icon-edit"></i>
  802. <span>绘制区域</span>
  803. </div>
  804. <div class="map-tool">
  805. <i class="iconfont icon-edit-square"></i>
  806. <span>编辑节点</span>
  807. </div>
  808. <div class="map-tool">
  809. <i class="iconfont icon-delete"></i>
  810. <span>删除</span>
  811. </div>
  812. <div class="map-tool">
  813. <i class="iconfont icon-undo"></i>
  814. <span>撤销</span>
  815. </div>
  816. <div class="map-tool">
  817. <i class="iconfont icon-redo"></i>
  818. <span>重做</span>
  819. </div>
  820. </div>
  821. <!-- 地图区域 (实际项目中这里会使用高德地图、百度地图等API) -->
  822. <div class="w-full h-full flex items-center justify-center text-gray-400">
  823. <div class="text-center">
  824. <i class="iconfont icon-map text-6xl"></i>
  825. <div class="mt-2">地图加载中...</div>
  826. <div class="mt-2 text-sm">实际项目中这里将集成高德地图、百度地图等API</div>
  827. </div>
  828. </div>
  829. </div>
  830. <div class="mt-4">
  831. <div class="font-medium mb-2">地块坐标信息</div>
  832. <div class="p-3 bg-gray-50 rounded-md text-sm font-mono">
  833. {"type":"Polygon","coordinates":[[[120.12345,30.12345],[120.23456,30.12345],[120.23456,30.23456],[120.12345,30.23456],[120.12345,30.12345]]]}
  834. </div>
  835. </div>
  836. </div>
  837. </div>
  838. </div>
  839. <script>
  840. document.addEventListener("DOMContentLoaded", function() {
  841. // 初始化表格滚动功能
  842. function initTableScroll() {
  843. const tableContainer = document.querySelector(".table-container");
  844. if (!tableContainer) return;
  845. const scrollLeftBtn = document.querySelector(".table-scroll-left");
  846. const scrollRightBtn = document.querySelector(".table-scroll-right");
  847. if (!scrollLeftBtn || !scrollRightBtn) return;
  848. // 检查表格是否需要水平滚动
  849. function checkTableOverflow() {
  850. if (tableContainer.scrollWidth > tableContainer.clientWidth) {
  851. tableContainer.classList.add("has-overflow");
  852. } else {
  853. tableContainer.classList.remove("has-overflow");
  854. }
  855. }
  856. // 左右滚动按钮点击事件
  857. scrollLeftBtn.addEventListener("click", function() {
  858. tableContainer.scrollLeft -= 150;
  859. });
  860. scrollRightBtn.addEventListener("click", function() {
  861. tableContainer.scrollLeft += 150;
  862. });
  863. // 初始检查和窗口大小变化时检查
  864. checkTableOverflow();
  865. window.addEventListener("resize", checkTableOverflow);
  866. // 滚动事件处理
  867. tableContainer.addEventListener("scroll", function() {
  868. // 根据滚动位置显示/隐藏滚动按钮
  869. if (tableContainer.scrollLeft <= 10) {
  870. scrollLeftBtn.style.opacity = "0.5";
  871. } else {
  872. scrollLeftBtn.style.opacity = "1";
  873. }
  874. if (tableContainer.scrollLeft >= tableContainer.scrollWidth - tableContainer.clientWidth - 10) {
  875. scrollRightBtn.style.opacity = "0.5";
  876. } else {
  877. scrollRightBtn.style.opacity = "1";
  878. }
  879. });
  880. // 初始触发滚动事件,设置初始按钮状态
  881. tableContainer.dispatchEvent(new Event("scroll"));
  882. }
  883. // 初始化表格滚动
  884. initTableScroll();
  885. // 获取URL参数
  886. const urlParams = new URLSearchParams(window.location.search);
  887. const fieldId = urlParams.get('id');
  888. const activeTab = urlParams.get('tab');
  889. // 切换Tab
  890. const tabs = document.querySelectorAll('.tab');
  891. const tabContents = document.querySelectorAll('.tab-content');
  892. // 如果URL中有指定的tab,则激活它
  893. if (activeTab) {
  894. tabs.forEach(tab => {
  895. tab.classList.remove('active');
  896. if (tab.getAttribute('data-tab') === activeTab) {
  897. tab.classList.add('active');
  898. }
  899. });
  900. tabContents.forEach(content => {
  901. content.classList.remove('active');
  902. if (content.id === 'tab-' + activeTab) {
  903. content.classList.add('active');
  904. }
  905. });
  906. }
  907. // Tab点击事件
  908. tabs.forEach(tab => {
  909. tab.addEventListener('click', function() {
  910. const tabId = this.getAttribute('data-tab');
  911. // 更新URL参数但不刷新页面
  912. const url = new URL(window.location);
  913. url.searchParams.set('tab', tabId);
  914. window.history.pushState({}, '', url);
  915. // 切换激活状态
  916. tabs.forEach(t => t.classList.remove('active'));
  917. this.classList.add('active');
  918. // 显示对应内容
  919. tabContents.forEach(content => {
  920. content.classList.remove('active');
  921. if (content.id === 'tab-' + tabId) {
  922. content.classList.add('active');
  923. }
  924. });
  925. });
  926. });
  927. // 编辑按钮事件
  928. document.getElementById('editBtn')?.addEventListener('click', function() {
  929. // 跳转到地块管理页的编辑模态框
  930. window.location.href = `field-management-content.html?edit=${fieldId}`;
  931. });
  932. // 设备绑定保存按钮
  933. document.getElementById('saveDeviceBtn')?.addEventListener('click', function() {
  934. alert('设备绑定关系保存成功');
  935. });
  936. // 人员绑定保存按钮
  937. document.getElementById('savePersonBtn')?.addEventListener('click', function() {
  938. alert('人员绑定关系保存成功');
  939. });
  940. // 地图区域保存按钮
  941. document.getElementById('saveMapBtn')?.addEventListener('click', function() {
  942. alert('地块区域保存成功');
  943. });
  944. // 设备绑定/解绑按钮
  945. const deviceBindBtns = document.querySelectorAll('#tab-device .btn-primary');
  946. deviceBindBtns.forEach(btn => {
  947. btn.addEventListener('click', function() {
  948. const deviceItem = this.closest('.device-item');
  949. deviceItem.classList.add('device-item-bound');
  950. this.className = 'btn btn-sm btn-danger';
  951. this.textContent = '解绑';
  952. });
  953. });
  954. const deviceUnbindBtns = document.querySelectorAll('#tab-device .btn-danger');
  955. deviceUnbindBtns.forEach(btn => {
  956. btn.addEventListener('click', function() {
  957. const deviceItem = this.closest('.device-item');
  958. deviceItem.classList.remove('device-item-bound');
  959. this.className = 'btn btn-sm btn-primary';
  960. this.textContent = '绑定';
  961. });
  962. });
  963. // 人员绑定/解绑按钮
  964. const personBindBtns = document.querySelectorAll('#tab-person .btn-primary');
  965. personBindBtns.forEach(btn => {
  966. btn.addEventListener('click', function() {
  967. const personItem = this.closest('.person-item');
  968. personItem.classList.add('person-item-bound');
  969. this.className = 'btn btn-sm btn-danger';
  970. this.textContent = '解绑';
  971. });
  972. });
  973. const personUnbindBtns = document.querySelectorAll('#tab-person .btn-danger');
  974. personUnbindBtns.forEach(btn => {
  975. btn.addEventListener('click', function() {
  976. const personItem = this.closest('.person-item');
  977. personItem.classList.remove('person-item-bound');
  978. this.className = 'btn btn-sm btn-primary';
  979. this.textContent = '绑定';
  980. });
  981. });
  982. // 地图工具点击事件
  983. const mapTools = document.querySelectorAll('.map-tool');
  984. mapTools.forEach(tool => {
  985. tool.addEventListener('click', function() {
  986. mapTools.forEach(t => t.classList.remove('active'));
  987. this.classList.add('active');
  988. });
  989. });
  990. // 绑定/未绑定切换功能
  991. function initFilterTabs(container) {
  992. const tabs = container.querySelectorAll('.filter-tab');
  993. tabs.forEach(tab => {
  994. tab.addEventListener('click', function() {
  995. // 移除所有tab的active状态
  996. tabs.forEach(t => t.classList.remove('active'));
  997. // 添加当前tab的active状态
  998. this.classList.add('active');
  999. // 获取目标列表
  1000. const targetId = this.getAttribute('data-target');
  1001. const lists = container.closest('.tab-content').querySelectorAll('[id$="-list"]');
  1002. // 隐藏所有列表
  1003. lists.forEach(list => list.style.display = 'none');
  1004. // 显示目标列表
  1005. document.getElementById(targetId).style.display = 'block';
  1006. });
  1007. });
  1008. }
  1009. // 初始化设备和人员的过滤标签
  1010. const deviceContent = document.getElementById('tab-device');
  1011. const personContent = document.getElementById('tab-person');
  1012. if (deviceContent) initFilterTabs(deviceContent);
  1013. if (personContent) initFilterTabs(personContent);
  1014. });
  1015. </script>
  1016. </body>
  1017. </html>